fix: 验收包写入公司内网地址,避免 Windows 空 VITE 与 Android 假域名

Windows 补 .env.production 与 endpoints 兜底;Android 默认 host/端口改为内网,启动后重写 HttpUtil/ApiService,Urls 改为 getter。

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
编码工程师
2026-08-20 16:21:40 +08:00
co-authored by Cursor multica-agent
parent 18d890ae7f
commit bbc4dce0b6
10 changed files with 76 additions and 35 deletions
@@ -20,7 +20,7 @@ class Config {
await Hive.initFlutter(path);
MediaKit.ensureInitialized();
HttpUtil.init();
ApiService().setBaseUrl(serverIp);
ApiService().setBaseUrl(imApiUrl);
} catch (_) {}
runApp();
@@ -65,9 +65,10 @@ class Config {
static const friendScheme = "io.openim.app/addFriend/";
static const groupScheme = "io.openim.app/joinGroup/";
static const _host = "your-server-ip or your-domain";
static const _host = "192.168.200.11";
static const _ipRegex = '((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)';
static const _ipRegex =
'((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)';
static bool get _isIP => RegExp(_ipRegex).hasMatch(_host);
@@ -86,7 +87,7 @@ class Config {
if (null != server) {
url = server['chatTokenUrl'];
}
return url ?? (_isIP ? "http://$_host:10009" : "https://$_host/chat");
return url ?? (_isIP ? "http://$_host:10010" : "https://$_host/chat");
}
static String get appAuthUrl {
@@ -95,7 +96,7 @@ class Config {
if (null != server) {
url = server['authUrl'];
}
return url ?? (_isIP ? "http://$_host:10008" : "https://$_host/chat");
return url ?? (_isIP ? "http://$_host:10010" : "https://$_host/chat");
}
static String get imApiUrl {