From 26ad6ec7fedce1f8b82dade25b7d39e88a34e25a Mon Sep 17 00:00:00 2001 From: Oliver G Date: Sun, 15 Feb 2026 13:18:40 +0100 Subject: [PATCH] fix: auto-select /api for non-localhost deployments --- src/app.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index 8a2ad59..e0ecbdb 100644 --- a/src/app.js +++ b/src/app.js @@ -1,4 +1,8 @@ -const API_BASE = window.STAYSENSE_API_BASE || "http://127.0.0.1:8787"; +const DEFAULT_API_BASE = + window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" + ? "http://127.0.0.1:8787" + : "/api"; +const API_BASE = window.STAYSENSE_API_BASE || DEFAULT_API_BASE; const DEVICE_TOKEN_KEY = "staysense.device_token.v1"; const SETTINGS_KEY = "staysense.settings.v1";