Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2022-06-03 17:28:30 +08:00
commit f821e0284b
11 changed files with 77 additions and 0 deletions

View file

@ -173,6 +173,10 @@
"setEmojiTip": "Please go to [Settings - Appearance to add emoji]",
"openSyncTip1": "Enable cloud sync",
"openSyncTip2": "When changing from disabled to enabled, it is recommended to manually click the sync button to trigger a synchronization",
"syncMode": "Cloud sync mode",
"syncModeTip": "The sync mode can be further selected after cloud sync is enabled",
"syncMode1": "Auto (sync every 30 seconds after the data no longer changes)",
"syncMode2": "Manual (automatic auto only once when the software is started and closed, other times need to manually trigger)",
"cloudSync": "Cloud sync",
"cloudSyncDir": "Cloud Sync Dir",
"emptyCloudSyncList": "The cloud sync list is empty",

View file

@ -173,6 +173,10 @@
"setEmojiTip": "Veuillez aller dans [Paramètres - Apparence] pour ajouter des emoji",
"openSyncTip1": "Activer Cloud Sync",
"openSyncTip2": "Lorsque vous passez de la désactivation à l'activation, il est recommandé de cliquer manuellement sur le bouton de synchronisation pour déclencher une synchronisation",
"syncMode": "Mode de synchronisation cloud",
"syncModeTip": "Le mode de synchronisation peut être sélectionné davantage après l'activation de la synchronisation dans le cloud",
"syncMode1": "Automatique (synchronisation toutes les 30 secondes après que les données ne changent plus)",
"syncMode2": "Manuelle (synchronisation automatique une seule fois lorsque le logiciel est démarré et fermé, les autres fois, il faut déclencher manuellement la synchronisation)",
"cloudSync": "Cloud Sync",
"cloudSyncDir": "Répertoire Cloud Sync",
"emptyCloudSyncList": "La liste de sync du cloud est videy",

View file

@ -173,6 +173,10 @@
"setEmojiTip": "請在 [設置 - 外觀] 中新增自訂表情",
"openSyncTip1": "啟用雲端同步",
"openSyncTip2": "從禁用改為啟用時建議手動點擊同步按鈕觸發一次同步",
"syncMode": "雲端同步模式",
"syncModeTip": "啟用雲端同步後可進一步選擇同步模式",
"syncMode1": "自動同步(數據不再變動後 30 秒進行一次同步)",
"syncMode2": "手動同步(僅啟動和關閉軟件時自動同步一次,其他時候需要手動觸發同步)",
"cloudSync": "雲端同步",
"cloudSyncDir": "雲端同步目錄",
"emptyCloudSyncList": "雲端同步列表為空",

View file

@ -173,6 +173,10 @@
"setEmojiTip": "请在 [设置 - 外观] 中添加自定义表情",
"openSyncTip1": "启用云端同步",
"openSyncTip2": "从禁用改为启用时建议手动点击同步按钮触发一次同步",
"syncMode": "云端同步模式",
"syncModeTip": "启用云端同步后可进一步选择同步模式",
"syncMode1": "自动同步(数据不再变动后 30 秒进行一次同步)",
"syncMode2": "手动同步(仅启动和关闭软件时自动同步一次,其他时候需要手动触发同步)",
"cloudSync": "云端同步",
"cloudSyncDir": "云端同步目录",
"emptyCloudSyncList": "云端同步列表为空",

View file

@ -325,6 +325,17 @@ ${passwordHTML}
<span class="fn__space"></span>
<input type="checkbox" id="reposCloudSyncSwitch"${window.siyuan.config.sync.enabled ? " checked='checked'" : ""} class="b3-switch fn__flex-center">
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.syncMode}
<div class="b3-label__text">${window.siyuan.languages.syncModeTip}</div>
</div>
<span class="fn__space"></span>
<select id="syncMode" class="b3-select fn__flex-center fn__size200">
<option value="1" ${window.siyuan.config.sync.mode === 1 ? "selected" : ""}>${window.siyuan.languages.syncMode1}</option>
<option value="2" ${window.siyuan.config.sync.mode === 2 ? "selected" : ""}>${window.siyuan.languages.syncMode2}</option>
</select>
</label>
<div class="b3-label">
<div class="fn__flex">
<div class="fn__flex-center">${window.siyuan.languages.cloudSync}</div>
@ -362,6 +373,17 @@ ${passwordHTML}
}
});
});
const syncModeElement = repos.element.querySelector("#syncMode") as HTMLSelectElement;
syncModeElement.addEventListener("change", () => {
fetchPost("/api/sync/setSyncMode", {mode: parseInt(syncModeElement.value, 10)}, (response) => {
if (response.code === 1) {
showMessage(response.msg);
syncModeElement.value = "1";
} else {
window.siyuan.config.sync.mode = parseInt(syncModeElement.value, 10);
}
});
});
const loadingElement = repos.element.querySelector("#reposLoading") as HTMLElement;
loadingElement.style.width = repos.element.clientWidth + "px";
loadingElement.style.height = repos.element.clientHeight + "px";

View file

@ -242,6 +242,7 @@ declare interface IConfig {
e2eePasswdMode: number
sync: {
enabled: boolean
mode: number
synced: number
stat: string
interval: number