mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2025-12-13 09:45:56 +00:00
Add new feature:
- Reread all files
This commit is contained in:
@@ -165,6 +165,9 @@ The remote database indicates that has been unlocked Pattern 1.
|
||||
When you mark all devices as resolved, you can unlock the database.
|
||||
But, there's no problem even if you leave it as it is.
|
||||
|
||||
### Reread all files
|
||||
Reread all files in the vault, and update them into the database if there's diff or could not read from the database.
|
||||
|
||||
### Drop history
|
||||
Drop all histories on the local database and the remote database, and initialize When synchronization time has been prolonged to the new device or new vault, or database size became to be much larger. Try this.
|
||||
|
||||
|
||||
@@ -166,6 +166,9 @@ Self-hosted LiveSyncは一つのチャンクのサイズを最低minimum chunk s
|
||||
ご使用のすべてのデバイスでロックを解除した場合は、データベースのロックを解除することができます。
|
||||
ただし、このまま放置しても問題はありません。
|
||||
|
||||
### Reread all files
|
||||
Vault内のファイルを全て読み込み直し、もし差分があったり、データベースから正常に読み込めなかったものに関して、データベースに反映します。
|
||||
|
||||
### Drop history
|
||||
データベースに記録されている履歴を削除し、データベースを初期化します。
|
||||
新しい端末や新しいVaultへの同期にやたらと時間がかかったり、データベースサイズが肥大化したりしてきた際に使用してください。
|
||||
|
||||
38
main.ts
38
main.ts
@@ -2062,8 +2062,13 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
||||
this.notifies[messagecontent].count++;
|
||||
this.notifies[messagecontent].notice.setMessage(`(${this.notifies[messagecontent].count}):${messagecontent}`);
|
||||
this.notifies[messagecontent].timer = setTimeout(() => {
|
||||
this.notifies[messagecontent].notice.hide();
|
||||
const notify = this.notifies[messagecontent].notice;
|
||||
delete this.notifies[messagecontent];
|
||||
try {
|
||||
notify.hide();
|
||||
} catch (ex) {
|
||||
// NO OP
|
||||
}
|
||||
}, 5000);
|
||||
} else {
|
||||
let notify = new Notice(messagecontent, 0);
|
||||
@@ -2071,8 +2076,8 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
||||
count: 0,
|
||||
notice: notify,
|
||||
timer: setTimeout(() => {
|
||||
notify.hide();
|
||||
delete this.notifies[messagecontent];
|
||||
notify.hide();
|
||||
}, 5000),
|
||||
};
|
||||
}
|
||||
@@ -3351,6 +3356,35 @@ class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
||||
await this.plugin.replicate(true);
|
||||
}
|
||||
};
|
||||
new Setting(containerEl)
|
||||
.setName("Reread all files")
|
||||
.setDesc("Reread all files and update the database without dropping history")
|
||||
.addButton((button) =>
|
||||
button
|
||||
.setButtonText("Reread")
|
||||
.setDisabled(false)
|
||||
.setWarning()
|
||||
.onClick(async () => {
|
||||
const files = this.app.vault.getFiles();
|
||||
Logger("Reread all files started", LOG_LEVEL.NOTICE);
|
||||
let notice = new Notice("", 0);
|
||||
let i = 0;
|
||||
for (const file of files) {
|
||||
i++;
|
||||
Logger(`Update into ${file.path}`);
|
||||
notice.setMessage(`${i}/${files.length}\n${file.path}`);
|
||||
try {
|
||||
await this.plugin.updateIntoDB(file);
|
||||
} catch (ex) {
|
||||
Logger("could not update:");
|
||||
Logger(ex);
|
||||
}
|
||||
}
|
||||
notice.hide();
|
||||
Logger("done", LOG_LEVEL.NOTICE);
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Drop History")
|
||||
.setDesc("Initialize local and remote database, and send all or retrieve all again.")
|
||||
|
||||
Reference in New Issue
Block a user