mirror of
https://github.com/remotely-save/remotely-save.git
synced 2024-06-07 21:10:45 +00:00
allow multi pages in dropbox
This commit is contained in:
parent
3aa91a2a1e
commit
2ce461ed6a
@ -481,20 +481,41 @@ export const listFromRemote = async (
|
|||||||
throw Error("prefix not supported (yet)");
|
throw Error("prefix not supported (yet)");
|
||||||
}
|
}
|
||||||
await client.init();
|
await client.init();
|
||||||
const res = await client.dropbox.filesListFolder({
|
let res = await client.dropbox.filesListFolder({
|
||||||
path: `/${client.vaultName}`,
|
path: `/${client.vaultName}`,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
|
include_deleted: false,
|
||||||
|
limit: 1000,
|
||||||
});
|
});
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
throw Error(JSON.stringify(res));
|
throw Error(JSON.stringify(res));
|
||||||
}
|
}
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
|
|
||||||
const contents = res.result.entries;
|
const contents = res.result.entries;
|
||||||
const unifiedContents = contents
|
const unifiedContents = contents
|
||||||
.filter((x) => x[".tag"] !== "deleted")
|
.filter((x) => x[".tag"] !== "deleted")
|
||||||
.filter((x) => x.path_display !== `/${client.vaultName}`)
|
.filter((x) => x.path_display !== `/${client.vaultName}`)
|
||||||
.map((x) => fromDropboxItemToRemoteItem(x, client.vaultName));
|
.map((x) => fromDropboxItemToRemoteItem(x, client.vaultName));
|
||||||
|
|
||||||
|
while (res.result.has_more) {
|
||||||
|
res = await client.dropbox.filesListFolderContinue({
|
||||||
|
cursor: res.result.cursor,
|
||||||
|
});
|
||||||
|
if (res.status !== 200) {
|
||||||
|
throw Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
|
|
||||||
|
const contents2 = res.result.entries;
|
||||||
|
const unifiedContents2 = contents2
|
||||||
|
.filter((x) => x[".tag"] !== "deleted")
|
||||||
|
.filter((x) => x.path_display !== `/${client.vaultName}`)
|
||||||
|
.map((x) => fromDropboxItemToRemoteItem(x, client.vaultName));
|
||||||
|
unifiedContents.push(...unifiedContents2);
|
||||||
|
}
|
||||||
|
|
||||||
fixLastModifiedTimeInplace(unifiedContents);
|
fixLastModifiedTimeInplace(unifiedContents);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
Contents: unifiedContents,
|
Contents: unifiedContents,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user