mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2025-01-20 18:28:20 +02:00
Fixed:
- No longer unexpected parallel replication is performed. - Now we can set the device name and enable customised synchronisation again.
This commit is contained in:
parent
3a4b59b998
commit
0bf087dba0
2
src/lib
2
src/lib
@ -1 +1 @@
|
||||
Subproject commit ed85f79cf76e81ae01939c818c28661534c5fe5f
|
||||
Subproject commit 302a2e7c0b73d88b9a943a22b80a195e2a7a6051
|
@ -1439,7 +1439,7 @@ We can perform a command in this file.
|
||||
this.replicator.openReplication(this.settings, true, false, false);
|
||||
}
|
||||
}
|
||||
if (this.settings.syncOnStart) {
|
||||
if (!this.settings.liveSync && this.settings.syncOnStart) {
|
||||
this.replicator.openReplication(this.settings, false, false, false);
|
||||
}
|
||||
this.periodicSyncProcessor.enable(this.settings.periodicReplication ? this.settings.periodicReplicationInterval * 1000 : 0);
|
||||
|
@ -437,12 +437,17 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
||||
localStorage.setItem("ls-setting-passphrase", this.editingSettings?.[key] ?? "");
|
||||
return await Promise.resolve();
|
||||
}
|
||||
if (key == "deviceAndVaultName") {
|
||||
this.plugin.deviceAndVaultName = this.editingSettings?.[key];
|
||||
return await Promise.resolve();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Apply and save setting to the plug-in.
|
||||
* @param keys setting keys for applying
|
||||
*/
|
||||
async saveSettings(keys: (AllSettingItemKey)[]) {
|
||||
let hasChanged = false;
|
||||
const appliedKeys = [] as AllSettingItemKey[];
|
||||
for (const k of keys) {
|
||||
if (!this.isDirty(k)) continue;
|
||||
@ -457,9 +462,12 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
||||
this.plugin.settings[k] = this.editingSettings[k];
|
||||
//@ts-ignore
|
||||
this.initialSettings[k] = this.plugin.settings[k];
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
await this.plugin.saveSettings();
|
||||
if (hasChanged) {
|
||||
await this.plugin.saveSettings();
|
||||
}
|
||||
|
||||
// if (runOnSaved) {
|
||||
const handlers =
|
||||
@ -498,6 +506,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
||||
const ret = { ...OnDialogSettingsDefault };
|
||||
ret.configPassphrase = localStorage.getItem("ls-setting-passphrase") || "";
|
||||
ret.preset = ""
|
||||
ret.deviceAndVaultName = this.plugin.deviceAndVaultName;
|
||||
return ret;
|
||||
}
|
||||
computeAllLocalSettings(): Partial<OnDialogSettings> {
|
||||
|
@ -6,6 +6,7 @@ export type OnDialogSettings = {
|
||||
preset: "" | "PERIODIC" | "LIVESYNC" | "DISABLE",
|
||||
syncMode: "ONEVENTS" | "PERIODIC" | "LIVESYNC"
|
||||
dummy: number,
|
||||
deviceAndVaultName: string,
|
||||
}
|
||||
|
||||
export const OnDialogSettingsDefault: OnDialogSettings = {
|
||||
@ -13,6 +14,7 @@ export const OnDialogSettingsDefault: OnDialogSettings = {
|
||||
preset: "",
|
||||
syncMode: "ONEVENTS",
|
||||
dummy: 0,
|
||||
deviceAndVaultName: "",
|
||||
}
|
||||
export const AllSettingDefault =
|
||||
{ ...DEFAULT_SETTINGS, ...OnDialogSettingsDefault }
|
||||
|
Loading…
x
Reference in New Issue
Block a user