客户端默认指向 jxd.jinniu.ink 的 HTTPS/WSS;登录后把 OpenIM userID 设为极光 alias。 华为 agconnect-services.json 不伪造、不入库。Master Secret 只从服务器文件注入。 Co-authored-by: multica-agent <github@multica.ai>
60 lines
2.4 KiB
Dart
60 lines
2.4 KiB
Dart
/// 服务器地址集中配置。
|
||
///
|
||
/// 默认指向公网测试域名 `jxd.jinniu.ink`(HTTPS / WSS)。
|
||
/// 内网联调不要改本文件,打包时覆盖:
|
||
/// `--dart-define=SERVER_HOST=192.168.200.11 --dart-define=USE_TLS=false`
|
||
/// 仅覆盖登录服务:`--dart-define=AUTH_HOST=127.0.0.1`
|
||
library;
|
||
|
||
/// 公网测试域名(不带协议、不带端口)
|
||
const String defaultPublicHost = 'jxd.jinniu.ink';
|
||
|
||
/// 服务器地址(不带协议、不带端口)
|
||
const String serverHost = String.fromEnvironment(
|
||
'SERVER_HOST',
|
||
defaultValue: defaultPublicHost,
|
||
);
|
||
|
||
/// 是否走 HTTPS/WSS(公网默认 true;内网联调传 false)
|
||
const bool useTls = bool.fromEnvironment('USE_TLS', defaultValue: true);
|
||
|
||
/// OpenIM API 端口(服务端 docker 映射,默认 10002;TLS 时由反向代理走 443)
|
||
const int apiPort = 10002;
|
||
|
||
/// OpenIM WebSocket 端口(默认 10001)
|
||
const int wsPort = 10001;
|
||
|
||
/// LiveKit 信令端口(注意:服务端已重映射为 17880,不是默认的 7880)
|
||
const int livekitPort = 17880;
|
||
|
||
/// 公司账号登录后端端口(B-60 account-server,docker 默认映射 10010)
|
||
const int authApiPort = 10010;
|
||
|
||
const String _authHostOverride = String.fromEnvironment('AUTH_HOST', defaultValue: '');
|
||
|
||
/// OpenIM API 地址
|
||
String get apiAddr => useTls ? 'https://$serverHost' : 'http://$serverHost:$apiPort';
|
||
|
||
/// OpenIM 消息长连接地址
|
||
String get wsAddr => useTls ? 'wss://$serverHost/msg_gateway' : 'ws://$serverHost:$wsPort';
|
||
|
||
/// LiveKit 连接地址
|
||
String get livekitUrl => useTls ? 'wss://$serverHost/livekit' : 'ws://$serverHost:$livekitPort';
|
||
|
||
/// 公司账号登录后端地址
|
||
///
|
||
/// 仅本地联调用:`--dart-define=AUTH_HOST=127.0.0.1` 可覆盖登录服务地址(OpenIM/LiveKit
|
||
/// 仍走 [serverHost]),正式打包不带该参数则与 [serverHost] 一致。
|
||
String get authApiBase {
|
||
if (_authHostOverride.isNotEmpty) {
|
||
return 'http://$_authHostOverride:$authApiPort';
|
||
}
|
||
return useTls ? 'https://$serverHost/account' : 'http://$serverHost:$authApiPort';
|
||
}
|
||
|
||
/// 极光 AppKey(可进客户端;Master Secret 禁止出现在客户端或仓库)
|
||
const String jpushAppKey = '95fc2352648a7d4568ac8d72';
|
||
|
||
/// 登录页自检:探测消息长连接入口(TLS 走反向代理路径,明文走宿主端口)
|
||
String get wsProbeUrl => useTls ? 'https://$serverHost/msg_gateway' : 'http://$serverHost:$wsPort/';
|