mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-17 06:42:31 +00:00
Add new configuration
- Use newer file if conflicted I mprove:. - status message improved. - fixed misconfigurations on automatically disabled sync.
This commit is contained in:
@@ -1621,6 +1621,7 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
this.settings.liveSync = false;
|
this.settings.liveSync = false;
|
||||||
this.settings.syncOnSave = false;
|
this.settings.syncOnSave = false;
|
||||||
this.settings.syncOnStart = false;
|
this.settings.syncOnStart = false;
|
||||||
|
this.settings.syncOnFileOpen = false;
|
||||||
this.settings.periodicReplication = false;
|
this.settings.periodicReplication = false;
|
||||||
this.settings.versionUpFlash = "I changed specifications incompatiblly, so when you enable sync again, be sure to made version up all nother devides.";
|
this.settings.versionUpFlash = "I changed specifications incompatiblly, so when you enable sync again, be sure to made version up all nother devides.";
|
||||||
this.saveSettings();
|
this.saveSettings();
|
||||||
@@ -1850,6 +1851,7 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
// If batchsave is enabled, queue all changes and do nothing.
|
// If batchsave is enabled, queue all changes and do nothing.
|
||||||
if (this.settings.batchSave) {
|
if (this.settings.batchSave) {
|
||||||
this.batchFileChange = Array.from(new Set([...this.batchFileChange, file.path]));
|
this.batchFileChange = Array.from(new Set([...this.batchFileChange, file.path]));
|
||||||
|
this.refreshStatusText();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.watchVaultChangeAsync(file, ...args);
|
this.watchVaultChangeAsync(file, ...args);
|
||||||
@@ -1872,6 +1874,7 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
Logger(ex, LOG_LEVEL.VERBOSE);
|
Logger(ex, LOG_LEVEL.VERBOSE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.refreshStatusText();
|
||||||
return Promise.all(promises);
|
return Promise.all(promises);
|
||||||
}
|
}
|
||||||
batchFileChange: string[] = [];
|
batchFileChange: string[] = [];
|
||||||
@@ -2199,7 +2202,11 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
w = "?";
|
w = "?";
|
||||||
}
|
}
|
||||||
this.statusBar.title = this.localDatabase.syncStatus;
|
this.statusBar.title = this.localDatabase.syncStatus;
|
||||||
this.statusBar.setText(`Sync:${w} ↑${sent} ↓${arrived}`);
|
let waiting = "";
|
||||||
|
if (this.settings.batchSave) {
|
||||||
|
waiting = " " + this.batchFileChange.map((e) => "🚀").join("");
|
||||||
|
}
|
||||||
|
this.statusBar.setText(`Sync:${w} ↑${sent} ↓${arrived}${waiting}`);
|
||||||
}
|
}
|
||||||
async replicate(showMessage?: boolean) {
|
async replicate(showMessage?: boolean) {
|
||||||
if (this.settings.versionUpFlash != "") {
|
if (this.settings.versionUpFlash != "") {
|
||||||
@@ -2250,18 +2257,18 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
const count = objects.length;
|
const count = objects.length;
|
||||||
Logger(procedurename);
|
Logger(procedurename);
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let lastTicks = performance.now() + 2000;
|
// let lastTicks = performance.now() + 2000;
|
||||||
let procs = objects.map(async (e) => {
|
let procs = objects.map(async (e) => {
|
||||||
try {
|
try {
|
||||||
// debugger;
|
// debugger;
|
||||||
// Logger("hello?")
|
// Logger("hello?")
|
||||||
await callback(e);
|
await callback(e);
|
||||||
i++;
|
i++;
|
||||||
if (lastTicks < performance.now()) {
|
if (i % 25 == 0) {
|
||||||
const notify = `${procedurename} : ${i}/${count}`;
|
const notify = `${procedurename} : ${i}/${count}`;
|
||||||
if (notice != null) notice.setMessage(notify);
|
if (notice != null) notice.setMessage(notify);
|
||||||
Logger(notify);
|
Logger(notify);
|
||||||
lastTicks = performance.now() + 2000;
|
// lastTicks = performance.now() + 2000;
|
||||||
// this.statusBar.setText(notify);
|
// this.statusBar.setText(notify);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
@@ -2435,7 +2442,7 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
await this.localDatabase.deleteDBEntry(path, { rev: loser.rev });
|
await this.localDatabase.deleteDBEntry(path, { rev: loser.rev });
|
||||||
await this.pullFile(path, null, true);
|
await this.pullFile(path, null, true);
|
||||||
Logger(`automaticaly merged (newerFileResolve) :${path}`);
|
Logger(`Automaticaly merged (newerFileResolve) :${path}`, LOG_LEVEL.NOTICE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// make diff.
|
// make diff.
|
||||||
@@ -2877,7 +2884,7 @@ class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName("End to End Encryption (beta)")
|
.setName("End to End Encryption")
|
||||||
.setDesc("Encrypting contents on the database.")
|
.setDesc("Encrypting contents on the database.")
|
||||||
.addToggle((toggle) =>
|
.addToggle((toggle) =>
|
||||||
toggle.setValue(this.plugin.settings.workingEncrypt).onChange(async (value) => {
|
toggle.setValue(this.plugin.settings.workingEncrypt).onChange(async (value) => {
|
||||||
@@ -2918,6 +2925,7 @@ class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
this.plugin.settings.periodicReplication = false;
|
this.plugin.settings.periodicReplication = false;
|
||||||
this.plugin.settings.syncOnSave = false;
|
this.plugin.settings.syncOnSave = false;
|
||||||
this.plugin.settings.syncOnStart = false;
|
this.plugin.settings.syncOnStart = false;
|
||||||
|
this.plugin.settings.syncOnFileOpen = false;
|
||||||
this.plugin.settings.encrypt = this.plugin.settings.workingEncrypt;
|
this.plugin.settings.encrypt = this.plugin.settings.workingEncrypt;
|
||||||
this.plugin.settings.passphrase = this.plugin.settings.workingPassphrase;
|
this.plugin.settings.passphrase = this.plugin.settings.workingPassphrase;
|
||||||
|
|
||||||
@@ -3096,6 +3104,15 @@ class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName("Use newer file if conflicted (beta)")
|
||||||
|
.setDesc("Resolve conflicts by newer files automatically.")
|
||||||
|
.addToggle((toggle) =>
|
||||||
|
toggle.setValue(this.plugin.settings.resolveConflictsByNewerFile).onChange(async (value) => {
|
||||||
|
this.plugin.settings.resolveConflictsByNewerFile = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
);
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName("Minimum chunk size")
|
.setName("Minimum chunk size")
|
||||||
.setDesc("(letters), minimum chunk size.")
|
.setDesc("(letters), minimum chunk size.")
|
||||||
@@ -3162,6 +3179,7 @@ class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
this.plugin.settings.periodicReplication = false;
|
this.plugin.settings.periodicReplication = false;
|
||||||
this.plugin.settings.syncOnSave = false;
|
this.plugin.settings.syncOnSave = false;
|
||||||
this.plugin.settings.syncOnStart = false;
|
this.plugin.settings.syncOnStart = false;
|
||||||
|
this.plugin.settings.syncOnFileOpen = false;
|
||||||
|
|
||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
applyDisplayEnabled();
|
applyDisplayEnabled();
|
||||||
|
|||||||
Reference in New Issue
Block a user