Files
controller-v2/client/src/lib/deviceIp.ts
T

12 lines
455 B
TypeScript
Raw Normal View History

/** 从地址栏 ?ip= 读取设备 IPhash 路由下 query 仍在 search 上) */
export function getDeviceIpFromUrl(): string | null {
if (typeof window === "undefined") return null;
const ip = new URLSearchParams(window.location.search).get("ip");
const trimmed = ip?.trim();
return trimmed || null;
}
export function resolveInitialDeviceIp(): string {
return getDeviceIpFromUrl() ?? localStorage.getItem("luxsin_ip") ?? "192.168.2.30";
}