diff --git a/.gitignore b/.gitignore index a69eb92..7d6b6db 100644 --- a/.gitignore +++ b/.gitignore @@ -10,11 +10,9 @@ lerna-debug.log* node_modules dist dist-ssr -*.local # 后端密钥 / 前端本地配置(含阿里云密钥、MQTT 凭据,不入库) backend/.env -.env.local # 后端运行时数据(媒体上传、持久化配置) backend/media/ diff --git a/src/config.js b/src/config.js index 1c60d1e..bbb313e 100644 --- a/src/config.js +++ b/src/config.js @@ -42,13 +42,10 @@ export function getMqttCredentials() { } /** 惰性读取 s2s 实时语音 WebSocket 地址。 - * 优先 config.json / VITE_VOICE_WS 显式配置; - * 否则默认跟随 `api_base` 的主机名(s2s 由 s2s_bridge 在后端同机 :8765 启动), - * 而不是页面 hostname(打包后是 tauri.localhost/192.168.1.9,会导致连本机回环而失败)。 */ + * s2s 由 s2s_bridge 在后端同机启动(:8765)→ 语音地址**固定跟随 `api_base` 主机**, + * 不再被 config.json / /api/config 里可能过期的 voice_url 覆盖成错误主机(如 MQTT 的 .3)。 + */ export function getVoiceWsUrl() { - if (window.__DPM_VOICE_WS__) return window.__DPM_VOICE_WS__; - const baked = env.VITE_VOICE_WS; - if (baked) return baked; let host; try { host = new URL(getApiBase()).hostname;