7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.
TypeScript
feat(desktop): show the app in the Dock, with a tray toggle (#1151)
Tashfeen0dab683fc2f5
diff --git a/desktop/src/config.ts b/desktop/src/config.tsindex a7896abf..86b6e31c 100644--- a/desktop/src/config.ts+++ b/desktop/src/config.ts@@ -15,6 +15,10 @@ export interface DesktopConfig {// for (#807). Explaining the fix once per version is enough; the tray can stay// hidden for as long as the user wants it hidden.trayHiddenNoticeVersion?: string;+ // Show the app in the Dock as well as the menu bar. On by default: the tray+ // icon alone is a poor "is it running?" signal, and macOS 26 can hide it+ // outright (#807). Users who want the lean menu-bar-only look turn it off.+ showInDock?: boolean;}function configPath(): string {diff --git a/desktop/src/i18n.ts b/desktop/src/i18n.tsindex 8df5c73a..ee6600c7 100644--- a/desktop/src/i18n.ts+++ b/desktop/src/i18n.ts@@ -29,6 +29,7 @@ const STRINGS: Record<NativeLocale, Strings> = {runningOn: 'Running on {addr}',openDashboard: 'Open Dashboard',lanAccess: 'Allow LAN access (0.0.0.0)',+ showInDock: 'Show in Dock',openLogs: 'Open Logs Folder',openBackups: 'Open Backups Folder',quitApp: 'Quit FreeLLMAPI',@@ -51,6 +52,7 @@ const STRINGS: Record<NativeLocale, Strings> = {runningOn: '运行于 {addr}',openDashboard: '打开仪表板',lanAccess: '允许局域网访问 (0.0.0.0)',+ showInDock: '在程序坞中显示',openLogs: '打开日志文件夹',openBackups: '打开备份文件夹',quitApp: '退出 FreeLLMAPI',@@ -73,6 +75,7 @@ const STRINGS: Record<NativeLocale, Strings> = {runningOn: 'En cours sur {addr}',openDashboard: 'Ouvrir le tableau de bord',lanAccess: 'Autoriser l\'accès LAN (0.0.0.0)',+ showInDock: 'Afficher dans le Dock',openLogs: 'Ouvrir le dossier des journaux',openBackups: 'Ouvrir le dossier des sauvegardes',quitApp: 'Quitter FreeLLMAPI',@@ -95,6 +98,7 @@ const STRINGS: Record<NativeLocale, Strings> = {runningOn: 'En ejecución en {addr}',openDashboard: 'Abrir el panel',lanAccess: 'Permitir acceso LAN (0.0.0.0)',+ showInDock: 'Mostrar en el Dock',openLogs: 'Abrir la carpeta de registros',openBackups: 'Abrir la carpeta de copias de seguridad',quitApp: 'Salir de FreeLLMAPI',@@ -117,6 +121,7 @@ const STRINGS: Record<NativeLocale, Strings> = {runningOn: 'Em execução em {addr}',openDashboard: 'Abrir o painel',lanAccess: 'Permitir acesso LAN (0.0.0.0)',+ showInDock: 'Mostrar no Dock',openLogs: 'Abrir a pasta de logs',openBackups: 'Abrir a pasta de backups',quitApp: 'Sair do FreeLLMAPI',@@ -139,6 +144,7 @@ const STRINGS: Record<NativeLocale, Strings> = {runningOn: 'In esecuzione su {addr}',openDashboard: 'Apri il pannello',lanAccess: 'Consenti accesso LAN (0.0.0.0)',+ showInDock: 'Mostra nel Dock',openLogs: 'Apri la cartella dei log',openBackups: 'Apri la cartella dei backup',quitApp: 'Esci da FreeLLMAPI',diff --git a/desktop/src/main.ts b/desktop/src/main.tsindex 9f7237cf..9dd5848b 100644--- a/desktop/src/main.ts+++ b/desktop/src/main.ts@@ -220,8 +220,23 @@ if (!app.requestSingleInstanceLock()) {if (choice === 0) openDashboard(port, sessionToken);}+ // The bundle ships LSUIElement, so the app starts as an accessory with no+ // Dock presence at all; app.dock.show() promotes it at runtime and hide()+ // puts it back, no relaunch either way.+ function applyDockVisibility(show: boolean): void {+ if (process.platform !== 'darwin') return;+ if (show) void app.dock?.show();+ else app.dock?.hide();+ }++ function toggleShowInDock(): void {+ const next = !(loadConfig().showInDock ?? true);+ saveConfig({ ...loadConfig(), showInDock: next });+ applyDockVisibility(next);+ }+app.whenReady().then(async () => {- if (process.platform === 'darwin') app.dock?.hide();+ applyDockVisibility(loadConfig().showInDock ?? true);const cfg = loadConfig();const dbPath = path.join(app.getPath('userData'), 'freeapi.db');@@ -255,7 +270,15 @@ if (!app.requestSingleInstanceLock()) {resolvedPort = port;saveConfig({ ...cfg, port });sessionToken = ensureSessionToken();- const tray = buildTray(port, sessionToken, () => locale, () => loadConfig().lanAccess ?? false, toggleLanAccess);+ const tray = buildTray(+ port,+ sessionToken,+ () => locale,+ () => loadConfig().lanAccess ?? false,+ toggleLanAccess,+ () => loadConfig().showInDock ?? true,+ toggleShowInDock,+ );console.log(`[desktop] FreeLLMAPI running on http://${host}:${port}${cfg.lanAccess ? ' (LAN access enabled)' : ''}`);// A tray that macOS refuses to draw still constructs cleanly, so the only// way to notice is to look at where the item landed (#807).diff --git a/desktop/src/tray.ts b/desktop/src/tray.tsindex 2c39dd8c..454de3e2 100644--- a/desktop/src/tray.ts+++ b/desktop/src/tray.ts@@ -21,6 +21,8 @@ export function buildTray(getLocale: () => NativeLocale,getLanAccess: () => boolean,onToggleLanAccess: () => void,+ getShowInDock: () => boolean,+ onToggleShowInDock: () => void,): Tray {const iconPath = path.join(__dirname, '../assets/trayTemplate.png');const icon = nativeImage.createFromPath(iconPath);@@ -39,6 +41,10 @@ export function buildTray({ type: 'separator' },// Toggling relaunches the app (the bind host is fixed at server start).{ label: dt(locale, 'lanAccess'), type: 'checkbox', checked: lanOn, click: () => onToggleLanAccess() },+ // The Dock icon is the "yes, it is running" signal the tray cannot always+ // give: macOS 26 lets the user hide menu-bar icons, and a notched display+ // clips them (#807). Applied live, no relaunch.+ { label: dt(locale, 'showInDock'), type: 'checkbox', checked: getShowInDock(), click: () => onToggleShowInDock() },// #824: the password-reset code is printed to the log and nowhere else,// so the folder holding it needs to be reachable without a terminal.{ label: dt(locale, 'openLogs'), click: () => openLogsFolder() },