Skip to content

Commit

Permalink
0.24.0.dev-rc8
Browse files Browse the repository at this point in the history
  • Loading branch information
vrtmrz committed Oct 25, 2024
1 parent a9020a3 commit 5afe24c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion manifest-beta.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
19 changes: 9 additions & 10 deletions src/features/HiddenFileSync/CmdHiddenFileSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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");
Expand Down Expand Up @@ -676,8 +678,6 @@ export class HiddenFileSync extends LiveSyncCommands implements IObsidianModule
this._log(`STORAGE <x- DB: ${displayFileName}: deleted (hidden).`);
await this.plugin.storageAccess.removeHidden(storageFilePath);
try {
// -- @ts-ignore internalAPI
// await this.app.vault.adapter.reconcileInternalFile(filename);
await this.plugin.storageAccess.triggerHiddenFile(storageFilePath);
} catch (ex) {
this._log("Failed to call internal API(reconcileInternalFile)", LOG_LEVEL_VERBOSE);
Expand All @@ -690,8 +690,7 @@ export class HiddenFileSync extends LiveSyncCommands implements IObsidianModule
await this.plugin.storageAccess.ensureDir(storageFilePath);
await this.plugin.storageAccess.writeHiddenFileAuto(storageFilePath, readContent(fileOnDB), { mtime: fileOnDB.mtime, ctime: fileOnDB.ctime });
try {
//@ts-ignore internalAPI
await this.app.vault.adapter.reconcileInternalFile(filename);
await this.plugin.storageAccess.triggerHiddenFile(storageFilePath);
} catch (ex) {
this._log("Failed to call internal API(reconcileInternalFile)", LOG_LEVEL_VERBOSE);
this._log(ex, LOG_LEVEL_VERBOSE);
Expand Down
6 changes: 6 additions & 0 deletions updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

### Fixed
Expand Down

0 comments on commit 5afe24c

Please sign in to comment.