default daemon url based on hostname

This commit is contained in:
grove5_admin committed 2026-04-28 12:25:35 -07:00
1 parent 81f353c66c
commit ad2c57f1c0
1 file changed
+5 -6
+5 -6
View File
@@ -13,12 +13,11 @@ function deepClone<T>(v: T): T {
} }
// ── Daemon URL ───────────────────────────────────────────────────────────── // ── Daemon URL ─────────────────────────────────────────────────────────────
// Set VITE_DAEMON_URL to connect to live daemon. // VITE_DAEMON_URL overrides the default daemon URL to connect to live daemon.
// Unset → mock mode (dev default). // Default: use hostname from current page.
const DAEMON_URL = (import.meta as any).env?.VITE_DAEMON_URL as string | undefined; const DAEMON_URL = (import.meta as any).env?.VITE_DAEMON_URL as string
const WS_URL = DAEMON_URL ?? `${window.location.protocol}//${window.location.host}`;
? DAEMON_URL.replace(/^http/, 'ws') + '/ws' const WS_URL = DAEMON_URL.replace(/^http/, 'ws') + '/ws';
: null;
// ── VPD calculation ──────────────────────────────────────────────────────── // ── VPD calculation ────────────────────────────────────────────────────────
// Vapour Pressure Deficit from temp and RH. // Vapour Pressure Deficit from temp and RH.