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

View File

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

View File

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

View File

@ -309,7 +309,7 @@ class KRSubscribeService {
//
KRSingBoxImp.instance.kr_saveOutbounds(listModel.configJsonList);
KRSingBoxImp.instance.kr_saveAllOutbounds(listModel.configJsonList);
KRSingBoxImp.instance.kr_saveAllOutbounds(listModel.countryOutboundList);
//
_kr_updateSubscribeStatus();
@ -662,7 +662,7 @@ class KRSubscribeService {
//
KRSingBoxImp.instance.kr_saveOutbounds(listModel.configJsonList);
KRSingBoxImp.instance.kr_saveAllOutbounds(listModel.configJsonList);
KRSingBoxImp.instance.kr_saveAllOutbounds(listModel.countryOutboundList);
//
_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_stats.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_log_util.dart';
import '../../utils/kr_secure_storage.dart';
@ -66,7 +68,7 @@ class KRSingBoxImp {
Map<String, dynamic> kr_configOption = {};
List<Map<String, dynamic>> kr_outbounds = [];
List<Map<String, dynamic>> Kr_allOutbounds = [];
List<KRCountryOutboundList> Kr_allOutbounds = [];
///
RxBool kr_isFristStart = false.obs;
@ -1202,8 +1204,13 @@ class KRSingBoxImp {
// print("错误堆栈: $stack");
// }
// }
void kr_saveAllOutbounds(List<Map<String, dynamic>> outbounds) {
void kr_saveAllOutbounds(List<KRCountryOutboundList> 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 {
@ -1457,18 +1464,40 @@ class KRSingBoxImp {
if (kr_outbounds.isNotEmpty) {
KRLogUtil.kr_i('🔄 启动前强制重新生成配置文件...', tag: 'SingBox');
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')) {
KRLogUtil.kr_i('🤖 检测到自动国家节点: $selectedNode', tag: 'SingBox');
final selectedCountry = selectedNode.replaceAll(RegExp(r'-auto$'), '');
toSave = Kr_allOutbounds.where((o) {
final country = o['country']?.toString() ?? '';
if (country.isNotEmpty) return country == selectedCountry;
final tag = o['tag']?.toString() ?? '';
if (tag == selectedNode) return true;
return tag.toLowerCase().contains(selectedCountry.toLowerCase());
}).toList();
KRLogUtil.kr_i('✅ 自动国家过滤: ${toSave.length}/${Kr_allOutbounds.length}', tag: 'SingBox');
String selectedCountry = selectedNode.replaceAll(RegExp(r'-auto$'), '');
final selectedCountryLower = selectedCountry.toLowerCase();
final matchedGroup = Kr_allOutbounds.firstWhere(
(g) => g.country.toLowerCase() == selectedCountryLower,
orElse: () => KRCountryOutboundList(country: '', outboundList: []),
);
if (matchedGroup.country.isNotEmpty) {
KRLogUtil.kr_i('🎯 命中分组: ${matchedGroup.country}, 节点数: ${matchedGroup.outboundList.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);
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(
FILES "../libcore/bin/HiddifyCli"
DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime RENAME BearVPNCli
COMPONENT Runtime RENAME HiFastVPNCli
)
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"

View File

@ -7,7 +7,7 @@ export LD_LIBRARY_PATH=usr/lib
show_help() {
cat << EOF
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
EOF
}
@ -30,8 +30,8 @@ else
# processing arguments
case $1 in
BearVPNCli)
exec ./BearVPNCli ${@:3}
HiFastVPNCli)
exec ./HiFastVPNCli ${@:3}
exit 0
;;
h)

View File

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

View File

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

View File

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

View File

@ -100,7 +100,7 @@ endif()
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
# CLI BearVPNCli.exe
# CLI HiFastVPNCli.exe
set(INSTALL_BUNDLE_CLI_DIR "${CMAKE_INSTALL_PREFIX}/cli")
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}"
COMPONENT Runtime)
# libcore.dll BearVPN.exe
# libcore.dll HiFastVPN.exe
install(FILES "../libcore/bin/libcore.dll"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime
OPTIONAL)
# BearVPNCli.exe libcore/bin
# libcore HiddifyCli.exe BearVPNCli.exe
# BearVPNCli.exe
install(FILES "../libcore/bin/BearVPNCli.exe"
# HiFastVPNCli.exe libcore/bin
# libcore HiddifyCli.exeHiFastVPNCli.exe
# HiFastVPNCli.exe
install(FILES "../libcore/bin/HiFastVPNCli.exe"
DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime
OPTIONAL)