mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2025-12-22 14:11:28 +00:00
Fixed:
- Rewritten lock acquiring logic. - Fixed plugin dialog's message. - Fixed some error messages. - Fixed action on replicating non-note entries.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "obsidian-livesync",
|
"id": "obsidian-livesync",
|
||||||
"name": "Self-hosted LiveSync",
|
"name": "Self-hosted LiveSync",
|
||||||
"version": "0.11.1",
|
"version": "0.11.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.11.1",
|
"version": "0.11.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.11.1",
|
"version": "0.11.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.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.",
|
"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",
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ export class LocalPouchDB {
|
|||||||
this.hashCaches.set(id, w.data);
|
this.hashCaches.set(id, w.data);
|
||||||
return w.data;
|
return w.data;
|
||||||
}
|
}
|
||||||
throw new Error(`Corrupted chunk detected.`);
|
throw new Error(`Corrupted chunk detected: ${id}`);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (ex.status && ex.status == 404) {
|
if (ex.status && ex.status == 404) {
|
||||||
if (waitForReady) {
|
if (waitForReady) {
|
||||||
@@ -326,7 +326,7 @@ export class LocalPouchDB {
|
|||||||
}
|
}
|
||||||
return this.getDBLeaf(id, false);
|
return this.getDBLeaf(id, false);
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Chunk was not found");
|
throw new Error(`Chunk was not found: ${id}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logger(`Something went wrong on retriving chunk`);
|
Logger(`Something went wrong on retriving chunk`);
|
||||||
@@ -437,7 +437,7 @@ export class LocalPouchDB {
|
|||||||
Logger(childrens);
|
Logger(childrens);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} 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);
|
Logger(ex, LOG_LEVEL.VERBOSE);
|
||||||
this.corruptedEntries[obj._id] = obj;
|
this.corruptedEntries[obj._id] = obj;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
export let plugin: ObsidianLiveSyncPlugin;
|
export let plugin: ObsidianLiveSyncPlugin;
|
||||||
let plugins: PluginDataEntry[] = [];
|
let plugins: PluginDataEntry[] = [];
|
||||||
let deviceAndPlugins: { [key: string]: PluginDataEntryDisp[] } = {};
|
let deviceAndPlugins: { [key: string]: PluginDataEntryDisp[] } = {};
|
||||||
let devicePluginList: [string, PluginDataEntryDisp[]][] = [];
|
let devicePluginList: [string, PluginDataEntryDisp[]][] = null;
|
||||||
let ownPlugins: DevicePluginList = null;
|
let ownPlugins: DevicePluginList = null;
|
||||||
let showOwnPlugins = false;
|
let showOwnPlugins = false;
|
||||||
let targetList: { [key: string]: boolean } = {};
|
let targetList: { [key: string]: boolean } = {};
|
||||||
@@ -205,58 +205,63 @@
|
|||||||
<th class="sls-plugins-tbl-device-head">Info</th>
|
<th class="sls-plugins-tbl-device-head">Info</th>
|
||||||
<th class="sls-plugins-tbl-device-head">Target</th>
|
<th class="sls-plugins-tbl-device-head">Target</th>
|
||||||
</tr>
|
</tr>
|
||||||
{#if devicePluginList.length == 0}
|
{#if !devicePluginList}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" class="sls-table-tail tcenter"> Retrieving... </td>
|
<td colspan="3" class="sls-table-tail tcenter"> Retrieving... </td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{:else if devicePluginList.length == 0}
|
||||||
{#each devicePluginList as [deviceName, devicePlugins]}
|
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2" class="sls-plugins-tbl-device-head">{deviceName}</th>
|
<td colspan="3" class="sls-table-tail tcenter"> No plugins found. </td>
|
||||||
<th class="sls-plugins-tbl-device-head">
|
|
||||||
<button class="mod-cta" on:click={() => toggleAll(deviceName)}>✔</button>
|
|
||||||
</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
{#each devicePlugins as plugin}
|
{:else}
|
||||||
|
{#each devicePluginList as [deviceName, devicePlugins]}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="sls-table-head">{plugin.manifest.name}</td>
|
<th colspan="2" class="sls-plugins-tbl-device-head">{deviceName}</th>
|
||||||
<td class="sls-table-tail tcenter">{plugin.versionInfo}{getDispString(plugin.versionFlag)}</td>
|
<th class="sls-plugins-tbl-device-head">
|
||||||
<td class="sls-table-tail tcenter">
|
<button class="mod-cta" on:click={() => toggleAll(deviceName)}>✔</button>
|
||||||
{#if plugin.versionFlag === "EVEN" || plugin.versionFlag === ""}
|
</th>
|
||||||
-
|
|
||||||
{:else}
|
|
||||||
<div class="wrapToggle">
|
|
||||||
<div
|
|
||||||
class="checkbox-container"
|
|
||||||
class:is-enabled={targetList[plugin.deviceVaultName + "---" + plugin.manifest.id + "---plugin"]}
|
|
||||||
on:click={() => toggleTarget(plugin.deviceVaultName + "---" + plugin.manifest.id + "---plugin")}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="sls-table-head">Settings</td>
|
|
||||||
<td class="sls-table-tail tcenter">{plugin.mtimeInfo}{getDispString(plugin.mtimeFlag)}</td>
|
|
||||||
<td class="sls-table-tail tcenter">
|
|
||||||
{#if plugin.mtimeFlag === "EVEN" || plugin.mtimeFlag === ""}
|
|
||||||
-
|
|
||||||
{:else}
|
|
||||||
<div class="wrapToggle">
|
|
||||||
<div
|
|
||||||
class="checkbox-container"
|
|
||||||
class:is-enabled={targetList[plugin.deviceVaultName + "---" + plugin.manifest.id + "---setting"]}
|
|
||||||
on:click={() => toggleTarget(plugin.deviceVaultName + "---" + plugin.manifest.id + "---setting")}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="divider">
|
|
||||||
<th colspan="3" />
|
|
||||||
</tr>
|
</tr>
|
||||||
|
{#each devicePlugins as plugin}
|
||||||
|
<tr>
|
||||||
|
<td class="sls-table-head">{plugin.manifest.name}</td>
|
||||||
|
<td class="sls-table-tail tcenter">{plugin.versionInfo}{getDispString(plugin.versionFlag)}</td>
|
||||||
|
<td class="sls-table-tail tcenter">
|
||||||
|
{#if plugin.versionFlag === "EVEN" || plugin.versionFlag === ""}
|
||||||
|
-
|
||||||
|
{:else}
|
||||||
|
<div class="wrapToggle">
|
||||||
|
<div
|
||||||
|
class="checkbox-container"
|
||||||
|
class:is-enabled={targetList[plugin.deviceVaultName + "---" + plugin.manifest.id + "---plugin"]}
|
||||||
|
on:click={() => toggleTarget(plugin.deviceVaultName + "---" + plugin.manifest.id + "---plugin")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="sls-table-head">Settings</td>
|
||||||
|
<td class="sls-table-tail tcenter">{plugin.mtimeInfo}{getDispString(plugin.mtimeFlag)}</td>
|
||||||
|
<td class="sls-table-tail tcenter">
|
||||||
|
{#if plugin.mtimeFlag === "EVEN" || plugin.mtimeFlag === ""}
|
||||||
|
-
|
||||||
|
{:else}
|
||||||
|
<div class="wrapToggle">
|
||||||
|
<div
|
||||||
|
class="checkbox-container"
|
||||||
|
class:is-enabled={targetList[plugin.deviceVaultName + "---" + plugin.manifest.id + "---setting"]}
|
||||||
|
on:click={() => toggleTarget(plugin.deviceVaultName + "---" + plugin.manifest.id + "---setting")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="divider">
|
||||||
|
<th colspan="3" />
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
{/each}
|
{/each}
|
||||||
{/each}
|
{/if}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="ols-plugins-div-buttons">
|
<div class="ols-plugins-div-buttons">
|
||||||
|
|||||||
2
src/lib
2
src/lib
Submodule src/lib updated: ae989051b5...6451afd112
@@ -968,8 +968,10 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
const now = new Date().getTime();
|
const now = new Date().getTime();
|
||||||
if (queue.missingChildren.length == 0) {
|
if (queue.missingChildren.length == 0) {
|
||||||
queue.done = true;
|
queue.done = true;
|
||||||
Logger(`Applying ${queue.entry._id} (${queue.entry._rev}) change...`);
|
if (isValidPath(id2path(queue.entry._id))) {
|
||||||
await this.handleDBChanged(queue.entry);
|
Logger(`Applying ${queue.entry._id} (${queue.entry._rev}) change...`);
|
||||||
|
await this.handleDBChanged(queue.entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (now > queue.timeout) {
|
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);
|
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) {
|
async sweepPlugin(showMessage = false) {
|
||||||
if (!this.settings.usePluginSync) return;
|
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;
|
const logLevel = showMessage ? LOG_LEVEL.NOTICE : LOG_LEVEL.INFO;
|
||||||
if (!this.settings.encrypt) {
|
if (!this.settings.encrypt) {
|
||||||
Logger("You have to encrypt the database to use plugin setting sync.", LOG_LEVEL.NOTICE);
|
Logger("You have to encrypt the database to use plugin setting sync.", LOG_LEVEL.NOTICE);
|
||||||
|
|||||||
Reference in New Issue
Block a user