Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat(settings): support editor system fonts

t8y2895c0d58af18
diff --git a/Cargo.lock b/Cargo.lock
index 49a2f3f05f..8de934b0ad 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1334,6 +1334,19 @@ version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
+[[package]]
+name = "core-graphics"
+version = "0.23.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"
+dependencies = [
+ "bitflags 1.3.2",
+ "core-foundation 0.9.4",
+ "core-graphics-types 0.1.3",
+ "foreign-types 0.5.0",
+ "libc",
+]
+
[[package]]
name = "core-graphics"
version = "0.25.0"
@@ -1342,11 +1355,22 @@ checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97"
dependencies = [
"bitflags 2.11.1",
"core-foundation 0.10.1",
- "core-graphics-types",
+ "core-graphics-types 0.2.0",
"foreign-types 0.5.0",
"libc",
]
+[[package]]
+name = "core-graphics-types"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"
+dependencies = [
+ "bitflags 1.3.2",
+ "core-foundation 0.9.4",
+ "libc",
+]
+
[[package]]
name = "core-graphics-types"
version = "0.2.0"
@@ -1358,6 +1382,18 @@ dependencies = [
"libc",
]
+[[package]]
+name = "core-text"
+version = "20.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c9d2790b5c08465d49f8dc05c8bcae9fea467855947db39b0f8145c091aaced5"
+dependencies = [
+ "core-foundation 0.9.4",
+ "core-graphics 0.23.2",
+ "foreign-types 0.5.0",
+ "libc",
+]
+
[[package]]
name = "cpubits"
version = "0.1.1"
@@ -1698,6 +1734,7 @@ dependencies = [
"csv",
"dbx-core",
"duckdb",
+ "font-kit",
"futures",
"log",
"mongodb",
@@ -1963,6 +2000,15 @@ dependencies = [
"syn 2.0.117",
]
+[[package]]
+name = "dlib"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"
+dependencies = [
+ "libloading",
+]
+
[[package]]
name = "dlopen2"
version = "0.8.2"
@@ -2079,6 +2125,18 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
+[[package]]
+name = "dwrote"
+version = "0.11.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e1b35532432acc8b19ceed096e35dfa088d3ea037fe4f3c085f1f97f33b4d02"
+dependencies = [
+ "lazy_static",
+ "libc",
+ "winapi",
+ "wio",
+]
+
[[package]]
name = "dyn-clone"
version = "1.0.20"
@@ -2393,6 +2451,12 @@ dependencies = [
"zlib-rs",
]
+[[package]]
+name = "float-ord"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d"
+
[[package]]
name = "flume"
version = "0.11.1"
@@ -2422,6 +2486,31 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
+[[package]]
+name = "font-kit"
+version = "0.14.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c7e611d49285d4c4b2e1727b72cf05353558885cc5252f93707b845dfcaf3d3"
+dependencies = [
+ "bitflags 2.11.1",
+ "byteorder",
+ "core-foundation 0.9.4",
+ "core-graphics 0.23.2",
+ "core-text",
+ "dirs",
+ "dwrote",
+ "float-ord",
+ "freetype-sys",
+ "lazy_static",
+ "libc",
+ "log",
+ "pathfinder_geometry",
+ "pathfinder_simd",
+ "walkdir",
+ "winapi",
+ "yeslogic-fontconfig-sys",
+]
+
[[package]]
name = "foreign-types"
version = "0.3.2"
@@ -2473,6 +2562,17 @@ dependencies = [
"percent-encoding",
]
+[[package]]
+name = "freetype-sys"
+version = "0.20.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0e7edc5b9669349acfda99533e9e0bcf26a51862ab43b08ee7745c55d28eb134"
+dependencies = [
+ "cc",
+ "libc",
+ "pkg-config",
+]
+
[[package]]
name = "fs_extra"
version = "1.3.0"
@@ -4903,6 +5003,25 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
+[[package]]
+name = "pathfinder_geometry"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b7e7b4ea703700ce73ebf128e1450eb69c3a8329199ffbfb9b2a0418e5ad3"
+dependencies = [
+ "log",
+ "pathfinder_simd",
+]
+
+[[package]]
+name = "pathfinder_simd"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4500030c302e4af1d423f36f3b958d1aecb6c04184356ed5a833bf6b60435777"
+dependencies = [
+ "rustc_version",
+]
+
[[package]]
name = "pbkdf2"
version = "0.12.2"
@@ -7262,7 +7381,7 @@ dependencies = [
"bitflags 2.11.1",
"block2",
"core-foundation 0.10.1",
- "core-graphics",
+ "core-graphics 0.25.0",
"crossbeam-channel",
"dbus",
"dispatch2",
@@ -9452,6 +9571,15 @@ dependencies = [
"windows-sys 0.59.0",
]
+[[package]]
+name = "wio"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"
+dependencies = [
+ "winapi",
+]
+
[[package]]
name = "wit-bindgen"
version = "0.51.0"
@@ -9636,6 +9764,17 @@ dependencies = [
"rustix 1.1.4",
]
+[[package]]
+name = "yeslogic-fontconfig-sys"
+version = "6.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76"
+dependencies = [
+ "dlib",
+ "once_cell",
+ "pkg-config",
+]
+
[[package]]
name = "yoke"
version = "0.8.2"
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index d7a5f6837e..b80edac80b 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -23,7 +23,7 @@ import {
} from "@/stores/settingsStore";
import { loadEditorTheme, editorFontTheme } from "@/lib/editorThemes";
import { isTauriRuntime } from "@/lib/tauriRuntime";
-import { aiListModels, aiTestConnection, type AiModelInfo } from "@/lib/api";
+import { aiListModels, aiTestConnection, listSystemFonts, type AiModelInfo } from "@/lib/api";
import { eventToShortcut } from "@/lib/keyboardShortcuts";
import {
SHORTCUT_DEFINITIONS,
@@ -58,6 +58,51 @@ const editRedisScanPageSize = ref(settingsStore.editorSettings.redisScanPageSize
const editShortcuts = ref(normalizeShortcutSettings(settingsStore.editorSettings.shortcuts));
const editSidebarActivation = ref(settingsStore.editorSettings.sidebarActivation);
const redisScanPageSizeOptions = [200, 1000, 5000, 10000];
+const systemFonts = ref<string[]>([]);
+const systemFontsLoading = ref(false);
+const systemFontsLoaded = ref(false);
+
+const presetFontLabels = new Map(FONT_FAMILIES.map((font) => [font.value, font.label]));
+
+function cssFontFamilyForName(name: string): string {
+ return `'${name.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}', monospace`;
+}
+
+function readableFontFamily(value: string): string {
+ const first = value.split(",")[0]?.trim() ?? value;
+ return first.replace(/^['"]|['"]$/g, "").replace(/\\'/g, "'");
+}
+
+function normalizeCustomFontFamilyInput(value: string): string {
+ const trimmed = value.trim();
+ if (!trimmed) return "";
+ if (trimmed.includes(",") || trimmed.includes("'") || trimmed.includes('"')) return trimmed;
+ return cssFontFamilyForName(trimmed);
+}
+
+const systemFontOptions = computed(() => {
+ const options = new Set(FONT_FAMILIES.map((font) => font.value));
+ for (const font of systemFonts.value) options.add(cssFontFamilyForName(font));
+ if (editFontFamily.value) options.add(editFontFamily.value);
+ return [...options];
+});
+
+function displayFontFamily(value: string): string {
+ return presetFontLabels.get(value) ?? readableFontFamily(value);
+}
+
+async function loadSystemFontOptions() {
+ if (systemFontsLoaded.value || systemFontsLoading.value) return;
+ systemFontsLoading.value = true;
+ try {
+ systemFonts.value = await listSystemFonts();
+ systemFontsLoaded.value = true;
+ } catch {
+ systemFonts.value = [];
+ } finally {
+ systemFontsLoading.value = false;
+ }
+}
// Sync from store when dialog opens
watch(
@@ -73,6 +118,7 @@ watch(
editRedisScanPageSize.value = settingsStore.editorSettings.redisScanPageSize;
editShortcuts.value = normalizeShortcutSettings(settingsStore.editorSettings.shortcuts);
editSidebarActivation.value = settingsStore.editorSettings.sidebarActivation;
+ void loadSystemFontOptions();
}
},
);
@@ -187,6 +233,17 @@ const settingsCategoryNav = computed<{ value: SettingsCategory; label: string }[
...(isWeb ? [{ value: "security" as const, label: t("settings.securityTab") }] : []),
{ value: "about", label: t("settings.aboutTab") },
]);
+const settingsTabsWithApplyFooter = new Set<SettingsCategory>([
+ "editor",
+ "appearance",
+ "navigation",
+ "redis",
+ "shortcuts",
+]);
+
+function hasSettingsApplyFooter(value: SettingsCategory): boolean {
+ return settingsTabsWithApplyFooter.has(value);
+}
function settingsCategoryButton(value: SettingsCategory): string {
return [
@@ -582,654 +639,634 @@ watch(
</button>
</nav>
- <div class="min-w-0 flex-1 overflow-y-auto overflow-x-hidden px-1">
- <section v-if="activeSettingsTab === 'editor'" class="flex min-h-full flex-col gap-5 py-2">
- <div class="grid gap-4 md:grid-cols-[minmax(0,1fr)_220px]">
- <!-- Font Family -->
- <div class="space-y-2">
- <Label>{{ t("settings.fontFamily") }}</Label>
- <Select :model-value="editFontFamily" @update:model-value="onFontFamilyChange">
- <SelectTrigger>
- <SelectValue :placeholder="t('settings.selectFont')" />
- </SelectTrigger>
- <SelectContent position="popper" class="min-w-[210px]">
- <SelectItem
- v-for="font in FONT_FAMILIES"
- :key="font.value"
- :value="font.value"
- :style="{ fontFamily: font.value }"
- class="whitespace-nowrap"
- >
- {{ font.label }}
- </SelectItem>
- </SelectContent>
- </Select>
- </div>
-
- <!-- Theme -->
- <div class="space-y-2">
- <Label>{{ t("settings.theme") }}</Label>
- <Select :model-value="editTheme" @update:model-value="onThemeChange">
- <SelectTrigger>
- <SelectValue :placeholder="t('settings.selectTheme')" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem v-for="theme in EDITOR_THEMES" :key="theme.value" :value="theme.value">
- <div class="flex items-center gap-2">
- <span
- class="h-3 w-3 rounded-full border"
- :class="
- theme.dark
- ? 'bg-foreground border-foreground/20'
- : 'bg-muted-foreground/30 border-muted-foreground/40'
- "
- />
- {{ theme.label }}
- </div>
- </SelectItem>
- </SelectContent>
- </Select>
- </div>
- </div>
+ <div class="min-w-0 flex-1 overflow-hidden px-1 flex flex-col">
+ <div class="min-h-0 flex-1 overflow-y-auto overflow-x-hidden pr-1">
+ <section v-if="activeSettingsTab === 'editor'" class="flex flex-col gap-5 py-2">
+ <div class="grid gap-4 md:grid-cols-[minmax(0,1fr)_220px]">
+ <!-- Font Family -->
+ <div class="space-y-2">
+ <Label>{{ t("settings.fontFamily") }}</Label>
+ <SearchableSelect
+ :model-value="editFontFamily"
+ :options="systemFontOptions"
+ :placeholder="t('settings.selectFont')"
+ :search-placeholder="t('settings.searchFont')"
+ :empty-text="t('settings.noFontsFound')"
+ :loading-text="t('settings.loadingFonts')"
+ :loading="systemFontsLoading"
+ allow-custom
+ :display-name="displayFontFamily"
+ :normalize-custom="normalizeCustomFontFamilyInput"
+ trigger-class="h-9 w-full max-w-none justify-between border bg-background px-3 text-sm shadow-xs hover:bg-accent"
+ content-class="w-[var(--reka-popover-trigger-width)] min-w-[260px]"
+ @update:model-value="onFontFamilyChange"
+ @update:open="(open: boolean) => open && loadSystemFontOptions()"
+ >
+ <template #trigger-label="{ label, loading }">
+ <span class="truncate" :style="{ fontFamily: editFontFamily }">
+ {{ loading ? t("settings.loadingFonts") : label }}
+ </span>
+ </template>
+ <template #option-label="{ option, label }">
+ <span class="truncate" :style="{ fontFamily: option }">{{ label }}</span>
+ </template>
+ <template #custom-option-label="{ value }">
+ <span class="truncate" :style="{ fontFamily: value }">
+ {{ t("settings.useCustomFont", { font: readableFontFamily(value) }) }}
+ </span>
+ </template>
+ </SearchableSelect>
+ </div>
- <!-- Font Size -->
- <div class="space-y-2">
- <div class="flex items-center justify-between">
- <Label>{{ t("settings.fontSize") }}</Label>
- <span class="text-xs text-muted-foreground tabular-nums">{{ editFontSize }}px</span>
- </div>
- <input
- type="range"
- min="10"
- max="24"
- step="1"
- :value="editFontSize"
- @input="editFontSize = Number(($event.target as HTMLInputElement).value)"
- class="w-full accent-primary"
- />
- <div class="flex items-center gap-2 text-xs text-muted-foreground">
- <span>10px</span>
- <span class="flex-1 border-b border-dashed border-muted-foreground/30" />
- <span>24px</span>
+ <!-- Theme -->
+ <div class="space-y-2">
+ <Label>{{ t("settings.theme") }}</Label>
+ <Select :model-value="editTheme" @update:model-value="onThemeChange">
+ <SelectTrigger>
+ <SelectValue :placeholder="t('settings.selectTheme')" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem v-for="theme in EDITOR_THEMES" :key="theme.value" :value="theme.value">
+ <div class="flex items-center gap-2">
+ <span
+ class="h-3 w-3 rounded-full border"
+ :class="
+ theme.dark
+ ? 'bg-foreground border-foreground/20'
+ : 'bg-muted-foreground/30 border-muted-foreground/40'
+ "
+ />
+ {{ theme.label }}
+ </div>
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ </div>
</div>
- </div>
-
- <Separator />
- <div class="grid gap-4 md:grid-cols-2">
+ <!-- Font Size -->
<div class="space-y-2">
- <Label>{{ t("settings.executeMode") }}</Label>
- <Select :model-value="editExecuteMode" @update:model-value="onExecuteModeChange">
- <SelectTrigger>
- <SelectValue :placeholder="t('settings.executeMode')" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="all">{{ t("settings.executeModeAll") }}</SelectItem>
- <SelectItem value="current">{{ t("settings.executeModeCurrent") }}</SelectItem>
- </SelectContent>
- </Select>
+ <div class="flex items-center justify-between">
+ <Label>{{ t("settings.fontSize") }}</Label>
+ <span class="text-xs text-muted-foreground tabular-nums">{{ editFontSize }}px</span>
+ </div>
+ <input
+ type="range"
+ min="10"
+ max="24"
+ step="1"
+ :value="editFontSize"
+ @input="editFontSize = Number(($event.target as HTMLInputElement).value)"
+ class="w-full accent-primary"
+ />
+ <div class="flex items-center gap-2 text-xs text-muted-foreground">
+ <span>10px</span>
+ <span class="flex-1 border-b border-dashed border-muted-foreground/30" />
+ <span>24px</span>
+ </div>
</div>
- </div>
- <div class="grid gap-4 md:grid-cols-2">
- <div class="flex items-start justify-between gap-4">
- <div class="space-y-1">
- <Label for="editor-word-wrap">{{ t("settings.wordWrap") }}</Label>
- <p class="text-xs text-muted-foreground">{{ t("settings.wordWrapDescription") }}</p>
+ <Separator />
+
+ <div class="grid gap-4 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
+ <div class="space-y-2">
+ <Label>{{ t("settings.executeMode") }}</Label>
+ <Select :model-value="editExecuteMode" @update:model-value="onExecuteModeChange">
+ <SelectTrigger>
+ <SelectValue :placeholder="t('settings.executeMode')" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="all">{{ t("settings.executeModeAll") }}</SelectItem>
+ <SelectItem value="current">{{ t("settings.executeModeCurrent") }}</SelectItem>
+ </SelectContent>
+ </Select>
</div>
- <Switch id="editor-word-wrap" v-model:checked="editWordWrap" class="mt-0.5" />
- </div>
- </div>
- <Separator />
-
- <!-- Live Preview -->
- <div class="space-y-2">
- <Label>{{ t("settings.preview") }}</Label>
- <div
- class="rounded-md border overflow-auto max-w-full"
- :class="
- editTheme === 'vscode-light' || editTheme === 'duotone-light' || editTheme === 'xcode'
- ? 'border-border'
- : 'border-border/50'
- "
- >
- <div ref="previewRef" style="min-width: 100%" />
+ <div class="flex items-center justify-between gap-4 self-end rounded-md border bg-muted/20 px-3 py-2">
+ <div class="space-y-1">
+ <Label for="editor-word-wrap">{{ t("settings.wordWrap") }}</Label>
+ <p class="text-xs text-muted-foreground">{{ t("settings.wordWrapDescription") }}</p>
+ </div>
+ <Switch id="editor-word-wrap" v-model:checked="editWordWrap" class="mt-0.5" />
+ </div>
</div>
- </div>
- <DialogFooter class="mt-auto border-t-0 bg-transparent gap-3 sm:gap-3">
- <Button variant="outline" @click="resetDefaults">
- {{ t("settings.resetDefaults") }}
- </Button>
- <div class="flex-1" />
- <Button variant="outline" @click="emit('update:open', false)">
- {{ t("common.close") }}
- </Button>
- <Button :disabled="!hasChanges() || hasShortcutConflicts" @click="applySettings">
- {{ t("settings.apply") }}
- </Button>
- </DialogFooter>
- </section>
-
- <section v-else-if="activeSettingsTab === 'appearance'" class="flex min-h-full flex-col gap-5 py-2">
- <div class="space-y-2">
- <Label>{{ t("settings.appLayout") }}</Label>
- <div class="grid grid-cols-2 gap-2">
- <Button
- type="button"
- variant="outline"
- class="h-auto justify-start border p-3"
- :class="editAppLayout === 'separated' ? 'border-blue-300 ring-2 ring-blue-300/50' : ''"
- @click="setAppLayout('separated')"
- >
- <div class="text-left">
- <div class="text-sm font-medium">{{ t("settings.appLayoutSeparated") }}</div>
- <div class="text-xs text-muted-foreground">{{ t("settings.appLayoutSeparatedDescription") }}</div>
- </div>
- </Button>
- <Button
- type="button"
- variant="outline"
- class="h-auto justify-start border p-3"
- :class="editAppLayout === 'classic' ? 'border-blue-300 ring-2 ring-blue-300/50' : ''"
- @click="setAppLayout('classic')"
+ <Separator />
+
+ <!-- Live Preview -->
+ <div class="space-y-2">
+ <Label>{{ t("settings.preview") }}</Label>
+ <div
+ class="rounded-md border overflow-auto max-w-full"
+ :class="
+ editTheme === 'vscode-light' || editTheme === 'duotone-light' || editTheme === 'xcode'
+ ? 'border-border'
+ : 'border-border/50'
+ "
>
- <div class="text-left">
- <div class="text-sm font-medium">{{ t("settings.appLayoutClassic") }}</div>
- <div class="text-xs text-muted-foreground">{{ t("settings.appLayoutClassicDescription") }}</div>
- </div>
- </Button>
+ <div ref="previewRef" style="min-width: 100%" />
+ </div>
</div>
- </div>
+ </section>
- <DialogFooter class="mt-auto border-t-0 bg-transparent gap-3 sm:gap-3">
- <Button variant="outline" @click="resetDefaults">
- {{ t("settings.resetDefaults") }}
- </Button>
- <div class="flex-1" />
- <Button variant="outline" @click="emit('update:open', false)">
- {{ t("common.close") }}
- </Button>
- <Button :disabled="!hasChanges() || hasShortcutConflicts" @click="applySettings">
- {{ t("settings.apply") }}
- </Button>
- </DialogFooter>
- </section>
-
- <section v-else-if="activeSettingsTab === 'navigation'" class="flex min-h-full flex-col gap-5 py-2">
- <div class="space-y-2">
- <Label>{{ t("settings.sidebarActivation") }}</Label>
- <div class="grid grid-cols-2 gap-2">
- <Button
- type="button"
- variant="outline"
- class="h-auto justify-start border p-3"
- :class="editSidebarActivation === 'single' ? 'border-blue-300 ring-2 ring-blue-300/50' : ''"
- @click="setSidebarActivation('single')"
- >
- <div class="text-left">
- <div class="text-sm font-medium">{{ t("settings.sidebarActivationSingle") }}</div>
- <div class="text-xs text-muted-foreground">
- {{ t("settings.sidebarActivationSingleDescription") }}
+ <section v-else-if="activeSettingsTab === 'appearance'" class="flex flex-col gap-5 py-2">
+ <div class="space-y-2">
+ <Label>{{ t("settings.appLayout") }}</Label>
+ <div class="grid grid-cols-2 gap-2">
+ <Button
+ type="button"
+ variant="outline"
+ class="h-auto justify-start border p-3"
+ :class="editAppLayout === 'separated' ? 'border-blue-300 ring-2 ring-blue-300/50' : ''"
+ @click="setAppLayout('separated')"
+ >
+ <div class="text-left">
+ <div class="text-sm font-medium">{{ t("settings.appLayoutSeparated") }}</div>
+ <div class="text-xs text-muted-foreground">{{ t("settings.appLayoutSeparatedDescription") }}</div>
</div>
- </div>
- </Button>
- <Button
- type="button"
- variant="outline"
- class="h-auto justify-start border p-3"
- :class="editSidebarActivation === 'double' ? 'border-blue-300 ring-2 ring-blue-300/50' : ''"
- @click="setSidebarActivation('double')"
- >
- <div class="text-left">
- <div class="text-sm font-medium">{{ t("settings.sidebarActivationDouble") }}</div>
- <div class="text-xs text-muted-foreground">
- {{ t("settings.sidebarActivationDoubleDescription") }}
+ </Button>
+ <Button
+ type="button"
+ variant="outline"
+ class="h-auto justify-start border p-3"
+ :class="editAppLayout === 'classic' ? 'border-blue-300 ring-2 ring-blue-300/50' : ''"
+ @click="setAppLayout('classic')"
+ >
+ <div class="text-left">
+ <div class="text-sm font-medium">{{ t("settings.appLayoutClassic") }}</div>
+ <div class="text-xs text-muted-foreground">{{ t("settings.appLayoutClassicDescription") }}</div>
</div>
- </div>
- </Button>
+ </Button>
+ </div>
</div>
- </div>
+ </section>
- <DialogFooter class="mt-auto border-t-0 bg-transparent gap-3 sm:gap-3">
- <Button variant="outline" @click="resetDefaults">
- {{ t("settings.resetDefaults") }}
- </Button>
- <div class="flex-1" />
- <Button variant="outline" @click="emit('update:open', false)">
- {{ t("common.close") }}
- </Button>
- <Button :disabled="!hasChanges() || hasShortcutConflicts" @click="applySettings">
- {{ t("settings.apply") }}
- </Button>
- </DialogFooter>
- </section>
-
- <section v-else-if="activeSettingsTab === 'redis'" class="flex min-h-full flex-col gap-5 py-2">
- <div class="space-y-2">
- <Label>{{ t("settings.redisScanPageSize") }}</Label>
- <Select :model-value="String(editRedisScanPageSize)" @update:model-value="onRedisScanPageSizeChange">
- <SelectTrigger>
- <SelectValue :placeholder="t('settings.redisScanPageSize')" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem v-for="size in redisScanPageSizeOptions" :key="size" :value="String(size)">
- {{ t("settings.redisScanPageSizeOption", { count: size }) }}
- </SelectItem>
- </SelectContent>
- </Select>
- <p class="text-xs text-muted-foreground">{{ t("settings.redisScanPageSizeDescription") }}</p>
- </div>
-
- <DialogFooter class="mt-auto border-t-0 bg-transparent gap-3 sm:gap-3">
- <Button variant="outline" @click="resetDefaults">
- {{ t("settings.resetDefaults") }}
- </Button>
- <div class="flex-1" />
- <Button variant="outline" @click="emit('update:open', false)">
- {{ t("common.close") }}
- </Button>
- <Button :disabled="!hasChanges() || hasShortcutConflicts" @click="applySettings">
- {{ t("settings.apply") }}
- </Button>
- </DialogFooter>
- </section>
-
- <section v-else-if="activeSettingsTab === 'shortcuts'" class="flex min-h-full flex-col gap-5 py-2">
- <div class="space-y-3">
- <div
- v-for="definition in SHORTCUT_DEFINITIONS"
- :key="definition.id"
- class="grid gap-2 rounded-md border bg-background p-3 sm:grid-cols-[minmax(0,1fr)_220px] sm:items-center"
- >
- <div class="min-w-0 space-y-1">
- <Label>{{ t(definition.labelKey) }}</Label>
- <p class="text-xs text-muted-foreground">
- {{ t(`settings.shortcutScope${definition.scope[0].toUpperCase()}${definition.scope.slice(1)}`) }}
- </p>
- </div>
- <div class="space-y-1.5">
- <div class="flex gap-2">
- <Input
- :model-value="formatShortcut(editShortcuts[definition.id])"
- readonly
- :aria-invalid="shortcutConflicts.includes(definition.id)"
- :placeholder="t('settings.shortcutPressShortcut')"
- class="font-mono"
- @keydown="(event: KeyboardEvent) => onShortcutKeydown(definition.id, event)"
- />
- <Button type="button" variant="outline" class="shrink-0" @click="resetShortcut(definition.id)">
- {{ t("settings.reset") }}
- </Button>
- </div>
- <p v-if="shortcutConflicts.includes(definition.id)" class="text-xs text-destructive">
- {{ t("settings.shortcutConflict") }}
- </p>
+ <section v-else-if="activeSettingsTab === 'navigation'" class="flex flex-col gap-5 py-2">
+ <div class="space-y-2">
+ <Label>{{ t("settings.sidebarActivation") }}</Label>
+ <div class="grid grid-cols-2 gap-2">
+ <Button
+ type="button"
+ variant="outline"
+ class="h-auto justify-start border p-3"
+ :class="editSidebarActivation === 'single' ? 'border-blue-300 ring-2 ring-blue-300/50' : ''"
+ @click="setSidebarActivation('single')"
+ >
+ <div class="text-left">
+ <div class="text-sm font-medium">{{ t("settings.sidebarActivationSingle") }}</div>
+ <div class="text-xs text-muted-foreground">
+ {{ t("settings.sidebarActivationSingleDescription") }}
+ </div>
+ </div>
+ </Button>
+ <Button
+ type="button"
+ variant="outline"
+ class="h-auto justify-start border p-3"
+ :class="editSidebarActivation === 'double' ? 'border-blue-300 ring-2 ring-blue-300/50' : ''"
+ @click="setSidebarActivation('double')"
+ >
+ <div class="text-left">
+ <div class="text-sm font-medium">{{ t("settings.sidebarActivationDouble") }}</div>
+ <div class="text-xs text-muted-foreground">
+ {{ t("settings.sidebarActivationDoubleDescription") }}
+ </div>
+ </div>
+ </Button>
</div>
</div>
- </div>
+ </section>
- <DialogFooter class="mt-auto border-t-0 bg-transparent gap-3 sm:gap-3">
- <Button variant="outline" @click="resetDefaults">
- {{ t("settings.resetDefaults") }}
- </Button>
- <div class="flex-1" />
- <Button variant="outline" @click="emit('update:open', false)">
- {{ t("common.close") }}
- </Button>
- <Button :disabled="!hasChanges() || hasShortcutConflicts" @click="applySettings">
- {{ t("settings.apply") }}
- </Button>
- </DialogFooter>
- </section>
- <!-- AI Settings Tab -->
- <section v-else-if="activeSettingsTab === 'ai'" class="flex min-h-full flex-col gap-5 py-2">
- <p class="text-xs text-muted-foreground">{{ t("ai.settingsHint") }}</p>
-
- <div class="space-y-3">
- <div class="grid grid-cols-3 items-center gap-3">
- <Label class="text-right text-xs">{{ t("ai.provider") }}</Label>
- <Select :model-value="aiEditProvider" @update:model-value="(v: any) => aiSelectProvider(v)">
- <SelectTrigger class="col-span-2 h-8 text-xs">
- <SelectValue>
- <span class="flex items-center gap-2">
- <AiProviderLogo
- :provider="selectedAiProviderPreset.provider"
- :label="selectedAiProviderPreset.label"
- :icon-slug="selectedAiProviderPreset.iconSlug"
- />
- <span>{{ selectedAiProviderPreset.label }}</span>
- </span>
- </SelectValue>
+ <section v-else-if="activeSettingsTab === 'redis'" class="flex flex-col gap-5 py-2">
+ <div class="space-y-2">
+ <Label>{{ t("settings.redisScanPageSize") }}</Label>
+ <Select :model-value="String(editRedisScanPageSize)" @update:model-value="onRedisScanPageSizeChange">
+ <SelectTrigger>
+ <SelectValue :placeholder="t('settings.redisScanPageSize')" />
</SelectTrigger>
<SelectContent>
- <SelectItem
- v-for="provider in aiProviderOptions"
- :key="provider.provider"
- :value="provider.provider"
- >
- <span class="flex items-center gap-2">
- <AiProviderLogo
- :provider="provider.provider"
- :label="provider.label"
- :icon-slug="provider.iconSlug"
- />
- <span>{{ provider.label }}</span>
- </span>
+ <SelectItem v-for="size in redisScanPageSizeOptions" :key="size" :value="String(size)">
+ {{ t("settings.redisScanPageSizeOption", { count: size }) }}
</SelectItem>
</SelectContent>
</Select>
+ <p class="text-xs text-muted-foreground">{{ t("settings.redisScanPageSizeDescription") }}</p>
</div>
+ </section>
- <div class="grid grid-cols-3 items-center gap-3">
- <Label class="text-right text-xs">API Key</Label>
- <Input
- v-model="aiEditApiKey"
- type="password"
- autocomplete="off"
- class="col-span-2 h-8 text-xs"
- :placeholder="aiRequiresApiKey ? '' : 'Optional'"
- />
+ <section v-else-if="activeSettingsTab === 'shortcuts'" class="flex flex-col gap-5 py-2">
+ <div class="space-y-3">
+ <div
+ v-for="definition in SHORTCUT_DEFINITIONS"
+ :key="definition.id"
+ class="grid gap-2 rounded-md border bg-background p-3 sm:grid-cols-[minmax(0,1fr)_220px] sm:items-center"
+ >
+ <div class="min-w-0 space-y-1">
+ <Label>{{ t(definition.labelKey) }}</Label>
+ <p class="text-xs text-muted-foreground">
+ {{ t(`settings.shortcutScope${definition.scope[0].toUpperCase()}${definition.scope.slice(1)}`) }}
+ </p>
+ </div>
+ <div class="space-y-1.5">
+ <div class="flex gap-2">
+ <Input
+ :model-value="formatShortcut(editShortcuts[definition.id])"
+ readonly
+ :aria-invalid="shortcutConflicts.includes(definition.id)"
+ :placeholder="t('settings.shortcutPressShortcut')"
+ class="font-mono"
+ @keydown="(event: KeyboardEvent) => onShortcutKeydown(definition.id, event)"
+ />
+ <Button type="button" variant="outline" class="shrink-0" @click="resetShortcut(definition.id)">
+ {{ t("settings.reset") }}
+ </Button>
+ </div>
+ <p v-if="shortcutConflicts.includes(definition.id)" class="text-xs text-destructive">
+ {{ t("settings.shortcutConflict") }}
+ </p>
+ </div>
+ </div>
</div>
+ </section>
+ <!-- AI Settings Tab -->
+ <section v-else-if="activeSettingsTab === 'ai'" class="flex flex-col gap-5 py-2">
+ <p class="text-xs text-muted-foreground">{{ t("ai.settingsHint") }}</p>
+
+ <div class="space-y-3">
+ <div class="grid grid-cols-3 items-center gap-3">
+ <Label class="text-right text-xs">{{ t("ai.provider") }}</Label>
+ <Select :model-value="aiEditProvider" @update:model-value="(v: any) => aiSelectProvider(v)">
+ <SelectTrigger class="col-span-2 h-8 text-xs">
+ <SelectValue>
+ <span class="flex items-center gap-2">
+ <AiProviderLogo
+ :provider="selectedAiProviderPreset.provider"
+ :label="selectedAiProviderPreset.label"
+ :icon-slug="selectedAiProviderPreset.iconSlug"
+ />
+ <span>{{ selectedAiProviderPreset.label }}</span>
+ </span>
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem
+ v-for="provider in aiProviderOptions"
+ :key="provider.provider"
+ :value="provider.provider"
+ >
+ <span class="flex items-center gap-2">
+ <AiProviderLogo
+ :provider="provider.provider"
+ :label="provider.label"
+ :icon-slug="provider.iconSlug"
+ />
+ <span>{{ provider.label }}</span>
+ </span>
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ </div>
- <div class="grid grid-cols-3 items-center gap-3">
- <Label class="text-right text-xs">Endpoint</Label>
- <Input
- v-model="aiEditEndpoint"
- placeholder="https://api.openai.com/v1"
- autocomplete="off"
- class="col-span-2 h-8 text-xs"
- />
- </div>
+ <div class="grid grid-cols-3 items-center gap-3">
+ <Label class="text-right text-xs">API Key</Label>
+ <Input
+ v-model="aiEditApiKey"
+ type="password"
+ autocomplete="off"
+ class="col-span-2 h-8 text-xs"
+ :placeholder="aiRequiresApiKey ? '' : 'Optional'"
+ />
+ </div>
- <div class="grid grid-cols-3 items-start gap-3">
- <Label class="pt-2 text-right text-xs">{{ t("ai.model") }}</Label>
- <div class="col-span-2 space-y-1.5">
- <div class="flex min-w-0 items-center gap-2">
- <Input v-model="aiEditModel" autocomplete="off" class="h-8 min-w-0 flex-1 text-xs" />
- <SearchableSelect
- :model-value="aiEditModel"
- :options="aiModelOptionIds"
- :placeholder="t('ai.browseModels')"
- :search-placeholder="t('ai.searchModels')"
- :empty-text="aiModelEmptyText"
- :loading-text="t('ai.loadingModels')"
- :loading="aiModelLoading"
- :display-name="displayAiModelName"
- trigger-class="h-8 min-w-[104px] max-w-[150px] shrink-0 border border-border bg-background px-2 text-xs shadow-none hover:bg-muted/50"
- content-class="w-72"
- @update:model-value="aiSelectModel"
- @update:open="onAiModelListOpen"
+ <div class="grid grid-cols-3 items-center gap-3">
+ <Label class="text-right text-xs">Endpoint</Label>
+ <Input
+ v-model="aiEditEndpoint"
+ placeholder="https://api.openai.com/v1"
+ autocomplete="off"
+ class="col-span-2 h-8 text-xs"
+ />
+ </div>
+
+ <div class="grid grid-cols-3 items-start gap-3">
+ <Label class="pt-2 text-right text-xs">{{ t("ai.model") }}</Label>
+ <div class="col-span-2 space-y-1.5">
+ <div class="flex min-w-0 items-center gap-2">
+ <Input v-model="aiEditModel" autocomplete="off" class="h-8 min-w-0 flex-1 text-xs" />
+ <SearchableSelect
+ :model-value="aiEditModel"
+ :options="aiModelOptionIds"
+ :placeholder="t('ai.browseModels')"
+ :search-placeholder="t('ai.searchModels')"
+ :empty-text="aiModelEmptyText"
+ :loading-text="t('ai.loadingModels')"
+ :loading="aiModelLoading"
+ :display-name="displayAiModelName"
+ trigger-class="h-8 min-w-[104px] max-w-[150px] shrink-0 border border-border bg-background px-2 text-xs shadow-none hover:bg-muted/50"
+ content-class="w-72"
+ @update:model-value="aiSelectModel"
+ @update:open="onAiModelListOpen"
+ >
+ <template #trigger-label="{ loading }">
+ <span class="truncate">{{ loading ? t("ai.loadingModels") : t("ai.browseModels") }}</span>
+ </template>
+ <template #option-label="{ option, label }">
+ <span class="flex min-w-0 flex-col">
+ <span class="truncate">{{ label }}</span>
+ <span v-if="label !== option" class="truncate text-[11px] text-muted-foreground">{{
+ option
+ }}</span>
+ </span>
+ </template>
+ </SearchableSelect>
+ <Button
+ type="button"
+ size="icon"
+ variant="outline"
+ class="shrink-0"
+ :disabled="aiModelLoading || !aiModelListSupported"
+ :title="t('ai.refreshModels')"
+ :aria-label="t('ai.refreshModels')"
+ @click="aiRefreshModels"
+ >
+ <Loader2 v-if="aiModelLoading" class="h-3.5 w-3.5 animate-spin" />
+ <RefreshCw v-else class="h-3.5 w-3.5" />
+ </Button>
+ </div>
+ <p v-if="aiModelError" class="text-xs text-destructive">{{ aiModelError }}</p>
+ <p v-else-if="!aiModelOptionIds.length" class="text-xs text-muted-foreground">
+ {{ aiModelListSupported ? t("ai.modelListHint") : t("ai.modelListUnsupported") }}
+ </p>
+ </div>
+ </div>
+
+ <div v-if="aiSupportsApiStyle" class="grid grid-cols-3 items-center gap-3">
+ <Label class="text-right text-xs">API</Label>
+ <div class="col-span-2 flex gap-2">
+ <Button
+ size="sm"
+ variant="outline"
+ class="h-8 flex-1 text-xs"
+ :class="{ 'border-blue-300 border-2 ring-2 ring-blue-300/50': aiEditApiStyle === 'completions' }"
+ @click="aiEditApiStyle = 'completions'"
+ >/chat/completions</Button
>
- <template #trigger-label="{ loading }">
- <span class="truncate">{{ loading ? t("ai.loadingModels") : t("ai.browseModels") }}</span>
- </template>
- <template #option-label="{ option, label }">
- <span class="flex min-w-0 flex-col">
- <span class="truncate">{{ label }}</span>
- <span v-if="label !== option" class="truncate text-[11px] text-muted-foreground">{{
- option
- }}</span>
- </span>
- </template>
- </SearchableSelect>
<Button
- type="button"
- size="icon"
+ size="sm"
variant="outline"
- class="shrink-0"
- :disabled="aiModelLoading || !aiModelListSupported"
- :title="t('ai.refreshModels')"
- :aria-label="t('ai.refreshModels')"
- @click="aiRefreshModels"
+ class="h-8 flex-1 text-xs"
+ :class="{ 'border-blue-300 border-2 ring-2 ring-blue-300/50': aiEditApiStyle === 'responses' }"
+ @click="aiEditApiStyle = 'responses'"
+ >/responses</Button
>
- <Loader2 v-if="aiModelLoading" class="h-3.5 w-3.5 animate-spin" />
- <RefreshCw v-else class="h-3.5 w-3.5" />
- </Button>
</div>
- <p v-if="aiModelError" class="text-xs text-destructive">{{ aiModelError }}</p>
- <p v-else-if="!aiModelOptionIds.length" class="text-xs text-muted-foreground">
- {{ aiModelListSupported ? t("ai.modelListHint") : t("ai.modelListUnsupported") }}
- </p>
</div>
- </div>
- <div v-if="aiSupportsApiStyle" class="grid grid-cols-3 items-center gap-3">
- <Label class="text-right text-xs">API</Label>
- <div class="col-span-2 flex gap-2">
- <Button
- size="sm"
- variant="outline"
- class="h-8 flex-1 text-xs"
- :class="{ 'border-blue-300 border-2 ring-2 ring-blue-300/50': aiEditApiStyle === 'completions' }"
- @click="aiEditApiStyle = 'completions'"
- >/chat/completions</Button
- >
- <Button
- size="sm"
- variant="outline"
- class="h-8 flex-1 text-xs"
- :class="{ 'border-blue-300 border-2 ring-2 ring-blue-300/50': aiEditApiStyle === 'responses' }"
- @click="aiEditApiStyle = 'responses'"
- >/responses</Button
- >
+ <div class="grid grid-cols-3 items-center gap-3">
+ <Label class="text-right text-xs">{{ t("ai.enableThinking") }}</Label>
+ <div class="col-span-2 flex items-center gap-2">
+ <label class="flex items-center gap-2 text-xs text-muted-foreground">
+ <input
+ v-model="aiEditEnableThinking"
+ type="checkbox"
+ class="h-4 w-4 shrink-0 accent-primary"
+ :disabled="!aiCompletionsMode || aiEditProvider === 'gemini'"
+ />
+ {{ aiEditEnableThinking ? t("ai.enableThinkingOn") : t("ai.enableThinkingOff") }}
+ </label>
+ <Popover>
+ <PopoverTrigger as-child>
+ <CircleHelp class="h-3.5 w-3.5 cursor-help text-muted-foreground hover:text-foreground" />
+ </PopoverTrigger>
+ <PopoverContent class="max-w-[320px] text-xs leading-relaxed" side="top" align="start">
+ {{ t("ai.enableThinkingHint") }}
+ </PopoverContent>
+ </Popover>
+ </div>
</div>
- </div>
- <div class="grid grid-cols-3 items-center gap-3">
- <Label class="text-right text-xs">{{ t("ai.enableThinking") }}</Label>
- <div class="col-span-2 flex items-center gap-2">
- <label class="flex items-center gap-2 text-xs text-muted-foreground">
- <input
- v-model="aiEditEnableThinking"
- type="checkbox"
- class="h-4 w-4 shrink-0 accent-primary"
- :disabled="!aiCompletionsMode || aiEditProvider === 'gemini'"
- />
- {{ aiEditEnableThinking ? t("ai.enableThinkingOn") : t("ai.enableThinkingOff") }}
+ <div class="grid grid-cols-3 items-center gap-3">
+ <Label class="text-right text-xs">{{ t("ai.proxy") }}</Label>
+ <label class="col-span-2 flex items-center gap-2 text-xs text-muted-foreground">
+ <input v-model="aiEditProxyEnabled" type="checkbox" class="h-4 w-4 shrink-0 accent-primary" />
+ {{ t("ai.proxyEnable") }}
</label>
- <Popover>
- <PopoverTrigger as-child>
- <CircleHelp class="h-3.5 w-3.5 cursor-help text-muted-foreground hover:text-foreground" />
- </PopoverTrigger>
- <PopoverContent class="max-w-[320px] text-xs leading-relaxed" side="top" align="start">
- {{ t("ai.enableThinkingHint") }}
- </PopoverContent>
- </Popover>
</div>
- </div>
- <div class="grid grid-cols-3 items-center gap-3">
- <Label class="text-right text-xs">{{ t("ai.proxy") }}</Label>
- <label class="col-span-2 flex items-center gap-2 text-xs text-muted-foreground">
- <input v-model="aiEditProxyEnabled" type="checkbox" class="h-4 w-4 shrink-0 accent-primary" />
- {{ t("ai.proxyEnable") }}
- </label>
+ <div class="grid grid-cols-3 items-center gap-3">
+ <Label class="text-right text-xs">{{ t("ai.proxyUrl") }}</Label>
+ <Input
+ v-model="aiEditProxyUrl"
+ autocomplete="off"
+ class="col-span-2 h-8 text-xs"
+ placeholder="socks5://127.0.0.1:7890"
+ :disabled="!aiEditProxyEnabled"
+ />
+ </div>
</div>
+ </section>
- <div class="grid grid-cols-3 items-center gap-3">
- <Label class="text-right text-xs">{{ t("ai.proxyUrl") }}</Label>
+ <section v-else-if="activeSettingsTab === 'security' && isWeb" class="flex flex-col gap-5 py-2">
+ <div class="space-y-3">
+ <Label class="text-base">{{ t("auth.changePassword") }}</Label>
+ <p class="text-sm text-muted-foreground">{{ t("auth.changePasswordDescription") }}</p>
+ <Input
+ v-model="oldPassword"
+ type="password"
+ :placeholder="t('auth.oldPassword')"
+ class="h-9"
+ autocomplete="off"
+ />
+ <Input
+ v-model="newPassword"
+ type="password"
+ :placeholder="t('auth.newPassword')"
+ class="h-9"
+ autocomplete="off"
+ />
<Input
- v-model="aiEditProxyUrl"
+ v-model="confirmNewPassword"
+ type="password"
+ :placeholder="t('auth.confirmPassword')"
+ class="h-9"
autocomplete="off"
- class="col-span-2 h-8 text-xs"
- placeholder="socks5://127.0.0.1:7890"
- :disabled="!aiEditProxyEnabled"
/>
+ <p
+ v-if="passwordMessage"
+ class="text-xs"
+ :class="passwordError ? 'text-destructive' : 'text-green-500'"
+ >
+ {{ passwordMessage }}
+ </p>
+ </div>
+ </section>
+
+ <section v-else-if="activeSettingsTab === 'about'" class="flex flex-col gap-5 py-2">
+ <div class="rounded-lg border bg-muted/20 p-4">
+ <div class="flex items-start justify-between gap-4">
+ <div class="min-w-0 space-y-1">
+ <div class="text-lg font-semibold">DBX</div>
+ <p class="text-sm text-muted-foreground">{{ t("settings.aboutDescription") }}</p>
+ </div>
+ <div
+ v-if="displayedAppVersion"
+ class="rounded-md border bg-background px-2 py-1 text-xs text-muted-foreground"
+ >
+ {{ displayedAppVersion }}
+ </div>
+ </div>
</div>
- </div>
- <DialogFooter class="mt-auto border-t-0 bg-transparent gap-3 sm:gap-3">
- <div class="flex flex-1 items-center gap-2">
- <Button
- size="sm"
- variant="outline"
- :disabled="
- aiTesting ||
- (aiRequiresApiKey && !aiEditApiKey?.trim()) ||
- !aiEditEndpoint?.trim() ||
- !aiEditModel?.trim()
- "
- @click="aiTestConn"
+ <div class="grid gap-3 sm:grid-cols-2">
+ <button
+ type="button"
+ class="rounded-lg border p-4 text-left transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ @click="openExternalUrl('https://qm.qq.com/cgi-bin/qm/qr?k=&group_code=1087880322')"
>
- <Loader2 v-if="aiTesting" class="h-3 w-3 animate-spin mr-1" />
- {{ t("connection.test") }}
- </Button>
- <span v-if="aiTestResult === 'success'" class="text-xs text-green-500">{{
- t("connection.testSuccess")
- }}</span>
- <span
- v-else-if="aiTestResult === 'error'"
- class="text-xs text-destructive truncate max-w-[200px]"
- :title="aiTestError"
- >{{ aiTestError }}</span
+ <div class="text-xs font-medium uppercase tracking-wider text-muted-foreground">
+ {{ t("settings.community") }}
+ </div>
+ <div class="mt-3 flex items-center gap-2 text-sm font-medium">
+ <img
+ src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iODYiIHdpZHRoPSI4NiIgdmlld0JveD0iMCAwIDEyMCAxNDUiPjxwYXRoIGZpbGw9IiNmYWFiMDciIGQ9Ik02MC41MDMgMTQyLjIzN2MtMTIuNTMzIDAtMjQuMDM4LTQuMTk1LTMxLjQ0NS0xMC40Ni0zLjc2MiAxLjEyNC04LjU3NCAyLjkzMi0xMS42MSA1LjE3NS0yLjYgMS45MTgtMi4yNzUgMy44NzQtMS44MDcgNC42NjMgMi4wNTYgMy40NyAzNS4yNzMgMi4yMTYgNDQuODYyIDEuMTM2em0wIDBjMTIuNTM1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YxIDguMDI4IDUxLjQzNiA3Ljg0NWguMTUzYzE1LjE3NS4xODMgMzUuMjQyLTIuOTYzIDUxLjQzNy03Ljg0NXptMCAwIi8+PC9zdmc+"
+ alt="QQ"
+ class="h-7 w-7 rounded-md bg-white p-1"
+ />
+ {{ t("settings.qqGroup") }}
+ <ExternalLink class="ml-auto h-3.5 w-3.5 text-muted-foreground" />
+ </div>
+ <div class="mt-1 font-mono text-base">1087880322</div>
+ </button>
+ <button
+ type="button"
+ class="rounded-lg border p-4 text-left transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ @click="openExternalUrl('https://discord.gg/W7NyVDRt6a')"
>
- </div>
- <Button variant="outline" @click="emit('update:open', false)">{{ t("common.close") }}</Button>
- <Button :disabled="!aiHasChanges()" @click="aiApplySettings">{{ t("settings.apply") }}</Button>
- </DialogFooter>
- </section>
-
- <section v-else-if="activeSettingsTab === 'security' && isWeb" class="flex min-h-full flex-col gap-5 py-2">
- <div class="space-y-3">
- <Label class="text-base">{{ t("auth.changePassword") }}</Label>
- <p class="text-sm text-muted-foreground">{{ t("auth.changePasswordDescription") }}</p>
- <Input
- v-model="oldPassword"
- type="password"
- :placeholder="t('auth.oldPassword')"
- class="h-9"
- autocomplete="off"
- />
- <Input
- v-model="newPassword"
- type="password"
- :placeholder="t('auth.newPassword')"
- class="h-9"
- autocomplete="off"
- />
- <Input
- v-model="confirmNewPassword"
- type="password"
- :placeholder="t('auth.confirmPassword')"
- class="h-9"
- autocomplete="off"
- />
- <p v-if="passwordMessage" class="text-xs" :class="passwordError ? 'text-destructive' : 'text-green-500'">
- {{ passwordMessage }}
- </p>
- </div>
- <DialogFooter class="mt-auto border-t-0 bg-transparent">
- <Button variant="outline" @click="emit('update:open', false)">
- {{ t("common.close") }}
- </Button>
- <Button
- :disabled="changingPassword || !oldPassword || !newPassword || !confirmNewPassword"
- @click="changePassword"
- >
- {{ t("auth.changePassword") }}
- </Button>
- </DialogFooter>
- </section>
-
- <section v-else-if="activeSettingsTab === 'about'" class="flex min-h-full flex-col gap-5 py-2">
- <div class="rounded-lg border bg-muted/20 p-4">
- <div class="flex items-start justify-between gap-4">
- <div class="min-w-0 space-y-1">
- <div class="text-lg font-semibold">DBX</div>
- <p class="text-sm text-muted-foreground">{{ t("settings.aboutDescription") }}</p>
- </div>
- <div
- v-if="displayedAppVersion"
- class="rounded-md border bg-background px-2 py-1 text-xs text-muted-foreground"
+ <div class="text-xs font-medium uppercase tracking-wider text-muted-foreground">
+ {{ t("settings.community") }}
+ </div>
+ <div class="mt-3 flex items-center gap-2 text-sm font-medium">
+ <img
+ src="https://cdn.simpleicons.org/discord/5865F2"
+ alt="Discord"
+ class="h-7 w-7 rounded-md bg-white p-1"
+ />
+ Discord
+ <ExternalLink class="ml-auto h-3.5 w-3.5 text-muted-foreground" />
+ </div>
+ <div class="mt-1 text-sm text-primary">discord.gg/W7NyVDRt6a</div>
+ </button>
+ <button
+ type="button"
+ class="rounded-lg border p-4 text-left transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ @click="openExternalUrl('https://github.com/t8y2/dbx')"
>
- {{ displayedAppVersion }}
- </div>
+ <div class="text-xs font-medium uppercase tracking-wider text-muted-foreground">
+ {{ t("settings.project") }}
+ </div>
+ <div class="mt-3 flex items-center gap-2 text-sm font-medium">
+ <img
+ src="https://cdn.simpleicons.org/github/181717"
+ alt="GitHub"
+ class="h-7 w-7 rounded-md bg-white p-1"
+ />
+ {{ t("settings.openSource") }}
+ <ExternalLink class="ml-auto h-3.5 w-3.5 text-muted-foreground" />
+ </div>
+ <div class="mt-1 text-sm text-primary">github.com/t8y2/dbx</div>
+ </button>
+ <button
+ type="button"
+ class="rounded-lg border p-4 text-left transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ @click="openExternalUrl('https://dbxio.com')"
+ >
+ <div class="text-xs font-medium uppercase tracking-wider text-muted-foreground">
+ {{ t("settings.project") }}
+ </div>
+ <div class="mt-3 flex items-center gap-2 text-sm font-medium">
+ <img src="/logo.png" alt="DBX" class="h-7 w-7 rounded-md" />
+ {{ t("settings.officialDocs") }}
+ <ExternalLink class="ml-auto h-3.5 w-3.5 text-muted-foreground" />
+ </div>
+ <div class="mt-1 text-sm text-primary">dbxio.com</div>
+ </button>
</div>
- </div>
+ </section>
+ </div>
- <div class="grid gap-3 sm:grid-cols-2">
- <button
- type="button"
- class="rounded-lg border p-4 text-left transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- @click="openExternalUrl('https://qm.qq.com/cgi-bin/qm/qr?k=&group_code=1087880322')"
- >
- <div class="text-xs font-medium uppercase tracking-wider text-muted-foreground">
- {{ t("settings.community") }}
- </div>
- <div class="mt-3 flex items-center gap-2 text-sm font-medium">
- <img
- src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iODYiIHdpZHRoPSI4NiIgdmlld0JveD0iMCAwIDEyMCAxNDUiPjxwYXRoIGZpbGw9IiNmYWFiMDciIGQ9Ik02MC41MDMgMTQyLjIzN2MtMTIuNTMzIDAtMjQuMDM4LTQuMTk1LTMxLjQ0NS0xMC40Ni0zLjc2MiAxLjEyNC04LjU3NCAyLjkzMi0xMS42MSA1LjE3NS0yLjYgMS45MTgtMi4yNzUgMy44NzQtMS44MDcgNC42NjMgMi4wNTYgMy40NyAzNS4yNzMgMi4yMTYgNDQuODYyIDEuMTM2em0wIDBjMTIuNTM1IDAgMjQuMDM5LTQuMTk1IDMxLjQ0Ny0xMC40NiAzLjc2IDEuMTI0IDguNTczIDIuOTMyIDExLjYxIDUuMTc1IDIuNTk4IDEuOTE4IDIuMjc0IDMuODc0IDEuODA1IDQuNjYzLTIuMDU2IDMuNDctMzUuMjcyIDIuMjE2LTQ0Ljg2MiAxLjEzNnptMCAwIi8+PHBhdGggZD0iTTYwLj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I2LTEuMjYzIDEuMDk1LTEuNzM0Ljg3NS0uMzA1LS4xNDItNC4wODItMi42Ni03LjU2MiAxLjA5Ny0uMjQuMjU3LS42NjguMzQ2LTEuMDczLjA0LS40MDctLjMwOC0uNTc0LS45My0uMzM0LTEuMzYyIi8+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTYwLjU3NiA4My4wOGgtLjE1M2MtOS45OTYuMTItMjIuMTE2LTEuMjA0LTMzLjg1NC0zLjUxOC0xLjAwNCA1LjgxOC0xLjYxIDEzLjEzMi0xLjA5IDIxLjg1MyAxLjMxNiAyMi4wNDMgMTQuNDA3IDM1LjkgMzQuNjE0IDM2LjFoLjgyYzIwLjIwOC0uMiAzMy4yOTgtMTQuMDU3IDM0LjYxNi0zNi4xLjUyLTguNzIzLS4wODctMTYuMDM1LTEuMDkyLTIxLjg1NC0xMS43MzkgMi4zMTUtMjMuODYyIDMuNjQtMzMuODYgMy41MTgiLz48cGF0aCBmaWxsPSIjZWIxOTIzIiBkPSJNMzIuMTAyIDgxLjIzNXYyMS42OTNzOS45MzcgMi4wMDQgMTkuODkzLjYxNlY4My41MzVjLTYuMzA3LS4zNTctMTMuMTA5LTEuMTUyLTE5Ljg5My0yLjMiLz48cGF0aCBmaWxsPSIjZWIxOTIzIiBkPSJNMTA1LjUzOSA2MC40MTJzLTE5LjMzIDYuMTAyLTQ0Ljk2MyA2LjI3NWgtLjE1M2MtMjUuNTkxLS4xNzItNDQuODk2LTYuMjU1LTQ0Ljk2Mi02LjI3NUw4Ljk4NyA3Ni41N2MxNi4xOTMgNC44ODIgMzYuMjYxIDguMDI4IDUxLjQzNiA3Ljg0NWguMTUzYzE1LjE3NS4xODMgMzUuMjQyLTIuOTYzIDUxLjQzNy03Ljg0NXptMCAwIi8+PC9zdmc+"
- alt="QQ"
- class="h-7 w-7 rounded-md bg-white p-1"
- />
- {{ t("settings.qqGroup") }}
- <ExternalLink class="ml-auto h-3.5 w-3.5 text-muted-foreground" />
- </div>
- <div class="mt-1 font-mono text-base">1087880322</div>
- </button>
- <button
- type="button"
- class="rounded-lg border p-4 text-left transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- @click="openExternalUrl('https://discord.gg/W7NyVDRt6a')"
- >
- <div class="text-xs font-medium uppercase tracking-wider text-muted-foreground">
- {{ t("settings.community") }}
- </div>
- <div class="mt-3 flex items-center gap-2 text-sm font-medium">
- <img
- src="https://cdn.simpleicons.org/discord/5865F2"
- alt="Discord"
- class="h-7 w-7 rounded-md bg-white p-1"
- />
- Discord
- <ExternalLink class="ml-auto h-3.5 w-3.5 text-muted-foreground" />
- </div>
- <div class="mt-1 text-sm text-primary">discord.gg/W7NyVDRt6a</div>
- </button>
- <button
- type="button"
- class="rounded-lg border p-4 text-left transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- @click="openExternalUrl('https://github.com/t8y2/dbx')"
+ <DialogFooter
+ v-if="hasSettingsApplyFooter(activeSettingsTab as SettingsCategory)"
+ class="mx-0 mb-0 shrink-0 rounded-none border-t-0 bg-transparent px-0 pb-0 pt-3 gap-3 sm:gap-3"
+ >
+ <Button variant="outline" @click="resetDefaults">
+ {{ t("settings.resetDefaults") }}
+ </Button>
+ <div class="flex-1" />
+ <Button variant="outline" @click="emit('update:open', false)">
+ {{ t("common.close") }}
+ </Button>
+ <Button :disabled="!hasChanges() || hasShortcutConflicts" @click="applySettings">
+ {{ t("settings.apply") }}
+ </Button>
+ </DialogFooter>
+
+ <DialogFooter
+ v-else-if="activeSettingsTab === 'ai'"
+ class="mx-0 mb-0 shrink-0 rounded-none border-t-0 bg-transparent px-0 pb-0 pt-3 gap-3 sm:gap-3"
+ >
+ <div class="flex flex-1 items-center gap-2">
+ <Button
+ size="sm"
+ variant="outline"
+ :disabled="
+ aiTesting ||
+ (aiRequiresApiKey && !aiEditApiKey?.trim()) ||
+ !aiEditEndpoint?.trim() ||
+ !aiEditModel?.trim()
+ "
+ @click="aiTestConn"
>
- <div class="text-xs font-medium uppercase tracking-wider text-muted-foreground">
- {{ t("settings.project") }}
- </div>
- <div class="mt-3 flex items-center gap-2 text-sm font-medium">
- <img
- src="https://cdn.simpleicons.org/github/181717"
- alt="GitHub"
- class="h-7 w-7 rounded-md bg-white p-1"
- />
- {{ t("settings.openSource") }}
- <ExternalLink class="ml-auto h-3.5 w-3.5 text-muted-foreground" />
- </div>
- <div class="mt-1 text-sm text-primary">github.com/t8y2/dbx</div>
- </button>
- <button
- type="button"
- class="rounded-lg border p-4 text-left transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- @click="openExternalUrl('https://dbxio.com')"
+ <Loader2 v-if="aiTesting" class="h-3 w-3 animate-spin mr-1" />
+ {{ t("connection.test") }}
+ </Button>
+ <span v-if="aiTestResult === 'success'" class="text-xs text-green-500">
+ {{ t("connection.testSuccess") }}
+ </span>
+ <span
+ v-else-if="aiTestResult === 'error'"
+ class="text-xs text-destructive truncate max-w-[200px]"
+ :title="aiTestError"
>
- <div class="text-xs font-medium uppercase tracking-wider text-muted-foreground">
- {{ t("settings.project") }}
- </div>
- <div class="mt-3 flex items-center gap-2 text-sm font-medium">
- <img src="/logo.png" alt="DBX" class="h-7 w-7 rounded-md" />
- {{ t("settings.officialDocs") }}
- <ExternalLink class="ml-auto h-3.5 w-3.5 text-muted-foreground" />
- </div>
- <div class="mt-1 text-sm text-primary">dbxio.com</div>
- </button>
+ {{ aiTestError }}
+ </span>
</div>
+ <Button variant="outline" @click="emit('update:open', false)">{{ t("common.close") }}</Button>
+ <Button :disabled="!aiHasChanges()" @click="aiApplySettings">{{ t("settings.apply") }}</Button>
+ </DialogFooter>
- <DialogFooter class="mt-auto border-t-0 bg-transparent">
- <Button variant="outline" @click="emit('update:open', false)">
- {{ t("common.close") }}
- </Button>
- </DialogFooter>
- </section>
+ <DialogFooter
+ v-else-if="activeSettingsTab === 'security' && isWeb"
+ class="mx-0 mb-0 shrink-0 rounded-none border-t-0 bg-transparent px-0 pb-0 pt-3"
+ >
+ <Button variant="outline" @click="emit('update:open', false)">
+ {{ t("common.close") }}
+ </Button>
+ <Button
+ :disabled="changingPassword || !oldPassword || !newPassword || !confirmNewPassword"
+ @click="changePassword"
+ >
+ {{ t("auth.changePassword") }}
+ </Button>
+ </DialogFooter>
+
+ <DialogFooter
+ v-else-if="activeSettingsTab === 'about'"
+ class="mx-0 mb-0 shrink-0 rounded-none border-t-0 bg-transparent px-0 pb-0 pt-3"
+ >
+ <Button variant="outline" @click="emit('update:open', false)">
+ {{ t("common.close") }}
+ </Button>
+ </DialogFooter>
</div>
</div>
</DialogContent>
diff --git a/apps/desktop/src/components/ui/searchable-select/SearchableSelect.vue b/apps/desktop/src/components/ui/searchable-select/SearchableSelect.vue
index 54c6c53fd0..fb760e444b 100644
--- a/apps/desktop/src/components/ui/searchable-select/SearchableSelect.vue
+++ b/apps/desktop/src/components/ui/searchable-select/SearchableSelect.vue
@@ -17,13 +17,17 @@ const props = withDefaults(
emptyText: string;
loadingText: string;
loading?: boolean;
+ allowCustom?: boolean;
triggerClass?: HTMLAttributes["class"];
contentClass?: HTMLAttributes["class"];
displayName?: (option: string) => string;
+ normalizeCustom?: (value: string) => string;
}>(),
{
loading: false,
+ allowCustom: false,
displayName: (option: string) => option,
+ normalizeCustom: (value: string) => value,
},
);
@@ -42,6 +46,10 @@ const selectedLabel = computed(() => {
});
const filteredOptions = computed(() => filterDatabaseOptions(props.options, searchText.value, props.displayName));
+const customOptionValue = computed(() => props.normalizeCustom(searchText.value.trim()));
+const canSelectCustom = computed(
+ () => props.allowCustom && !!customOptionValue.value && !props.options.includes(customOptionValue.value),
+);
watch(open, async (value) => {
emit("update:open", value);
@@ -58,6 +66,11 @@ function selectOption(option: string) {
emit("update:modelValue", option);
open.value = false;
}
+
+function selectCustomOption() {
+ if (!canSelectCustom.value) return;
+ selectOption(customOptionValue.value);
+}
</script>
<template>
@@ -107,7 +120,29 @@ function selectOption(option: string) {
<span class="truncate">{{ displayName(option) }}</span>
</slot>
</button>
+ <button
+ v-if="canSelectCustom"
+ type="button"
+ class="flex h-8 w-full min-w-0 items-center gap-2 rounded-sm px-2 text-left text-sm hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:outline-none"
+ @click="selectCustomOption"
+ >
+ <Check class="h-3.5 w-3.5 shrink-0 opacity-0" />
+ <slot name="custom-option-label" :value="customOptionValue">
+ <span class="truncate">{{ customOptionValue }}</span>
+ </slot>
+ </button>
</template>
+ <button
+ v-else-if="canSelectCustom"
+ type="button"
+ class="flex h-8 w-full min-w-0 items-center gap-2 rounded-sm px-2 text-left text-sm hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:outline-none"
+ @click="selectCustomOption"
+ >
+ <Check class="h-3.5 w-3.5 shrink-0 opacity-0" />
+ <slot name="custom-option-label" :value="customOptionValue">
+ <span class="truncate">{{ customOptionValue }}</span>
+ </slot>
+ </button>
<div v-else class="px-2 py-2 text-sm text-muted-foreground">
{{ emptyText }}
</div>
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 30ee23c9b5..c3f656875b 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -1172,6 +1172,10 @@ export default {
aboutTab: "About",
fontFamily: "Font Family",
selectFont: "Select font...",
+ searchFont: "Search fonts...",
+ loadingFonts: "Loading fonts...",
+ noFontsFound: "No fonts found",
+ useCustomFont: "Use “{font}”",
fontSize: "Font Size",
theme: "Theme",
selectTheme: "Select theme...",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index c801bba8ad..ef18f2d5c4 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -1071,6 +1071,10 @@ export default {
aboutTab: "Acerca de",
fontFamily: "Familia tipográfica",
selectFont: "Seleccionar fuente...",
+ searchFont: "Buscar fuentes...",
+ loadingFonts: "Cargando fuentes...",
+ noFontsFound: "No se encontraron fuentes",
+ useCustomFont: "Usar “{font}”",
fontSize: "Tamaño de fuente",
theme: "Tema",
selectTheme: "Seleccionar tema...",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index 791f1612d4..fd1aa3b00b 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -1150,6 +1150,10 @@ export default {
aboutTab: "关于我们",
fontFamily: "字体",
selectFont: "选择字体...",
+ searchFont: "搜索字体...",
+ loadingFonts: "正在加载字体...",
+ noFontsFound: "未找到字体",
+ useCustomFont: "使用“{font}”",
fontSize: "字号",
theme: "主题",
selectTheme: "选择主题...",
diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.ts
index 52d5c29525..fac2242ab4 100644
--- a/apps/desktop/src/lib/api.ts
+++ b/apps/desktop/src/lib/api.ts
@@ -99,6 +99,9 @@ export const saveAiConversation = forward("saveAiConversation");
export const loadAiConversations = forward("loadAiConversations");
export const deleteAiConversation = forward("deleteAiConversation");
+// System
+export const listSystemFonts = forward("listSystemFonts");
+
// SQL File Execution
export const previewSqlFile = forward("previewSqlFile");
export const executeSqlFile = forward("executeSqlFile");
diff --git a/apps/desktop/src/lib/http.ts b/apps/desktop/src/lib/http.ts
index c52303107c..6068c394cc 100644
--- a/apps/desktop/src/lib/http.ts
+++ b/apps/desktop/src/lib/http.ts
@@ -105,6 +105,10 @@ export async function loadConnections(): Promise<ConnectionConfig[]> {
return get("/api/connection/list");
}
+export async function listSystemFonts(): Promise<string[]> {
+ return [];
+}
+
export async function listPlugins(): Promise<InstalledPlugin[]> {
return get("/api/plugins");
}
diff --git a/apps/desktop/src/lib/tauri.ts b/apps/desktop/src/lib/tauri.ts
index 64215a8069..8022f4fb3d 100644
--- a/apps/desktop/src/lib/tauri.ts
+++ b/apps/desktop/src/lib/tauri.ts
@@ -117,6 +117,10 @@ export async function loadAiConfig(): Promise<AiConfig | null> {
return invoke("load_ai_config");
}
+export async function listSystemFonts(): Promise<string[]> {
+ return invoke("list_system_fonts");
+}
+
export async function pendingOpenSqlFiles(): Promise<string[]> {
return invoke("pending_open_sql_files");
}
diff --git a/packages/app-tests/editorSystemFonts.test.ts b/packages/app-tests/editorSystemFonts.test.ts
new file mode 100644
index 0000000000..e3930bd32a
--- /dev/null
+++ b/packages/app-tests/editorSystemFonts.test.ts
@@ -0,0 +1,32 @@
+import { readFileSync } from "node:fs";
+import { strict as assert } from "node:assert";
+import test from "node:test";
+
+test("frontend API exposes system font loading", () => {
+ const api = readFileSync("apps/desktop/src/lib/api.ts", "utf8");
+ const tauri = readFileSync("apps/desktop/src/lib/tauri.ts", "utf8");
+ const http = readFileSync("apps/desktop/src/lib/http.ts", "utf8");
+
+ assert.match(api, /export const listSystemFonts = forward\("listSystemFonts"\)/);
+ assert.match(tauri, /invoke\("list_system_fonts"\)/);
+ assert.match(http, /export async function listSystemFonts\(\): Promise<string\[\]>/);
+});
+
+test("settings editor font picker loads system fonts and accepts custom names", () => {
+ const source = readFileSync("apps/desktop/src/components/editor/EditorSettingsDialog.vue", "utf8");
+
+ assert.match(source, /listSystemFonts/);
+ assert.match(source, /systemFontOptions/);
+ assert.match(source, /allow-custom/);
+ assert.match(source, /normalizeCustomFontFamilyInput/);
+ assert.match(source, /settings\.useCustomFont/);
+ assert.doesNotMatch(source, /settings\.customFontFamily/);
+});
+
+test("Tauri registers the system font command", () => {
+ const commands = readFileSync("src-tauri/src/commands/mod.rs", "utf8");
+ const lib = readFileSync("src-tauri/src/lib.rs", "utf8");
+
+ assert.match(commands, /pub mod system_fonts/);
+ assert.match(lib, /commands::system_fonts::list_system_fonts/);
+});
diff --git a/packages/app-tests/settingsDialogLayout.test.ts b/packages/app-tests/settingsDialogLayout.test.ts
index 5d3d97da1d..f0546a7c9f 100644
--- a/packages/app-tests/settingsDialogLayout.test.ts
+++ b/packages/app-tests/settingsDialogLayout.test.ts
@@ -22,8 +22,12 @@ test("Redis scan size lives in its own settings category", () => {
});
test("settings action footer stays at the bottom of the content pane", () => {
- assert.match(source, /class="[^"]*min-h-full[^"]*flex-col[^"]*"/);
- assert.match(source, /<DialogFooter class="[^"]*mt-auto[^"]*"/);
+ assert.match(source, /class="[^"]*overflow-hidden[^"]*flex-col[^"]*"/);
+ assert.match(source, /class="[^"]*overflow-y-auto[^"]*"/);
+ assert.match(source, /<DialogFooter[\s\S]*class="[^"]*shrink-0[^"]*"/);
+ assert.match(source, /<DialogFooter[\s\S]*class="[^"]*bg-transparent[^"]*"/);
+ assert.doesNotMatch(source, /<DialogFooter[\s\S]*sticky/);
+ assert.doesNotMatch(source, /<DialogFooter[\s\S]*bg-background/);
});
test("settings dialog has a shortcuts category", () => {
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 7ddda85c0c..9d7edfe867 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -50,3 +50,4 @@ csv = "1.4.0"
calamine = "0.30.1"
zip = "4.6.1"
dbx-core = { path = "../crates/dbx-core" }
+font-kit = "0.14.3"
diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs
index 75ab12f1fc..7a5dc86b56 100644
--- a/src-tauri/src/commands/mod.rs
+++ b/src-tauri/src/commands/mod.rs
@@ -17,6 +17,7 @@ pub mod saved_sql;
pub mod schema;
pub mod schema_cache;
pub mod sql_file;
+pub mod system_fonts;
pub mod table_import;
pub mod transfer;
pub mod update;
diff --git a/src-tauri/src/commands/system_fonts.rs b/src-tauri/src/commands/system_fonts.rs
new file mode 100644
index 0000000000..ae4420be12
--- /dev/null
+++ b/src-tauri/src/commands/system_fonts.rs
@@ -0,0 +1,36 @@
+use std::collections::BTreeSet;
+
+use font_kit::source::SystemSource;
+
+pub fn normalize_font_families(families: Vec<String>) -> Vec<String> {
+ families
+ .into_iter()
+ .map(|family| family.trim().to_string())
+ .filter(|family| !family.is_empty())
+ .collect::<BTreeSet<_>>()
+ .into_iter()
+ .collect()
+}
+
+#[tauri::command]
+pub fn list_system_fonts() -> Result<Vec<String>, String> {
+ SystemSource::new().all_families().map(normalize_font_families).map_err(|err| err.to_string())
+}
+
+#[cfg(test)]
+mod tests {
+ use super::normalize_font_families;
+
+ #[test]
+ fn normalizes_and_sorts_font_family_names() {
+ assert_eq!(
+ normalize_font_families(vec![
+ "Maple Mono NF CN".to_string(),
+ " ".to_string(),
+ "Arial".to_string(),
+ "Maple Mono NF CN".to_string(),
+ ]),
+ vec!["Arial".to_string(), "Maple Mono NF CN".to_string()],
+ );
+ }
+}
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index b63222b27b..6c0468a1ba 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -278,6 +278,7 @@ pub fn run() {
commands::agents::invalidate_agent_registry_cache,
commands::agents::import_agents_from_zip,
commands::agents::import_agent_jar_cmd,
+ commands::system_fonts::list_system_fonts,
])
.build(tauri::generate_context!())
.expect("error while building tauri application")