mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-01-20 20:25:28 +00:00
Merge branch 'main' into main
This commit is contained in:
@@ -205,13 +205,10 @@ export class ModuleFileHandler extends AbstractModule implements ICoreModule {
|
||||
): Promise<boolean> {
|
||||
const file = typeof info === "string" ? this.storage.getFileStub(info) : info;
|
||||
const mode = file == null ? "create" : "modify";
|
||||
|
||||
const docEntry =
|
||||
typeof entryInfo === "string"
|
||||
? await this.db.fetchEntryMeta(entryInfo, undefined, true)
|
||||
: await this.db.fetchEntryMeta(entryInfo.path, undefined, true);
|
||||
const pathFromEntryInfo = typeof entryInfo === "string" ? entryInfo : getPath(entryInfo);
|
||||
const docEntry = await this.db.fetchEntryMeta(pathFromEntryInfo, undefined, true);
|
||||
if (!docEntry) {
|
||||
this._log(`File ${entryInfo} is not exist on the database`, LOG_LEVEL_VERBOSE);
|
||||
this._log(`File ${pathFromEntryInfo} is not exist on the database`, LOG_LEVEL_VERBOSE);
|
||||
return false;
|
||||
}
|
||||
const path = getPath(docEntry);
|
||||
@@ -275,7 +272,7 @@ export class ModuleFileHandler extends AbstractModule implements ICoreModule {
|
||||
}
|
||||
// 2. if not, the content should be checked.
|
||||
|
||||
if (shouldApplied) {
|
||||
if (!shouldApplied) {
|
||||
const readFile = await this.readFileFromStub(existDoc);
|
||||
if (await isDocContentSame(docData, readFile.body)) {
|
||||
// The content is same. So, we do not need to update the file.
|
||||
|
||||
@@ -301,8 +301,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
||||
const syncMode = this.editingSettings?.liveSync
|
||||
? "LIVESYNC"
|
||||
: this.editingSettings?.periodicReplication
|
||||
? "PERIODIC"
|
||||
: "ONEVENTS";
|
||||
? "PERIODIC"
|
||||
: "ONEVENTS";
|
||||
return {
|
||||
syncMode,
|
||||
};
|
||||
@@ -2032,7 +2032,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
||||
text: "Please set device name to identify this device. This name should be unique among your devices. While not configured, we cannot enable this feature.",
|
||||
cls: "op-warn",
|
||||
},
|
||||
(c) => { },
|
||||
(c) => {},
|
||||
visibleOnly(() => this.isConfiguredAs("deviceAndVaultName", ""))
|
||||
);
|
||||
this.createEl(
|
||||
@@ -2042,7 +2042,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
||||
text: "We cannot change the device name while this feature is enabled. Please disable this feature to change the device name.",
|
||||
cls: "op-warn-info",
|
||||
},
|
||||
(c) => { },
|
||||
(c) => {},
|
||||
visibleOnly(() => this.isConfiguredAs("usePluginSync", true))
|
||||
);
|
||||
|
||||
@@ -2134,8 +2134,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
||||
const scheme = pluginConfig.couchDB_URI.startsWith("http:")
|
||||
? "(HTTP)"
|
||||
: pluginConfig.couchDB_URI.startsWith("https:")
|
||||
? "(HTTPS)"
|
||||
: "";
|
||||
? "(HTTPS)"
|
||||
: "";
|
||||
pluginConfig.couchDB_URI = isCloudantURI(pluginConfig.couchDB_URI)
|
||||
? "cloudant"
|
||||
: `self-hosted${scheme}`;
|
||||
@@ -2155,8 +2155,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
||||
const endpointScheme = pluginConfig.endpoint.startsWith("http:")
|
||||
? "(HTTP)"
|
||||
: pluginConfig.endpoint.startsWith("https:")
|
||||
? "(HTTPS)"
|
||||
: "";
|
||||
? "(HTTPS)"
|
||||
: "";
|
||||
pluginConfig.endpoint = `${endpoint.indexOf(".r2.cloudflarestorage.") !== -1 ? "R2" : "self-hosted?"}(${endpointScheme})`;
|
||||
}
|
||||
const obsidianInfo = `Navigator: ${navigator.userAgent}
|
||||
@@ -2367,10 +2367,10 @@ ${stringifyYaml(pluginConfig)}`;
|
||||
Logger("Start verifying all files", LOG_LEVEL_NOTICE, "verify");
|
||||
const files = this.plugin.settings.syncInternalFiles
|
||||
? await this.plugin.storageAccess.getFilesIncludeHidden(
|
||||
"/",
|
||||
undefined,
|
||||
ignorePatterns
|
||||
)
|
||||
"/",
|
||||
undefined,
|
||||
ignorePatterns
|
||||
)
|
||||
: await this.plugin.storageAccess.getFileNames();
|
||||
const documents = [] as FilePath[];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user