Merge remote-tracking branch 'origin/main' into beta to port #802

This commit is contained in:
vorotamoroz
2026-02-24 07:44:18 +00:00
5 changed files with 32 additions and 4 deletions

Submodule src/lib updated: 790b90f1a1...b19f087599

View File

@@ -44,7 +44,9 @@ async function canReplicateWithPBKDF2(
return false;
}
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);
if (!ensureResult) {
errorManager.showError(ensureMessage, showMessage ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO);

View File

@@ -236,7 +236,7 @@ export class ModuleObsidianAPI extends AbstractObsidianModule {
} catch (ex: any) {
this._log(`HTTP:${method}${size} to:${localURL} -> failed`, LOG_LEVEL_VERBOSE);
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);
// limit only in bulk_docs.
if (url.toString().indexOf("_bulk_docs") !== -1) {

View File

@@ -40,6 +40,7 @@ import {
isValidFilenameInWidows,
} from "@lib/string_and_binary/path.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.
@@ -282,7 +283,20 @@ export class ModuleLog extends AbstractObsidianModule {
const fileStatus = this.activeFileStatus.value;
if (fileStatus && !this.settings.hideFileWarningNotice) messageLines.push(fileStatus);
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");
}
}

View File

@@ -4,6 +4,8 @@ import { LiveSyncSetting as Setting } from "./LiveSyncSetting.ts";
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
import type { PageFunctions } 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(
this: ObsidianLiveSyncSettingTab,
paneEl: HTMLElement,
@@ -24,6 +26,16 @@ export function paneGeneral(
});
new Setting(paneEl).autoWireToggle("showStatusOnStatusbar");
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) => {
paneEl.addClass("wizardHidden");