2
0
mirror of https://github.com/koreader/koreader synced 2024-11-04 12:00:25 +00:00

CloudStorage: add DropBox starting folder (#9821)

This commit is contained in:
hius07 2022-11-22 14:53:10 +02:00 committed by GitHub
parent 5b889a0145
commit 90f6dd178e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 16 deletions

View File

@ -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

View File

@ -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 <APP_KEY>:<APP_SECRET> Base64 encoded string.
To generate new access token please use Dropbox refresh token and <APP_KEY>:<APP_SECRET> 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 <APP_KEY>:<APP_SECRET>\n(leave blank for long-lived token)"),
},
{
text = text_url,
hint = _("Dropbox folder (/ for root)"),
},
},
buttons = {
{