diff --git a/manifest.json b/manifest.json index ce42a6d..89986a0 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-livesync", "name": "Self-hosted LiveSync", - "version": "0.11.1", + "version": "0.11.2", "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.", "author": "vorotamoroz", diff --git a/package-lock.json b/package-lock.json index 8998f1e..51a8ca7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsidian-livesync", - "version": "0.11.1", + "version": "0.11.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "obsidian-livesync", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "diff-match-patch": "^1.0.5", diff --git a/package.json b/package.json index 35dcc09..77f97c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-livesync", - "version": "0.11.1", + "version": "0.11.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.", "main": "main.js", "type": "module", diff --git a/src/LocalPouchDB.ts b/src/LocalPouchDB.ts index c12a098..0473fb5 100644 --- a/src/LocalPouchDB.ts +++ b/src/LocalPouchDB.ts @@ -315,7 +315,7 @@ export class LocalPouchDB { this.hashCaches.set(id, w.data); return w.data; } - throw new Error(`Corrupted chunk detected.`); + throw new Error(`Corrupted chunk detected: ${id}`); } catch (ex) { if (ex.status && ex.status == 404) { if (waitForReady) { @@ -326,7 +326,7 @@ export class LocalPouchDB { } return this.getDBLeaf(id, false); } else { - throw new Error("Chunk was not found"); + throw new Error(`Chunk was not found: ${id}`); } } else { Logger(`Something went wrong on retriving chunk`); @@ -437,7 +437,7 @@ export class LocalPouchDB { Logger(childrens); } } catch (ex) { - Logger(`Something went wrong on reading chunks of ${obj._id} from database:`, LOG_LEVEL.NOTICE); + Logger(`Something went wrong on reading chunks of ${obj._id} from database, see verbose info for detail.`, LOG_LEVEL.NOTICE); Logger(ex, LOG_LEVEL.VERBOSE); this.corruptedEntries[obj._id] = obj; return false; diff --git a/src/PluginPane.svelte b/src/PluginPane.svelte index 48b5ac1..01f90cb 100644 --- a/src/PluginPane.svelte +++ b/src/PluginPane.svelte @@ -16,7 +16,7 @@ export let plugin: ObsidianLiveSyncPlugin; let plugins: PluginDataEntry[] = []; let deviceAndPlugins: { [key: string]: PluginDataEntryDisp[] } = {}; - let devicePluginList: [string, PluginDataEntryDisp[]][] = []; + let devicePluginList: [string, PluginDataEntryDisp[]][] = null; let ownPlugins: DevicePluginList = null; let showOwnPlugins = false; let targetList: { [key: string]: boolean } = {}; @@ -205,58 +205,63 @@ Info Target - {#if devicePluginList.length == 0} + {#if !devicePluginList} Retrieving... - {/if} - {#each devicePluginList as [deviceName, devicePlugins]} + {:else if devicePluginList.length == 0} - {deviceName} - - - + No plugins found. - {#each devicePlugins as plugin} + {:else} + {#each devicePluginList as [deviceName, devicePlugins]} - {plugin.manifest.name} - {plugin.versionInfo}{getDispString(plugin.versionFlag)} - - {#if plugin.versionFlag === "EVEN" || plugin.versionFlag === ""} - - - {:else} -
-
toggleTarget(plugin.deviceVaultName + "---" + plugin.manifest.id + "---plugin")} - /> -
- {/if} - - - - Settings - {plugin.mtimeInfo}{getDispString(plugin.mtimeFlag)} - - {#if plugin.mtimeFlag === "EVEN" || plugin.mtimeFlag === ""} - - - {:else} -
-
toggleTarget(plugin.deviceVaultName + "---" + plugin.manifest.id + "---setting")} - /> -
- {/if} - - - - + {deviceName} + + + + {#each devicePlugins as plugin} + + {plugin.manifest.name} + {plugin.versionInfo}{getDispString(plugin.versionFlag)} + + {#if plugin.versionFlag === "EVEN" || plugin.versionFlag === ""} + - + {:else} +
+
toggleTarget(plugin.deviceVaultName + "---" + plugin.manifest.id + "---plugin")} + /> +
+ {/if} + + + + Settings + {plugin.mtimeInfo}{getDispString(plugin.mtimeFlag)} + + {#if plugin.mtimeFlag === "EVEN" || plugin.mtimeFlag === ""} + - + {:else} +
+
toggleTarget(plugin.deviceVaultName + "---" + plugin.manifest.id + "---setting")} + /> +
+ {/if} + + + + + + {/each} {/each} - {/each} + {/if}
diff --git a/src/lib b/src/lib index ae98905..6451afd 160000 --- a/src/lib +++ b/src/lib @@ -1 +1 @@ -Subproject commit ae989051b5fd55db3e9a6b9facf45ee72c0d48c0 +Subproject commit 6451afd112fc74874aae3958e8e18210f411cf3a diff --git a/src/main.ts b/src/main.ts index 3c1a4d9..1418a6b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -968,8 +968,10 @@ export default class ObsidianLiveSyncPlugin extends Plugin { const now = new Date().getTime(); if (queue.missingChildren.length == 0) { queue.done = true; - Logger(`Applying ${queue.entry._id} (${queue.entry._rev}) change...`); - await this.handleDBChanged(queue.entry); + if (isValidPath(id2path(queue.entry._id))) { + Logger(`Applying ${queue.entry._id} (${queue.entry._rev}) change...`); + await this.handleDBChanged(queue.entry); + } } if (now > queue.timeout) { if (!queue.warned) Logger(`Timed out: ${queue.entry._id} could not collect ${queue.missingChildren.length} chunks. plugin keeps watching, but you have to check the file after the replication.`, LOG_LEVEL.NOTICE); @@ -1733,7 +1735,8 @@ export default class ObsidianLiveSyncPlugin extends Plugin { async sweepPlugin(showMessage = false) { if (!this.settings.usePluginSync) return; - await runWithLock("sweepplugin", false, async () => { + if (!this.localDatabase.isReady) return; + await runWithLock("sweepplugin", true, async () => { const logLevel = showMessage ? LOG_LEVEL.NOTICE : LOG_LEVEL.INFO; if (!this.settings.encrypt) { Logger("You have to encrypt the database to use plugin setting sync.", LOG_LEVEL.NOTICE);