mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-20 16:22:31 +00: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:
+1
-1
Submodule src/lib updated: ed85f79cf7...302a2e7c0b
+1
-1
@@ -1439,7 +1439,7 @@ We can perform a command in this file.
|
|||||||
this.replicator.openReplication(this.settings, true, false, false);
|
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.replicator.openReplication(this.settings, false, false, false);
|
||||||
}
|
}
|
||||||
this.periodicSyncProcessor.enable(this.settings.periodicReplication ? this.settings.periodicReplicationInterval * 1000 : 0);
|
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] ?? "");
|
localStorage.setItem("ls-setting-passphrase", this.editingSettings?.[key] ?? "");
|
||||||
return await Promise.resolve();
|
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.
|
* Apply and save setting to the plug-in.
|
||||||
* @param keys setting keys for applying
|
* @param keys setting keys for applying
|
||||||
*/
|
*/
|
||||||
async saveSettings(keys: (AllSettingItemKey)[]) {
|
async saveSettings(keys: (AllSettingItemKey)[]) {
|
||||||
|
let hasChanged = false;
|
||||||
const appliedKeys = [] as AllSettingItemKey[];
|
const appliedKeys = [] as AllSettingItemKey[];
|
||||||
for (const k of keys) {
|
for (const k of keys) {
|
||||||
if (!this.isDirty(k)) continue;
|
if (!this.isDirty(k)) continue;
|
||||||
@@ -457,9 +462,12 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
this.plugin.settings[k] = this.editingSettings[k];
|
this.plugin.settings[k] = this.editingSettings[k];
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
this.initialSettings[k] = this.plugin.settings[k];
|
this.initialSettings[k] = this.plugin.settings[k];
|
||||||
|
hasChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.plugin.saveSettings();
|
if (hasChanged) {
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
// if (runOnSaved) {
|
// if (runOnSaved) {
|
||||||
const handlers =
|
const handlers =
|
||||||
@@ -498,6 +506,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
const ret = { ...OnDialogSettingsDefault };
|
const ret = { ...OnDialogSettingsDefault };
|
||||||
ret.configPassphrase = localStorage.getItem("ls-setting-passphrase") || "";
|
ret.configPassphrase = localStorage.getItem("ls-setting-passphrase") || "";
|
||||||
ret.preset = ""
|
ret.preset = ""
|
||||||
|
ret.deviceAndVaultName = this.plugin.deviceAndVaultName;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
computeAllLocalSettings(): Partial<OnDialogSettings> {
|
computeAllLocalSettings(): Partial<OnDialogSettings> {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export type OnDialogSettings = {
|
|||||||
preset: "" | "PERIODIC" | "LIVESYNC" | "DISABLE",
|
preset: "" | "PERIODIC" | "LIVESYNC" | "DISABLE",
|
||||||
syncMode: "ONEVENTS" | "PERIODIC" | "LIVESYNC"
|
syncMode: "ONEVENTS" | "PERIODIC" | "LIVESYNC"
|
||||||
dummy: number,
|
dummy: number,
|
||||||
|
deviceAndVaultName: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const OnDialogSettingsDefault: OnDialogSettings = {
|
export const OnDialogSettingsDefault: OnDialogSettings = {
|
||||||
@@ -13,6 +14,7 @@ export const OnDialogSettingsDefault: OnDialogSettings = {
|
|||||||
preset: "",
|
preset: "",
|
||||||
syncMode: "ONEVENTS",
|
syncMode: "ONEVENTS",
|
||||||
dummy: 0,
|
dummy: 0,
|
||||||
|
deviceAndVaultName: "",
|
||||||
}
|
}
|
||||||
export const AllSettingDefault =
|
export const AllSettingDefault =
|
||||||
{ ...DEFAULT_SETTINGS, ...OnDialogSettingsDefault }
|
{ ...DEFAULT_SETTINGS, ...OnDialogSettingsDefault }
|
||||||
|
|||||||
Reference in New Issue
Block a user