fix(config): 生产构建(Tauri打包)默认回退生产 opc.pinesound.cn + 启动地址诊断日志

- resolveHost:生产构建且运行于 Tauri WebView 时默认回退 opc.pinesound.cn(不再回退局域网 192.168.1.9),
  即使 config.json / .env 缺失也能接入生产;本地 dev 仍回退局域网
- main.jsx:bootstrap 后打印最终生效 API_BASE / MQTT_URL / MQTT_USER,便于定位地址切换问题
- 已验证构建产物:烘焙 https://opc.pinesound.cn/park,无 192.168.1.9:8090 / 192.168.1.3:8083 残留
This commit is contained in:
Pine
2026-09-16 22:19:57 +08:00
parent 43bb33cc1a
commit b0c1c7209b
2 changed files with 10 additions and 5 deletions
+5 -1
View File
@@ -5,7 +5,7 @@ import BindScreen from "./components/BindScreen.jsx";
import { isDeviceBound } from "./utils/tenant";
import ErrorBoundary from "./components/ErrorBoundary";
import { ThemeProvider } from "@appica/ui-react/providers/theme-provider";
import { getApiBase } from "./config";
import { getApiBase, getMqttUrl, getMqttCredentials } from "./config";
import { invoke } from "@tauri-apps/api/core";
import "./styles/global.css";
@@ -80,6 +80,10 @@ async function bootstrapRuntimeConfig() {
}
bootstrapRuntimeConfig().then(() => {
// 启动诊断:打印最终生效的 API / MQTT 地址(config.json > 构建烘焙 > /api/config 下发 > 内置默认)
try {
console.info(`[bootstrap] API_BASE=${getApiBase()} MQTT_URL=${getMqttUrl()} MQTT_USER=${getMqttCredentials().username || "(空)"}`);
} catch (e) { /* 忽略 */ }
ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode>
<ErrorBoundary>