add intro
This commit is contained in:
parent
9fc46553e1
commit
aff5a8b088
@ -1,7 +1,7 @@
|
|||||||
# Sync Algorithm
|
# Sync Algorithm
|
||||||
|
|
||||||
* [v1](./v1/README.md)
|
- [v1](./v1/README.md)
|
||||||
* [v2](./v2/README.md)
|
- [v2](./v2/README.md)
|
||||||
* v3
|
- v3
|
||||||
* [intro doc for end users](./v3/intro.md)
|
- [intro doc for end users](./v3/intro.md)
|
||||||
* [design doc](./v3/design.md)
|
- [design doc](./v3/design.md)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# Sync Algorithm V3
|
# Sync Algorithm V3
|
||||||
|
|
||||||
* [intro doc for end users](./intro.md)
|
- [intro doc for end users](./intro.md)
|
||||||
* [design doc](./design.md)
|
- [design doc](./design.md)
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
# Introduction To Sync Algorithm V3
|
# Introduction To Sync Algorithm V3
|
||||||
|
|
||||||
* [x] sync conflict: keep newer
|
- [x] sync conflict: keep newer
|
||||||
* [x] sync conflict: keep larger
|
- [x] sync conflict: keep larger
|
||||||
* [ ] sync conflict: keep both and rename
|
- [ ] sync conflict: keep both and rename
|
||||||
* [ ] sync conflict: show warning
|
- [ ] sync conflict: show warning
|
||||||
* [x] deletion: true deletion status computation
|
- [x] deletion: true deletion status computation
|
||||||
* [x] meta data: no remote meta data any more
|
- [x] meta data: no remote meta data any more
|
||||||
* [x] migration: old data auto transfer to new db (hopefully)
|
- [x] migration: old data auto transfer to new db (hopefully)
|
||||||
* [ ] partial sync: force push
|
- [ ] partial sync: force push
|
||||||
* [ ] partial sync: force pull
|
- [ ] partial sync: force pull
|
||||||
* [ ] sync protection: warning based on the threshold
|
- [ ] sync protection: warning based on the threshold
|
||||||
|
|||||||
@ -293,7 +293,8 @@
|
|||||||
"settings_resetcache_button": "Reset",
|
"settings_resetcache_button": "Reset",
|
||||||
"settings_resetcache_notice": "Local internal cache/databases deleted. Please manually reload the plugin.",
|
"settings_resetcache_notice": "Local internal cache/databases deleted. Please manually reload the plugin.",
|
||||||
"syncalgov3_title": "Remotely Save has HUGE update on sync algorithm",
|
"syncalgov3_title": "Remotely Save has HUGE update on sync algorithm",
|
||||||
"syncalgov3_texts": "Welcome to use Remotely Save!\nFrom this version, a new algorithm has been developed. If you agree, plase click the button \"Agree\", and enjoy the plugin! AND PLEASE REMEMBER TO BACKUP YOUR VAULT FIRSTLY!\nIf you do not agree, you should stop using the current and later versions of Remotely Save. By clicking the \"Do Not Agree\" button, the plugin will unload itself, and you need to manually disable it in Obsidian settings.",
|
"syncalgov3_texts": "Welcome to use Remotely Save!\nFrom this version, a new algorithm has been developed: More robust deletion sync, basic conflict handling, no more meta data uploaded... Stay tune for more! A full introduction is in the <a href='https://github.com/remotely-save/remotely-save/tree/master/docs/sync_algorithm/v3/intro.md'>doc website</a>.\nIf you agree to use thew new version and algorithm, plase check \"I WILL BACKUP MY VAULT MANUALLY FIRSTLY.\" then click the \"Agree\" button, and enjoy the plugin!\nIf you do not agree, please click the \"Do Not Agree\" button, the plugin will unload itself, and you need to manually disable it in Obsidian settings.",
|
||||||
|
"syncalgov3_checkbox_manual_backup": "I WILL BACKUP MY VAULT MANUALLY FIRSTLY.",
|
||||||
"syncalgov3_button_agree": "Agree",
|
"syncalgov3_button_agree": "Agree",
|
||||||
"syncalgov3_button_disagree": "Do Not Agree"
|
"syncalgov3_button_disagree": "Do Not Agree"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -292,8 +292,9 @@
|
|||||||
"settings_resetcache_desc": "(出于调试原因)重设本地缓存和数据库。您需要在重设之后重新载入此插件。本重设不会删除 s3,密码……等设定。",
|
"settings_resetcache_desc": "(出于调试原因)重设本地缓存和数据库。您需要在重设之后重新载入此插件。本重设不会删除 s3,密码……等设定。",
|
||||||
"settings_resetcache_button": "重设",
|
"settings_resetcache_button": "重设",
|
||||||
"settings_resetcache_notice": "本地同步缓存和数据库已被删除。请手动重新载入此插件。",
|
"settings_resetcache_notice": "本地同步缓存和数据库已被删除。请手动重新载入此插件。",
|
||||||
"syncalgov3_title": "Remotely Save 的同步算法重大优化",
|
"syncalgov3_title": "Remotely Save 的同步算法有重大更新",
|
||||||
"syncalgov3_texts": "欢迎使用 Remotely Save!\n从这个版本 0.3.0 开始,它带来了新的同步算法\n如果您同意使用,请点击按钮 \"同意\",然后开始享用此插件!且特别要注意:使用插件之前,请首先备份好您的库(Vault)!\n如果您不同意此策略,您应该停止使用此版本和之后版本的 Remotely Save。点击 \"不同意\" 之后,插件会自动停止运行(unload),然后您需要 Obsidian 设置里手动停用(disable)此插件。",
|
"syncalgov3_texts": "欢迎使用 Remotely Save!\n从这个版本开始,插件更新了同步算法:更稳健的删除同步、引入冲突处理、避免上传元数据…… 敬请期待更多更新!详细介绍请参阅 <a href='https://github.com/remotely-save/remotely-save/tree/master/docs/sync_algorithm/v3/intro.md'>文档网站</a>。\n如果您同意使用新版本和算法,请勾选“我将会手动备份我的库(Vault)”,然后点击“同意”按钮,开始使用插件吧!\n如果您不同意,请点击“不同意”按钮,插件将自动停止运行(unload),然后您需要 Obsidian 设置里手动停用(disable)此插件。",
|
||||||
|
"syncalgov3_checkbox_manual_backup": "我将会手动备份我的库(Vault)",
|
||||||
"syncalgov3_button_agree": "同意",
|
"syncalgov3_button_agree": "同意",
|
||||||
"syncalgov3_button_disagree": "不同意"
|
"syncalgov3_button_disagree": "不同意"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -292,8 +292,9 @@
|
|||||||
"settings_resetcache_desc": "(出於除錯原因)重設本地快取和資料庫。您需要在重設之後重新載入此外掛。本重設不會刪除 s3,密碼……等設定。",
|
"settings_resetcache_desc": "(出於除錯原因)重設本地快取和資料庫。您需要在重設之後重新載入此外掛。本重設不會刪除 s3,密碼……等設定。",
|
||||||
"settings_resetcache_button": "重設",
|
"settings_resetcache_button": "重設",
|
||||||
"settings_resetcache_notice": "本地同步快取和資料庫已被刪除。請手動重新載入此外掛。",
|
"settings_resetcache_notice": "本地同步快取和資料庫已被刪除。請手動重新載入此外掛。",
|
||||||
"syncalgov3_title": "Remotely Save 的同步演算法重大最佳化",
|
"syncalgov3_title": "Remotely Save 的同步演算法有重大更新",
|
||||||
"syncalgov3_texts": "歡迎使用 Remotely Save!\n從這個版本 0.3.0 開始,它帶來了新的同步演算法\n如果您同意使用,請點選按鈕 \"同意\",然後開始享用此外掛!且特別要注意:使用外掛之前,請首先備份好您的庫(Vault)!\n如果您不同意此策略,您應該停止使用此版本和之後版本的 Remotely Save。點選 \"不同意\" 之後,外掛會自動停止執行(unload),然後您需要 Obsidian 設定裡手動停用(disable)此外掛。",
|
"syncalgov3_texts": "歡迎使用 Remotely Save!\n從這個版本開始,外掛更新了同步演算法:更穩健的刪除同步、引入衝突處理、避免上傳元資料…… 敬請期待更多更新!詳細介紹請參閱 <a href='https://github.com/remotely-save/remotely-save/tree/master/docs/sync_algorithm/v3/intro.md'>文件網站</a>。\n如果您同意使用新版本和演算法,請勾選“我將會手動備份我的庫(Vault)”,然後點選“同意”按鈕,開始使用外掛吧!\n如果您不同意,請點選“不同意”按鈕,外掛將自動停止執行(unload),然後您需要 Obsidian 設定裡手動停用(disable)此外掛。",
|
||||||
|
"syncalgov3_checkbox_manual_backup": "我將會手動備份我的庫(Vault)",
|
||||||
"syncalgov3_button_agree": "同意",
|
"syncalgov3_button_agree": "同意",
|
||||||
"syncalgov3_button_disagree": "不同意"
|
"syncalgov3_button_disagree": "不同意"
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/misc.ts
12
src/misc.ts
@ -493,3 +493,15 @@ export const compareVersion = (x: string | null, y: string | null) => {
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://stackoverflow.com/questions/19929641/how-to-append-an-html-string-to-a-documentfragment
|
||||||
|
* To introduce some advanced html fragments.
|
||||||
|
* @param string
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const stringToFragment = (string: string) => {
|
||||||
|
const wrapper = document.createElement("template");
|
||||||
|
wrapper.innerHTML = string;
|
||||||
|
return wrapper.content;
|
||||||
|
};
|
||||||
|
|||||||
@ -3,14 +3,17 @@ import type RemotelySavePlugin from "./main"; // unavoidable
|
|||||||
import type { TransItemType } from "./i18n";
|
import type { TransItemType } from "./i18n";
|
||||||
|
|
||||||
import { log } from "./moreOnLog";
|
import { log } from "./moreOnLog";
|
||||||
|
import { stringToFragment } from "./misc";
|
||||||
|
|
||||||
export class SyncAlgoV3Modal extends Modal {
|
export class SyncAlgoV3Modal extends Modal {
|
||||||
agree: boolean;
|
agree: boolean;
|
||||||
|
manualBackup: boolean;
|
||||||
readonly plugin: RemotelySavePlugin;
|
readonly plugin: RemotelySavePlugin;
|
||||||
constructor(app: App, plugin: RemotelySavePlugin) {
|
constructor(app: App, plugin: RemotelySavePlugin) {
|
||||||
super(app);
|
super(app);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.agree = false;
|
this.agree = false;
|
||||||
|
this.manualBackup = false;
|
||||||
}
|
}
|
||||||
onOpen() {
|
onOpen() {
|
||||||
let { contentEl } = this;
|
let { contentEl } = this;
|
||||||
@ -27,21 +30,55 @@ export class SyncAlgoV3Modal extends Modal {
|
|||||||
.split("\n")
|
.split("\n")
|
||||||
.forEach((val) => {
|
.forEach((val) => {
|
||||||
ul.createEl("li", {
|
ul.createEl("li", {
|
||||||
text: val,
|
text: stringToFragment(val),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
new Setting(contentEl)
|
// code modified partially from BART released under MIT License
|
||||||
.addButton((button) => {
|
contentEl.createDiv("modal-button-container", (buttonContainerEl) => {
|
||||||
button.setButtonText(t("syncalgov3_button_agree"));
|
let agreeBtn: HTMLButtonElement | undefined = undefined;
|
||||||
button.onClick(async () => {
|
buttonContainerEl.createEl(
|
||||||
|
"label",
|
||||||
|
{
|
||||||
|
cls: "mod-checkbox",
|
||||||
|
},
|
||||||
|
(labelEl) => {
|
||||||
|
const checkboxEl = labelEl.createEl("input", {
|
||||||
|
attr: { tabindex: -1 },
|
||||||
|
type: "checkbox",
|
||||||
|
});
|
||||||
|
checkboxEl.checked = this.manualBackup;
|
||||||
|
checkboxEl.addEventListener("click", () => {
|
||||||
|
this.manualBackup = checkboxEl.checked;
|
||||||
|
if (agreeBtn !== undefined) {
|
||||||
|
if (checkboxEl.checked) {
|
||||||
|
agreeBtn.removeAttribute("disabled");
|
||||||
|
} else {
|
||||||
|
agreeBtn.setAttr("disabled", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
labelEl.appendText(t("syncalgov3_checkbox_manual_backup"));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
agreeBtn = buttonContainerEl.createEl("button", {
|
||||||
|
attr: { type: "button" },
|
||||||
|
cls: "mod-cta",
|
||||||
|
text: t("syncalgov3_button_agree"),
|
||||||
|
});
|
||||||
|
agreeBtn.setAttr("disabled", true);
|
||||||
|
agreeBtn.addEventListener("click", () => {
|
||||||
this.agree = true;
|
this.agree = true;
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
buttonContainerEl
|
||||||
|
.createEl("button", {
|
||||||
|
attr: { type: "submit" },
|
||||||
|
text: t("syncalgov3_button_disagree"),
|
||||||
})
|
})
|
||||||
.addButton((button) => {
|
.addEventListener("click", () => {
|
||||||
button.setButtonText(t("syncalgov3_button_disagree"));
|
|
||||||
button.onClick(() => {
|
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user