0.24.0.dev-rc8

This commit is contained in:
vorotamoroz
2024-10-25 12:39:32 +01:00
parent a9020a3aea
commit 5afe24c460
5 changed files with 19 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
{ {
"id": "obsidian-livesync", "id": "obsidian-livesync",
"name": "Self-hosted LiveSync", "name": "Self-hosted LiveSync",
"version": "0.24.0.dev-rc7", "version": "0.24.0.dev-rc8",
"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
View File

@@ -1,12 +1,12 @@
{ {
"name": "obsidian-livesync", "name": "obsidian-livesync",
"version": "0.24.0.dev-rc7", "version": "0.24.0.dev-rc8",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "obsidian-livesync", "name": "obsidian-livesync",
"version": "0.24.0.dev-rc7", "version": "0.24.0.dev-rc8",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "^3.645.0", "@aws-sdk/client-s3": "^3.645.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "obsidian-livesync", "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.", "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",

View File

@@ -407,7 +407,8 @@ export class HiddenFileSync extends LiveSyncCommands implements IObsidianModule
fileOnStorage: xFileOnStorage, fileOnStorage: xFileOnStorage,
fileOnDatabase: xFileOnDatabase fileOnDatabase: xFileOnDatabase
} = params[0]; } = params[0];
if (xFileOnStorage && xFileOnDatabase) { const xFileOnDatabaseExists = xFileOnDatabase !== undefined && !(xFileOnDatabase.deleted || xFileOnDatabase._deleted);
if (xFileOnStorage && xFileOnDatabaseExists) {
// Both => Synchronize // Both => Synchronize
if ((direction != "pullForce" && direction != "pushForce") && isMarkedAsSameChanges(filename, [xFileOnDatabase.mtime, xFileOnStorage.mtime]) == EVEN) { 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); 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 { } else {
// Even, or not forced. skip. // Even, or not forced. skip.
} }
} else if (!xFileOnStorage && xFileOnDatabase) { } else if (!xFileOnStorage && xFileOnDatabaseExists) {
if (direction == "push" || direction == "pushForce") { if (direction == "push" || direction == "pushForce") {
if (xFileOnDatabase.deleted) if (xFileOnDatabase.deleted)
return; return;
@@ -442,13 +443,14 @@ export class HiddenFileSync extends LiveSyncCommands implements IObsidianModule
countUpdatedFolder(filename); countUpdatedFolder(filename);
} }
} }
} else if (xFileOnStorage && !xFileOnDatabase) { } else if (xFileOnStorage && !xFileOnDatabaseExists) {
if (direction == "push" || direction == "pushForce" || direction == "safe") { if (direction == "push" || direction == "pushForce" || direction == "safe") {
await this.storeInternalFileToDatabase(xFileOnStorage); await this.storeInternalFileToDatabase(xFileOnStorage);
} else { } else {
// if (await this.extractInternalFileFromDatabase(xFileOnStorage.path)) { // Apply the deletion
// countUpdatedFolder(xFileOnStorage.path); if (await this.extractInternalFileFromDatabase(xFileOnStorage.path)) {
// } countUpdatedFolder(xFileOnStorage.path);
}
} }
} else { } else {
throw new Error("Invalid state on hidden file sync"); throw new Error("Invalid state on hidden file sync");
@@ -676,8 +678,6 @@ export class HiddenFileSync extends LiveSyncCommands implements IObsidianModule
this._log(`STORAGE <x- DB: ${displayFileName}: deleted (hidden).`); this._log(`STORAGE <x- DB: ${displayFileName}: deleted (hidden).`);
await this.plugin.storageAccess.removeHidden(storageFilePath); await this.plugin.storageAccess.removeHidden(storageFilePath);
try { try {
// -- @ts-ignore internalAPI
// await this.app.vault.adapter.reconcileInternalFile(filename);
await this.plugin.storageAccess.triggerHiddenFile(storageFilePath); await this.plugin.storageAccess.triggerHiddenFile(storageFilePath);
} catch (ex) { } catch (ex) {
this._log("Failed to call internal API(reconcileInternalFile)", LOG_LEVEL_VERBOSE); this._log("Failed to call internal API(reconcileInternalFile)", LOG_LEVEL_VERBOSE);
@@ -690,8 +690,7 @@ export class HiddenFileSync extends LiveSyncCommands implements IObsidianModule
await this.plugin.storageAccess.ensureDir(storageFilePath); await this.plugin.storageAccess.ensureDir(storageFilePath);
await this.plugin.storageAccess.writeHiddenFileAuto(storageFilePath, readContent(fileOnDB), { mtime: fileOnDB.mtime, ctime: fileOnDB.ctime }); await this.plugin.storageAccess.writeHiddenFileAuto(storageFilePath, readContent(fileOnDB), { mtime: fileOnDB.mtime, ctime: fileOnDB.ctime });
try { try {
//@ts-ignore internalAPI await this.plugin.storageAccess.triggerHiddenFile(storageFilePath);
await this.app.vault.adapter.reconcileInternalFile(filename);
} catch (ex) { } catch (ex) {
this._log("Failed to call internal API(reconcileInternalFile)", LOG_LEVEL_VERBOSE); this._log("Failed to call internal API(reconcileInternalFile)", LOG_LEVEL_VERBOSE);
this._log(ex, LOG_LEVEL_VERBOSE); this._log(ex, LOG_LEVEL_VERBOSE);

View File

@@ -23,6 +23,12 @@ Thank you, and I hope your troubles will be resolved!
--- ---
## 0.24.0.dev-rc8
### Fixed
- Now the deletion of hidden files are correctly synchronised.
## 0.24.0.dev-rc7 ## 0.24.0.dev-rc7
### Fixed ### Fixed