From fe4067105eaebcc96cc98eb0f74efdd7c30e9434 Mon Sep 17 00:00:00 2001 From: wanghongenpin Date: Fri, 12 Sep 2025 01:40:14 +0800 Subject: [PATCH] 1.2.1-beta --- lib/ui/configuration.dart | 6 ++--- lib/ui/desktop/desktop.dart | 30 ++++++++++++---------- lib/ui/desktop/setting/request_map.dart | 17 ++++++++++--- lib/ui/desktop/setting/script.dart | 13 ++++++++-- lib/ui/mobile/mobile.dart | 34 +++++++++++++++---------- 5 files changed, 65 insertions(+), 35 deletions(-) diff --git a/lib/ui/configuration.dart b/lib/ui/configuration.dart index 60ccc91..40a9702 100644 --- a/lib/ui/configuration.dart +++ b/lib/ui/configuration.dart @@ -71,7 +71,7 @@ class AppConfiguration { Locale? _language; //是否显示更新内容公告 - bool upgradeNoticeV20 = true; + bool upgradeNoticeV21 = true; /// 是否启用画中画 ValueNotifier pipEnabled = ValueNotifier(Platform.isAndroid); @@ -196,7 +196,7 @@ class AppConfiguration { _theme = ThemeModel(mode: mode, useMaterial3: config['useMaterial3'] ?? true); _theme.color = config['themeColor'] ?? "Blue"; - upgradeNoticeV20 = config['upgradeNoticeV20'] ?? true; + upgradeNoticeV21 = config['upgradeNoticeV21'] ?? true; _language = config['language'] == null ? null : Locale.fromSubtags( @@ -247,7 +247,7 @@ class AppConfiguration { 'mode': _theme.mode.name, 'themeColor': _theme.color, 'useMaterial3': _theme.useMaterial3, - 'upgradeNoticeV20': upgradeNoticeV20, + 'upgradeNoticeV21': upgradeNoticeV21, "language": _language?.languageCode, "languageScript": _language?.scriptCode, "headerExpanded": headerExpanded, diff --git a/lib/ui/desktop/desktop.dart b/lib/ui/desktop/desktop.dart index d873099..70a8652 100644 --- a/lib/ui/desktop/desktop.dart +++ b/lib/ui/desktop/desktop.dart @@ -93,7 +93,7 @@ class _DesktopHomePagePageState extends State implements EventL proxyServer.addListener(this); panel = NetworkTabController(tabStyle: const TextStyle(fontSize: 16), proxyServer: proxyServer); - if (widget.appConfiguration.upgradeNoticeV20) { + if (widget.appConfiguration.upgradeNoticeV21) { WidgetsBinding.instance.addPostFrameCallback((_) { showUpgradeNotice(); }); @@ -161,7 +161,7 @@ class _DesktopHomePagePageState extends State implements EventL actions: [ TextButton( onPressed: () { - widget.appConfiguration.upgradeNoticeV20 = false; + widget.appConfiguration.upgradeNoticeV21 = false; widget.appConfiguration.flushConfig(); Navigator.pop(context); }, @@ -176,20 +176,24 @@ class _DesktopHomePagePageState extends State implements EventL ? '提示:默认不会开启HTTPS抓包,请安装证书后再开启HTTPS抓包。\n' '点击HTTPS抓包(加锁图标),选择安装根证书,按照提示操作即可。\n\n' '1. 消息体增加搜索高亮;\n' - '2. 安卓ROOT系统支持自动安装系统证书;\n' - '3. Socket自动清理,防止退出时资源占用问题;\n' - '4. 调整UI菜单;\n' - '5. 修复HTTP2包大小不正确;\n' - '5. 修复请求映射Bug;\n' - '6. 修复安卓部分闪退情况;\n' + '2. WebSocket 消息体增加预览;\n' + '3. 安卓ROOT系统支持自动安装系统证书;\n' + '4. Socket自动清理,防止退出时资源占用问题;\n' + '5. 修复脚本fetch API部分请求bug;\n' + '6. 修复HTTP2包大小不正确;\n' + '7. 修复请求映射Bug;\n' + '8. 修复手机端历史未自动保存bug;\n' + '9. 修复安卓部分闪退情况;\n' : 'Tips:By default, HTTPS packet capture will not be enabled. Please install the certificate before enabling HTTPS packet capture。\n' 'Click HTTPS Capture packets(Lock icon),Choose to install the root certificate and follow the prompts to proceed。\n\n' '1. Add search highlight for message body;\n' - '2. Android ROOT system supports automatic installation of system certificates;\n' - '3. Socket auto cleanup to prevent resource occupation when exiting;\n' - '4. Adjust UI menu;\n' - '5. Fix incorrect HTTP2 packet size;\n' - '6. Fix request map bug;\n' + '2. Add preview for WebSocket message body;\n' + '3. Android ROOT system supports automatic installation of system certificates;\n' + '4. Socket auto cleanup to prevent resource occupation when exiting;\n' + '5. Fix script fetch API request bug;\n' + '6. Fix incorrect HTTP2 packet size;\n' + '7. Fix request map bug;\n' + '8. Fix the bug that the history on the mobile side is not saved automatically;\n' '7. Fix some Android crash issues;\n', style: const TextStyle(fontSize: 14)))); }); diff --git a/lib/ui/desktop/setting/request_map.dart b/lib/ui/desktop/setting/request_map.dart index 81e4742..13f8b99 100644 --- a/lib/ui/desktop/setting/request_map.dart +++ b/lib/ui/desktop/setting/request_map.dart @@ -21,12 +21,19 @@ import '../../../../network/util/logger.dart'; bool _refresh = false; /// 刷新配置 -void _refreshConfig({bool force = false}) { - if (_refresh && !force) { +Future _refreshConfig({bool force = false}) async { + if (force) { + _refresh = false; + await RequestMapManager.instance.then((manager) => manager.flushConfig()); + await DesktopMultiWindow.invokeMethod(0, "refreshRequestMap"); + return; + } + + if (_refresh) { return; } _refresh = true; - Future.delayed(const Duration(milliseconds: 1500), () async { + Future.delayed(const Duration(milliseconds: 1000), () async { _refresh = false; await RequestMapManager.instance.then((manager) => manager.flushConfig()); await DesktopMultiWindow.invokeMethod(0, "refreshRequestMap"); @@ -66,6 +73,10 @@ class _RequestMapPageState extends State { if ((HardwareKeyboard.instance.isMetaPressed || HardwareKeyboard.instance.isControlPressed) && event.logicalKey == LogicalKeyboardKey.keyW) { HardwareKeyboard.instance.removeHandler(onKeyEvent); + if (_refresh) { + _refreshConfig(force: true).whenComplete(() => WindowController.fromWindowId(widget.windowId!).close()); + return true; + } WindowController.fromWindowId(widget.windowId!).close(); return true; } diff --git a/lib/ui/desktop/setting/script.dart b/lib/ui/desktop/setting/script.dart index 85e944d..426e2cd 100644 --- a/lib/ui/desktop/setting/script.dart +++ b/lib/ui/desktop/setting/script.dart @@ -37,12 +37,17 @@ import 'package:proxypin/utils/lang.dart'; bool _refresh = false; /// 刷新脚本 -void _refreshScript() { +Future _refreshScript({bool force = false}) async { + if (force) { + _refresh = false; + await ScriptManager.instance.then((manager) => manager.flushConfig()); + await DesktopMultiWindow.invokeMethod(0, "refreshScript"); + } if (_refresh) { return; } _refresh = true; - Future.delayed(const Duration(milliseconds: 1500), () async { + Future.delayed(const Duration(milliseconds: 1000), () async { _refresh = false; await ScriptManager.instance.then((manager) => manager.flushConfig()); await DesktopMultiWindow.invokeMethod(0, "refreshScript"); @@ -84,6 +89,10 @@ class _ScriptWidgetState extends State { if ((HardwareKeyboard.instance.isMetaPressed || HardwareKeyboard.instance.isControlPressed) && event.logicalKey == LogicalKeyboardKey.keyW) { HardwareKeyboard.instance.removeHandler(onKeyEvent); + if (_refresh) { + _refreshScript(force: true).whenComplete(() => WindowController.fromWindowId(widget.windowId).close()); + return true; + } WindowController.fromWindowId(widget.windowId).close(); return true; } diff --git a/lib/ui/mobile/mobile.dart b/lib/ui/mobile/mobile.dart index b3755db..1a2ec92 100644 --- a/lib/ui/mobile/mobile.dart +++ b/lib/ui/mobile/mobile.dart @@ -117,7 +117,7 @@ class MobileHomeState extends State implements EventListener, Li proxyServer.addListener(this); proxyServer.start(); - if (widget.appConfiguration.upgradeNoticeV20) { + if (widget.appConfiguration.upgradeNoticeV21) { WidgetsBinding.instance.addPostFrameCallback((_) { showUpgradeNotice(); }); @@ -283,23 +283,29 @@ class MobileHomeState extends State implements EventListener, Li String content = isCN ? '提示:默认不会开启HTTPS抓包,请安装证书后再开启HTTPS抓包。\n\n' '1. 消息体增加搜索高亮;\n' - '2. 安卓ROOT系统支持自动安装系统证书;\n' - '3. Socket自动清理,防止退出时资源占用问题;\n' - '4. 调整UI菜单;\n' - '5. 修复HTTP2包大小不正确;\n' - '6. 修复请求映射Bug;\n' - '7. 修复安卓部分闪退情况;\n' + '2. WebSocket 消息体增加预览;\n' + '3. 安卓ROOT系统支持自动安装系统证书;\n' + '4. Socket自动清理,防止退出时资源占用问题;\n' + '5. 调整UI菜单;\n' + '6. 修复脚本fetch API部分请求bug;\n' + '7. 修复HTTP2包大小不正确;\n' + '8. 修复请求映射Bug;\n' + '9. 修复手机端历史未自动保存bug;\n' + '10. 修复安卓部分闪退情况;\n' : 'Tips: HTTPS packet capture is disabled by default. Please install the certificate before enabling HTTPS packet capture.\n\n' '1. Add search highlight for message body;\n' - '2. Android ROOT system supports automatic installation of system certificates;\n' - '3. Socket auto cleanup to prevent resource occupation when exiting;\n' - '4. Adjust UI menu;\n' - '5. Fix incorrect HTTP2 packet size;\n' - '6. Fix request map bug;\n' - '7. Fix some Android crash issues;\n'; + '2. Add preview for WebSocket message body;\n' + '3. Android ROOT system supports automatic installation of system certificates;\n' + '4. Socket auto cleanup to prevent resource occupation when exiting;\n' + '5. Adjust UI menu;\n' + '5. Fix script fetch API part request bug;\n' + '7. Fix incorrect HTTP2 packet size;\n' + '8. Fix request map bug;\n' + '9. Fix the bug that the history on the mobile side is not saved automatically;\n' + '10. Fix some Android crash issues;\n'; showAlertDialog(isCN ? '更新内容V${AppConfiguration.version}' : "Update content V${AppConfiguration.version}", content, () { - widget.appConfiguration.upgradeNoticeV20 = false; + widget.appConfiguration.upgradeNoticeV21 = false; widget.appConfiguration.flushConfig(); }); }