From a2cd6b7099cf7d9081405246ccbc17246d020f02 Mon Sep 17 00:00:00 2001 From: KodekaTeam Date: Thu, 6 Aug 2026 01:51:40 +0700 Subject: [PATCH] refactor(storage): update storage keys to use 'doktainer' prefix --- src/lib/browser-storage.ts | 12 +++++++----- src/lib/preferences.ts | 8 ++++---- src/lib/theme.ts | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/lib/browser-storage.ts b/src/lib/browser-storage.ts index c801f4a..c1767db 100644 --- a/src/lib/browser-storage.ts +++ b/src/lib/browser-storage.ts @@ -1,6 +1,6 @@ -const TOKEN_KEY = "vps_token"; -const USER_KEY = "vps_user"; -const ORGANIZATION_STORAGE_KEY = "vps_active_organization"; +const TOKEN_KEY = "doktainer_token"; +const USER_KEY = "doktainer_user"; +const ORGANIZATION_STORAGE_KEY = "doktainer_active_organization"; type SensitiveStorageKey = | typeof TOKEN_KEY @@ -17,7 +17,9 @@ function getLocalStorage(): Storage | null { } } -export function getSensitiveStorageItem(key: SensitiveStorageKey): string | null { +export function getSensitiveStorageItem( + key: SensitiveStorageKey, +): string | null { return getLocalStorage()?.getItem(key) ?? null; } @@ -36,4 +38,4 @@ export const sensitiveStorageKeys = { token: TOKEN_KEY, user: USER_KEY, organization: ORGANIZATION_STORAGE_KEY, -} as const; \ No newline at end of file +} as const; diff --git a/src/lib/preferences.ts b/src/lib/preferences.ts index f7e047c..b1b2197 100644 --- a/src/lib/preferences.ts +++ b/src/lib/preferences.ts @@ -11,10 +11,10 @@ export { resolveThemePreference, } from "@/lib/theme"; -const SETTINGS_EVENT = "vps:settings-updated"; -const PANEL_NAME_KEY = "vps_panel_name"; -const PANEL_URL_KEY = "vps_panel_url"; -const SESSION_TIMEOUT_KEY = "vps_session_timeout_minutes"; +const SETTINGS_EVENT = "doktainer:settings-updated"; +const PANEL_NAME_KEY = "doktainer_panel_name"; +const PANEL_URL_KEY = "doktainer_panel_url"; +const SESSION_TIMEOUT_KEY = "doktainer_session_timeout_minutes"; const DEFAULT_PANEL_NAME = process.env.NEXT_PUBLIC_PANEL_NAME || "DOKTAINER"; function resolveDefaultPanelUrl() { diff --git a/src/lib/theme.ts b/src/lib/theme.ts index 59375b8..cad1e81 100644 --- a/src/lib/theme.ts +++ b/src/lib/theme.ts @@ -1,6 +1,6 @@ export type ThemePreference = "dark" | "light" | "system"; -export const THEME_STORAGE_KEY = "vps_theme"; +export const THEME_STORAGE_KEY = "doktainer_theme"; export const DEFAULT_THEME: ThemePreference = "dark"; function isThemePreference(value: string | null): value is ThemePreference {