- Now we *surely* can set the device name and enable customised synchronisation.
- Unnecessary dialogue update processes have been eliminated.
- Customisation sync no longer stores half-collected files.
- No longer hangs up when removing or renaming files with the `Sync on Save` toggle enabled.
Improved:
- Customisation sync now performs data deserialization more smoothly.
- New translations have been merged.
This commit is contained in:
vorotamoroz
2024-05-28 12:26:23 +01:00
parent bf3a6e7570
commit 2a2b39009c
4 changed files with 81 additions and 36 deletions
+15 -12
View File
@@ -878,6 +878,7 @@ Note: We can always able to read V1 format. It will be progressively converted.
async onload() {
logStore.pipeTo(new QueueProcessor(logs => logs.forEach(e => this.addLog(e.message, e.level, e.key)), { suspended: false, batchSize: 20, concurrentLimit: 1, delay: 0 })).startPipeline();
Logger("loading plugin");
__onMissingTranslation(() => { });
// eslint-disable-next-line no-unused-labels
DEV: {
__onMissingTranslation((key) => {
@@ -1137,12 +1138,14 @@ Note: We can always able to read V1 format. It will be progressively converted.
this.settingTab.requestReload()
}
async saveSettingData() {
saveDeviceAndVaultName() {
const lsKey = "obsidian-live-sync-vaultanddevicename-" + this.getVaultName();
localStorage.setItem(lsKey, this.deviceAndVaultName || "");
}
async saveSettingData() {
this.saveDeviceAndVaultName();
const settings = { ...this.settings };
settings.deviceAndVaultName = "";
if (this.usedPassphrase == "" && !await this.getPassphrase(settings)) {
Logger("Could not determine passphrase for saving data.json! Our data.json have insecure items!", LOG_LEVEL_NOTICE);
} else {
@@ -3060,28 +3063,28 @@ Or if you are sure know what had been happened, we can unlock the database from
const ret = await this.localDatabase.putDBEntry(d);
if (ret !== false) {
Logger(msg + fullPath);
if (this.settings.syncOnSave && !this.suspended) {
scheduleTask("perform-replicate-after-save", 250, () => this.replicate());
}
this.scheduleReplicateIfSyncOnSave();
}
return ret != false;
}
scheduleReplicateIfSyncOnSave() {
if (this.settings.syncOnSave && !this.suspended) {
scheduleTask("perform-replicate-after-save", 250, () => this.replicate());
}
}
async deleteFromDB(file: TFile) {
if (!await this.isTargetFile(file)) return;
const fullPath = getPathFromTFile(file);
Logger(`deleteDB By path:${fullPath}`);
await this.deleteFromDBbyPath(fullPath);
if (this.settings.syncOnSave && !this.suspended) {
await this.replicate();
}
this.scheduleReplicateIfSyncOnSave();
}
async deleteFromDBbyPath(fullPath: FilePath) {
await this.localDatabase.deleteDBEntry(fullPath);
if (this.settings.syncOnSave && !this.suspended) {
await this.replicate();
}
this.scheduleReplicateIfSyncOnSave();
}
async resetLocalDatabase() {