Compare commits

...

3 Commits

Author SHA1 Message Date
62d1af8517 feat: 修改接口方式
Some checks failed
Build Windows / 编译 libcore (Windows) (20.15.1) (push) Successful in 20m26s
Build Windows / build (push) Has been cancelled
2025-11-20 18:11:29 -08:00
3b05d4ff72 feat: 修改国家选择匹配问题 2025-11-20 09:08:23 -08:00
bcb4d17236 feat: ai修改win 名称信息 2025-11-20 09:07:40 -08:00
11 changed files with 64 additions and 33 deletions

View File

@ -4,12 +4,12 @@ echo 📋 复制 libcore 文件...
:: 创建目标目录 :: 创建目标目录
mkdir libcore\bin >nul 2>&1 mkdir libcore\bin >nul 2>&1
:: 查找并复制 HiddifyCli.exe重命名为 BearVPNCli.exe :: 查找并复制 HiddifyCli.exe重命名为 CLI 可执行文件
for /r %%f in (HiddifyCli.exe) do ( for /r %%f in (HiddifyCli.exe) do (
if exist "%%f" ( if exist "%%f" (
echo ✅ 找到 HiddifyCli.exe: %%f echo ✅ 找到 HiddifyCli.exe: %%f
echo 📝 复制并重命名为 BearVPNCli.exe echo 📝 复制并重命名为 HiFastVPNCli.exe
copy "%%f" libcore\bin\BearVPNCli.exe copy "%%f" libcore\bin\HiFastVPNCli.exe
echo ✅ 重命名完成 echo ✅ 重命名完成
goto :dll goto :dll
) )
@ -32,7 +32,7 @@ echo.
echo 📄 验证文件: echo 📄 验证文件:
if exist libcore\bin ( if exist libcore\bin (
dir libcore\bin dir libcore\bin
if exist libcore\bin\BearVPNCli.exe ( if exist libcore\bin\HiFastVPNCli.exe (
if exist libcore\bin\libcore.dll ( if exist libcore\bin\libcore.dll (
echo ✅ 验证成功:所有文件已正确复制 echo ✅ 验证成功:所有文件已正确复制
exit /b 0 exit /b 0
@ -41,7 +41,7 @@ if exist libcore\bin (
exit /b 1 exit /b 1
) )
) else ( ) else (
echo ❌ 验证失败:BearVPNCli.exe 不存在 echo ❌ 验证失败:HiFastVPNCli.exe 不存在
exit /b 1 exit /b 1
) )
) else ( ) else (

View File

@ -59,6 +59,8 @@ class UserInfoCard extends StatelessWidget {
children: [ children: [
Text( Text(
'ID: $userId', 'ID: $userId',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14.sp, fontSize: 14.sp,

View File

@ -298,7 +298,7 @@ class KRAuthApi {
BaseResponse<dynamic> baseResponse = await HttpUtil.getInstance() BaseResponse<dynamic> baseResponse = await HttpUtil.getInstance()
.request<dynamic>(Api.kr_deleteAccount, data, .request<dynamic>(Api.kr_deleteAccount, data,
method: HttpMethod.DELETE, isShowLoading: true); method: HttpMethod.POST, isShowLoading: true);
if (!baseResponse.isSuccess) { if (!baseResponse.isSuccess) {
return left( return left(
HttpError(msg: baseResponse.retMsg, code: baseResponse.retCode)); HttpError(msg: baseResponse.retMsg, code: baseResponse.retCode));

View File

@ -309,7 +309,7 @@ class KRSubscribeService {
// //
KRSingBoxImp.instance.kr_saveOutbounds(listModel.configJsonList); KRSingBoxImp.instance.kr_saveOutbounds(listModel.configJsonList);
KRSingBoxImp.instance.kr_saveAllOutbounds(listModel.configJsonList); KRSingBoxImp.instance.kr_saveAllOutbounds(listModel.countryOutboundList);
// //
_kr_updateSubscribeStatus(); _kr_updateSubscribeStatus();
@ -662,7 +662,7 @@ class KRSubscribeService {
// //
KRSingBoxImp.instance.kr_saveOutbounds(listModel.configJsonList); KRSingBoxImp.instance.kr_saveOutbounds(listModel.configJsonList);
KRSingBoxImp.instance.kr_saveAllOutbounds(listModel.configJsonList); KRSingBoxImp.instance.kr_saveAllOutbounds(listModel.countryOutboundList);
// //
_kr_updateSubscribeStatus(); _kr_updateSubscribeStatus();

View File

@ -19,6 +19,8 @@ import '../../../singbox/model/singbox_config_option.dart';
import '../../../singbox/model/singbox_outbound.dart'; import '../../../singbox/model/singbox_outbound.dart';
import '../../../singbox/model/singbox_stats.dart'; import '../../../singbox/model/singbox_stats.dart';
import '../../../singbox/model/singbox_status.dart'; import '../../../singbox/model/singbox_status.dart';
import '../../model/business/kr_group_outbound_list.dart';
import '../../model/business/kr_outbound_item.dart';
import '../../utils/kr_country_util.dart'; import '../../utils/kr_country_util.dart';
import '../../utils/kr_log_util.dart'; import '../../utils/kr_log_util.dart';
import '../../utils/kr_secure_storage.dart'; import '../../utils/kr_secure_storage.dart';
@ -66,7 +68,7 @@ class KRSingBoxImp {
Map<String, dynamic> kr_configOption = {}; Map<String, dynamic> kr_configOption = {};
List<Map<String, dynamic>> kr_outbounds = []; List<Map<String, dynamic>> kr_outbounds = [];
List<Map<String, dynamic>> Kr_allOutbounds = []; List<KRCountryOutboundList> Kr_allOutbounds = [];
/// ///
RxBool kr_isFristStart = false.obs; RxBool kr_isFristStart = false.obs;
@ -1202,8 +1204,13 @@ class KRSingBoxImp {
// print("错误堆栈: $stack"); // print("错误堆栈: $stack");
// } // }
// } // }
void kr_saveAllOutbounds(List<Map<String, dynamic>> outbounds) { void kr_saveAllOutbounds(List<KRCountryOutboundList> outbounds) {
Kr_allOutbounds = outbounds; Kr_allOutbounds = outbounds;
KRLogUtil.kr_i('📊 保存国家分组: ${Kr_allOutbounds.length}', tag: 'SingBox');
for (int i = 0; i < Kr_allOutbounds.length; i++) {
final c = Kr_allOutbounds[i];
KRLogUtil.kr_i(' group[$i] country="${c.country}" outbounds=${c.outboundList.length}', tag: 'SingBox');
}
} }
/// ///
void kr_saveOutbounds(List<Map<String, dynamic>> outbounds) async { void kr_saveOutbounds(List<Map<String, dynamic>> outbounds) async {
@ -1457,18 +1464,40 @@ class KRSingBoxImp {
if (kr_outbounds.isNotEmpty) { if (kr_outbounds.isNotEmpty) {
KRLogUtil.kr_i('🔄 启动前强制重新生成配置文件...', tag: 'SingBox'); KRLogUtil.kr_i('🔄 启动前强制重新生成配置文件...', tag: 'SingBox');
final selectedNode = await KRSecureStorage().kr_readData(key: _keySelectedNode); final selectedNode = await KRSecureStorage().kr_readData(key: _keySelectedNode);
var toSave = Kr_allOutbounds; KRLogUtil.kr_i('📊 国家分组数量: ${Kr_allOutbounds.length}', tag: 'SingBox');
for (int i = 0; i < Kr_allOutbounds.length; i++) {
final g = Kr_allOutbounds[i];
KRLogUtil.kr_i('Kr_allOutbounds[$i] country="${g.country}" outbounds=${g.outboundList.length}', tag: 'SingBox');
}
List<Map<String, dynamic>> toSave = [];
if (selectedNode != null && selectedNode.endsWith('-auto')) { if (selectedNode != null && selectedNode.endsWith('-auto')) {
KRLogUtil.kr_i('🤖 检测到自动国家节点: $selectedNode', tag: 'SingBox'); KRLogUtil.kr_i('🤖 检测到自动国家节点: $selectedNode', tag: 'SingBox');
final selectedCountry = selectedNode.replaceAll(RegExp(r'-auto$'), ''); String selectedCountry = selectedNode.replaceAll(RegExp(r'-auto$'), '');
toSave = Kr_allOutbounds.where((o) { final selectedCountryLower = selectedCountry.toLowerCase();
final country = o['country']?.toString() ?? ''; final matchedGroup = Kr_allOutbounds.firstWhere(
if (country.isNotEmpty) return country == selectedCountry; (g) => g.country.toLowerCase() == selectedCountryLower,
final tag = o['tag']?.toString() ?? ''; orElse: () => KRCountryOutboundList(country: '', outboundList: []),
if (tag == selectedNode) return true; );
return tag.toLowerCase().contains(selectedCountry.toLowerCase()); if (matchedGroup.country.isNotEmpty) {
}).toList(); KRLogUtil.kr_i('🎯 命中分组: ${matchedGroup.country}, 节点数: ${matchedGroup.outboundList.length}', tag: 'SingBox');
KRLogUtil.kr_i('✅ 自动国家过滤: ${toSave.length}/${Kr_allOutbounds.length}', tag: 'SingBox'); toSave = matchedGroup.outboundList.map((it) => it.config).toList();
} else {
for (final g in Kr_allOutbounds) {
for (final it in g.outboundList) {
final tagLower = it.tag.toLowerCase();
if (tagLower == selectedNode.toLowerCase() || tagLower.contains(selectedCountryLower)) {
toSave.add(it.config);
}
}
}
}
KRLogUtil.kr_i('✅ 自动国家过滤: ${toSave.length}', tag: 'SingBox');
} else {
for (final g in Kr_allOutbounds) {
for (final it in g.outboundList) {
toSave.add(it.config);
}
}
} }
kr_saveOutbounds(toSave); kr_saveOutbounds(toSave);
await Future.delayed(const Duration(milliseconds: 100)); await Future.delayed(const Duration(milliseconds: 100));

View File

@ -114,7 +114,7 @@ install(FILES "../libcore/bin/lib/libcore.so" DESTINATION "${INSTALL_BUNDLE_LIB_
install( install(
FILES "../libcore/bin/HiddifyCli" FILES "../libcore/bin/HiddifyCli"
DESTINATION "${CMAKE_INSTALL_PREFIX}" DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime RENAME BearVPNCli COMPONENT Runtime RENAME HiFastVPNCli
) )
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"

View File

@ -7,7 +7,7 @@ export LD_LIBRARY_PATH=usr/lib
show_help() { show_help() {
cat << EOF cat << EOF
Usage: ${0##*/} ... Usage: ${0##*/} ...
start Hiddify or BearVPNCli, when no parameter is given, Hiddify is executed. start Hiddify or HiFastVPNCli, when no parameter is given, Hiddify is executed.
-v show version -v show version
EOF EOF
} }
@ -30,8 +30,8 @@ else
# processing arguments # processing arguments
case $1 in case $1 in
BearVPNCli) HiFastVPNCli)
exec ./BearVPNCli ${@:3} exec ./HiFastVPNCli ${@:3}
exit 0 exit 0
;; ;;
h) h)

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# BearVPN macOS 公证脚本 # HiFastVPN macOS 公证脚本
# 作者: AI Assistant # 作者: AI Assistant
set -e set -e

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# BearVPN macOS 签名、公证和打包脚本 # HiFastVPN macOS 签名、公证和打包脚本
# 作者: AI Assistant # 作者: AI Assistant
# 日期: $(date) # 日期: $(date)

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# BearVPN macOS 签名和打包脚本 # HiFastVPN macOS 签名和打包脚本
# 作者: AI Assistant # 作者: AI Assistant
# 日期: $(date) # 日期: $(date)

View File

@ -100,7 +100,7 @@ endif()
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
# CLI BearVPNCli.exe # CLI HiFastVPNCli.exe
set(INSTALL_BUNDLE_CLI_DIR "${CMAKE_INSTALL_PREFIX}/cli") set(INSTALL_BUNDLE_CLI_DIR "${CMAKE_INSTALL_PREFIX}/cli")
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
@ -112,16 +112,16 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime) COMPONENT Runtime)
# libcore.dll BearVPN.exe # libcore.dll HiFastVPN.exe
install(FILES "../libcore/bin/libcore.dll" install(FILES "../libcore/bin/libcore.dll"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime COMPONENT Runtime
OPTIONAL) OPTIONAL)
# BearVPNCli.exe libcore/bin # HiFastVPNCli.exe libcore/bin
# libcore HiddifyCli.exe BearVPNCli.exe # libcore HiddifyCli.exeHiFastVPNCli.exe
# BearVPNCli.exe # HiFastVPNCli.exe
install(FILES "../libcore/bin/BearVPNCli.exe" install(FILES "../libcore/bin/HiFastVPNCli.exe"
DESTINATION "${CMAKE_INSTALL_PREFIX}" DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime COMPONENT Runtime
OPTIONAL) OPTIONAL)