diff --git a/tauri/src-tauri/tauri.conf.json b/tauri/src-tauri/tauri.conf.json index 7b353e3..55ccbc6 100644 --- a/tauri/src-tauri/tauri.conf.json +++ b/tauri/src-tauri/tauri.conf.json @@ -5,7 +5,7 @@ "identifier": "com.lineup.client", "build": { "beforeDevCommand": "npm run dev", - "devUrl": "http://127.0.0.1:1420", + "devUrl": "http://192.168.3.13:1420", "beforeBuildCommand": "npm run build", "frontendDist": "../dist" }, diff --git a/tauri/src/main.ts b/tauri/src/main.ts index 733c8c0..b640f91 100644 --- a/tauri/src/main.ts +++ b/tauri/src/main.ts @@ -41,12 +41,15 @@ declare global { } // 这是登录表单首次显示时使用的本地默认地址;用户提交后的地址会保存到 localStorage。 -// `0.0.0.0` is a server bind address, never a browser destination. When the -// Web Host is opened locally use loopback; when it is opened through the -// trusted Tailscale Host use the matching reachable AppServer address. -const DEFAULT_API = location.hostname === "127.0.0.1" || location.hostname === "localhost" - ? "http://127.0.0.1:8090" - : "http://100.121.118.116:8090"; +// `0.0.0.0` is a server bind address, never a browser destination. +// 打包后的 Tauri(Android + macOS)都通过 Tailscale 访问远程 AppServer, +// 不能用 loopback(手机/沙盒里 127.0.0.1 指向自己),所以走 100.121.118.116。 +// 仅浏览器本地 dev 模式(`http://127.0.0.1:1420` / `http://localhost:1420`)才回退到 loopback。 +const DEFAULT_API = "__TAURI_INTERNALS__" in window + ? "http://100.121.118.116:8090" + : location.hostname === "127.0.0.1" || location.hostname === "localhost" + ? "http://127.0.0.1:8090" + : "http://100.121.118.116:8090"; // 这些状态对象属于当前可信 Host 的装配层:Runtime 负责会话、消息和可靠性, // 它们负责将 Surface、Capability、Artifact 和执行进度投影到当前页面。