mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-05-09 09:11:51 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
799e604eb2 | ||
|
|
d9b69d9a1b | ||
|
|
c18b5c24b4 | ||
|
|
07f16e3d7d |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "obsidian-livesync",
|
"id": "obsidian-livesync",
|
||||||
"name": "Self-hosted LiveSync",
|
"name": "Self-hosted LiveSync",
|
||||||
"version": "0.16.0",
|
"version": "0.16.2",
|
||||||
"minAppVersion": "0.9.12",
|
"minAppVersion": "0.9.12",
|
||||||
"description": "Community implementation of self-hosted livesync. Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.",
|
"description": "Community implementation of self-hosted livesync. Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.",
|
||||||
"author": "vorotamoroz",
|
"author": "vorotamoroz",
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.16.0",
|
"version": "0.16.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.16.0",
|
"version": "0.16.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"diff-match-patch": "^1.0.5",
|
"diff-match-patch": "^1.0.5",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.16.0",
|
"version": "0.16.2",
|
||||||
"description": "Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.",
|
"description": "Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
2
src/lib
2
src/lib
Submodule src/lib updated: 564da310e2...8d9f82ed9b
71
src/main.ts
71
src/main.ts
@@ -841,42 +841,45 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
clearTrigger("applyBatchAuto");
|
clearTrigger("applyBatchAuto");
|
||||||
const ret = await runWithLock("procFiles", false, async () => {
|
const ret = await runWithLock("procFiles", true, async () => {
|
||||||
const procs = [...this.watchedFileEventQueue];
|
do {
|
||||||
this.watchedFileEventQueue = [];
|
const procs = [...this.watchedFileEventQueue];
|
||||||
for (const queue of procs) {
|
this.watchedFileEventQueue = [];
|
||||||
const file = queue.args.file;
|
for (const queue of procs) {
|
||||||
const key = `file-last-proc-${queue.type}-${file.path}`;
|
const file = queue.args.file;
|
||||||
const last = Number(await this.localDatabase.kvDB.get(key) || 0);
|
const key = `file-last-proc-${queue.type}-${file.path}`;
|
||||||
if (file instanceof TFile && file.stat.mtime == last) {
|
const last = Number(await this.localDatabase.kvDB.get(key) || 0);
|
||||||
Logger(`File has been already scanned on ${queue.type}, skip: ${file.path}`, LOG_LEVEL.VERBOSE);
|
if (file instanceof TFile && file.stat.mtime == last) {
|
||||||
continue;
|
Logger(`File has been already scanned on ${queue.type}, skip: ${file.path}`, LOG_LEVEL.VERBOSE);
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const cache = queue.args.cache;
|
const cache = queue.args.cache;
|
||||||
if ((queue.type == "CREATE" || queue.type == "CHANGED") && file instanceof TFile) {
|
if ((queue.type == "CREATE" || queue.type == "CHANGED") && file instanceof TFile) {
|
||||||
await this.updateIntoDB(file, false, cache);
|
await this.updateIntoDB(file, false, cache);
|
||||||
}
|
}
|
||||||
if (queue.type == "DELETE") {
|
if (queue.type == "DELETE") {
|
||||||
|
if (file instanceof TFile) {
|
||||||
|
await this.deleteFromDB(file);
|
||||||
|
} else if (file instanceof TFolder) {
|
||||||
|
await this.deleteFolderOnDB(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (queue.type == "RENAME") {
|
||||||
|
if (file instanceof TFile) {
|
||||||
|
await this.watchVaultRenameAsync(file, queue.args.oldPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (queue.type == "INTERNAL") {
|
||||||
|
await this.watchVaultRawEventsAsync(file.path);
|
||||||
|
}
|
||||||
if (file instanceof TFile) {
|
if (file instanceof TFile) {
|
||||||
await this.deleteFromDB(file);
|
await this.localDatabase.kvDB.set(key, file.stat.mtime);
|
||||||
} else if (file instanceof TFolder) {
|
|
||||||
await this.deleteFolderOnDB(file);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (queue.type == "RENAME") {
|
this.refreshStatusText();
|
||||||
if (file instanceof TFile) {
|
} while (this.watchedFileEventQueue.length != 0);
|
||||||
await this.watchVaultRenameAsync(file, queue.args.oldPath);
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
if (queue.type == "INTERNAL") {
|
|
||||||
await this.watchVaultRawEventsAsync(file.path);
|
|
||||||
}
|
|
||||||
if (file instanceof TFile) {
|
|
||||||
await this.localDatabase.kvDB.set(key, file.stat.mtime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.refreshStatusText();
|
|
||||||
})
|
})
|
||||||
this.refreshStatusText();
|
this.refreshStatusText();
|
||||||
return ret;
|
return ret;
|
||||||
@@ -917,7 +920,9 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async applyBatchChange() {
|
async applyBatchChange() {
|
||||||
return await this.procFileEvent(true);
|
if (this.settings.batchSave) {
|
||||||
|
return await this.procFileEvent(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watch raw events (Internal API)
|
// Watch raw events (Internal API)
|
||||||
|
|||||||
@@ -3,8 +3,13 @@
|
|||||||
- If you want it to back to its previous behaviour, please disable `Monitor changes to internal files`.
|
- If you want it to back to its previous behaviour, please disable `Monitor changes to internal files`.
|
||||||
- Due to using an internal API, this feature may become unusable with a major update. If this happens, please disable this once.
|
- Due to using an internal API, this feature may become unusable with a major update. If this happens, please disable this once.
|
||||||
|
|
||||||
|
#### Minors
|
||||||
|
|
||||||
|
- 0.16.1 Added missing log updates.
|
||||||
|
- 0.16.2 Fixed many problems caused by combinations of `Sync On Save` and the tracking logic that changed at 0.15.6.
|
||||||
|
|
||||||
### 0.15.0
|
### 0.15.0
|
||||||
- Outdated configuration items have been removed.
|
- Outdated configuration items have been removed.
|
||||||
- Setup wizard has been implemented!
|
- Setup wizard has been implemented!
|
||||||
|
|
||||||
I appreciate for reviewing and giving me advice @Pouhon158!
|
I appreciate for reviewing and giving me advice @Pouhon158!
|
||||||
|
|||||||
Reference in New Issue
Block a user