Compare commits

...
5 Commits
Author SHA1 Message Date
fyears 7a13f4566c full word 2021-12-10 00:18:26 +08:00
fyears d355f72b7a update to 0.2.1 2021-12-10 00:17:31 +08:00
fyears 9b1eebdf90 standarized codes 2021-12-10 00:16:28 +08:00
fyears 2ce461ed6a allow multi pages in dropbox 2021-12-10 00:11:53 +08:00
fyears 3aa91a2a1e add env to build 2021-12-04 01:46:40 +08:00
9 changed files with 36 additions and 9 deletions
+2
View File
@@ -13,6 +13,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: env-for-buildci
strategy: strategy:
matrix: matrix:
node-version: [16.x] node-version: [16.x]
+2 -2
View File
@@ -1,9 +1,9 @@
{ {
"id": "remotely-save", "id": "remotely-save",
"name": "Remotely Save", "name": "Remotely Save",
"version": "0.2.0", "version": "0.2.1",
"minAppVersion": "0.12.15", "minAppVersion": "0.12.15",
"description": "Yet another unofficial plugin allowing users to sync notes between local device and the cloud service.", "description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.",
"author": "fyears", "author": "fyears",
"authorUrl": "https://github.com/fyears", "authorUrl": "https://github.com/fyears",
"isDesktopOnly": false "isDesktopOnly": false
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "remotely-save", "name": "remotely-save",
"version": "0.2.0", "version": "0.2.1",
"description": "This is yet another sync plugin for Obsidian app.", "description": "This is yet another sync plugin for Obsidian app.",
"scripts": { "scripts": {
"dev": "node esbuild.config.mjs", "dev": "node esbuild.config.mjs",
+6 -2
View File
@@ -27,8 +27,12 @@ import type { InternalDBs } from "./localdb";
import type { SyncStatusType, PasswordCheckType } from "./sync"; import type { SyncStatusType, PasswordCheckType } from "./sync";
import { isPasswordOk, getSyncPlan, doActualSync } from "./sync"; import { isPasswordOk, getSyncPlan, doActualSync } from "./sync";
import { S3Config, DEFAULT_S3_CONFIG } from "./s3"; import { S3Config, DEFAULT_S3_CONFIG } from "./remoteForS3";
import { WebdavConfig, DEFAULT_WEBDAV_CONFIG, WebdavAuthType } from "./webdav"; import {
WebdavConfig,
DEFAULT_WEBDAV_CONFIG,
WebdavAuthType,
} from "./remoteForWebdav";
import { import {
DropboxConfig, DropboxConfig,
DEFAULT_DROPBOX_CONFIG, DEFAULT_DROPBOX_CONFIG,
+2 -2
View File
@@ -1,8 +1,8 @@
import { Vault } from "obsidian"; import { Vault } from "obsidian";
import type { SUPPORTED_SERVICES_TYPE } from "./baseTypes"; import type { SUPPORTED_SERVICES_TYPE } from "./baseTypes";
import * as s3 from "./s3"; import * as s3 from "./remoteForS3";
import * as webdav from "./webdav"; import * as webdav from "./remoteForWebdav";
import * as dropbox from "./remoteForDropbox"; import * as dropbox from "./remoteForDropbox";
export class RemoteClient { export class RemoteClient {
+22 -1
View File
@@ -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,
}; };
View File
+1 -1
View File
@@ -1,3 +1,3 @@
{ {
"0.2.0": "0.12.15" "0.2.1": "0.12.15"
} }