mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-19 15:52:31 +00:00
Merge remote-tracking branch 'origin/main' into beta to port #802
This commit is contained in:
+1
-1
Submodule src/lib updated: 790b90f1a1...b19f087599
@@ -44,7 +44,9 @@ async function canReplicateWithPBKDF2(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
errorManager.clearError(errorMessage);
|
errorManager.clearError(errorMessage);
|
||||||
const ensureMessage = "Failed to initialise the encryption key, preventing replication.";
|
// Showing message is false: that because be shown here. (And it is a fatal error, no way to hide it).
|
||||||
|
// tagged as network error at beginning for error filtering with NetworkWarningStyles
|
||||||
|
const ensureMessage = "\u{200b}Failed to initialise the encryption key, preventing replication.";
|
||||||
const ensureResult = await replicator.ensurePBKDF2Salt(currentSettings, showMessage, true);
|
const ensureResult = await replicator.ensurePBKDF2Salt(currentSettings, showMessage, true);
|
||||||
if (!ensureResult) {
|
if (!ensureResult) {
|
||||||
errorManager.showError(ensureMessage, showMessage ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO);
|
errorManager.showError(ensureMessage, showMessage ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO);
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ export class ModuleObsidianAPI extends AbstractObsidianModule {
|
|||||||
} catch (ex: any) {
|
} catch (ex: any) {
|
||||||
this._log(`HTTP:${method}${size} to:${localURL} -> failed`, LOG_LEVEL_VERBOSE);
|
this._log(`HTTP:${method}${size} to:${localURL} -> failed`, LOG_LEVEL_VERBOSE);
|
||||||
const msg = ex instanceof Error ? `${ex?.name}:${ex?.message}` : ex?.toString();
|
const msg = ex instanceof Error ? `${ex?.name}:${ex?.message}` : ex?.toString();
|
||||||
this.showError(`Failed to fetch: ${msg}`); // Do not show notice, due to throwing below
|
this.showError(`\u{200b}Network Error: Failed to fetch: ${msg}`); // Do not show notice, due to throwing below
|
||||||
this._log(ex, LOG_LEVEL_VERBOSE);
|
this._log(ex, LOG_LEVEL_VERBOSE);
|
||||||
// limit only in bulk_docs.
|
// limit only in bulk_docs.
|
||||||
if (url.toString().indexOf("_bulk_docs") !== -1) {
|
if (url.toString().indexOf("_bulk_docs") !== -1) {
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import {
|
|||||||
isValidFilenameInWidows,
|
isValidFilenameInWidows,
|
||||||
} from "@lib/string_and_binary/path.ts";
|
} from "@lib/string_and_binary/path.ts";
|
||||||
import { MARK_LOG_SEPARATOR } from "@lib/services/lib/logUtils.ts";
|
import { MARK_LOG_SEPARATOR } from "@lib/services/lib/logUtils.ts";
|
||||||
|
import { NetworkWarningStyles } from "@lib/common/models/setting.const.ts";
|
||||||
|
|
||||||
// This module cannot be a core module because it depends on the Obsidian UI.
|
// This module cannot be a core module because it depends on the Obsidian UI.
|
||||||
|
|
||||||
@@ -282,7 +283,20 @@ export class ModuleLog extends AbstractObsidianModule {
|
|||||||
const fileStatus = this.activeFileStatus.value;
|
const fileStatus = this.activeFileStatus.value;
|
||||||
if (fileStatus && !this.settings.hideFileWarningNotice) messageLines.push(fileStatus);
|
if (fileStatus && !this.settings.hideFileWarningNotice) messageLines.push(fileStatus);
|
||||||
const messages = (await this.services.appLifecycle.getUnresolvedMessages()).flat().filter((e) => e);
|
const messages = (await this.services.appLifecycle.getUnresolvedMessages()).flat().filter((e) => e);
|
||||||
messageLines.push(...messages);
|
const stringMessages = messages.filter((m): m is string => typeof m === "string"); // for 'startsWith'
|
||||||
|
const networkMessages = stringMessages.filter((m) => m.startsWith("\u{200b}"));
|
||||||
|
const otherMessages = stringMessages.filter((m) => !m.startsWith("\u{200b}"));
|
||||||
|
|
||||||
|
messageLines.push(...otherMessages);
|
||||||
|
|
||||||
|
if (
|
||||||
|
this.settings.networkWarningStyle !== NetworkWarningStyles.ICON &&
|
||||||
|
this.settings.networkWarningStyle !== NetworkWarningStyles.HIDDEN
|
||||||
|
) {
|
||||||
|
messageLines.push(...networkMessages);
|
||||||
|
} else if (this.settings.networkWarningStyle === NetworkWarningStyles.ICON) {
|
||||||
|
if (networkMessages.length > 0) messageLines.push("🔗❌");
|
||||||
|
}
|
||||||
this.messageArea.innerText = messageLines.map((e) => `⚠️ ${e}`).join("\n");
|
this.messageArea.innerText = messageLines.map((e) => `⚠️ ${e}`).join("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import { LiveSyncSetting as Setting } from "./LiveSyncSetting.ts";
|
|||||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||||
import type { PageFunctions } from "./SettingPane.ts";
|
import type { PageFunctions } from "./SettingPane.ts";
|
||||||
import { visibleOnly } from "./SettingPane.ts";
|
import { visibleOnly } from "./SettingPane.ts";
|
||||||
|
import { EVENT_ON_UNRESOLVED_ERROR, eventHub } from "@/common/events.ts";
|
||||||
|
import { NetworkWarningStyles } from "@lib/common/models/setting.const.ts";
|
||||||
export function paneGeneral(
|
export function paneGeneral(
|
||||||
this: ObsidianLiveSyncSettingTab,
|
this: ObsidianLiveSyncSettingTab,
|
||||||
paneEl: HTMLElement,
|
paneEl: HTMLElement,
|
||||||
@@ -24,6 +26,16 @@ export function paneGeneral(
|
|||||||
});
|
});
|
||||||
new Setting(paneEl).autoWireToggle("showStatusOnStatusbar");
|
new Setting(paneEl).autoWireToggle("showStatusOnStatusbar");
|
||||||
new Setting(paneEl).autoWireToggle("hideFileWarningNotice");
|
new Setting(paneEl).autoWireToggle("hideFileWarningNotice");
|
||||||
|
new Setting(paneEl).autoWireDropDown("networkWarningStyle", {
|
||||||
|
options: {
|
||||||
|
[NetworkWarningStyles.BANNER]: "Show full banner",
|
||||||
|
[NetworkWarningStyles.ICON]: "Show icon only",
|
||||||
|
[NetworkWarningStyles.HIDDEN]: "Hide completely",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
this.addOnSaved("networkWarningStyle", () => {
|
||||||
|
eventHub.emitEvent(EVENT_ON_UNRESOLVED_ERROR);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleLogging")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleLogging")).then((paneEl) => {
|
||||||
paneEl.addClass("wizardHidden");
|
paneEl.addClass("wizardHidden");
|
||||||
|
|||||||
Reference in New Issue
Block a user