mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2025-03-03 15:32:25 +02:00
Fixed
- No longer unchanged hidden files and customisations are saved and transferred now. - File integrity of vault history indicates the integrity correctly. Improved - In the report, the schema of the remote database URI is now printed.
This commit is contained in:
parent
90ff75ab35
commit
e7edf88713
@ -4,7 +4,7 @@ import { Notice, type PluginManifest, parseYaml, normalizePath, type ListedFiles
|
|||||||
import type { EntryDoc, LoadedEntry, InternalFileEntry, FilePathWithPrefix, FilePath, DocumentID, AnyEntry, SavingEntry } from "./lib/src/types";
|
import type { EntryDoc, LoadedEntry, InternalFileEntry, FilePathWithPrefix, FilePath, DocumentID, AnyEntry, SavingEntry } from "./lib/src/types";
|
||||||
import { LOG_LEVEL_INFO, LOG_LEVEL_NOTICE, LOG_LEVEL_VERBOSE, MODE_SELECTIVE } from "./lib/src/types";
|
import { LOG_LEVEL_INFO, LOG_LEVEL_NOTICE, LOG_LEVEL_VERBOSE, MODE_SELECTIVE } from "./lib/src/types";
|
||||||
import { ICXHeader, PERIODIC_PLUGIN_SWEEP, } from "./types";
|
import { ICXHeader, PERIODIC_PLUGIN_SWEEP, } from "./types";
|
||||||
import { createTextBlob, delay, getDocData, sendSignal, waitForSignal } from "./lib/src/utils";
|
import { createTextBlob, delay, getDocData, isDocContentSame, sendSignal, waitForSignal } from "./lib/src/utils";
|
||||||
import { Logger } from "./lib/src/logger";
|
import { Logger } from "./lib/src/logger";
|
||||||
import { WrappedNotice } from "./lib/src/wrapper";
|
import { WrappedNotice } from "./lib/src/wrapper";
|
||||||
import { readString, decodeBinary, arrayBufferToBase64, sha1 } from "./lib/src/strbin";
|
import { readString, decodeBinary, arrayBufferToBase64, sha1 } from "./lib/src/strbin";
|
||||||
@ -687,9 +687,21 @@ export class ConfigSync extends LiveSyncCommands {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (old.mtime == mtime) {
|
if (old.mtime == mtime) {
|
||||||
// Logger(`STORAGE --> DB:${file.path}: (hidden) Not changed`, LOG_LEVEL_VERBOSE);
|
// Logger(`STORAGE --> DB:${prefixedFileName}: (config) Skipped (Same time)`, LOG_LEVEL_VERBOSE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
const oldC = await this.localDatabase.getDBEntryFromMeta(old, {}, false, false);
|
||||||
|
if (oldC) {
|
||||||
|
const d = await deserialize(getDocData(oldC.data), {}) as PluginDataEx;
|
||||||
|
const diffs = (d.files.map(previous => ({ prev: previous, curr: dt.files.find(e => e.filename == previous.filename) })).map(async e => {
|
||||||
|
try { return await isDocContentSame(e.curr.data, e.prev.data) } catch (_) { return false }
|
||||||
|
}))
|
||||||
|
const isSame = (await Promise.all(diffs)).every(e => e == true);
|
||||||
|
if (isSame) {
|
||||||
|
Logger(`STORAGE --> DB:${prefixedFileName}: (config) Skipped (Same content)`, LOG_LEVEL_VERBOSE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
saveData =
|
saveData =
|
||||||
{
|
{
|
||||||
...old,
|
...old,
|
||||||
|
@ -479,7 +479,7 @@ export class HiddenFileSync extends LiveSyncCommands {
|
|||||||
type: "newnote",
|
type: "newnote",
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (await isDocContentSame(old.data, content) && !forceWrite) {
|
if (await isDocContentSame(createBinaryBlob(decodeBinary(old.data)), content) && !forceWrite) {
|
||||||
// Logger(`STORAGE --> DB:${file.path}: (hidden) Not changed`, LOG_LEVEL_VERBOSE);
|
// Logger(`STORAGE --> DB:${file.path}: (hidden) Not changed`, LOG_LEVEL_VERBOSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
import { DocumentHistoryModal } from "./DocumentHistoryModal";
|
import { DocumentHistoryModal } from "./DocumentHistoryModal";
|
||||||
import { isPlainText, stripAllPrefixes } from "./lib/src/path";
|
import { isPlainText, stripAllPrefixes } from "./lib/src/path";
|
||||||
import { TFile } from "./deps";
|
import { TFile } from "./deps";
|
||||||
|
import { decodeBinary } from "./lib/src/strbin";
|
||||||
export let plugin: ObsidianLiveSyncPlugin;
|
export let plugin: ObsidianLiveSyncPlugin;
|
||||||
|
|
||||||
let showDiffInfo = false;
|
let showDiffInfo = false;
|
||||||
@ -113,7 +114,7 @@
|
|||||||
} else {
|
} else {
|
||||||
const data = await plugin.vaultAccess.adapterReadBinary(abs);
|
const data = await plugin.vaultAccess.adapterReadBinary(abs);
|
||||||
const dataEEncoded = createBinaryBlob(data);
|
const dataEEncoded = createBinaryBlob(data);
|
||||||
result = await isDocContentSame(dataEEncoded, doc.data);
|
result = await isDocContentSame(dataEEncoded, createBinaryBlob(decodeBinary(doc.data)));
|
||||||
}
|
}
|
||||||
if (result) {
|
if (result) {
|
||||||
diffDetail += " ⚖️";
|
diffDetail += " ⚖️";
|
||||||
|
@ -1635,7 +1635,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
const pluginConfig = JSON.parse(JSON.stringify(this.plugin.settings)) as ObsidianLiveSyncSettings;
|
const pluginConfig = JSON.parse(JSON.stringify(this.plugin.settings)) as ObsidianLiveSyncSettings;
|
||||||
pluginConfig.couchDB_DBNAME = REDACTED;
|
pluginConfig.couchDB_DBNAME = REDACTED;
|
||||||
pluginConfig.couchDB_PASSWORD = REDACTED;
|
pluginConfig.couchDB_PASSWORD = REDACTED;
|
||||||
pluginConfig.couchDB_URI = isCloudantURI(pluginConfig.couchDB_URI) ? "cloudant" : "self-hosted";
|
const scheme = pluginConfig.couchDB_URI.startsWith("http:") ? "(HTTP)" : (pluginConfig.couchDB_URI.startsWith("https:")) ? "(HTTPS)" : ""
|
||||||
|
pluginConfig.couchDB_URI = isCloudantURI(pluginConfig.couchDB_URI) ? "cloudant" : `self-hosted${scheme}`;
|
||||||
pluginConfig.couchDB_USER = REDACTED;
|
pluginConfig.couchDB_USER = REDACTED;
|
||||||
pluginConfig.passphrase = REDACTED;
|
pluginConfig.passphrase = REDACTED;
|
||||||
pluginConfig.encryptedPassphrase = REDACTED;
|
pluginConfig.encryptedPassphrase = REDACTED;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user