diff --git a/manifest.json b/manifest.json index 9f9365d..c0b1568 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-livesync", "name": "Self-hosted LiveSync", - "version": "0.25.43-patched-8", + "version": "0.25.43-patched-9", "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 9137591..960247b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsidian-livesync", - "version": "0.25.43-patched-8", + "version": "0.25.43-patched-9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "obsidian-livesync", - "version": "0.25.43-patched-8", + "version": "0.25.43-patched-9", "license": "MIT", "dependencies": { "@aws-sdk/client-s3": "^3.808.0", diff --git a/package.json b/package.json index d3858a3..d1ede6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-livesync", - "version": "0.25.43-patched-8", + "version": "0.25.43-patched-9", "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/lib b/src/lib index d402f2d..d038ee5 160000 --- a/src/lib +++ b/src/lib @@ -1 +1 @@ -Subproject commit d402f2d7f3d5677bee4ca11846b0c4f2259840f1 +Subproject commit d038ee5149ccd853210ad755e6951139105e9de6 diff --git a/src/modules/core/ModuleTargetFilter.ts b/src/modules/core/ModuleTargetFilter.ts index 6c5af7e..f4db428 100644 --- a/src/modules/core/ModuleTargetFilter.ts +++ b/src/modules/core/ModuleTargetFilter.ts @@ -47,7 +47,7 @@ export class ModuleTargetFilter extends AbstractModule { totalFileEventCount = 0; - private async _isTargetFileByFileNameDuplication(file: string | UXFileInfoStub) { + private async _isTargetAcceptedByFileNameDuplication(file: string | UXFileInfoStub) { await this.fileCountMap.updateValue(this.totalFileEventCount); const fileCountMap = this.fileCountMap.value; if (!fileCountMap) { @@ -107,7 +107,7 @@ export class ModuleTargetFilter extends AbstractModule { } } - private async _isTargetFileByLocalDB(file: string | UXFileInfoStub) { + private async _isTargetAcceptedByLocalDB(file: string | UXFileInfoStub) { const filepath = getStoragePathFromUXFileInfo(file); if (!this.localDatabase?.isTargetFile(filepath)) { this._log("File is not target by local DB: " + filepath); @@ -117,12 +117,12 @@ export class ModuleTargetFilter extends AbstractModule { return await Promise.resolve(true); } - private async _isTargetFileFinal(file: string | UXFileInfoStub) { + private async _isTargetAcceptedFinally(file: string | UXFileInfoStub) { this._log("File is target finally: " + getStoragePathFromUXFileInfo(file), LOG_LEVEL_DEBUG); return await Promise.resolve(true); } - private async _isTargetIgnoredByIgnoreFiles(file: string | UXFileInfoStub): Promise { + private async _isTargetAcceptedByIgnoreFiles(file: string | UXFileInfoStub): Promise { if (!this.settings.useIgnoreFiles) { return true; } @@ -137,14 +137,19 @@ export class ModuleTargetFilter extends AbstractModule { return true; } + private async _isTargetIgnoredByIgnoreFiles(file: string | UXFileInfoStub) { + const result = await this._isTargetAcceptedByIgnoreFiles(file); + return !result; + } + override onBindFunction(core: LiveSyncCore, services: typeof core.services): void { services.vault.markFileListPossiblyChanged.setHandler(this._markFileListPossiblyChanged.bind(this)); services.appLifecycle.onLoaded.addHandler(this._everyOnload.bind(this)); services.vault.isIgnoredByIgnoreFile.setHandler(this._isTargetIgnoredByIgnoreFiles.bind(this)); - services.vault.isTargetFile.addHandler(this._isTargetFileByFileNameDuplication.bind(this), 10); - services.vault.isTargetFile.addHandler(this._isTargetIgnoredByIgnoreFiles.bind(this), 20); - services.vault.isTargetFile.addHandler(this._isTargetFileByLocalDB.bind(this), 30); - services.vault.isTargetFile.addHandler(this._isTargetFileFinal.bind(this), 100); + services.vault.isTargetFile.addHandler(this._isTargetAcceptedByFileNameDuplication.bind(this), 10); + services.vault.isTargetFile.addHandler(this._isTargetAcceptedByIgnoreFiles.bind(this), 20); + services.vault.isTargetFile.addHandler(this._isTargetAcceptedByLocalDB.bind(this), 30); + services.vault.isTargetFile.addHandler(this._isTargetAcceptedFinally.bind(this), 100); services.setting.onSettingRealised.addHandler(this.refreshSettings.bind(this)); } } diff --git a/updates.md b/updates.md index abb2044..74067ee 100644 --- a/updates.md +++ b/updates.md @@ -3,6 +3,33 @@ Since 19th July, 2025 (beta1 in 0.25.0-beta1, 13th July, 2025) The head note of 0.25 is now in [updates_old.md](https://github.com/vrtmrz/obsidian-livesync/blob/main/updates_old.md). Because 0.25 got a lot of updates, thankfully, compatibility is kept and we do not need breaking changes! In other words, when get enough stabled. The next version will be v1.0.0. Even though it my hope. +## 0.25.43-patched-9 a.ka. 0.25.44-rc1 + +We are finally ready for release. I think I will go ahead and release it after using it for a few days. + +### Fixed + +- Hidden file synchronisation now works! +- Now Hidden file synchronisation respects `.ignore` files. +- Replicator initialisation during rebuilding now works correctly. + +### Refactored + +- Some methods naming have been changed for better clarity, i.e., `_isTargetFileByLocalDB` is now `_isTargetAcceptedByLocalDB`. + +### Follow-up tasks memo (After 0.25.44) + +Going forward, functionality that does not span multiple events is expected to be implemented as middleware-style functions rather than modules based on classes. + +Consequently, the existing modules will likely be gradually dismantled. +For reference, `ModuleReplicator.ts` has extracted several functionalities as functions. + +However, this does not negate object-oriented design. Where lifecycles and state are present, and the Liskov Substitution Principle can be upheld, we design using classes. After all, a visible state is preferable to a hidden state. In other words, the handler still accepts both functions and member methods, so formally there is no change. + +As undertaking this for everything would be a bit longer task, I intend to release it at this stage. + +Note: I left using `setHandler`s that as a mark of `need to be refactored`. Basically, they should be implemented in the service itself. That because it is just only a mis-designed separated implementation. + ## 0.25.43-patched-8 I really must thank you all. You know that it seems we have just a little more to do.