Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0802767726 | ||
|
|
be4a2d3271 | ||
|
|
7ca2d19255 | ||
|
|
ff765d5ae7 | ||
|
|
bdbf0b1484 | ||
|
|
7497b5fae7 | ||
|
|
408acb6230 | ||
|
|
d9cab7b1ff | ||
|
|
5e53967e01 | ||
|
|
fb9f4a67b4 | ||
|
|
26a426dda8 | ||
|
|
de64c3c53f | ||
|
|
0cefafa491 |
@@ -100,6 +100,8 @@ Additionally, the plugin author may occasionally visit Obsidian official forum a
|
||||
### webdav
|
||||
|
||||
- Tutorials / Examples:
|
||||
- [Nextcloud](./docs/remote_services/webdav_nextcloud/README.md)
|
||||
- [The Good Cloud](./docs/remote_services/webdav_thegoodcloud/README.md)
|
||||
- [ownCloud](./docs/remote_services/webdav_owncloud/README.md)
|
||||
- [InfiniCloud](./docs/remote_services/webdav_infinicloud_teracloud/README.md)
|
||||
- [Synology webdav server](./docs/remote_services/webdav_synology_webdav_server/README.md) | [群晖 webdav server](./docs/remote_services/webdav_synology_webdav_server/README.zh-cn.md)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# Nextcloud
|
||||
|
||||
## Link
|
||||
|
||||
<https://nextcloud.com/>
|
||||
|
||||
## Steps
|
||||
|
||||
1. Install, or find a hosted version.
|
||||
* The docker version <https://github.com/nextcloud/docker> for internal network, and [Caddy as reverse proxy](https://caddyserver.com/docs/quick-starts/reverse-proxy) (for https), are personally recommended.
|
||||
* If you find installing Nextcloud by yourselves is difficult, you can find some "Nextcloud's trusted, certified providers" on [Nextcloud Sign up page](https://nextcloud.com/sign-up/); For example, [The Good Cloud](https://thegood.cloud/) there generously provides 2 GB free stoarage space.
|
||||
* Remotely Save is tested to be working with the docker version and The Good Cloud.
|
||||
2. Go to Nextcloud's settings. Find the webdav url (something like `https://cloud.example.com/remote.php/dav/files/USERNAME`). Use this (without tailing slash), and your account and your password, in Remotely Save.
|
||||
@@ -0,0 +1,9 @@
|
||||
# The Good Cloud
|
||||
|
||||
## Link
|
||||
|
||||
<https://thegood.cloud/>
|
||||
|
||||
## Steps
|
||||
|
||||
It's a hosted version of Nextcloud providing 2GB free spaces. See [NextCloud](../webdav_nextcloud/README.md) for more instructions.
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "remotely-save",
|
||||
"name": "Remotely Save",
|
||||
"version": "0.4.22",
|
||||
"version": "0.4.25",
|
||||
"minAppVersion": "0.13.21",
|
||||
"description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.",
|
||||
"author": "fyears",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "remotely-save",
|
||||
"name": "Remotely Save",
|
||||
"version": "0.4.22",
|
||||
"version": "0.4.25",
|
||||
"minAppVersion": "0.13.21",
|
||||
"description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.",
|
||||
"author": "fyears",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "remotely-save",
|
||||
"version": "0.4.22",
|
||||
"version": "0.4.25",
|
||||
"description": "This is yet another sync plugin for Obsidian app.",
|
||||
"scripts": {
|
||||
"dev2": "node esbuild.config.mjs --watch",
|
||||
|
||||
+7
-1
@@ -106,7 +106,13 @@ export type SyncDirectionType =
|
||||
|
||||
export type CipherMethodType = "rclone-base64" | "openssl-base64" | "unknown";
|
||||
|
||||
export type QRExportType = "all_but_oauth2" | "dropbox" | "onedrive";
|
||||
export type QRExportType =
|
||||
| "basic_and_advanced"
|
||||
| "s3"
|
||||
| "dropbox"
|
||||
| "onedrive"
|
||||
| "webdav"
|
||||
| "webdis";
|
||||
|
||||
export interface ProfilerConfig {
|
||||
enablePrinting?: boolean;
|
||||
|
||||
+3
-1
@@ -87,7 +87,9 @@ export class FakeFsEncrypt extends FakeFs {
|
||||
this.cacheMapOrigToEnc = {};
|
||||
this.hasCacheMap = false;
|
||||
|
||||
this.kind = `encrypt(${this.innerFs.kind},${method})`;
|
||||
this.kind = `encrypt(${this.innerFs.kind},${
|
||||
this.password !== "" ? method : "no password"
|
||||
})`;
|
||||
|
||||
if (method === "rclone-base64") {
|
||||
this.cipherRClone = new rclone.CipherRclone(password, 5);
|
||||
|
||||
+39
-5
@@ -324,8 +324,17 @@ export class FakeFsWebdav extends FakeFs {
|
||||
await this._checkPartialSupport();
|
||||
}
|
||||
|
||||
/**
|
||||
* <server>/remote.php/dav/files/<userid>
|
||||
* => <server>/remote.php/dav/uploads/<userid>
|
||||
*/
|
||||
_getnextcloudUploadServerAddress = () => {
|
||||
const s = this.webdavConfig.address.split("/");
|
||||
let k = this.webdavConfig.address;
|
||||
if (k.endsWith('/')) {
|
||||
// no tailing slash
|
||||
k = k.substring(0, k.length-1);
|
||||
}
|
||||
const s = k.split("/");
|
||||
if (
|
||||
s.length > 3 &&
|
||||
s[s.length - 3] === "dav" &&
|
||||
@@ -422,7 +431,20 @@ export class FakeFsWebdav extends FakeFs {
|
||||
// glob: "/**" /* avoid dot files by using glob */,
|
||||
}) as Promise<FileStat[]>;
|
||||
});
|
||||
const r2 = flatten(await Promise.all(r));
|
||||
const r3 = await Promise.all(r);
|
||||
for (const r4 of r3) {
|
||||
if (
|
||||
this.webdavConfig.address.includes("jianguoyun.com") &&
|
||||
r4.length >= 749
|
||||
) {
|
||||
// https://help.jianguoyun.com/?p=2064
|
||||
// no more than 750 per request
|
||||
throw Error(
|
||||
`出错:坚果云 api 有限制,文件列表加载不全。终止同步!`
|
||||
);
|
||||
}
|
||||
}
|
||||
const r2 = flatten(r3);
|
||||
subContents.push(...r2);
|
||||
}
|
||||
for (let i = 0; i < subContents.length; ++i) {
|
||||
@@ -536,7 +558,19 @@ export class FakeFsWebdav extends FakeFs {
|
||||
);
|
||||
}
|
||||
|
||||
// larger than 10 MB, try to upload by chunks
|
||||
// larger than 10 MB
|
||||
if (!this.isNextcloud && !this.supportNativePartial) {
|
||||
// give up and upload by whole, and directly return
|
||||
return await this._writeFileFromRootFull(
|
||||
key,
|
||||
content,
|
||||
mtime,
|
||||
ctime,
|
||||
origKey
|
||||
);
|
||||
}
|
||||
|
||||
// try to upload by chunks
|
||||
try {
|
||||
if (this.isNextcloud) {
|
||||
return await this._writeFileFromRootNextcloud(
|
||||
@@ -555,10 +589,10 @@ export class FakeFsWebdav extends FakeFs {
|
||||
origKey
|
||||
);
|
||||
}
|
||||
throw Error(`no partial upload / update`);
|
||||
throw Error(`Error: partial upload / update method is not implemented??`);
|
||||
} catch (e) {
|
||||
console.error(
|
||||
`we fail to write file partially, so downgrade to full and ignore the error:`
|
||||
`we fail to write file partially for nextcloud or apache or sabre/dav, stop!`
|
||||
);
|
||||
console.error(e);
|
||||
throw e;
|
||||
|
||||
+10
-1
@@ -17,14 +17,23 @@ export const exportQrCodeUri = async (
|
||||
) => {
|
||||
let settings2: Partial<RemotelySavePluginSettings> = {};
|
||||
|
||||
if (exportFields === "all_but_oauth2") {
|
||||
if (exportFields === "basic_and_advanced") {
|
||||
settings2 = cloneDeep(settings);
|
||||
delete settings2.s3;
|
||||
delete settings2.dropbox;
|
||||
delete settings2.onedrive;
|
||||
delete settings2.webdav;
|
||||
delete settings2.webdis;
|
||||
} else if (exportFields === "s3") {
|
||||
settings2 = { s3: cloneDeep(settings.s3) };
|
||||
} else if (exportFields === "dropbox") {
|
||||
settings2 = { dropbox: cloneDeep(settings.dropbox) };
|
||||
} else if (exportFields === "onedrive") {
|
||||
settings2 = { onedrive: getShrinkedSettings(settings.onedrive) };
|
||||
} else if (exportFields === "webdav") {
|
||||
settings2 = { webdav: cloneDeep(settings.webdav) };
|
||||
} else if (exportFields === "webdis") {
|
||||
settings2 = { webdis: cloneDeep(settings.webdis) };
|
||||
}
|
||||
|
||||
delete settings2.vaultRandomID;
|
||||
|
||||
+7
-1
@@ -289,6 +289,9 @@
|
||||
"settings_protectmodifypercentage_000_desc": "0 (always block)",
|
||||
"settings_protectmodifypercentage_050_desc": "50 (default)",
|
||||
"settings_protectmodifypercentage_100_desc": "100 (disable the protection)",
|
||||
"settings_protectmodifypercentage_custom_desc": "custom",
|
||||
"settings_protectmodifypercentage_customfield": "Custom Abort Sync If Modification Above Percentage",
|
||||
"settings_protectmodifypercentage_customfield_desc": "You need to enter a number between 0 (inclusive) and 100 (inclusive). Float number is also allowed.",
|
||||
"setting_syncdirection": "Sync Direction",
|
||||
"setting_syncdirection_desc": "Which direction should the plugin sync to? Please be aware that only CHANGED files (based on time and size) are synced regardless any option.",
|
||||
"setting_syncdirection_bidirectional_desc": "Bidirectional (default)",
|
||||
@@ -299,9 +302,12 @@
|
||||
"settings_importexport": "Import and Export Partial Settings",
|
||||
"settings_export": "Export",
|
||||
"settings_export_desc": "Export settings by generating a QR code or URI.",
|
||||
"settings_export_all_but_oauth2_button": "Export Non-Oauth2 Part",
|
||||
"settings_export_basic_and_advanced_button": "Export Basic And Advanced Part",
|
||||
"settings_export_s3_button": "Export S3 Part",
|
||||
"settings_export_dropbox_button": "Export Dropbox Part",
|
||||
"settings_export_onedrive_button": "Export OneDrive Part",
|
||||
"settings_export_webdav_button": "Export Webdav Part",
|
||||
"settings_export_webdis_button": "Export Webdis Part",
|
||||
"settings_import": "Import",
|
||||
"settings_import_desc": "Paste the exported URI into here and click \"Import\". Or, you can open a camera or scan-qrcode app to scan the QR code.",
|
||||
"settings_import_button": "Import",
|
||||
|
||||
@@ -288,6 +288,9 @@
|
||||
"settings_protectmodifypercentage_000_desc": "0(总是强制中止)",
|
||||
"settings_protectmodifypercentage_050_desc": "50(默认值)",
|
||||
"settings_protectmodifypercentage_100_desc": "100(去除此保护)",
|
||||
"settings_protectmodifypercentage_custom_desc": "自定义",
|
||||
"settings_protectmodifypercentage_customfield": "如果修改超过自定义百分比则中止同步",
|
||||
"settings_protectmodifypercentage_customfield_desc": "您需要输入 0(含)~ 100(含)的数字。小数也是可以的。",
|
||||
"setting_syncdirection": "同步方向",
|
||||
"setting_syncdirection_desc": "插件应该向哪里同步?注意每个选项都是只有修改了的文件(基于修改时间和大小判断)才会触发同步动作。",
|
||||
"setting_syncdirection_bidirectional_desc": "双向同步(默认)",
|
||||
@@ -298,9 +301,12 @@
|
||||
"settings_importexport": "导入导出部分设置",
|
||||
"settings_export": "导出",
|
||||
"settings_export_desc": "用 QR 码或 URI 导出设置信息。",
|
||||
"settings_export_all_but_oauth2_button": "导出非 Oauth2 部分",
|
||||
"settings_export_basic_and_advanced_button": "导出基本或进阶设置",
|
||||
"settings_export_s3_button": "导出 S3 部分",
|
||||
"settings_export_dropbox_button": "导出 Dropbox 部分",
|
||||
"settings_export_onedrive_button": "导出 OneDrive 部分",
|
||||
"settings_export_webdav_button": "导出 Webdav 部分",
|
||||
"settings_export_webdis_button": "导出 Webdis 部分",
|
||||
"settings_import": "导入",
|
||||
"settings_import_desc": "粘贴之前导出的 URI 到这里然后点击“导入”。或,使用拍摄 app 或者扫描 QR 码的 app,来扫描对应的 QR 码。",
|
||||
"settings_import_button": "导入",
|
||||
|
||||
@@ -287,6 +287,9 @@
|
||||
"settings_protectmodifypercentage_000_desc": "0(總是強制中止)",
|
||||
"settings_protectmodifypercentage_050_desc": "50(預設值)",
|
||||
"settings_protectmodifypercentage_100_desc": "100(去除此保護)",
|
||||
"settings_protectmodifypercentage_custom_desc": "自定義",
|
||||
"settings_protectmodifypercentage_customfield": "如果修改超過自定義百分比則中止同步",
|
||||
"settings_protectmodifypercentage_customfield_desc": "您需要輸入 0(含)~ 100(含)的數字。小數也是可以的。",
|
||||
"setting_syncdirection": "同步方向",
|
||||
"setting_syncdirection_desc": "外掛應該向哪裡同步?注意每個選項都是隻有修改了的檔案(基於修改時間和大小判斷)才會觸發同步動作。",
|
||||
"setting_syncdirection_bidirectional_desc": "雙向同步(預設)",
|
||||
@@ -297,9 +300,12 @@
|
||||
"settings_importexport": "匯入匯出部分設定",
|
||||
"settings_export": "匯出",
|
||||
"settings_export_desc": "用 QR 碼或 URI 匯出設定資訊。",
|
||||
"settings_export_all_but_oauth2_button": "匯出非 Oauth2 部分",
|
||||
"settings_export_basic_and_advanced_button": "匯出基本或進階設定",
|
||||
"settings_export_s3_button": "匯出 S3 部分",
|
||||
"settings_export_dropbox_button": "匯出 Dropbox 部分",
|
||||
"settings_export_onedrive_button": "匯出 OneDrive 部分",
|
||||
"settings_export_webdav_button": "匯出 Webdav 部分",
|
||||
"settings_export_webdis_button": "匯出 Webdis 部分",
|
||||
"settings_import": "匯入",
|
||||
"settings_import_desc": "貼上之前匯出的 URI 到這裡然後點選“匯入”。或,使用拍攝 app 或者掃描 QR 碼的 app,來掃描對應的 QR 碼。",
|
||||
"settings_import_button": "匯入",
|
||||
|
||||
+1
-1
@@ -345,7 +345,7 @@ export const unixTimeToStr = (x: number | undefined | null) => {
|
||||
if (x === undefined || x === null || Number.isNaN(x)) {
|
||||
return undefined;
|
||||
}
|
||||
return new Date(x).toISOString();
|
||||
return window.moment(x).format() as string;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+88
-21
@@ -2168,28 +2168,77 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(advDiv)
|
||||
const percentage1 = new Setting(advDiv)
|
||||
.setName(t("settings_protectmodifypercentage"))
|
||||
.setDesc(t("settings_protectmodifypercentage_desc"))
|
||||
.addDropdown((dropdown) => {
|
||||
for (const i of Array.from({ length: 11 }, (x, i) => i * 10)) {
|
||||
let desc = `${i}`;
|
||||
if (i === 0) {
|
||||
desc = t("settings_protectmodifypercentage_000_desc");
|
||||
} else if (i === 50) {
|
||||
desc = t("settings_protectmodifypercentage_050_desc");
|
||||
} else if (i === 100) {
|
||||
desc = t("settings_protectmodifypercentage_100_desc");
|
||||
}
|
||||
dropdown.addOption(`${i}`, desc);
|
||||
}
|
||||
dropdown
|
||||
.setValue(`${this.plugin.settings.protectModifyPercentage ?? 50}`)
|
||||
.onChange(async (val) => {
|
||||
this.plugin.settings.protectModifyPercentage = Number.parseInt(val);
|
||||
.setDesc(t("settings_protectmodifypercentage_desc"));
|
||||
|
||||
const percentage2 = new Setting(advDiv)
|
||||
.setName(t("settings_protectmodifypercentage_customfield"))
|
||||
.setDesc(t("settings_protectmodifypercentage_customfield_desc"));
|
||||
if ((this.plugin.settings.protectModifyPercentage ?? 50) % 10 === 0) {
|
||||
percentage2.settingEl.addClass("settings-percentage-custom-hide");
|
||||
}
|
||||
let percentage2Text: TextComponent | undefined = undefined;
|
||||
percentage2.addText((text) => {
|
||||
text.inputEl.type = "number";
|
||||
percentage2Text = text;
|
||||
text
|
||||
.setPlaceholder("0 ~ 100")
|
||||
.setValue(`${this.plugin.settings.protectModifyPercentage ?? 50}`)
|
||||
.onChange(async (val) => {
|
||||
let k = Number.parseFloat(val.trim());
|
||||
if (Number.isNaN(k)) {
|
||||
// do nothing!
|
||||
} else {
|
||||
if (k < 0) {
|
||||
k = 0;
|
||||
} else if (k > 100) {
|
||||
k = 100;
|
||||
}
|
||||
this.plugin.settings.protectModifyPercentage = k;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
percentage1.addDropdown((dropdown) => {
|
||||
for (const i of Array.from({ length: 11 }, (x, i) => i * 10)) {
|
||||
let desc = `${i}`;
|
||||
if (i === 0) {
|
||||
desc = t("settings_protectmodifypercentage_000_desc");
|
||||
} else if (i === 50) {
|
||||
desc = t("settings_protectmodifypercentage_050_desc");
|
||||
} else if (i === 100) {
|
||||
desc = t("settings_protectmodifypercentage_100_desc");
|
||||
}
|
||||
dropdown.addOption(`${i}`, desc);
|
||||
}
|
||||
dropdown.addOption(
|
||||
"custom",
|
||||
t("settings_protectmodifypercentage_custom_desc")
|
||||
);
|
||||
|
||||
const p = this.plugin.settings.protectModifyPercentage ?? 50;
|
||||
let initVal = "custom";
|
||||
if (p % 10 === 0) {
|
||||
initVal = `${p}`;
|
||||
} else {
|
||||
// show custom
|
||||
percentage2.settingEl.removeClass("settings-percentage-custom");
|
||||
}
|
||||
dropdown.setValue(initVal).onChange(async (val) => {
|
||||
const k = Number.parseInt(val);
|
||||
if (val === "custom" || Number.isNaN(k)) {
|
||||
// do nothing until user changes something in custom field
|
||||
percentage2.settingEl.removeClass("settings-percentage-custom-hide");
|
||||
} else {
|
||||
this.plugin.settings.protectModifyPercentage = k;
|
||||
percentage2.settingEl.addClass("settings-percentage-custom-hide");
|
||||
percentage2Text?.setValue(`${k}`);
|
||||
await this.plugin.saveSettings();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(advDiv)
|
||||
.setName(t("setting_syncdirection"))
|
||||
@@ -2268,15 +2317,21 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
||||
importExportDivSetting1.settingEl.addClass("setting-need-wrapping");
|
||||
importExportDivSetting1
|
||||
.addButton(async (button) => {
|
||||
button.setButtonText(t("settings_export_all_but_oauth2_button"));
|
||||
button.setButtonText(t("settings_export_basic_and_advanced_button"));
|
||||
button.onClick(async () => {
|
||||
new ExportSettingsQrCodeModal(
|
||||
this.app,
|
||||
this.plugin,
|
||||
"all_but_oauth2"
|
||||
"basic_and_advanced"
|
||||
).open();
|
||||
});
|
||||
})
|
||||
.addButton(async (button) => {
|
||||
button.setButtonText(t("settings_export_s3_button"));
|
||||
button.onClick(async () => {
|
||||
new ExportSettingsQrCodeModal(this.app, this.plugin, "s3").open();
|
||||
});
|
||||
})
|
||||
.addButton(async (button) => {
|
||||
button.setButtonText(t("settings_export_dropbox_button"));
|
||||
button.onClick(async () => {
|
||||
@@ -2296,6 +2351,18 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
||||
"onedrive"
|
||||
).open();
|
||||
});
|
||||
})
|
||||
.addButton(async (button) => {
|
||||
button.setButtonText(t("settings_export_webdav_button"));
|
||||
button.onClick(async () => {
|
||||
new ExportSettingsQrCodeModal(this.app, this.plugin, "webdav").open();
|
||||
});
|
||||
})
|
||||
.addButton(async (button) => {
|
||||
button.setButtonText(t("settings_export_webdis_button"));
|
||||
button.onClick(async () => {
|
||||
new ExportSettingsQrCodeModal(this.app, this.plugin, "webdis").open();
|
||||
});
|
||||
});
|
||||
|
||||
let importSettingVal = "";
|
||||
|
||||
+7
-2
@@ -774,12 +774,16 @@ const getSyncPlanInplace = async (
|
||||
mixedEntityMappings["/$@meta"] = {
|
||||
key: "/$@meta", // don't mess up with the types
|
||||
sideNotes: {
|
||||
version: "20240508 fs version",
|
||||
version: "20240525 fs version",
|
||||
generateTime: currTime,
|
||||
generateTimeFmt: currTimeFmt,
|
||||
service: settings.serviceType,
|
||||
concurrency: settings.concurrency,
|
||||
hasPassword: settings.password !== "",
|
||||
syncConfigDir: settings.syncConfigDir,
|
||||
syncUnderscoreItems: settings.syncUnderscoreItems,
|
||||
skipSizeLargerThan: settings.skipSizeLargerThan,
|
||||
protectModifyPercentage: settings.protectModifyPercentage,
|
||||
conflictAction: conflictAction,
|
||||
syncDirection: syncDirection,
|
||||
triggerSource: triggerSource,
|
||||
@@ -986,7 +990,8 @@ async function copyFile(
|
||||
const statsLeft = await left.stat(key);
|
||||
const content = await left.readFile(key);
|
||||
|
||||
if (statsLeft.size === undefined) {
|
||||
if (statsLeft.size === undefined || statsLeft.size === 0) {
|
||||
// some weird bugs on android not returning size. just ignore them
|
||||
statsLeft.size = content.byteLength;
|
||||
} else {
|
||||
if (statsLeft.size !== content.byteLength) {
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
padding-top: 18px;
|
||||
}
|
||||
|
||||
.settings-percentage-custom-hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.s3-disclaimer {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user