Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(webui): migrate brand logos to default on
Xubin Ren6b07c91aa2cf
diff --git a/webui/src/lib/local-preferences.ts b/webui/src/lib/local-preferences.tsindex 5405b1c0a..d8d4f93dd 100644--- a/webui/src/lib/local-preferences.ts+++ b/webui/src/lib/local-preferences.ts@@ -13,6 +13,11 @@ export interface LocalPreferences {export const LOCAL_PREFS_STORAGE_KEY = "nanobot-webui.settings-preferences";export const LOCAL_PREFS_CHANGED_EVENT = "nanobot-webui.local-preferences-changed";+const LOCAL_PREFS_SCHEMA_VERSION = 1;++type PersistedLocalPreferences = Partial<LocalPreferences> & {+ schemaVersion?: number;+};export const DEFAULT_LOCAL_PREFS: LocalPreferences = {density: "comfortable",@@ -31,12 +36,14 @@ export function readLocalPreferences(): LocalPreferences {try {const raw = window.localStorage.getItem(LOCAL_PREFS_STORAGE_KEY);if (!raw) return DEFAULT_LOCAL_PREFS;- const parsed = JSON.parse(raw) as Partial<LocalPreferences>;+ const parsed = JSON.parse(raw) as PersistedLocalPreferences;return {density: parsed.density === "compact" ? "compact" : "comfortable",activityMode: parsed.activityMode === "expanded" ? "expanded" : "auto",codeWrap: parsed.codeWrap !== false,- brandLogos: parsed.brandLogos !== false,+ brandLogos: parsed.schemaVersion === LOCAL_PREFS_SCHEMA_VERSION+ ? parsed.brandLogos !== false+ : true,browserNotifications: parsed.browserNotifications === true,fileEditDisplayMode: normalizeFileEditDisplayMode(parsed.fileEditDisplayMode),};@@ -47,7 +54,10 @@ export function readLocalPreferences(): LocalPreferences {export function writeLocalPreferences(preferences: LocalPreferences): void {try {- window.localStorage.setItem(LOCAL_PREFS_STORAGE_KEY, JSON.stringify(preferences));+ window.localStorage.setItem(LOCAL_PREFS_STORAGE_KEY, JSON.stringify({+ schemaVersion: LOCAL_PREFS_SCHEMA_VERSION,+ ...preferences,+ }));} catch {// Browser-only preferences should never block settings.}diff --git a/webui/src/tests/local-preferences.test.ts b/webui/src/tests/local-preferences.test.tsindex 6e17e672c..cafea7d45 100644--- a/webui/src/tests/local-preferences.test.ts+++ b/webui/src/tests/local-preferences.test.ts@@ -10,7 +10,7 @@ import {describe("local preferences", () => {beforeEach(() => localStorage.clear());- it("shows third-party brand logos by default while preserving an explicit opt-out", () => {+ it("enables third-party brand logos by default and migrates the previous default", () => {expect(DEFAULT_LOCAL_PREFS.brandLogos).toBe(true);expect(readLocalPreferences().brandLogos).toBe(true);@@ -18,6 +18,11 @@ describe("local preferences", () => {LOCAL_PREFS_STORAGE_KEY,JSON.stringify({ brandLogos: false }),);+ expect(readLocalPreferences().brandLogos).toBe(true);+ });++ it("preserves a brand logo opt-out after the default-on migration", () => {+ writeLocalPreferences({ ...DEFAULT_LOCAL_PREFS, brandLogos: false });expect(readLocalPreferences().brandLogos).toBe(false);});