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",
"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",

4
package-lock.json generated
View File

@@ -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",

View File

@@ -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",

View File

@@ -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 <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);
@@ -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);

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
### Fixed