Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
Add full sidebar visibility controls (#739)
Randifcc48cc73823
diff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.mdindex 2a2a5562fc..f2582cf288 100644--- a/docs/USER_GUIDE.md+++ b/docs/USER_GUIDE.md@@ -783,10 +783,11 @@ curl -X POST http://localhost:20128/api/db-backups/import \### Settings Dashboard-The settings page is organized into 5 tabs for easy navigation:+The settings page is organized into 6 tabs for easy navigation:| Tab | Contents || -------------- | ---------------------------------------------------------------------------------------------- |+| **General** | System storage tools, appearance settings, theme controls, and per-item sidebar visibility || **Security** | Login/Password settings, IP Access Control, API auth for `/models`, and Provider Blocking || **Routing** | Global routing strategy (6 options), wildcard model aliases, fallback chains, combo defaults || **Resilience** | Provider profiles, editable rate limits, circuit breaker status, policies & locked identifiers |diff --git a/src/app/(dashboard)/dashboard/settings/components/AppearanceTab.tsx b/src/app/(dashboard)/dashboard/settings/components/AppearanceTab.tsxindex abe5a83204..5afb230437 100644--- a/src/app/(dashboard)/dashboard/settings/components/AppearanceTab.tsx+++ b/src/app/(dashboard)/dashboard/settings/components/AppearanceTab.tsx@@ -6,17 +6,35 @@ import { useTheme } from "@/shared/hooks/useTheme";import useThemeStore, { COLOR_THEMES } from "@/store/themeStore";import { cn } from "@/shared/utils/cn";import { useTranslations } from "next-intl";+import {+ HIDDEN_SIDEBAR_ITEMS_SETTING_KEY,+ SIDEBAR_SECTIONS,+ SIDEBAR_SETTINGS_UPDATED_EVENT,+ normalizeHiddenSidebarItems,+ type HideableSidebarItemId,+} from "@/shared/constants/sidebarVisibility";export default function AppearanceTab() {const { theme, setTheme, isDark } = useTheme();const { colorTheme, customColor, setColorTheme, setCustomColorTheme } = useThemeStore();const t = useTranslations("settings");+ const tSidebar = useTranslations("sidebar");const [settings, setSettings] = useState<Record<string, any>>({});const [loading, setLoading] = useState(true);const [customThemeColor, setCustomThemeColor] = useState(customColor || "#3b82f6");- const isValidHex = /^#([0-9a-fA-F]{6})$/.test(customThemeColor.startsWith("#") ? customThemeColor : `#${customThemeColor}`);+ const isValidHex = /^#([0-9a-fA-F]{6})$/.test(+ customThemeColor.startsWith("#") ? customThemeColor : `#${customThemeColor}`+ );+ const hiddenSidebarItems = normalizeHiddenSidebarItems(+ settings[HIDDEN_SIDEBAR_ITEMS_SETTING_KEY]+ );+ const hiddenSidebarSet = new Set(hiddenSidebarItems);++ const getSettingsLabel = (key: string, fallback: string) =>+ typeof t.has === "function" && t.has(key) ? t(key) : fallback;+ const getSidebarLabel = (key: string, fallback: string) =>+ typeof tSidebar.has === "function" && tSidebar.has(key) ? tSidebar(key) : fallback;- // Subscribe to store changes (e.g. from another tab) via Zustand external subscriptionuseEffect(() => {const unsubscribe = useThemeStore.subscribe((state) => {if (state.customColor && state.customColor !== customThemeColor) {@@ -25,6 +43,7 @@ export default function AppearanceTab() {});return unsubscribe;}, []); // eslint-disable-line react-hooks/exhaustive-deps+const themeOptionLabels: Record<string, string> = {light: t("themeLight"),dark: t("themeDark"),@@ -40,7 +59,12 @@ export default function AppearanceTab() {return res.json();}).then((data) => {- setSettings(data);+ setSettings({+ ...data,+ [HIDDEN_SIDEBAR_ITEMS_SETTING_KEY]: normalizeHiddenSidebarItems(+ data[HIDDEN_SIDEBAR_ITEMS_SETTING_KEY]+ ),+ });setLoading(false);}).catch(() => setLoading(false));@@ -54,7 +78,18 @@ export default function AppearanceTab() {body: JSON.stringify({ [key]: value }),});if (res.ok) {- setSettings((prev) => ({ ...prev, [key]: value }));+ setSettings((prev) => ({+ ...prev,+ [key]:+ key === HIDDEN_SIDEBAR_ITEMS_SETTING_KEY ? normalizeHiddenSidebarItems(value) : value,+ }));+ if (typeof window !== "undefined") {+ window.dispatchEvent(+ new CustomEvent(SIDEBAR_SETTINGS_UPDATED_EVENT, {+ detail: { [key]: value },+ })+ );+ }}} catch (err) {console.error(`Failed to update ${key}:`, err);@@ -71,6 +106,20 @@ export default function AppearanceTab() {{ id: "cyan", color: COLOR_THEMES.cyan, label: t("themeCyan") },];+ const sidebarSections = SIDEBAR_SECTIONS.map((section) => ({+ ...section,+ title: getSidebarLabel(section.titleKey, section.titleFallback),+ items: section.items.map((item) => ({ ...item, label: tSidebar(item.i18nKey) })),+ }));++ const toggleSidebarItem = (itemId: HideableSidebarItemId) => {+ const nextHiddenItems = hiddenSidebarSet.has(itemId)+ ? hiddenSidebarItems.filter((id) => id !== itemId)+ : [...hiddenSidebarItems, itemId];++ updateSetting(HIDDEN_SIDEBAR_ITEMS_SETTING_KEY, nextHiddenItems);+ };+return (<Card><div className="flex items-center gap-3 mb-4">@@ -164,10 +213,61 @@ export default function AppearanceTab() {maxLength={7}className={`flex-1 h-10 px-3 rounded-lg bg-surface border text-sm text-text-main focus:outline-none ${isValidHex ? "border-border focus:border-primary" : "border-red-400 focus:border-red-500"}`}/>- <Button onClick={() => setCustomColorTheme(customThemeColor)} disabled={!isValidHex}>{t("themeCreate")}</Button>+ <Button onClick={() => setCustomColorTheme(customThemeColor)} disabled={!isValidHex}>+ {t("themeCreate")}+ </Button></div></div>+ <div className="pt-4 border-t border-border">+ <div className="mb-3">+ <p className="font-medium">+ {getSettingsLabel("sidebarVisibility", "Hide sidebar items")}+ </p>+ <p className="text-sm text-text-muted">+ {getSettingsLabel(+ "sidebarVisibilityDesc",+ "Hide any sidebar navigation entry to reduce visual clutter without disabling any features"+ )}+ </p>+ </div>++ <div className="flex flex-col gap-4">+ {sidebarSections.map((section) => (+ <div key={section.id} className="rounded-lg border border-border bg-surface/40">+ <div className="px-4 py-3 border-b border-border/70">+ <p className="text-xs font-semibold uppercase tracking-wider text-text-muted/70">+ {section.title}+ </p>+ </div>++ <div className="divide-y divide-border/70">+ {section.items.map((item) => (+ <div+ key={item.id}+ className="flex items-center justify-between gap-4 px-4 py-3"+ >+ <p className="font-medium">{item.label}</p>+ <Toggle+ checked={hiddenSidebarSet.has(item.id)}+ onChange={() => toggleSidebarItem(item.id)}+ disabled={loading}+ />+ </div>+ ))}+ </div>+ </div>+ ))}+ </div>++ <p className="mt-3 text-xs text-text-muted">+ {getSettingsLabel(+ "sidebarVisibilityHint",+ "Any sidebar section is hidden automatically when all of its entries are hidden"+ )}+ </p>+ </div>+<div className="pt-4 border-t border-border"><div className="flex items-center justify-between"><div>diff --git a/src/domain/types.ts b/src/domain/types.tsindex e3b942bb1d..ef516fa406 100644--- a/src/domain/types.ts+++ b/src/domain/types.ts@@ -101,6 +101,7 @@* @property {string} [instanceName] - Instance display name* @property {string} [corsOrigins] - Allowed CORS origins* @property {number} [logRetentionDays] - Log retention in days+ * @property {string[]} [hiddenSidebarItems] - Sidebar entry ids hidden for visual decluttering*//**diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.jsonindex c5b3d79207..dc9105da85 100644--- a/src/i18n/messages/en.json+++ b/src/i18n/messages/en.json@@ -170,6 +170,11 @@"debug": "Debug","system": "System","help": "Help",+ "primarySection": "Main",+ "cliSection": "CLI",+ "debugSection": "Debug",+ "systemSection": "System",+ "helpSection": "Help","serverDisconnected": "Server Disconnected","serverDisconnectedMsg": "The proxy server has been stopped or is restarting.","expandSidebar": "Expand sidebar",@@ -1724,6 +1729,9 @@"themeLight": "Light","themeDark": "Dark","themeSystem": "System",+ "sidebarVisibility": "Hide sidebar items",+ "sidebarVisibilityDesc": "Hide any sidebar navigation entry to reduce visual clutter without disabling any features",+ "sidebarVisibilityHint": "Any sidebar section is hidden automatically when all of its entries are hidden","hideHealthLogs": "Hide Health Check Logs","hideHealthLogsDesc": "When ON, suppress [HealthCheck] messages in server console","themeAccent": "Theme color",diff --git a/src/i18n/messages/zh-CN.json b/src/i18n/messages/zh-CN.jsonindex 44ea4b62cb..400802ea98 100644--- a/src/i18n/messages/zh-CN.json+++ b/src/i18n/messages/zh-CN.json@@ -170,6 +170,11 @@"debug": "调试","system": "系统","help": "帮助",+ "primarySection": "主导航",+ "cliSection": "CLI",+ "debugSection": "调试",+ "systemSection": "系统",+ "helpSection": "帮助","serverDisconnected": "服务器已断开连接","serverDisconnectedMsg": "代理服务器已停止,或正在重启。","expandSidebar": "展开侧边栏",@@ -1718,6 +1723,9 @@"themeLight": "浅色","themeDark": "深色","themeSystem": "系统",+ "sidebarVisibility": "隐藏侧边栏项目",+ "sidebarVisibilityDesc": "可以隐藏任意侧边栏导航项,以减少视觉负担,但不会禁用任何功能",+ "sidebarVisibilityHint": "当某个侧边栏分组中的所有项目都被隐藏时,该分组会自动隐藏","hideHealthLogs": "隐藏健康检查日志","hideHealthLogsDesc": "开启后,将抑制服务器控制台中的 [HealthCheck] 消息","themeAccent": "主题颜色",diff --git a/src/lib/db/settings.ts b/src/lib/db/settings.tsindex e5ac9f6553..4822d08dc6 100644--- a/src/lib/db/settings.ts+++ b/src/lib/db/settings.ts@@ -45,6 +45,7 @@ export async function getSettings() {cloudEnabled: false,stickyRoundRobinLimit: 3,requireLogin: true,+ hiddenSidebarItems: [],};for (const row of rows) {const record = toRecord(row);diff --git a/src/shared/components/Sidebar.tsx b/src/shared/components/Sidebar.tsxindex 24165899dc..fb77a3017a 100644--- a/src/shared/components/Sidebar.tsx+++ b/src/shared/components/Sidebar.tsx@@ -11,46 +11,12 @@ import Button from "./Button";import { ConfirmModal } from "./Modal";import CloudSyncStatus from "./CloudSyncStatus";import { useTranslations } from "next-intl";-// Nav items use i18n keys resolved inside the component-const navItemDefs = [- { href: "/dashboard", i18nKey: "home", icon: "home", exact: true },- { href: "/dashboard/endpoint", i18nKey: "endpoints", icon: "api" },- { href: "/dashboard/api-manager", i18nKey: "apiManager", icon: "vpn_key" },- { href: "/dashboard/providers", i18nKey: "providers", icon: "dns" },- { href: "/dashboard/combos", i18nKey: "combos", icon: "layers" },- { href: "/dashboard/costs", i18nKey: "costs", icon: "account_balance_wallet" },- { href: "/dashboard/analytics", i18nKey: "analytics", icon: "analytics" },- { href: "/dashboard/limits", i18nKey: "limits", icon: "tune" },- { href: "/dashboard/cache", i18nKey: "cache", icon: "cached" },-];--const cliItemDefs = [- { href: "/dashboard/cli-tools", i18nKey: "cliToolsShort", icon: "terminal" },- { href: "/dashboard/agents", i18nKey: "agents", icon: "smart_toy" },-];--const debugItemDefs = [- { href: "/dashboard/translator", i18nKey: "translator", icon: "translate" },- { href: "/dashboard/playground", i18nKey: "playground", icon: "science" },- { href: "/dashboard/media", i18nKey: "media", icon: "auto_awesome" },- { href: "/dashboard/search-tools", i18nKey: "searchTools", icon: "manage_search" },-];--const systemItemDefs = [- { href: "/dashboard/health", i18nKey: "health", icon: "health_and_safety" },- { href: "/dashboard/logs", i18nKey: "logs", icon: "description" },- { href: "/dashboard/settings", i18nKey: "settings", icon: "settings" },-];--const helpItemDefs = [- { href: "/docs", i18nKey: "docs", icon: "menu_book" },- {- href: "https://github.com/diegosouzapw/OmniRoute/issues",- i18nKey: "issues",- icon: "bug_report",- external: true,- },-];+import {+ HIDDEN_SIDEBAR_ITEMS_SETTING_KEY,+ SIDEBAR_SETTINGS_UPDATED_EVENT,+ SIDEBAR_SECTIONS,+ normalizeHiddenSidebarItems,+} from "@/shared/constants/sidebarVisibility";export default function Sidebar({onClose,@@ -70,13 +36,41 @@ export default function Sidebar({const [isRestarting, setIsRestarting] = useState(false);const [isDisconnected, setIsDisconnected] = useState(false);const [showDebug, setShowDebug] = useState(false);+ const [hiddenSidebarItems, setHiddenSidebarItems] = useState<string[]>([]);- // Check if debug mode is enableduseEffect(() => {+ const applySettings = (data) => {+ setShowDebug(data?.enableRequestLogs === true);+ setHiddenSidebarItems(normalizeHiddenSidebarItems(data?.[HIDDEN_SIDEBAR_ITEMS_SETTING_KEY]));+ };+fetch("/api/settings").then((res) => res.json())- .then((data) => setShowDebug(data?.enableRequestLogs === true))+ .then((data) => applySettings(data)).catch(() => {});++ const handleSettingsUpdated = (event: Event) => {+ const detail = (event as CustomEvent<Record<string, unknown>>).detail || {};++ if ("enableRequestLogs" in detail) {+ setShowDebug(detail.enableRequestLogs === true);+ }++ if (HIDDEN_SIDEBAR_ITEMS_SETTING_KEY in detail) {+ setHiddenSidebarItems(+ normalizeHiddenSidebarItems(detail[HIDDEN_SIDEBAR_ITEMS_SETTING_KEY])+ );+ }+ };++ window.addEventListener(SIDEBAR_SETTINGS_UPDATED_EVENT, handleSettingsUpdated as EventListener);++ return () => {+ window.removeEventListener(+ SIDEBAR_SETTINGS_UPDATED_EVENT,+ handleSettingsUpdated as EventListener+ );+ };}, []);const isActive = (href, exact) => {@@ -107,20 +101,27 @@ export default function Sidebar({}setIsRestarting(false);setShowRestartModal(false);- // Show reconnecting state, then try to reload after a delaysetIsDisconnected(true);setTimeout(() => {globalThis.location.reload();}, 3000);};- // Resolve i18n keys → labels- const resolveItems = (defs) => defs.map((d) => ({ ...d, label: t(d.i18nKey) }));- const navItems = resolveItems(navItemDefs);- const cliItems = resolveItems(cliItemDefs);- const debugItems = resolveItems(debugItemDefs);- const systemItems = resolveItems(systemItemDefs);- const helpItems = resolveItems(helpItemDefs);+ const getSidebarLabel = (key: string, fallback: string) =>+ typeof t.has === "function" && t.has(key) ? t(key) : fallback;++ const hiddenSidebarSet = new Set(hiddenSidebarItems);+ const visibleSections = SIDEBAR_SECTIONS.filter(+ (section) => section.visibility !== "debug" || showDebug+ )+ .map((section) => ({+ ...section,+ title: getSidebarLabel(section.titleKey, section.titleFallback),+ items: section.items+ .map((item) => ({ ...item, label: t(item.i18nKey) }))+ .filter((item) => !hiddenSidebarSet.has(item.id)),+ }))+ .filter((section) => section.items.length > 0);const renderNavLink = (item) => {const active = !item.external && isActive(item.href, item.exact);@@ -179,14 +180,12 @@ export default function Sidebar({collapsed ? "w-16" : "w-72")}>- {/* Skip to content link */}<ahref="#main-content"className="sr-only focus:not-sr-only focus:absolute focus:z-50 focus:p-3 focus:bg-primary focus:text-white focus:rounded-md focus:m-2">Skip to content</a>- {/* Traffic lights + collapse toggle */}<divclassName={cn("flex items-center gap-2 pt-5 pb-2",@@ -216,7 +215,6 @@ export default function Sidebar({)}</div>- {/* Logo */}<div className={cn("py-4", collapsed ? "px-2" : "px-6")}><Linkhref="/dashboard"@@ -236,7 +234,6 @@ export default function Sidebar({</Link></div>- {/* Navigation */}<navaria-label="Main navigation"className={cn(@@ -244,58 +241,27 @@ export default function Sidebar({collapsed ? "px-2" : "px-4")}>- {navItems.map(renderNavLink)}-- {/* CLI section */}- <div className="pt-4 mt-2">- {!collapsed && (- <p className="px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2">- CLI- </p>- )}- {collapsed && <div className="border-t border-black/5 dark:border-white/5 mb-2" />}- {cliItems.map(renderNavLink)}- </div>-- {/* Debug section */}- {showDebug && (- <div className="pt-4 mt-2">- {!collapsed && (- <p className="px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2">- Debug- </p>- )}- {collapsed && <div className="border-t border-black/5 dark:border-white/5 mb-2" />}- {debugItems.map(renderNavLink)}- </div>- )}-- {/* System section */}- <div className="pt-4 mt-2">- {!collapsed && (- <p className="px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2">- System- </p>- )}- {collapsed && <div className="border-t border-black/5 dark:border-white/5 mb-2" />}- {systemItems.map(renderNavLink)}- </div>+ {visibleSections.map((section) => {+ const showTitle = section.showTitleInSidebar !== false;- <div className="pt-4 mt-2">- {!collapsed && (- <p className="px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2">- Help- </p>- )}- {collapsed && <div className="border-t border-black/5 dark:border-white/5 mb-2" />}- {helpItems.map(renderNavLink)}- </div>+ return (+ <div key={section.id} className={showTitle ? "pt-4 mt-2" : undefined}>+ {!collapsed && showTitle && (+ <p className="px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2">+ {section.title}+ </p>+ )}+ {collapsed && showTitle && (+ <div className="border-t border-black/5 dark:border-white/5 mb-2" />+ )}+ {section.items.map(renderNavLink)}+ </div>+ );+ })}</nav>- {/* Cloud sync status indicator */}<CloudSyncStatus collapsed={collapsed} />- {/* Footer — Shutdown + Restart */}<divclassName={cn("border-t border-black/5 dark:border-white/5",@@ -329,7 +295,6 @@ export default function Sidebar({</div></aside>- {/* Shutdown Confirmation Modal */}<ConfirmModalisOpen={showShutdownModal}onClose={() => setShowShutdownModal(false)}@@ -342,7 +307,6 @@ export default function Sidebar({loading={isShuttingDown}/>- {/* Restart Confirmation Modal */}<ConfirmModalisOpen={showRestartModal}onClose={() => setShowRestartModal(false)}@@ -355,7 +319,6 @@ export default function Sidebar({loading={isRestarting}/>- {/* Disconnected Overlay */}{isDisconnected && (<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm"><div className="text-center p-8">diff --git a/src/shared/constants/sidebarVisibility.ts b/src/shared/constants/sidebarVisibility.tsnew file mode 100644index 0000000000..fa73e228d7--- /dev/null+++ b/src/shared/constants/sidebarVisibility.ts@@ -0,0 +1,144 @@+export const HIDEABLE_SIDEBAR_ITEM_IDS = [+ "home",+ "endpoints",+ "api-manager",+ "providers",+ "combos",+ "costs",+ "analytics",+ "limits",+ "cache",+ "cli-tools",+ "agents",+ "translator",+ "playground",+ "media",+ "search-tools",+ "health",+ "logs",+ "settings",+ "docs",+ "issues",+] as const;++export type HideableSidebarItemId = (typeof HIDEABLE_SIDEBAR_ITEM_IDS)[number];+export type SidebarSectionId = "primary" | "cli" | "debug" | "system" | "help";++export interface SidebarItemDefinition {+ id: HideableSidebarItemId;+ href: string;+ i18nKey: string;+ icon: string;+ exact?: boolean;+ external?: boolean;+}++export interface SidebarSectionDefinition {+ id: SidebarSectionId;+ titleKey: string;+ titleFallback: string;+ items: readonly SidebarItemDefinition[];+ showTitleInSidebar?: boolean;+ visibility?: "always" | "debug";+}++const PRIMARY_SIDEBAR_ITEMS: readonly SidebarItemDefinition[] = [+ { id: "home", href: "/dashboard", i18nKey: "home", icon: "home", exact: true },+ { id: "endpoints", href: "/dashboard/endpoint", i18nKey: "endpoints", icon: "api" },+ { id: "api-manager", href: "/dashboard/api-manager", i18nKey: "apiManager", icon: "vpn_key" },+ { id: "providers", href: "/dashboard/providers", i18nKey: "providers", icon: "dns" },+ { id: "combos", href: "/dashboard/combos", i18nKey: "combos", icon: "layers" },+ { id: "costs", href: "/dashboard/costs", i18nKey: "costs", icon: "account_balance_wallet" },+ { id: "analytics", href: "/dashboard/analytics", i18nKey: "analytics", icon: "analytics" },+ { id: "limits", href: "/dashboard/limits", i18nKey: "limits", icon: "tune" },+ { id: "cache", href: "/dashboard/cache", i18nKey: "cache", icon: "cached" },+];++const CLI_SIDEBAR_ITEMS: readonly SidebarItemDefinition[] = [+ { id: "cli-tools", href: "/dashboard/cli-tools", i18nKey: "cliToolsShort", icon: "terminal" },+ { id: "agents", href: "/dashboard/agents", i18nKey: "agents", icon: "smart_toy" },+];++const DEBUG_SIDEBAR_ITEMS: readonly SidebarItemDefinition[] = [+ { id: "translator", href: "/dashboard/translator", i18nKey: "translator", icon: "translate" },+ { id: "playground", href: "/dashboard/playground", i18nKey: "playground", icon: "science" },+ { id: "media", href: "/dashboard/media", i18nKey: "media", icon: "auto_awesome" },+ {+ id: "search-tools",+ href: "/dashboard/search-tools",+ i18nKey: "searchTools",+ icon: "manage_search",+ },+];++const SYSTEM_SIDEBAR_ITEMS: readonly SidebarItemDefinition[] = [+ { id: "health", href: "/dashboard/health", i18nKey: "health", icon: "health_and_safety" },+ { id: "logs", href: "/dashboard/logs", i18nKey: "logs", icon: "description" },+ { id: "settings", href: "/dashboard/settings", i18nKey: "settings", icon: "settings" },+];++const HELP_SIDEBAR_ITEMS: readonly SidebarItemDefinition[] = [+ { id: "docs", href: "/docs", i18nKey: "docs", icon: "menu_book", external: true },+ {+ id: "issues",+ href: "https://github.com/diegosouzapw/OmniRoute/issues",+ i18nKey: "issues",+ icon: "bug_report",+ external: true,+ },+];++export const SIDEBAR_SECTIONS: readonly SidebarSectionDefinition[] = [+ {+ id: "primary",+ titleKey: "primarySection",+ titleFallback: "Main",+ items: PRIMARY_SIDEBAR_ITEMS,+ showTitleInSidebar: false,+ },+ {+ id: "cli",+ titleKey: "cliSection",+ titleFallback: "CLI",+ items: CLI_SIDEBAR_ITEMS,+ },+ {+ id: "debug",+ titleKey: "debugSection",+ titleFallback: "Debug",+ items: DEBUG_SIDEBAR_ITEMS,+ visibility: "debug",+ },+ {+ id: "system",+ titleKey: "systemSection",+ titleFallback: "System",+ items: SYSTEM_SIDEBAR_ITEMS,+ },+ {+ id: "help",+ titleKey: "helpSection",+ titleFallback: "Help",+ items: HELP_SIDEBAR_ITEMS,+ },+] as const;++export const HIDDEN_SIDEBAR_ITEMS_SETTING_KEY = "hiddenSidebarItems";+export const SIDEBAR_SETTINGS_UPDATED_EVENT = "omniroute:settings-updated";++export function normalizeHiddenSidebarItems(value: unknown): HideableSidebarItemId[] {+ if (!Array.isArray(value)) return [];++ const hiddenItems = new Set<HideableSidebarItemId>();++ for (const item of value) {+ if (+ typeof item === "string" &&+ HIDEABLE_SIDEBAR_ITEM_IDS.includes(item as HideableSidebarItemId)+ ) {+ hiddenItems.add(item as HideableSidebarItemId);+ }+ }++ return HIDEABLE_SIDEBAR_ITEM_IDS.filter((item) => hiddenItems.has(item));+}diff --git a/src/shared/validation/schemas.ts b/src/shared/validation/schemas.tsindex 0c32f398c6..6af6e4a295 100644--- a/src/shared/validation/schemas.ts+++ b/src/shared/validation/schemas.ts@@ -1,4 +1,5 @@import { z } from "zod";+import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility";import { isForbiddenUpstreamHeaderName } from "@/shared/constants/upstreamHeaders";function isHttpUrl(value: string): boolean {@@ -159,6 +160,7 @@ export const updateSettingsSchema = z.object({requireAuthForModels: z.boolean().optional(),blockedProviders: z.array(z.string().max(100)).optional(),hideHealthCheckLogs: z.boolean().optional(),+ hiddenSidebarItems: z.array(z.enum(HIDEABLE_SIDEBAR_ITEM_IDS)).optional(),// Routing settings (#134)fallbackStrategy: z.enum([diff --git a/src/shared/validation/settingsSchemas.ts b/src/shared/validation/settingsSchemas.tsindex 33092bb7f7..ec3392f792 100644--- a/src/shared/validation/settingsSchemas.ts+++ b/src/shared/validation/settingsSchemas.ts@@ -6,6 +6,7 @@* at runtime (see: https://github.com/vercel/next.js/issues/12557).*/import { z } from "zod";+import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility";export const updateSettingsSchema = z.object({newPassword: z.string().min(1).max(200).optional(),@@ -25,6 +26,7 @@ export const updateSettingsSchema = z.object({requireAuthForModels: z.boolean().optional(),blockedProviders: z.array(z.string().max(100)).optional(),hideHealthCheckLogs: z.boolean().optional(),+ hiddenSidebarItems: z.array(z.enum(HIDEABLE_SIDEBAR_ITEM_IDS)).optional(),// Routing settings (#134)fallbackStrategy: z.enum(["fill-first", "round-robin", "p2c", "random", "least-used", "cost-optimized"])diff --git a/src/types/settings.ts b/src/types/settings.tsindex 188405672a..15f84d3a23 100644--- a/src/types/settings.ts+++ b/src/types/settings.ts@@ -1,3 +1,5 @@+import type { HideableSidebarItemId } from "@/shared/constants/sidebarVisibility";+/*** Application settings stored in SQLite key-value pairs.*/@@ -14,6 +16,8 @@ export interface Settings {| "strict-random";stickyRoundRobinLimit: number;jwtSecret?: string;+ hideHealthCheckLogs?: boolean;+ hiddenSidebarItems?: HideableSidebarItemId[];}export interface ComboDefaults {