fix api ip address detect

This commit is contained in:
Do Manh Phuong 2025-08-15 15:15:27 +07:00
parent 00be81e18b
commit 11428ab3dd

View File

@ -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";