feat: change load from cloud format and order

This commit is contained in:
Azgaar 2022-06-04 20:10:23 +03:00
parent 3694d77b87
commit 44e98d853f
4 changed files with 2362 additions and 525 deletions

View file

@ -73,7 +73,13 @@ window.Cloud = (function () {
async list() {
const resp = await this.call("filesListFolder", {path: ""});
return resp.result.entries.map(e => ({name: e.name, path: e.path_lower}));
const filesData = resp.result.entries.map(({name, client_modified, size, path_lower}) => ({
name: name,
updated: client_modified,
size,
path: path_lower
}));
return filesData.filter(({size}) => size).reverse();
},
auth() {
@ -117,7 +123,13 @@ window.Cloud = (function () {
if (sharedLinks.result.links.length) return resp.result.links[0].url;
// create new shared link
const settings = {require_password: false, audience: "public", access: "viewer", requested_visibility: "public", allow_download: true};
const settings = {
require_password: false,
audience: "public",
access: "viewer",
requested_visibility: "public",
allow_download: true
};
const resp = await this.call("sharingCreateSharedLinkWithSettings", {path, settings});
DEBUG && console.log("Dropbox link object:", resp.result);
return resp.result.url;