fix: 修改样式

This commit is contained in:
speakeloudest 2026-01-22 16:58:54 -08:00
parent 343891b702
commit 73480ce417
22 changed files with 450 additions and 219 deletions

View File

@ -6,7 +6,6 @@
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:alf57p.openinstall.com</string>
<string>applinks:alf57p.oplinking.com</string>
</array>
<key>com.apple.developer.networking.networkextension</key>

View File

@ -6,7 +6,6 @@
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:alf57p.openinstall.com</string>
<string>applinks:alf57p.oplinking.com</string>
</array>
<key>com.apple.developer.networking.networkextension</key>

View File

@ -150,9 +150,9 @@ class KrNodeListItem {
final protocolsList = jsonDecode(protocols) as List;
final currentProtocol = json['protocol']?.toString().toLowerCase() ?? '';
KRLogUtil.kr_i('📋 protocols 字段内容 (${protocolsList.length} 个协议):', tag: 'NodeList');
// KRLogUtil.kr_i('📋 protocols 字段内容 (${protocolsList.length} 个协议):', tag: 'NodeList');
for (var i = 0; i < protocolsList.length; i++) {
KRLogUtil.kr_i(' 协议 $i: ${jsonEncode(protocolsList[i])}', tag: 'NodeList');
// KRLogUtil.kr_i(' 协议 $i: ${jsonEncode(protocolsList[i])}', tag: 'NodeList');
}
if (protocolsList.isNotEmpty) {
@ -170,7 +170,7 @@ class KrNodeListItem {
(currentProtocol == 'shadowsocks' && protocolType == 'ss') ||
(currentProtocol == 'ss' && protocolType == 'shadowsocks')) {
matchedProtocolConfig = configMap;
KRLogUtil.kr_i('🎯 找到匹配的协议配置: $protocolType', tag: 'NodeList');
// KRLogUtil.kr_i('🎯 找到匹配的协议配置: $protocolType', tag: 'NodeList');
break;
}
}
@ -182,22 +182,22 @@ class KrNodeListItem {
// 53441 protocols 287
if (port == 0 && targetProtocol['port'] != null) {
port = _parseIntSafely(targetProtocol['port']);
KRLogUtil.kr_i('✅ 从 protocols 解析端口: $port', tag: 'NodeList');
// KRLogUtil.kr_i('✅ 从 protocols 解析端口: $port', tag: 'NodeList');
} else {
KRLogUtil.kr_i('✅ 保留顶层端口: $port (protocols中的端口: ${targetProtocol['port']})', tag: 'NodeList');
// KRLogUtil.kr_i('✅ 保留顶层端口: $port (protocols中的端口: ${targetProtocol['port']})', tag: 'NodeList');
}
// cipher
if (targetProtocol['cipher'] != null && targetProtocol['cipher'].toString().isNotEmpty) {
method = targetProtocol['cipher'].toString();
KRLogUtil.kr_i('✅ 从 protocols 解析 cipher: $method', tag: 'NodeList');
// KRLogUtil.kr_i('✅ 从 protocols 解析 cipher: $method', tag: 'NodeList');
}
}
} catch (e) {
KRLogUtil.kr_w('⚠️ 解析 protocols 字段失败: $e', tag: 'NodeList');
}
}
KRLogUtil.kr_i('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━', tag: 'NodeList');
// KRLogUtil.kr_i('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━', tag: 'NodeList');
return KrNodeListItem(
id: _parseIntSafely(json['id']),

View File

@ -132,12 +132,12 @@ class _HINodePageViewState extends State<HINodePageView> {
TextSpan(
children: [
TextSpan(
text: '${AppTranslations.kr_setting.connectionTypeRule}',
text: '智能模式',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.sp, color: Colors.black),
),
TextSpan(
text: AppTranslations.kr_setting.connectionTypeRuleRemark,
style: TextStyle(fontSize: 14.sp, color: Colors.black54),
text: '绕过所在地IP只代理外网服务器速度更快',
style: TextStyle(fontSize: 14.sp,),
),
],
),
@ -147,12 +147,12 @@ class _HINodePageViewState extends State<HINodePageView> {
TextSpan(
children: [
TextSpan(
text: '${AppTranslations.kr_setting.connectionTypeGlobal}',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.sp, color: Colors.black),
text: '全局模式',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.sp),
),
TextSpan(
text: AppTranslations.kr_setting.connectionTypeGlobalRemark,
style: TextStyle(fontSize: 14.sp, color: Colors.black54),
text: '代理所有网络服务器,保障隐私',
style: TextStyle(fontSize: 14.sp),
),
],
),

