修正切换订阅计划多节点列表展示问题
This commit is contained in:
@@ -9,6 +9,7 @@ import 'package:kaer_with_panels/app/model/response/kr_package_list.dart';
|
||||
import 'package:kaer_with_panels/app/network/base_response.dart';
|
||||
import 'package:kaer_with_panels/app/network/http_error.dart';
|
||||
import 'package:kaer_with_panels/app/network/http_util.dart';
|
||||
import 'package:kaer_with_panels/app/utils/kr_log_util.dart';
|
||||
|
||||
import '../../model/response/kr_already_subscribe.dart';
|
||||
import '../../model/response/kr_node_group_list.dart';
|
||||
@@ -55,7 +56,24 @@ class KRSubscribeApi {
|
||||
HttpError(msg: baseResponse.retMsg, code: baseResponse.retCode));
|
||||
}
|
||||
|
||||
return right(baseResponse.model);
|
||||
// 将请求的 subscribeId 传入节点列表模型中
|
||||
final nodeList = baseResponse.model;
|
||||
|
||||
// 将请求ID添加到模型中用于查找匹配的订阅项
|
||||
// 使用 body 字段重新解析,以便能够找到正确的订阅项
|
||||
if (baseResponse.body.isNotEmpty && baseResponse.body.containsKey('list')) {
|
||||
try {
|
||||
// 添加订阅ID信息到解析参数中
|
||||
baseResponse.body['subscribeId'] = id.toString();
|
||||
final reparsed = KRNodeList.fromJson(baseResponse.body);
|
||||
return right(reparsed);
|
||||
} catch (e) {
|
||||
// 如果重新解析失败,使用原始模型
|
||||
KRLogUtil.kr_w('重新解析节点列表失败: $e,使用原始模型', tag: 'SubscribeApi');
|
||||
}
|
||||
}
|
||||
|
||||
return right(nodeList);
|
||||
}
|
||||
|
||||
/// 获取用户可用订阅
|
||||
|
||||
@@ -230,11 +230,10 @@ class KRSingBoxImp {
|
||||
"log-level": "warn",
|
||||
"resolve-destination": false,
|
||||
"ipv6-mode": "ipv4_only",
|
||||
// "remote-dns-address": "https://cloudflare-dns.com/dns-query",
|
||||
"remote-dns-address": "udp://1.1.1.1",
|
||||
"remote-dns-domain-strategy": "",
|
||||
"direct-dns-address": "223.5.5.5",
|
||||
"direct-dns-domain-strategy": "",
|
||||
"remote-dns-address": "udp://8.8.8.8",
|
||||
"remote-dns-domain-strategy": "prefer_ipv4",
|
||||
"direct-dns-address": "udp://1.1.1.1",
|
||||
"direct-dns-domain-strategy": "prefer_ipv4",
|
||||
"mixed-port": kr_port,
|
||||
"tproxy-port": kr_port,
|
||||
"local-dns-port": 36450,
|
||||
|
||||
Reference in New Issue
Block a user