From 5afe24c4604c9be9cc472f9e38f424d4a5d2b32e Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Fri, 25 Oct 2024 12:39:32 +0100 Subject: [PATCH] 0.24.0.dev-rc8 --- manifest-beta.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- .../HiddenFileSync/CmdHiddenFileSync.ts | 19 +++++++++---------- updates.md | 6 ++++++ 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/manifest-beta.json b/manifest-beta.json index 1cd4cc45..99ddb1b8 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "obsidian-livesync", "name": "Self-hosted LiveSync", - "version": "0.24.0.dev-rc7", + "version": "0.24.0.dev-rc8", "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 7d1ed69c..7eaa7992 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsidian-livesync", - "version": "0.24.0.dev-rc7", + "version": "0.24.0.dev-rc8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "obsidian-livesync", - "version": "0.24.0.dev-rc7", + "version": "0.24.0.dev-rc8", "license": "MIT", "dependencies": { "@aws-sdk/client-s3": "^3.645.0", diff --git a/package.json b/package.json index dfc3abca..2d66f3b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-livesync", - "version": "0.24.0.dev-rc7", + "version": "0.24.0.dev-rc8", "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/features/HiddenFileSync/CmdHiddenFileSync.ts b/src/features/HiddenFileSync/CmdHiddenFileSync.ts index 6e24a435..d57699a9 100644 --- a/src/features/HiddenFileSync/CmdHiddenFileSync.ts +++ b/src/features/HiddenFileSync/CmdHiddenFileSync.ts @@ -407,7 +407,8 @@ export class HiddenFileSync extends LiveSyncCommands implements IObsidianModule fileOnStorage: xFileOnStorage, fileOnDatabase: xFileOnDatabase } = params[0]; - if (xFileOnStorage && xFileOnDatabase) { + const xFileOnDatabaseExists = xFileOnDatabase !== undefined && !(xFileOnDatabase.deleted || xFileOnDatabase._deleted); + if (xFileOnStorage && xFileOnDatabaseExists) { // Both => Synchronize if ((direction != "pullForce" && direction != "pushForce") && isMarkedAsSameChanges(filename, [xFileOnDatabase.mtime, xFileOnStorage.mtime]) == EVEN) { this._log(`Hidden file skipped: ${filename} is marked as same`, LOG_LEVEL_VERBOSE); @@ -426,7 +427,7 @@ export class HiddenFileSync extends LiveSyncCommands implements IObsidianModule } else { // Even, or not forced. skip. } - } else if (!xFileOnStorage && xFileOnDatabase) { + } else if (!xFileOnStorage && xFileOnDatabaseExists) { if (direction == "push" || direction == "pushForce") { if (xFileOnDatabase.deleted) return; @@ -442,13 +443,14 @@ export class HiddenFileSync extends LiveSyncCommands implements IObsidianModule countUpdatedFolder(filename); } } - } else if (xFileOnStorage && !xFileOnDatabase) { + } else if (xFileOnStorage && !xFileOnDatabaseExists) { if (direction == "push" || direction == "pushForce" || direction == "safe") { await this.storeInternalFileToDatabase(xFileOnStorage); } else { - // if (await this.extractInternalFileFromDatabase(xFileOnStorage.path)) { - // countUpdatedFolder(xFileOnStorage.path); - // } + // Apply the deletion + if (await this.extractInternalFileFromDatabase(xFileOnStorage.path)) { + countUpdatedFolder(xFileOnStorage.path); + } } } else { throw new Error("Invalid state on hidden file sync"); @@ -676,8 +678,6 @@ export class HiddenFileSync extends LiveSyncCommands implements IObsidianModule this._log(`STORAGE