From 90f6dd178e065276cb74ec08c6923a14a54b7d09 Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Tue, 22 Nov 2022 14:53:10 +0200 Subject: [PATCH] CloudStorage: add DropBox starting folder (#9821) --- frontend/apps/cloudstorage/cloudstorage.lua | 12 +++--------- frontend/apps/cloudstorage/dropbox.lua | 15 ++++++++------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/frontend/apps/cloudstorage/cloudstorage.lua b/frontend/apps/cloudstorage/cloudstorage.lua index 8df5f5a4f..24f57b312 100644 --- a/frontend/apps/cloudstorage/cloudstorage.lua +++ b/frontend/apps/cloudstorage/cloudstorage.lua @@ -23,14 +23,6 @@ local Screen = require("device").screen local T = require("ffi/util").template local CloudStorage = Menu:extend{ - cloud_servers = { - { - text = _("Add new cloud storage"), - title = _("Choose cloud type"), - url = "add", - editable = false, - }, - }, no_title = false, show_parent = nil, is_popout = false, @@ -277,6 +269,7 @@ function CloudStorage:downloadFile(item) { { text = _("Cancel"), + id = "close", callback = function() UIManager:close(input_dialog) end, @@ -719,8 +712,8 @@ function CloudStorage:configCloud(type) name = fields[1], password = fields[2], address = fields[3], + url = fields[4], type = "dropbox", - url = "/" }) elseif type == "ftp" then table.insert(cs_servers,{ @@ -766,6 +759,7 @@ function CloudStorage:editCloudServer(item) server.name = fields[1] server.password = fields[2] server.address = fields[3] + server.url = fields[4] cs_servers[i] = server break end diff --git a/frontend/apps/cloudstorage/dropbox.lua b/frontend/apps/cloudstorage/dropbox.lua index 8ed03ada2..c3c3d8968 100644 --- a/frontend/apps/cloudstorage/dropbox.lua +++ b/frontend/apps/cloudstorage/dropbox.lua @@ -58,11 +58,7 @@ end function DropBox:downloadFileNoUI(url, password, path) local code_response = DropBoxApi:downloadFile(url, password, path) - if code_response == 200 then - return true - else - return false - end + return code_response == 200 end function DropBox:uploadFile(url, password, file_path, callback_close) @@ -98,14 +94,15 @@ end function DropBox:config(item, callback) local text_info = _([[ Dropbox access tokens are short-lived (4 hours). -To generate new access token please use Dropbox refresh token and : Base64 encoded string. +To generate new access token please use Dropbox refresh token and : string. Some of the previously generated long-lived tokens are still valid.]]) - local text_name, text_token, text_appkey + local text_name, text_token, text_appkey, text_url if item then text_name = item.text text_token = item.password text_appkey = item.address + text_url = item.url end self.settings_dialog = MultiInputDialog:new { title = _("Dropbox cloud storage"), @@ -122,6 +119,10 @@ Some of the previously generated long-lived tokens are still valid.]]) text = text_appkey, hint = _("Dropbox :\n(leave blank for long-lived token)"), }, + { + text = text_url, + hint = _("Dropbox folder (/ for root)"), + }, }, buttons = { {