View File

@ -16,6 +16,7 @@ import 'dart:convert';
import 'package:kaer_with_panels/utils/snackbar_util.dart';
import 'package:kaer_with_panels/app/routes/app_pages.dart';
import 'package:kaer_with_panels/app/common/app_config.dart';
import 'package:kaer_with_panels/app/utils/kr_common_util.dart';
class HIUserInfoController extends GetxController {
///
@ -212,7 +213,8 @@ class HIUserInfoController extends GetxController {
KRLogUtil.kr_e('订阅信息刷新失败: $e', tag: 'DeviceManagement');
}
KRSnackBarUtil.show(AppTranslations.kr_dialog.success, '退出登录成功');
// KRSnackBarUtil.show(AppTranslations.kr_dialog.success, '退出登录成功');
KRCommonUtil.kr_showToast('退出登录成功');
Get.offAllNamed(Routes.KR_HOME);
},
);

View File

@ -273,6 +273,7 @@ class HIUserInfoView extends GetView<HIUserInfoController> {
confirmText: '返回',
// 3. onCancel
onCancel: () {
Get.back();
//
Get.toNamed(Routes.KR_DELETE_ACCOUNT);
},
@ -547,7 +548,7 @@ class HIUserInfoView extends GetView<HIUserInfoController> {
RichText(
text: TextSpan(
style: TextStyle(
fontSize: 10.sp,
fontSize: 12.sp,
color: Colors.black, //
),
children: <TextSpan>[

View File

@ -206,6 +206,7 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
return;
}
bool isExpired = false;
print('current.expireTime${current.expireTime}');
if (current.expireTime.isNotEmpty) {
try {
isExpired =

View File

@ -152,7 +152,7 @@ class KRInviteController extends GetxController {
///
Future<void> kr_handleBindInviteCode() async {
final text = otherInviteCodeController.text;
final text = otherInviteCodeController.text.trim();
if (text.isEmpty) {
KRCommonUtil.kr_showToast('请输入邀请码');
return;

View File

@ -172,9 +172,10 @@ class KRInviteView extends GetView<KRInviteController> {
textInputAction: TextInputAction.done,
onSubmitted: (_) => controller.kr_handleBindInviteCode(),
textAlign: TextAlign.center,
maxLength: 10,
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
decoration: InputDecoration(
hintText: '入邀请人邀请码兑换免费时长...',
hintText: '码领免费时长...',
hintStyle: const TextStyle(color: Color(0xFFA6A6A6)),
filled: true,
fillColor: Colors.transparent,

View File

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
@ -11,6 +12,7 @@ import 'package:kaer_with_panels/app/localization/app_translations.dart';
import 'package:kaer_with_panels/app/utils/kr_event_bus.dart';
import 'package:kaer_with_panels/app/services/kr_site_config_service.dart';
import 'package:kaer_with_panels/app/widgets/dialogs/hi_dialog.dart';
import 'package:kaer_with_panels/app/utils/kr_secure_storage.dart';
import '../../../localization/kr_language_utils.dart';
import 'package:kaer_with_panels/app/services/kr_subscribe_service.dart';
@ -97,6 +99,9 @@ class KRLoginController extends GetxController
RxList kr_emailList = [].obs;
RxBool kr_isDropdownVisible = false.obs;
///
RxList<String> kr_emailHistory = <String>[].obs;
///
final LayerLink kr_layerLink = LayerLink();
OverlayEntry? overlayEntry; //
@ -176,7 +181,6 @@ class KRLoginController extends GetxController
// entry kr_loginByPsd
}
//
_timer = Timer(Duration.zero, () {});
@ -279,6 +283,20 @@ class KRLoginController extends GetxController
});*/
kr_initFocus();
//
KRSecureStorage()
.kr_readData(key: KRSecureStorage.EMAIL_HISTORY_KEY)
.then((historyString) {
if (historyString != null && historyString.isNotEmpty) {
try {
final List<dynamic> decodedList = jsonDecode(historyString);
kr_emailHistory.assignAll(decodedList.cast<String>());
} catch (e) {
print('Error decoding email history: $e');
}
}
});
}
//
@ -338,8 +356,7 @@ class KRLoginController extends GetxController
}, (r) async {
HIDialog.show(
title: '*重要提示',
message:
'验证邮件已发送至邮箱,如无法找到,请检查垃圾邮件箱或营销邮件箱。',
message: '验证邮件已发送至邮箱,如无法找到,请检查垃圾邮件箱或营销邮件箱。',
);
_startCountdown();
@ -353,9 +370,8 @@ class KRLoginController extends GetxController
return;
}
final either = await KRAuthApi().kr_login(
accountController.text,
psdController.text);
final either =
await KRAuthApi().kr_login(accountController.text, psdController.text);
either.fold((l) {
KRCommonUtil.kr_showToast(l.msg);
}, (r) async {
@ -406,7 +422,9 @@ class KRLoginController extends GetxController
accountController.text,
psdController.text,
code: codeController.text.isEmpty ? null : codeController.text,
inviteCode: inviteCodeController.text.isEmpty ? null : inviteCodeController.text,
inviteCode: inviteCodeController.text.isEmpty
? null
: inviteCodeController.text,
);
either.fold(
@ -424,8 +442,10 @@ class KRLoginController extends GetxController
},
);
}
//
final subscriptionResult = await KRAuthApi().kr_checkSubscription(accountController.text);
final subscriptionResult =
await KRAuthApi().kr_checkSubscription(accountController.text);
subscriptionResult.fold(
(error) {
@ -508,9 +528,7 @@ class KRLoginController extends GetxController
}
final either = await KRAuthApi().kr_setNewPsdByForgetPsd(
accountController.text,
codeController.text,
psdController.text);
accountController.text, codeController.text, psdController.text);
either.fold((l) {
KRCommonUtil.kr_showToast(l.msg);
}, (r) async {
@ -547,7 +565,8 @@ class KRLoginController extends GetxController
///
bool validateEmail(String str) {
return RegExp(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$').hasMatch(str);
return RegExp(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$')
.hasMatch(str);
}
///
@ -556,6 +575,33 @@ class KRLoginController extends GetxController
token,
accountController.text,
);
//
KRSecureStorage()
.kr_readData(key: KRSecureStorage.EMAIL_HISTORY_KEY)
.then((historyString) async {
List<String> history = [];
if (historyString != null && historyString.isNotEmpty) {
try {
final List<dynamic> decodedList = jsonDecode(historyString);
history = decodedList.cast<String>();
} catch (e) {
print('Error decoding email history for saving: $e');
}
}
//
if (!history.contains(accountController.text)) {
history.add(accountController.text);
}
// 5
if (history.length > 5) {
history = history.sublist(history.length - 5);
}
await KRSecureStorage().kr_saveData(
key: KRSecureStorage.EMAIL_HISTORY_KEY, value: jsonEncode(history));
});
kr_loginStatus.value = KRLoginProgressStatus.kr_check;
// /

View File

@ -124,10 +124,17 @@ class KRLoginView extends GetView<KRLoginController> {
constraints: BoxConstraints(minHeight: 300.w),
child: Column(
children: [
_buildStandardInputField(
Obx(() => _buildStandardInputField(
controller: controller.accountController,
hintText: 'Email',
),
hintText: '请输入邮箱地址',
suffixes: const [
'@gmail.com',
'@outlook.com',
'@qq.com',
'@163.com'
],
historyEmails: controller.kr_emailHistory.toList(),
)),
// SizedBox(height: 10.w),
// _buildStandardInputField(
// controller: controller.psdController,
@ -157,11 +164,18 @@ class KRLoginView extends GetView<KRLoginController> {
required TextEditingController controller,
required String hintText,
bool isPassword = false,
List<String>? suffixes,
List<String>? historyEmails,
}) {
return SizedBox(
// height: 50, //
child: TextField(
//
Widget buildTextField({
FocusNode? focusNode,
VoidCallback? onEditingComplete,
}) {
return TextField(
controller: controller,
focusNode: focusNode,
onEditingComplete: onEditingComplete,
obscureText: isPassword,
style: KrAppTextStyle(
fontSize: 16,
@ -189,6 +203,122 @@ class KRLoginView extends GetView<KRLoginController> {
borderSide: BorderSide(color: Colors.white, width: 2),
),
),
);
}
//
if ((suffixes == null || suffixes.isEmpty) &&
(historyEmails == null || historyEmails.isEmpty)) {
return SizedBox(
child: buildTextField(),
);
}
// 使 RawAutocomplete
return SizedBox(
child: RawAutocomplete<String>(
textEditingController: controller,
focusNode: FocusNode(),
optionsBuilder: (TextEditingValue textEditingValue) {
final inputText = textEditingValue.text;
//
List<String> options = [];
// 1. ()
if (historyEmails != null) {
if (inputText.isEmpty) {
// RawAutocomplete options fieldViewBuilder
// RawAutocomplete optionsBuilder text
// Focus
// RawAutocomplete initialValue? triggerMode
//
options.addAll(historyEmails);
} else {
options.addAll(historyEmails
.where((email) => email.startsWith(inputText)));
}
}
// 2. ( @ @ )
if (suffixes != null && inputText.isNotEmpty) {
if (!inputText.contains('@')) {
options.addAll(suffixes.map((suffix) => '$inputText$suffix'));
} else {
final atIndex = inputText.indexOf('@');
final prefix = inputText.substring(0, atIndex);
final domainInput = inputText.substring(atIndex); // @
options.addAll(suffixes
.where((suffix) => suffix.startsWith(domainInput))
.map((suffix) => '$prefix$suffix'));
}
}
//
return options.toSet().toList();
},
fieldViewBuilder: (
BuildContext context,
TextEditingController textEditingController,
FocusNode focusNode,
VoidCallback onFieldSubmitted,
) {
// 使 controller fieldViewBuilder textEditingController
// controller
// RawAutocomplete textEditingController
// controller RawAutocomplete
// fieldViewBuilder textEditingController
return buildTextField(
focusNode: focusNode,
onEditingComplete: onFieldSubmitted,
);
},
optionsViewBuilder: (
BuildContext context,
AutocompleteOnSelected<String> onSelected,
Iterable<String> options,
) {
return Align(
alignment: Alignment.topLeft,
child: Material(
elevation: 4.0,
color: const Color(0xFF1E1E1E), //
borderRadius: BorderRadius.circular(8.r),
child: Container(
constraints: BoxConstraints(
maxHeight: 200.w,
maxWidth: 300.w, //
),
width: MediaQuery.of(context).size.width - 80.w, // padding
child: ListView.builder(
padding: EdgeInsets.zero,
shrinkWrap: true,
itemCount: options.length,
itemBuilder: (BuildContext context, int index) {
final String option = options.elementAt(index);
return InkWell(
onTap: () {
onSelected(option);
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.w, vertical: 12.w),
child: Text(
option,
style: KrAppTextStyle(
fontSize: 14,
color: Colors.white,
),
),
),
);
},
),
),
),
);
},
),
);
}

View File

@ -247,38 +247,6 @@ class KRPurchaseMembershipView extends GetView<KRPurchaseMembershipController>
);
}
//
Widget _kr_buildAccountSection(BuildContext context) {
return Container(
margin: EdgeInsets.all(16),
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(12),
),
child: Row(
children: [
Text(
AppTranslations.kr_purchaseMembership.myAccount,
style: KrAppTextStyle(
fontSize: 14,
color: Theme.of(context).textTheme.bodyMedium?.color,
),
),
const Spacer(),
Obx(() => Text(
controller.kr_userEmail.value,
style: KrAppTextStyle(
fontSize: 14,
color: Theme.of(context).textTheme.bodySmall?.color,
),
)),
],
),
);
}
//
Widget _kr_buildPlanOptionCard(
KRPackageListItem plan,
@ -428,9 +396,7 @@ class KRPurchaseMembershipView extends GetView<KRPurchaseMembershipController>
style: TextStyle(
color: Colors.black, //
fontSize: 14,
fontWeight: index == 1
? FontWeight.w300
: FontWeight.w600,
fontWeight: FontWeight.w600,
),
textAlign: TextAlign.center,
),

View File

@ -259,7 +259,7 @@ class HttpUtil {
/// HTTP
class _KRSimpleHttpInterceptor extends Interceptor {
///
static const bool KR_HTTP_PRINT = true;
static const bool KR_HTTP_PRINT = false;
final Dio _dio;
_KRSimpleHttpInterceptor(this._dio);
static String? _lastPath;

View File

@ -607,6 +607,15 @@ class KRSingBoxImp {
KRLogUtil.kr_i('✅ [智能代理模式] region 设为 $effectiveRegion', tag: 'SingBox');
}
final useWindowsDnsDefaults = Platform.isWindows;
final remoteDnsAddress = useWindowsDnsDefaults
? 'udp://1.1.1.1'
: 'https://dns.google/dns-query';
final directDnsAddress = useWindowsDnsDefaults
? (effectiveRegion == 'cn' ? 'udp://223.5.5.5' : 'udp://1.1.1.1')
: 'local';
final dnsDomainStrategy = useWindowsDnsDefaults ? '' : 'prefer_ipv4';
final op = {
"region": effectiveRegion, // 🔧 region
"block-ads": false, // hiddify-app: 广
@ -616,11 +625,10 @@ class KRSingBoxImp {
"resolve-destination": false,
"ipv6-mode":
"ipv4_only", // hiddify-app: 使 IPv4 (: ipv4_only, prefer_ipv4, prefer_ipv6, ipv6_only)
"remote-dns-address":
"https://dns.google/dns-query", // 使 Google DoH DNS
"remote-dns-domain-strategy": "prefer_ipv4",
"direct-dns-address": "local", // 使 DNS
"direct-dns-domain-strategy": "prefer_ipv4",
"remote-dns-address": remoteDnsAddress, // 使 Google DoH DNS
"remote-dns-domain-strategy": dnsDomainStrategy,
"direct-dns-address": directDnsAddress, // 使 DNS
"direct-dns-domain-strategy": dnsDomainStrategy,
"mixed-port": kr_port,
"tproxy-port": kr_port,
"local-dns-port": 36450,

View File

@ -22,7 +22,6 @@ class KRCommonUtil {
_kr_isOpeningCustomerService = true;
try {
kr_showToast('userInfo.openingCustomerService'.tr);
await Get.toNamed(Routes.KR_CHATWOOT);
} catch (e) {
debugPrint('打开客服失败: $e');

View File

@ -17,6 +17,9 @@ class KRSecureStorage {
//
static const String _boxName = 'kaer_secure_storage';
//
static const String EMAIL_HISTORY_KEY = 'email_history';
//
static const String _encryptionKey = 'kaer_secure_storage_key';

View File

@ -179,7 +179,6 @@ class HIBaseScaffold extends StatelessWidget {
style: TextStyle(
color: Colors.black, // 使
fontSize: 14,
fontWeight: FontWeight.w100,
),
),
),

View File

@ -53,20 +53,21 @@ class FFISingboxService with InfraLogger implements SingboxService {
return p.join("libcore", libName);
}
// 🔧 使
//
final devPath = p.join("libcore", "bin", libName);
if (kDebugMode) {
print('🔍 [FFI] 检查开发环境路径: $devPath');
print('🔍 [FFI] 当前工作目录: ${Directory.current.path}');
print('🔍 [FFI] 文件是否存在: ${File(devPath).existsSync()}');
}
if (Platform.isMacOS) {
// app binary
final execPath = File(Platform.resolvedExecutable).absolute.path;
if (File(devPath).existsSync()) {
if (kDebugMode) {
print('✅ [FFI] 使用开发环境路径: $devPath');
// App binary Contents/MacOS, libcore Contents/Frameworks
final bundleDir = p.dirname(p.dirname(execPath)); // Contents
final frameworksPath = p.join(bundleDir, 'Frameworks', libName);
if (File(frameworksPath).existsSync()) {
if (kDebugMode) print('✅ [FFI] macOS bundle 相对路径: $frameworksPath');
return frameworksPath;
} else {
print('⚠️ [FFI] 未找到 libcore.dylibfallback 到默认路径: $libName');
return libName;
}
return devPath;
}
// 使bundle中的路径
@ -82,22 +83,28 @@ class FFISingboxService with InfraLogger implements SingboxService {
print('🚀 [FFI] init() 开始');
}
loggy.debug("initializing");
final box = FFISingboxService._box;
box.setupOnce(NativeApi.initializeApiDLData);
// setupOnce worker isolate _ffiLoadLibrary
// isolate
if (kDebugMode) {
print('⏭️ [FFI] 跳过主 isolate 中的 setupOnce将在 worker isolate 中执行)');
}
print('📡 [FFI] 主 Isolate setupOnce 执行完毕Port 已创建');
if (kDebugMode) {
print('📡 [FFI] 创建 ReceivePort');
}
_statusReceiver = ReceivePort('service status receiver');
print('📡 [FFI] Dart port created: ${_statusReceiver.sendPort.nativePort}');
if (kDebugMode) {
print('🔄 [FFI] 设置状态流');
}
final source = _statusReceiver.asBroadcastStream().map((event) => jsonDecode(event as String)).map(SingboxStatus.fromEvent);
final source = _statusReceiver
.asBroadcastStream()
.map((event) => jsonDecode(event as String))
.map(SingboxStatus.fromEvent);
_status = ValueConnectableStream.seeded(
source,
const SingboxStopped(),
@ -137,9 +144,15 @@ class FFISingboxService with InfraLogger implements SingboxService {
_logger.error('[黑屏调试] setup() 错误: $err');
return left(err);
}
if (kDebugMode) {
print('✅ [FFI][ORDER] setup() finished OK');
}
return right(unit);
} catch (e) {
_logger.error('[黑屏调试] setup() 异常: $e');
if (kDebugMode) {
print('❌ [FFI][ORDER] setup() threw: $e');
}
return left(e.toString());
}
});
@ -226,6 +239,9 @@ class FFISingboxService with InfraLogger implements SingboxService {
bool disableMemoryLimit,
) {
loggy.debug("starting, memory limit: [${!disableMemoryLimit}]");
if (kDebugMode) {
print('🚦 [FFI][ORDER] start() entered (after setup)');
}
return TaskEither(() async {
try {
final startTime = DateTime.now();
@ -244,9 +260,15 @@ class FFISingboxService with InfraLogger implements SingboxService {
_logger.error('[黑屏调试] start() 错误: $err');
return left(err);
}
if (kDebugMode) {
print('✅ [FFI][ORDER] start() finished OK');
}
return right(unit);
} catch (e) {
_logger.error('[黑屏调试] start() 异常: $e');
if (kDebugMode) {
print('❌ [FFI][ORDER] start() threw: $e');
}
return left(e.toString());
}
});
@ -343,12 +365,18 @@ class FFISingboxService with InfraLogger implements SingboxService {
},
);
final err = _box.startCommandClient(1, receiver.sendPort.nativePort).cast<Utf8>().toDartString();
if (kDebugMode) {
print(
'📡 [FFI][ORDER] watchStats startCommandClient port=${receiver.sendPort.nativePort}');
}
final err = _box
.startCommandClient(1, receiver.sendPort.nativePort)
.cast<Utf8>()
.toDartString();
if (err.isNotEmpty) {
loggy.error("error starting status command: $err");
throw err;
}
return _serviceStatsStream = statusStream;
}
@ -385,7 +413,14 @@ class FFISingboxService with InfraLogger implements SingboxService {
);
try {
final err = _box.startCommandClient(5, receiver.sendPort.nativePort).cast<Utf8>().toDartString();
if (kDebugMode) {
print(
'📡 [FFI][ORDER] watchGroups startCommandClient port=${receiver.sendPort.nativePort}');
}
final err = _box
.startCommandClient(5, receiver.sendPort.nativePort)
.cast<Utf8>()
.toDartString();
if (err.isNotEmpty) {
logger.error("error starting group command: $err");
throw err;
@ -429,7 +464,14 @@ class FFISingboxService with InfraLogger implements SingboxService {
);
try {
final err = _box.startCommandClient(13, receiver.sendPort.nativePort).cast<Utf8>().toDartString();
if (kDebugMode) {
print(
'📡 [FFI][ORDER] watchActiveGroups startCommandClient port=${receiver.sendPort.nativePort}');
}
final err = _box
.startCommandClient(13, receiver.sendPort.nativePort)
.cast<Utf8>()
.toDartString();
if (err.isNotEmpty) {
logger.error("error starting: $err");
throw err;
@ -484,7 +526,9 @@ class FFISingboxService with InfraLogger implements SingboxService {
@override
Stream<List<String>> watchLogs(String path) async* {
yield await _readLogFile(File(path));
yield* Watcher(path, pollingDelay: const Duration(seconds: 1)).events.asyncMap((event) async {
yield* Watcher(path, pollingDelay: const Duration(seconds: 1))
.events
.asyncMap((event) async {
if (event.type == ChangeType.MODIFY) {
await _readLogFile(File(path));
}
@ -502,7 +546,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
Future<List<String>> _readLogFile(File file) async {
if (_logFilePosition == 0 && file.lengthSync() == 0) return [];
final content = await file.openRead(_logFilePosition).transform(utf8.decoder).join();
final content =
await file.openRead(_logFilePosition).transform(utf8.decoder).join();
_logFilePosition = file.lengthSync();
final lines = const LineSplitter().convert(content);
if (lines.length > 300) {
@ -527,7 +572,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
return TaskEither(() async {
try {
final result = await IsolateWorker().execute(
() => _ffiGenerateWarpConfig(licenseKey, previousAccountId, previousAccessToken),
() => _ffiGenerateWarpConfig(
licenseKey, previousAccountId, previousAccessToken),
allowSyncFallback: false,
);
final ok = result.isNotEmpty && result[0] == true;
@ -558,6 +604,10 @@ String? _ffiSetup(
int statusPort,
int debugFlag,
) {
if (kDebugMode) {
print(
'🧭 [FFI][ORDER] _ffiSetup inputs statusPort=$statusPort base="$baseDir" working="$workingDir" temp="$tempDir" debug="$debugFlag"');
}
final box = _ffiLoadLibrary();
final err = box
.setup(
@ -569,6 +619,9 @@ String? _ffiSetup(
)
.cast<Utf8>()
.toDartString();
if (kDebugMode) {
print('🧭 [FFI][ORDER] _ffiSetup returned err="${err.isEmpty ? '' : err}"');
}
return err.isEmpty ? null : err;
}
@ -591,7 +644,10 @@ String? _ffiValidateConfig(
String? _ffiChangeOptions(String optionsJson) {
final box = _ffiLoadLibrary();
final err = box.changeHiddifyOptions(optionsJson.toNativeUtf8().cast()).cast<Utf8>().toDartString();
final err = box
.changeHiddifyOptions(optionsJson.toNativeUtf8().cast())
.cast<Utf8>()
.toDartString();
return err.isEmpty ? null : err;
}
@ -653,7 +709,8 @@ String? _ffiSelectOutbound(String groupTag, String outboundTag) {
String? _ffiUrlTest(String groupTag) {
final box = _ffiLoadLibrary();
final err = box.urlTest(groupTag.toNativeUtf8().cast()).cast<Utf8>().toDartString();
final err =
box.urlTest(groupTag.toNativeUtf8().cast()).cast<Utf8>().toDartString();
return err.isEmpty ? null : err;
}

View File

@ -564,6 +564,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
/usr/lib/swift,
"'@executable_path/../Frameworks'",
"\"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
@ -581,10 +587,11 @@
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = NJRRF427XB;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = NJRRF427XB;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = HiFastVPN;
@ -595,6 +602,7 @@
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = com.taw.hifastvpn.mac;
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "HiFastVPN-Mac-Pord";
SWIFT_VERSION = 5.0;
};
name = Profile;
@ -654,6 +662,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
/usr/lib/swift,
"'@executable_path/../Frameworks'",
"\"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -703,6 +717,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
/usr/lib/swift,
"'@executable_path/../Frameworks'",
"\"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
@ -720,10 +740,11 @@
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = NJRRF427XB;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = NJRRF427XB;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = HiFastVPN;
@ -734,6 +755,7 @@
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = com.taw.hifastvpn.mac;
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "HiFastVPN-Mac-Pord";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
@ -748,10 +770,11 @@
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = NJRRF427XB;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = NJRRF427XB;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = HiFastVPN;
@ -762,6 +785,7 @@
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = com.taw.hifastvpn.mac;
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "HiFastVPN-Mac-Pord";
SWIFT_VERSION = 5.0;
};
name = Release;

View File

@ -3,23 +3,19 @@
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>$(TeamIdentifierPrefix)</string>
</array>
<key>com.apple.security.assets.pictures.read-write</key>
<true/>
<key>com.apple.security.personal-information.photos-library</key>
<true/>
<false/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>

View File

@ -3,19 +3,19 @@
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.assets.pictures.read-write</key>
<true/>
<key>com.apple.security.personal-information.photos-library</key>
<true/>
<false/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>

View File

@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+102
version: 1.0.0+103
environment:
sdk: ">=3.5.0 <4.0.0"