This commit is contained in:
Liang Ding 2022-07-03 22:02:21 +08:00
parent 5b1b38aabe
commit eb79fbd37d
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
10 changed files with 59 additions and 0 deletions

View file

@ -361,6 +361,14 @@ ${passwordHTML}
<option value="2" ${window.siyuan.config.sync.mode === 2 ? "selected" : ""}>${window.siyuan.languages.syncMode2}</option>
</select>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.syncDataRepo}
<div class="b3-label__text">${window.siyuan.languages.syncDataRepoTip}</div>
</div>
<span class="fn__space"></span>
<input type="checkbox" id="useDataRepo"${window.siyuan.config.sync.useDataRepo ? " checked='checked'" : ""} class="b3-switch fn__flex-center">
</label>
<div class="b3-label">
<div class="fn__flex">
<div class="fn__flex-center">${window.siyuan.languages.cloudSync}</div>
@ -409,6 +417,17 @@ ${passwordHTML}
}
});
});
const useDataRepoElement = repos.element.querySelector("#useDataRepo") as HTMLInputElement;
useDataRepoElement.addEventListener("change", () => {
fetchPost("/api/sync/setSyncUseDataRepo", {enabled: useDataRepoElement.checked}, (response) => {
if (response.code === 1) {
showMessage(response.msg);
useDataRepoElement.checked = false;
} else {
window.siyuan.config.sync.useDataRepo = useDataRepoElement.checked;
}
});
});
const loadingElement = repos.element.querySelector("#reposLoading") as HTMLElement;
loadingElement.style.width = repos.element.clientWidth + "px";
loadingElement.style.height = repos.element.clientHeight + "px";

View file

@ -255,6 +255,7 @@ declare interface IConfig {
stat: string
interval: number
cloudName: string
useDataRepo: boolean
},
lang: string
api: {