mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-05-16 20:41:18 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e657b38a9 | ||
|
|
21861d8c51 | ||
|
|
3bb4aba395 |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "obsidian-livesync",
|
"id": "obsidian-livesync",
|
||||||
"name": "Self-hosted LiveSync",
|
"name": "Self-hosted LiveSync",
|
||||||
"version": "0.24.3",
|
"version": "0.24.4",
|
||||||
"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",
|
||||||
|
|||||||
30
package-lock.json
generated
30
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.24.3",
|
"version": "0.24.4",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.24.3",
|
"version": "0.24.4",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.645.0",
|
"@aws-sdk/client-s3": "^3.645.0",
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"fflate": "^0.8.2",
|
"fflate": "^0.8.2",
|
||||||
"idb": "^8.0.0",
|
"idb": "^8.0.0",
|
||||||
"minimatch": "^10.0.1",
|
"minimatch": "^10.0.1",
|
||||||
"octagonal-wheels": "^0.1.15",
|
"octagonal-wheels": "^0.1.19",
|
||||||
"svelte-check": "^4.0.4",
|
"svelte-check": "^4.0.4",
|
||||||
"xxhash-wasm": "0.4.2",
|
"xxhash-wasm": "0.4.2",
|
||||||
"xxhash-wasm-102": "npm:xxhash-wasm@^1.0.2"
|
"xxhash-wasm-102": "npm:xxhash-wasm@^1.0.2"
|
||||||
@@ -4944,9 +4944,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/nanoid": {
|
"node_modules/nanoid": {
|
||||||
"version": "3.3.7",
|
"version": "3.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
|
||||||
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
|
"integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -5105,9 +5105,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/octagonal-wheels": {
|
"node_modules/octagonal-wheels": {
|
||||||
"version": "0.1.15",
|
"version": "0.1.19",
|
||||||
"resolved": "https://registry.npmjs.org/octagonal-wheels/-/octagonal-wheels-0.1.15.tgz",
|
"resolved": "https://registry.npmjs.org/octagonal-wheels/-/octagonal-wheels-0.1.19.tgz",
|
||||||
"integrity": "sha512-rl6y/3/+tqeiDmBmW2RgYQh85D4xVHQIGg14DyC4/sUnO6UDLuVUULIO+00E2jfA/o4coKnPOPEB8Tt6BE9SEA==",
|
"integrity": "sha512-typj8QfDuiiZd4x7OB619XfLP3VYEcwr0hQdS4Tt7nLiebWfw7qsQdBBhLVsSDNd1fEtgOBdE6S02NBcuFl9xw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"idb": "^8.0.0",
|
"idb": "^8.0.0",
|
||||||
"xxhash-wasm": "0.4.2",
|
"xxhash-wasm": "0.4.2",
|
||||||
@@ -10216,9 +10216,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"nanoid": {
|
"nanoid": {
|
||||||
"version": "3.3.7",
|
"version": "3.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
|
||||||
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
|
"integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"natural-compare": {
|
"natural-compare": {
|
||||||
@@ -10316,9 +10316,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"octagonal-wheels": {
|
"octagonal-wheels": {
|
||||||
"version": "0.1.15",
|
"version": "0.1.19",
|
||||||
"resolved": "https://registry.npmjs.org/octagonal-wheels/-/octagonal-wheels-0.1.15.tgz",
|
"resolved": "https://registry.npmjs.org/octagonal-wheels/-/octagonal-wheels-0.1.19.tgz",
|
||||||
"integrity": "sha512-rl6y/3/+tqeiDmBmW2RgYQh85D4xVHQIGg14DyC4/sUnO6UDLuVUULIO+00E2jfA/o4coKnPOPEB8Tt6BE9SEA==",
|
"integrity": "sha512-typj8QfDuiiZd4x7OB619XfLP3VYEcwr0hQdS4Tt7nLiebWfw7qsQdBBhLVsSDNd1fEtgOBdE6S02NBcuFl9xw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"idb": "^8.0.0",
|
"idb": "^8.0.0",
|
||||||
"xxhash-wasm": "0.4.2",
|
"xxhash-wasm": "0.4.2",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.24.3",
|
"version": "0.24.4",
|
||||||
"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",
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
"fflate": "^0.8.2",
|
"fflate": "^0.8.2",
|
||||||
"idb": "^8.0.0",
|
"idb": "^8.0.0",
|
||||||
"minimatch": "^10.0.1",
|
"minimatch": "^10.0.1",
|
||||||
"octagonal-wheels": "^0.1.15",
|
"octagonal-wheels": "^0.1.19",
|
||||||
"svelte-check": "^4.0.4",
|
"svelte-check": "^4.0.4",
|
||||||
"xxhash-wasm": "0.4.2",
|
"xxhash-wasm": "0.4.2",
|
||||||
"xxhash-wasm-102": "npm:xxhash-wasm@^1.0.2"
|
"xxhash-wasm-102": "npm:xxhash-wasm@^1.0.2"
|
||||||
|
|||||||
2
src/lib
2
src/lib
Submodule src/lib updated: 2e156a988b...b299a4255c
@@ -13,15 +13,16 @@ import {
|
|||||||
VER,
|
VER,
|
||||||
type EntryBody,
|
type EntryBody,
|
||||||
type EntryDoc,
|
type EntryDoc,
|
||||||
|
type EntryLeaf,
|
||||||
type LoadedEntry,
|
type LoadedEntry,
|
||||||
type MetaEntry,
|
type MetaEntry,
|
||||||
} from "../../lib/src/common/types";
|
} from "../../lib/src/common/types";
|
||||||
import { QueueProcessor } from "octagonal-wheels/concurrency/processor";
|
import { QueueProcessor } from "octagonal-wheels/concurrency/processor";
|
||||||
import { getPath, isChunk, isValidPath, scheduleTask } from "../../common/utils";
|
import { getPath, isChunk, isValidPath, scheduleTask } from "../../common/utils";
|
||||||
import { sendValue } from "octagonal-wheels/messagepassing/signal";
|
|
||||||
import { isAnyNote } from "../../lib/src/common/utils";
|
import { isAnyNote } from "../../lib/src/common/utils";
|
||||||
import { EVENT_FILE_SAVED, eventHub } from "../../common/events";
|
import { EVENT_FILE_SAVED, eventHub } from "../../common/events";
|
||||||
import type { LiveSyncAbstractReplicator } from "../../lib/src/replication/LiveSyncAbstractReplicator";
|
import type { LiveSyncAbstractReplicator } from "../../lib/src/replication/LiveSyncAbstractReplicator";
|
||||||
|
import { globalSlipBoard } from "../../lib/src/bureau/bureau";
|
||||||
|
|
||||||
export class ModuleReplicator extends AbstractModule implements ICoreModule {
|
export class ModuleReplicator extends AbstractModule implements ICoreModule {
|
||||||
$everyOnloadAfterLoadSettings(): Promise<boolean> {
|
$everyOnloadAfterLoadSettings(): Promise<boolean> {
|
||||||
@@ -242,9 +243,7 @@ Or if you are sure know what had been happened, we can unlock the database from
|
|||||||
const change = docs[0];
|
const change = docs[0];
|
||||||
if (!change) return;
|
if (!change) return;
|
||||||
if (isChunk(change._id)) {
|
if (isChunk(change._id)) {
|
||||||
// SendSignal?
|
globalSlipBoard.submit("read-chunk", change._id, change as EntryLeaf);
|
||||||
// this.parseIncomingChunk(change);
|
|
||||||
sendValue(`leaf-${change._id}`, change);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (await this.core.$anyModuleParsedReplicationResultItem(change)) return;
|
if (await this.core.$anyModuleParsedReplicationResultItem(change)) return;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { unique } from "octagonal-wheels/collection";
|
import { unique } from "octagonal-wheels/collection";
|
||||||
import { QueueProcessor } from "octagonal-wheels/concurrency/processor";
|
|
||||||
import { throttle } from "octagonal-wheels/function";
|
import { throttle } from "octagonal-wheels/function";
|
||||||
import { eventHub } from "../../common/events.ts";
|
import { eventHub } from "../../common/events.ts";
|
||||||
import { BASE_IS_NEW, compareFileFreshness, EVEN, getPath, isValidPath, TARGET_IS_NEW } from "../../common/utils.ts";
|
import { BASE_IS_NEW, compareFileFreshness, EVEN, getPath, isValidPath, TARGET_IS_NEW } from "../../common/utils.ts";
|
||||||
@@ -19,7 +18,7 @@ import { isAnyNote } from "../../lib/src/common/utils.ts";
|
|||||||
import { stripAllPrefixes } from "../../lib/src/string_and_binary/path.ts";
|
import { stripAllPrefixes } from "../../lib/src/string_and_binary/path.ts";
|
||||||
import { AbstractModule } from "../AbstractModule.ts";
|
import { AbstractModule } from "../AbstractModule.ts";
|
||||||
import type { ICoreModule } from "../ModuleTypes.ts";
|
import type { ICoreModule } from "../ModuleTypes.ts";
|
||||||
|
import { withConcurrency } from "octagonal-wheels/iterable/map";
|
||||||
export class ModuleInitializerFile extends AbstractModule implements ICoreModule {
|
export class ModuleInitializerFile extends AbstractModule implements ICoreModule {
|
||||||
async $$performFullScan(showingNotice?: boolean): Promise<void> {
|
async $$performFullScan(showingNotice?: boolean): Promise<void> {
|
||||||
this._log("Opening the key-value database", LOG_LEVEL_VERBOSE);
|
this._log("Opening the key-value database", LOG_LEVEL_VERBOSE);
|
||||||
@@ -152,35 +151,30 @@ export class ModuleInitializerFile extends AbstractModule implements ICoreModule
|
|||||||
if (!this.localDatabase.isReady) throw Error("Database is not ready!");
|
if (!this.localDatabase.isReady) throw Error("Database is not ready!");
|
||||||
let success = 0;
|
let success = 0;
|
||||||
let failed = 0;
|
let failed = 0;
|
||||||
const step = 10;
|
let total = 0;
|
||||||
const processor = new QueueProcessor(
|
for await (const result of withConcurrency(
|
||||||
|
objects,
|
||||||
async (e) => {
|
async (e) => {
|
||||||
try {
|
try {
|
||||||
await callback(e[0]);
|
await callback(e);
|
||||||
success++;
|
return true;
|
||||||
// return
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
this._log(`Error while ${procedureName}`, LOG_LEVEL_NOTICE);
|
this._log(`Error while ${procedureName}`, LOG_LEVEL_NOTICE);
|
||||||
this._log(ex, LOG_LEVEL_VERBOSE);
|
this._log(ex, LOG_LEVEL_VERBOSE);
|
||||||
failed++;
|
return false;
|
||||||
}
|
}
|
||||||
if ((success + failed) % step == 0) {
|
|
||||||
const msg = `${procedureName}: DONE:${success}, FAILED:${failed}, LAST:${processor._queue.length}`;
|
|
||||||
updateLog(procedureName, msg);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
},
|
},
|
||||||
{
|
10
|
||||||
batchSize: 1,
|
)) {
|
||||||
concurrentLimit: 10,
|
if (result) {
|
||||||
delay: 0,
|
success++;
|
||||||
suspended: true,
|
} else {
|
||||||
maintainDelay: false,
|
failed++;
|
||||||
interval: 0,
|
}
|
||||||
},
|
total++;
|
||||||
objects
|
const msg = `${procedureName}: DONE:${success}, FAILED:${failed}, LAST:${objects.length - total}`;
|
||||||
);
|
updateLog(procedureName, msg);
|
||||||
await processor.waitForAllDoneAndTerminate();
|
}
|
||||||
const msg = `${procedureName} All done: DONE:${success}, FAILED:${failed}`;
|
const msg = `${procedureName} All done: DONE:${success}, FAILED:${failed}`;
|
||||||
updateLog(procedureName, msg);
|
updateLog(procedureName, msg);
|
||||||
};
|
};
|
||||||
|
|||||||
13
updates.md
13
updates.md
@@ -14,6 +14,19 @@ Thank you, and I hope your troubles will be resolved!
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 0.24.4
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed so many inefficient and buggy modules inherited from the past.
|
||||||
|
|
||||||
|
### Improved
|
||||||
|
|
||||||
|
- Tasks are now executed in an efficient asynchronous library.
|
||||||
|
- On-demand chunk fetching is now more efficient and keeps the interval between requests.
|
||||||
|
- This will reduce the load on the server and the network.
|
||||||
|
- And, safe for the Cloudant.
|
||||||
|
|
||||||
## 0.24.3
|
## 0.24.3
|
||||||
|
|
||||||
### Improved
|
### Improved
|
||||||
|
|||||||
Reference in New Issue
Block a user