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
fix: make dashboard glass + theme sync actually work
Tashfeen1d239824e2b7
diff --git a/src/main.ts b/src/main.tsindex 832d9b09..aaaec6fc 100644--- a/src/main.ts+++ b/src/main.ts@@ -10,10 +10,11 @@ import { todayStats, hourlyRequests, successRateToday } from './stats.js';const __dirname = path.dirname(fileURLToPath(import.meta.url));const DEFAULT_PORT = 31415;-// Lean posture: no GPU process, one instance, menu-bar only.+// Lean posture: one instance, menu-bar only. GPU stays ON — vibrancy+// (the popover/dashboard glass) needs GPU compositing; with hardware+// acceleration disabled, transparent windows render an opaque white.app.setName('FreeLLMAPI');app.setPath('userData', path.join(app.getPath('appData'), 'FreeLLMAPI'));-app.disableHardwareAcceleration();if (!app.requestSingleInstanceLock()) {app.quit();diff --git a/src/preload.ts b/src/preload.tsindex 2d302a2e..77cc85dd 100644--- a/src/preload.ts+++ b/src/preload.ts@@ -19,10 +19,21 @@ if (arg) {// no Sign out) when running inside the desktop shell.contextBridge.exposeInMainWorld('__FREEAPI_DESKTOP__', true);-// `desktop` class before page styles paint → the client's translucent-// desktop backdrop applies from the first frame (window vibrancy shows-// through, no opaque flash).-document.documentElement.classList.add('desktop');+// `desktop` class on <html> activates the client's translucent backdrop+// (html.desktop in index.css). CAREFUL: for an http:// load the preload+// runs before the page's document is parsed — documentElement is null or+// a placeholder that the parser replaces — so the early add is best-effort+// (no-flash when it sticks) and MUST NOT throw, or the theme observer+// below would never register. The client re-adds the class itself at+// module load (App.tsx), so the effect never depends on the early add.+function applyDesktopClass() {+ document.documentElement?.classList.add('desktop');+}+try {+ applyDesktopClass();+} catch {+ // Document not ready — DOMContentLoaded below covers it.+}// Mirror the dashboard's theme to the main process so the tray popover// matches. The dashboard expresses its theme as the `dark` class on@@ -36,6 +47,7 @@ function reportTheme() {);}window.addEventListener('DOMContentLoaded', () => {+ applyDesktopClass();reportTheme();new MutationObserver(reportTheme).observe(document.documentElement, {attributes: true,diff --git a/src/window.ts b/src/window.tsindex b7a75f58..b05dd739 100644--- a/src/window.ts+++ b/src/window.ts@@ -29,14 +29,14 @@ export function openDashboard(port: number, token: string): void {title: 'FreeLLMAPI',// Native feel: traffic lights float over the app's own header (the client// adds a drag region + left padding when it detects the desktop shell),- // and the window carries an under-window vibrancy so the client's- // slightly-translucent desktop backdrop (html.desktop in index.css)- // picks up a hint of the same glass as the tray popover. The material+ // and the window carries a sidebar vibrancy — the strong, Finder-style+ // material — so the client's translucent desktop backdrop (html.desktop+ // in index.css) shows real glass, matching the tray popover. The material// follows nativeTheme.themeSource, i.e. the dashboard's own theme....(process.platform === 'darwin'? {titleBarStyle: 'hiddenInset' as const,- vibrancy: 'under-window' as const,+ vibrancy: 'sidebar' as const,visualEffectState: 'followWindow' as const,backgroundColor: '#00000000',}