From 11428ab3dd4714343004972a69de7c7edbe19da1 Mon Sep 17 00:00:00 2001 From: phuongdm Date: Fri, 15 Aug 2025 15:15:27 +0700 Subject: [PATCH] fix api ip address detect --- src/config/api.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/config/api.ts b/src/config/api.ts index a3a9ba5..dd63873 100644 --- a/src/config/api.ts +++ b/src/config/api.ts @@ -1,10 +1,13 @@ const hostname = window.location.hostname; console.log("Current hostname:", hostname); +var tailscaleIP = import.meta.env.VITE_IP_TAILSCALE; +var localIP = import.meta.env.VITE_IP_LOCAL; + let API_MODE: "tailscale" | "local" | "ip"; -if (hostname.includes("ts.net")) { +if (hostname.includes(tailscaleIP)) { API_MODE = "tailscale"; -} else if (hostname === "localhost") { +} else if (hostname === localIP) { API_MODE = "local"; } else { API_MODE = "ip";