feat: 优化未连接节点时候批量节点测速功能,修复网络初始化报错后,导致的连锁反应界面出现错乱和DioExceptionType.unknown报错信息,直连模式,不依赖未初始化的核心
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 构建 iOS (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (iOS/tvOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled
Build Windows / 编译 libcore (Windows) (push) Has been cancelled
Build Windows / build (push) Has been cancelled

This commit is contained in:
2025-11-04 03:08:24 -08:00
parent 33f45aa4a5
commit 6131a80b2c
4 changed files with 420 additions and 218 deletions
+10 -14
View File
@@ -17,21 +17,17 @@ class KRSiteConfigService extends ChangeNotifier {
_dio.options.sendTimeout = const Duration(seconds: 20);
_dio.options.receiveTimeout = const Duration(seconds: 20);
// 🔧 配置HttpClientAdapter使用sing-box的mixed代理
_dio.httpClientAdapter = IOHttpClientAdapter(
createHttpClient: () {
final client = HttpClient();
client.findProxy = (url) {
final proxyConfig = KRSingBoxImp.instance.kr_buildProxyRule();
KRLogUtil.kr_i(
'🔍 KRSiteConfigService 请求使用代理: $proxyConfig, url: $url',
tag: 'KRSiteConfigService',
);
return proxyConfig;
};
return client;
},
// 🔧 关键修复:网站配置请求不使用代理
// 原因:网站配置是应用启动的第一步,此时 SingBox 还未初始化
// 必须直接连接服务器获取配置,避免循环依赖和初始化失败
// 之前的代理配置会导致 DioExceptionType.unknown 错误
KRLogUtil.kr_i(
'🌐 网站配置服务:使用直连模式(不通过代理)',
tag: 'KRSiteConfigService',
);
if (kDebugMode) {
print('🌐 网站配置服务:使用直连模式,避免 SingBox 未初始化问题');
}
}
KRSiteConfig? _siteConfig;
+6 -18
View File
@@ -290,31 +290,19 @@ class KRSubscribeService {
return;
}
// 优先使用 API 返回的 isTryOut 字段判断试用状态
// 🔧 关键修复:信任 API 返回的 isTryOut 字段,不再额外检查购买记录
// 之前的逻辑会在购买套餐后仍显示"试用中",因为购买记录可能未及时更新
final currentSubscribe = kr_currentSubscribe.value!;
// 1. 优先使用 API 返回的 isTryOut 字段
// 1. 使用 API 返回的 isTryOut 字段(最权威的判断)
kr_isTrial.value = currentSubscribe.isTryOut;
KRLogUtil.kr_i('步骤1 - API isTryOut 字段: ${currentSubscribe.isTryOut}', tag: 'SubscribeService');
// 2. 如果 API 说不是试用,检查是否有购买记录
if (!kr_isTrial.value) {
final bool kr_isSubscribed = kr_alreadySubscribe.any(
(subscribe) => currentSubscribe.id == subscribe.userSubscribeId
);
KRLogUtil.kr_i('步骤2 - 检查购买记录: $kr_isSubscribed', tag: 'SubscribeService');
// 如果没有购买记录,判断为试用
if (!kr_isSubscribed) {
kr_isTrial.value = true;
KRLogUtil.kr_i('步骤2 - 没有购买记录,判定为试用', tag: 'SubscribeService');
}
}
// 3. 最后检查订阅名称是否包含"试用"关键字(最后的备用方案)
// 2. 仅在 API 没有明确标识时,才检查订阅名称作为备用方案
// 注意:只有当 API 说不是试用,但名称包含"试用"时才覆盖
if (!kr_isTrial.value && currentSubscribe.name.contains('试用')) {
kr_isTrial.value = true;
KRLogUtil.kr_i('步骤3 - 订阅名称包含"试用"关键字,判定为试用', tag: 'SubscribeService');
KRLogUtil.kr_i('步骤2 - 订阅名称包含"试用"关键字,判定为试用', tag: 'SubscribeService');
}
KRLogUtil.kr_i('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━', tag: 'SubscribeService');