Merge branch 'master' into s3-docs

This commit is contained in:
fyears 2024-01-05 22:13:38 +08:00 committed by GitHub
commit e3e8db04e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 413 additions and 91 deletions

View File

@ -26,6 +26,7 @@ This is yet another unofficial sync plugin for Obsidian. If you like it or find
- **[End-to-end encryption](./docs/encryption.md) supported.** Files would be encrypted using openssl format before being sent to the cloud **if** user specify a password.
- **Scheduled auto sync supported.** You can also manually trigger the sync using sidebar ribbon, or using the command from the command palette (or even bind the hot key combination to the command then press the hot key combination).
- **[Minimal Intrusive](./docs/minimal_intrusive_design.md).**
- **Skip Large files and skip paths by custom regex conditions!
- **Fully open source under [Apache-2.0 License](./LICENSE).**
- **[Sync Algorithm open](./docs/sync_algorithm_v2.md) for discussion.**
@ -60,8 +61,11 @@ Additionally, the plugin author may occasionally visit Obsidian official forum a
### S3
- Prepare your S3 (-compatible) service information: [endpoint, region](https://docs.aws.amazon.com/general/latest/gr/s3.html). The bucket should be empty and solely for syncing a vault.
- Create [policy and user](./docs/s3_user_policy.md).
- Tutorials / Examples:
- [Cloudflare R2](./docs/remote_services/s3_cloudflare_r2/README.md)
- [MinIO](./docs/remote_services/s3_minio/README.md)
- Prepare your S3 (-compatible) service information: [endpoint, region](https://docs.aws.amazon.com/general/latest/gr/s3.html), [access key id, secret access key](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/getting-your-credentials.html), bucket name. The bucket should be empty and solely for syncing a vault.
- If you are using AWS S3, create [policy and user](./docs/s3_user_policy.md).
- About CORS:
- If you are using Obsidian desktop >= 0.13.25 or mobile >= 1.1.1, you can skip this CORS part.
- If you are using Obsidian desktop < 0.13.25 or mobile < 1.1.1, you need to configure (enable) [CORS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/enabling-cors-examples.html) for requests from `app://obsidian.md` and `capacitor://localhost` and `http://localhost`, and add at least `ETag` into exposed headers. Full example is [here](./docs/s3_cors_configure.md). It's unfortunately required, because the plugin sends requests from a browser-like envirement. And those addresses are tested and found on desktop and ios and android.
@ -88,6 +92,10 @@ Additionally, the plugin author may occasionally visit Obsidian official forum a
### webdav
- Tutorials / Examples:
- [ownCloud](./docs/remote_services/webdav_owncloud/README.md)
- [InfiniCloud](./docs/remote_services/webdav_infinicloud_teracloud/README.md)
- [坚果云 JianGuoYun/NutStore](./docs/remote_services/webdav_jianguoyun/README.md)
- About CORS:
- If you are using Obsidian desktop >= 0.13.25 or iOS >= 1.1.1, you can skip this CORS part.
- If you are using Obsidian desktop < 0.13.25 or iOS < 1.1.1 or any Android version:

View File

@ -0,0 +1,27 @@
# Cloudflare R2
## Links
<https://www.cloudflare.com/developer-platform/r2/>
## Steps
1. **Be aware that it may cost you money.**
2. Create a Cloudflare account and enable R2 feature. **Credit card info might be required by Cloudflare**, though Cloudflare provides generous free tier and zero egress fee.
3. Create a bucket.
![](./s3_cloudflare_r2_create_bucket.png)
4. Create an Access Key with "Object Read & Write" permission, and add specify to your created bucket. During the creation, you will also get the auto-generated secret key, and the endpoint address.
![](./s3_cloudflare_r2_create_api_token.png)
5. In remotely-save setting page, input the address / bucket / access key / secret key. **Region being set to `us-east-1` is sufficient.** Enable "Bypass CORS", because usually that's what you want.
Click "check connectivity". (If you encounter an issue and sure the info are correct, please upgrade remotely-save to **version >= 0.3.29** and try again.)
![](./s3_cloudflare_r2_rs_settings.png)
6. Sync!
## And Issue Related To "Check Connectivity"
If you encounter an issue and sure the info are correct, please upgrade remotely-save to **version >= 0.3.29** and try again.
Cloudflare doesn't allow `HeadBucket` for access keys with "Object Read & Write". So it may be possible that checking connectivity is not ok but actual syncing is ok. New version >= 0.3.29 of the plugin fix this problem by using `ListObjects` instead of `HeadBucket`.

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:49a5cd07e538205ba733dc3ccb30e4e7da1290a4a80aefe08afac19fd2db2232
size 467448

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:61fc0812fe96871eed507d2f6b7bbad790ab70e95ff5fe764f8f8b2ab8ce82c2
size 153015

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:02f9c0fea36679e54c8c3fac979bc41d15ae4f7992b269bc2b67255059af1d2f
size 579889

View File

@ -0,0 +1,27 @@
# MinIO
## Links
<https://min.io/>
## Steps
1. Configure your minio instance and get an account.
2. Create an Access Key (during the creation, you will also get the auto-generated secret key).
![](./minio_access_key.png)
3. Check or set the region.
![](./minio_region.png)
4. Create a bucket.
![](./minio_create_bucket.png)
5. In remotely-save setting page, input the address / bucket / access key / secret key. **Usually minio instances may need "S3 URL style"="Path Style".** Enable "Bypass CORS", because usually that's what you want.
![](./minio_rs_settings.png)
6. Sync!
![](./minio_sync_success.png)
## Ports In Address
Just type in the full address with `http(s)://` and `:port` in remotely-save settings, for example `http://192.168.31.198:9000`.
It's verified that everything is ok.
![](./minio_custom_port.png)

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c384ec32a43fcac1e63dbc81d4fbb7fbfaffcd67d0f5a66104482a39475ad639
size 323050

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:894a6a10b7f41754936d77a935b4a5a4ae722796fa5680c9c6d0dd53c3cdc1a2
size 269705

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b25c1209875ad781a29d3ac1cde5bd9c2137622e3919987c4d4e5f77dc8e3ec7
size 68997

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bfcc526281d2c6a9f1261f489603f3dd768f8b94f099a1b26649fa37c9318575
size 315030

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:83615a6c2fbf7ff74679b480d29d222db8835bc067aee33a646e4b8d500c3aca
size 467575

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fd1bb9a6e285a1e63b545d714ca269eb714e980a5177392b967556f1f1754afe
size 147218

View File

@ -0,0 +1,22 @@
# AList
## 链接 Links
- English official website: <https://alist.nn.ci/> and <https://alist.nn.ci/guide/webdav.html>
- 中文官网:<https://alist.nn.ci/zh/><https://alist.nn.ci/zh/guide/webdav.html>
## 步骤 Steps
1. 安装和使用 AList。获取账号名和密码。在网页上登录。Install and run AList. Get the account and password. Login using the web page.
2. 新建挂载,检查挂载路径。如图所示是 `/alisttest davpath`。Add new storage. Pay attention to the mount path. The screenshot shows the mount path as `/alisttest davpath`.
![](./alist_mount_path.zh.png)
![](./alist_mount_path.en.png)
3. 从而构建 webdav 网址如下,**http(s)://域名** + **端口** + **`/dav`** + **挂载路径**,其中挂载路径中假如有空格,换成 `%20`Construct the webdav address as: **http(s)://domain** + **port** + **`/dav`** + **mount path**, and the space inside the mount path should be replaced with `%20`:
```
http[s]://domain:port/dav/[mountpath url encoded]
http://127.0.0.1:5244/dav/alisttest%20davpath
```
4. 在 remotely-save 设置,输入**带域名端口`/dav`和挂载路径的网址**、账号、密码。In remotely-save setting page, select webdav type, then input the **full address with mount path**/account/password.
![](./alist_rs_settings.en.png)
5. 在 remotely-save 设置检查连接。In remotely-save setting page, click "Check Connectivity".
6. 同步文件Sync!

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ea05f67782b8f84518f13cf5587df719bdaa15f9e35b79f2801f91e695de6480
size 46798

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dcaaa5e64e894f0e9c8b0242b64bf4dd364c16d7314b09bc004f7ed0a0f1e0e5
size 60853

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0b792320e2a4aaa16a17d82e80225ab35da05fd1f407fe067de72651beca088e
size 426289

View File

@ -0,0 +1,15 @@
# InfiniCLOUD (formally TeraCLOUD) Webdav
## Link
<https://infini-cloud.net/en/>
## Steps
1. Register an acount.
2. Go to <https://infini-cloud.net/en/modules/mypage/usage/>, in section "Apps Connection", enable "Turn on Apps Connection". Here you get the address and account and webdav password (different from your account password):
![](./infinicloud_account.png)
3. In remotely-save setting page, select webdav type, then input the address/account/**webdav password**(not your account password).
![](./infinicloud_rs_setting.png)
4. In remotely-save setting page, click "Check Connectivity".
5. Sync!

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0e16bc9d86b30ab907fc176087701474f4ca2b8d887f649302f2e184f69d0cbc
size 373845

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8d707f6997df57b9c6b74d72bcfd567995d15062269761ee404e6596a266a241
size 91012

View File

@ -0,0 +1,22 @@
# 坚果云 JianGuoYun/NutStore
## 链接 Link
<https://www.jianguoyun.com/>
## 注意Attentions!!!
坚果云有限制 api 数量等设定。本插件会产生若干查询,如果文件较多很容易触发 api 上限,从而工作不正常。这不是插件 bug也没有办法解决。
JianGuoYun/NutStore has api limits. The plugin may generate many queries, and it's possible to reach the api limits if there are many files, then do not work properly. It's not a bug and there's no way to fix this situation.
## 步骤 Steps
1. **知悉坚果云有 api 限制本插件可能因此工作不正常。Be aware that JianGuoYun/NutStore has api limits, and the plugin may not work properly because of this.**
2. 注册账号登录。Register an account.
3. 去“个人信息”->“安全”,“添加应用”,从而获取了 webDAV 账号(应该是 email和 WebDAV 密码一串特殊的字符不等于网站密码。Go to "settings"->"Security", click "Add Application", then obtain the WebDAV account (email), and WebDAV password (a string different from web site password).
![](./webdav_jianguoyun.cn.png)
4. 在 remotely-save 设置,输入网址、账号、密码、**“发送到服务器的 Depth Header”设置为“只支持 depth='1'”**。Input the WebDAV address, account, password, **Depth Header Sent To Servers="only supports depth='1'"** in remotely-save settings.
![](./webdav_jianguoyun_rs_settting.cn.png)
5. 在 remotely-save 设置检查连接。In remotely-save setting page, click "Check Connectivity".
6. 同步文件Sync!

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fd5aaab1e1ac0ea8996517c819bf5ac0d2a828483037419ba289b538957f4752
size 515913

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:112778176af954e16c93c582d968e7c14e5b950d64facce8593855f5fb75fbcc
size 431527

View File

@ -0,0 +1,17 @@
# ownCloud Webdav
## Link
<https://owncloud.com/>
# Steps
1. Create an account.
2. Login.
3. In the Settings position, enable the "Show hidden files" and find out the WebDAV address.
![](./owncloud_address.png)
4. Input the WebDAV address, account, password, **Depth Header Sent To Servers="only supports depth='1'"** in remotely-save settings.
![](./owncloud_rs_settings.png)
5. In remotely-save setting page, click "Check Connectivity".
6. Sync!
![](./owncloud_files.png)

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e0d025b4ccf1be7fa2cc74e914e9a1a89a8d8f12a1b917bd4b26b975bf208294
size 27796

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b3d24d416016b2676a86166fcc35fa89f8befb7a872503b8da2be4374ef360ce
size 53503

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2e8bf9a51e5d5bed66fb45fe085f37943bd90a51b33ef752d898c5b2caa71c2d
size 448797

10
manifest-beta.json Normal file
View File

@ -0,0 +1,10 @@
{
"id": "remotely-save",
"name": "Remotely Save",
"version": "0.3.29",
"minAppVersion": "0.13.21",
"description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.",
"author": "fyears",
"authorUrl": "https://github.com/fyears",
"isDesktopOnly": false
}

View File

@ -86,6 +86,7 @@ export interface RemotelySavePluginSettings {
lang?: LangTypeAndAuto;
logToDB?: boolean;
skipSizeLargerThan?: number;
ignorePaths?: string[];
/**
* @deprecated

@ -1 +1 @@
Subproject commit 42eab5d544961f4c7830c63ba9559375437340c0
Subproject commit c75336a2a52fcf00147eea01ca767872dff2d0b4

View File

@ -85,6 +85,7 @@ const DEFAULT_SETTINGS: RemotelySavePluginSettings = {
lang: "auto",
logToDB: false,
skipSizeLargerThan: -1,
ignorePaths: [],
};
interface OAuth2Info {
@ -296,6 +297,7 @@ export default class RemotelySavePlugin extends Plugin {
this.app.vault.configDir,
this.settings.syncUnderscoreItems,
this.settings.skipSizeLargerThan,
this.settings.ignorePaths,
this.settings.password
);
log.info(plan.mixedStates); // for debugging
@ -793,6 +795,9 @@ export default class RemotelySavePlugin extends Plugin {
if (this.settings.s3.forcePathStyle === undefined) {
this.settings.s3.forcePathStyle = false;
}
if (this.settings.ignorePaths === undefined) {
this.settings.ignorePaths = [];
}
}
async checkIfPresetRulesFollowed() {

View File

@ -509,6 +509,11 @@ export const deleteFromRemote = async (
/**
* Check the config of S3 by heading bucket
* https://stackoverflow.com/questions/50842835
*
* Updated on 20240102:
* Users are not always have permission of heading bucket,
* so we need to use listing objects instead...
*
* @param s3Client
* @param s3Config
* @returns
@ -519,9 +524,15 @@ export const checkConnectivity = async (
callbackFunc?: any
) => {
try {
const results = await s3Client.send(
new HeadBucketCommand({ Bucket: s3Config.s3BucketName })
);
// const results = await s3Client.send(
// new HeadBucketCommand({ Bucket: s3Config.s3BucketName })
// );
// very simplified version of listing objects
const confCmd = {
Bucket: s3Config.s3BucketName,
} as ListObjectsV2CommandInput;
const results = await s3Client.send(new ListObjectsV2Command(confCmd));
if (
results === undefined ||
results.$metadata === undefined ||

View File

@ -15,21 +15,22 @@ import type {
FileStat,
WebDAVClient,
RequestOptionsWithState,
Response,
ResponseDataDetailed,
// Response,
// ResponseDataDetailed,
} from "webdav";
import { getPatcher } from "webdav";
// @ts-ignore
import { getPatcher } from "webdav/dist/web/index.js";
if (VALID_REQURL) {
getPatcher().patch(
"request",
async (
options: RequestOptionsWithState
): Promise<Response | ResponseDataDetailed<any>> => {
async (options: RequestOptionsWithState): Promise<Response> => {
const transformedHeaders = { ...options.headers };
delete transformedHeaders["host"];
delete transformedHeaders["Host"];
delete transformedHeaders["content-length"];
delete transformedHeaders["Content-Length"];
const r = await requestUrl({
url: options.url,
method: options.method,
@ -37,80 +38,99 @@ if (VALID_REQURL) {
headers: transformedHeaders,
});
let r2: Response | ResponseDataDetailed<any> = undefined;
if ((options as any).responseType === undefined) {
r2 = {
data: undefined,
status: r.status,
statusText: getReasonPhrase(r.status),
headers: r.headers,
};
} else if ((options as any).responseType === "json") {
r2 = {
data: r.json,
status: r.status,
statusText: getReasonPhrase(r.status),
headers: r.headers,
};
} else if ((options as any).responseType === "text") {
r2 = {
data: r.text,
status: r.status,
statusText: getReasonPhrase(r.status),
headers: r.headers,
};
} else if ((options as any).responseType === "arraybuffer") {
r2 = {
data: r.arrayBuffer,
status: r.status,
statusText: getReasonPhrase(r.status),
headers: r.headers,
};
} else {
throw Error(
`do not know how to deal with responseType = ${
(options as any).responseType
}`
);
let contentType: string | undefined =
r.headers["Content-Type"] ||
r.headers["content-type"] ||
options.headers["Content-Type"] ||
options.headers["content-type"] ||
options.headers["Accept"] ||
options.headers["accept"];
if (contentType !== undefined) {
contentType = contentType.toLowerCase();
}
const rspHeaders = { ...r.headers };
for (let key in rspHeaders) {
if (rspHeaders.hasOwnProperty(key)) {
if (key === "content-disposition" || key === "Content-Disposition") {
rspHeaders[key] = encodeURIComponent(rspHeaders[key]);
}
}
}
// console.log(`requesting url=${options.url}`);
// console.log(`contentType=${contentType}`);
// console.log(`rspHeaders=${JSON.stringify(rspHeaders)}`)
// let r2: Response = undefined;
// if (contentType.includes("xml")) {
// r2 = new Response(r.text, {
// status: r.status,
// statusText: getReasonPhrase(r.status),
// headers: rspHeaders,
// });
// } else if (
// contentType.includes("json") ||
// contentType.includes("javascript")
// ) {
// console.log('inside json branch');
// // const j = r.json;
// // console.log(j);
// r2 = new Response(
// r.text, // yea, here is the text because Response constructor expects a text
// {
// status: r.status,
// statusText: getReasonPhrase(r.status),
// headers: rspHeaders,
// });
// } else if (contentType.includes("text")) {
// // avoid text/json,
// // so we split this out from the above xml or json branch
// r2 = new Response(r.text, {
// status: r.status,
// statusText: getReasonPhrase(r.status),
// headers: rspHeaders,
// });
// } else if (
// contentType.includes("octet-stream") ||
// contentType.includes("binary") ||
// contentType.includes("buffer")
// ) {
// // application/octet-stream
// r2 = new Response(r.arrayBuffer, {
// status: r.status,
// statusText: getReasonPhrase(r.status),
// headers: rspHeaders,
// });
// } else {
// throw Error(
// `do not know how to deal with requested content type = ${contentType}`
// );
// }
let r2: Response = undefined;
if ([101, 103, 204, 205, 304].includes(r.status)) {
// A null body status is a status that is 101, 103, 204, 205, or 304.
// https://fetch.spec.whatwg.org/#statuses
// fix this: Failed to construct 'Response': Response with null body status cannot have body
r2 = new Response(null, {
status: r.status,
statusText: getReasonPhrase(r.status),
headers: rspHeaders,
});
} else {
r2 = new Response(r.arrayBuffer, {
status: r.status,
statusText: getReasonPhrase(r.status),
headers: rspHeaders,
});
}
return r2;
}
);
}
// getPatcher().patch("request", (options: any) => {
// // console.log("using fetch");
// const r = fetch(options.url, {
// method: options.method,
// body: options.data as any,
// headers: options.headers,
// signal: options.signal,
// })
// .then((rsp) => {
// if (options.responseType === undefined) {
// return Promise.all([undefined, rsp]);
// }
// if (options.responseType === "json") {
// return Promise.all([rsp.json(), rsp]);
// }
// if (options.responseType === "text") {
// return Promise.all([rsp.text(), rsp]);
// }
// if (options.responseType === "arraybuffer") {
// return Promise.all([rsp.arrayBuffer(), rsp]);
// }
// })
// .then(([d, r]) => {
// return {
// data: d,
// status: r.status,
// statusText: r.statusText,
// headers: r.headers,
// };
// });
// // console.log("using fetch");
// return r;
// });
import { AuthType, BufferLike, createClient } from "webdav";
// @ts-ignore
import { AuthType, BufferLike, createClient } from "webdav/dist/web/index.js";
export type { WebDAVClient } from "webdav";
export const DEFAULT_WEBDAV_CONFIG = {
@ -234,8 +254,9 @@ export class WrappedWebdavClient {
method: "PROPFIND",
headers: {
Depth: "infinity",
Accept: "text/plain,application/xml",
},
responseType: "text",
// responseType: "text",
} as any);
if (res.status === 403) {
throw Error("not support Infinity, get 403");
@ -255,8 +276,9 @@ export class WrappedWebdavClient {
method: "PROPFIND",
headers: {
Depth: "1",
Accept: "text/plain,application/xml",
},
responseType: "text",
// responseType: "text",
} as any
);
testPassed = true;
@ -457,9 +479,9 @@ const downloadFromRemoteRaw = async (
fileOrFolderPath: string
) => {
await client.init();
const buff = (await client.client.getFileContents(
getWebdavPath(fileOrFolderPath, client.remoteBaseDir)
)) as BufferLike;
const p = getWebdavPath(fileOrFolderPath, client.remoteBaseDir);
// console.log(`getWebdavPath=${p}`);
const buff = (await client.client.getFileContents(p)) as BufferLike;
if (buff instanceof ArrayBuffer) {
return buff;
} else if (buff instanceof Buffer) {
@ -498,6 +520,7 @@ export const downloadFromRemote = async (
downloadFile = remoteEncryptedKey;
}
downloadFile = getWebdavPath(downloadFile, client.remoteBaseDir);
// console.log(`downloadFile=${downloadFile}`);
const remoteContent = await downloadFromRemoteRaw(client, downloadFile);
let localContent = remoteContent;
if (password !== "") {

View File

@ -1596,6 +1596,23 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
});
});
new Setting(basicDiv)
.setName(t("settings_ignorepaths"))
.setDesc(t("settings_ignorepaths_desc"))
.setClass("ignorepaths-settings")
.addTextArea((textArea) => {
textArea
.setValue(`${this.plugin.settings.ignorePaths.join("\n")}`)
.onChange(async (value) => {
this.plugin.settings.ignorePaths = value.trim().split("\n");
await this.plugin.saveSettings();
});
textArea.inputEl.rows = 10;
textArea.inputEl.addClass("ignorepaths-textarea");
});
//////////////////////////////////////////////////
// below for advanced settings
//////////////////////////////////////////////////

View File

@ -7,6 +7,7 @@ import {
} from "obsidian";
import AggregateError from "aggregate-error";
import PQueue from "p-queue";
import XRegExp from "xregexp";
import type {
RemoteItem,
SyncTriggerSourceType,
@ -293,8 +294,16 @@ const isSkipItem = (
key: string,
syncConfigDir: boolean,
syncUnderscoreItems: boolean,
configDir: string
configDir: string,
ignorePaths: string[]
) => {
if (ignorePaths !== undefined && ignorePaths.length > 0) {
for (const r of ignorePaths) {
if (XRegExp(r, "A").test(key)) {
return true;
}
}
}
if (syncConfigDir && isInsideObsFolder(key, configDir)) {
return false;
}
@ -315,6 +324,7 @@ const ensembleMixedStates = async (
syncConfigDir: boolean,
configDir: string,
syncUnderscoreItems: boolean,
ignorePaths: string[],
password: string
) => {
const results = {} as Record<string, FileOrFolderMixedState>;
@ -322,7 +332,15 @@ const ensembleMixedStates = async (
for (const r of remoteStates) {
const key = r.key;
if (isSkipItem(key, syncConfigDir, syncUnderscoreItems, configDir)) {
if (
isSkipItem(
key,
syncConfigDir,
syncUnderscoreItems,
configDir,
ignorePaths
)
) {
continue;
}
results[key] = r;
@ -361,7 +379,15 @@ const ensembleMixedStates = async (
throw Error(`unexpected ${entry}`);
}
if (isSkipItem(key, syncConfigDir, syncUnderscoreItems, configDir)) {
if (
isSkipItem(
key,
syncConfigDir,
syncUnderscoreItems,
configDir,
ignorePaths
)
) {
continue;
}
@ -395,6 +421,18 @@ const ensembleMixedStates = async (
password === "" ? undefined : getSizeFromOrigToEnc(entry.size),
};
if (
isSkipItem(
key,
syncConfigDir,
syncUnderscoreItems,
configDir,
ignorePaths
)
) {
continue;
}
if (results.hasOwnProperty(key)) {
results[key].key = r.key;
results[key].existLocal = r.existLocal;
@ -417,7 +455,15 @@ const ensembleMixedStates = async (
deltimeRemoteFmt: unixTimeToStr(entry.actionWhen),
} as FileOrFolderMixedState;
if (isSkipItem(key, syncConfigDir, syncUnderscoreItems, configDir)) {
if (
isSkipItem(
key,
syncConfigDir,
syncUnderscoreItems,
configDir,
ignorePaths
)
) {
continue;
}
@ -445,7 +491,15 @@ const ensembleMixedStates = async (
throw Error(`unexpected ${entry}`);
}
if (isSkipItem(key, syncConfigDir, syncUnderscoreItems, configDir)) {
if (
isSkipItem(
key,
syncConfigDir,
syncUnderscoreItems,
configDir,
ignorePaths
)
) {
continue;
}
@ -967,6 +1021,7 @@ export const getSyncPlan = async (
configDir: string,
syncUnderscoreItems: boolean,
skipSizeLargerThan: number,
ignorePaths: string[],
password: string = ""
) => {
const mixedStates = await ensembleMixedStates(
@ -978,6 +1033,7 @@ export const getSyncPlan = async (
syncConfigDir,
configDir,
syncUnderscoreItems,
ignorePaths,
password
);

View File

@ -61,3 +61,7 @@
width: 350px;
height: 350px;
}
.ignorepaths-textarea {
font-family: monospace;
}