Skip to content

Commit

Permalink
v1.1.6-Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghongenpin committed Nov 11, 2024
1 parent 7a00960 commit ac8e1fd
Show file tree
Hide file tree
Showing 23 changed files with 148 additions and 67 deletions.
2 changes: 1 addition & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
"shareCurl": "Share cURL Request",
"shareRequestResponse": "Share Request and Response",
"captureDetail": "Capture Detail",
"proxyPinSoftware": "ProxyPin Full platform packet capture software",
"proxyPinSoftware": "ProxyPin Open source traffic capture software for all platforms",

"prompt": "Prompt",
"curlSchemeRequest": "If the curl format is recognized, should it be converted into an HTTP request?",
Expand Down
2 changes: 1 addition & 1 deletion lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
"shareCurl": "分享 cURL 请求",
"shareRequestResponse": "分享请求和响应",
"captureDetail": "抓包详情",
"proxyPinSoftware": "ProxyPin全平台抓包软件",
"proxyPinSoftware": "ProxyPin全平台开源抓包软件",

"prompt": "提示",
"curlSchemeRequest": "识别到curl格式,是否转换为HTTP请求?",
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/component/multi_window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ Widget multiWindow(int windowId, Map<dynamic, dynamic> argument) {
}

if (argument['name'] == 'CertHashPage') {
return CertHashPage();
return CertHashPage(windowId: windowId);
}

if (argument['name'] == 'JavaScript') {
return const JavaScript();
}

if (argument['name'] == 'RegExpPage') {
return const RegExpPage();
return RegExpPage(windowId: windowId);
}
if (argument['name'] == 'TimestampPage') {
return TimestampPage(windowId: windowId);
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/component/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ InputDecoration decoration(BuildContext context, {String? label, String? hintTex
labelText: label,
hintText: hintText,
suffixIcon: suffixIcon,
hintStyle: TextStyle(color: Colors.grey.shade500),
hintStyle: TextStyle(color: Colors.grey.shade500, fontSize: 15),
border: OutlineInputBorder(borderSide: BorderSide(width: 0.8, color: color)),
enabledBorder: OutlineInputBorder(borderSide: BorderSide(width: 1.3, color: color)),
focusedBorder: OutlineInputBorder(borderSide: BorderSide(width: 2, color: color)));
Expand Down
34 changes: 29 additions & 5 deletions lib/ui/component/toolbox/cert_hash.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@
*/

import 'dart:io';
import 'dart:typed_data';

import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_toastr/flutter_toastr.dart';
import 'package:proxypin/network/util/cert/x509.dart';
import 'package:proxypin/ui/component/buttons.dart';
import 'package:proxypin/ui/component/text_field.dart';
import 'package:proxypin/utils/platform.dart';

///证书哈希名称查看
///@author Hongen Wang
class CertHashPage extends StatefulWidget {
const CertHashPage({super.key});
final int? windowId;

const CertHashPage({super.key, this.windowId});

@override
State<StatefulWidget> createState() {
Expand All @@ -42,13 +46,34 @@ class _CertHashPageState extends State<CertHashPage> {

AppLocalizations get localizations => AppLocalizations.of(context)!;

@override
void initState() {
super.initState();
if (Platforms.isDesktop() && widget.windowId != null) {
HardwareKeyboard.instance.addHandler(onKeyEvent);
}
}

@override
void dispose() {
input.dispose();
decodeData.dispose();
HardwareKeyboard.instance.removeHandler(onKeyEvent);
super.dispose();
}

bool onKeyEvent(KeyEvent event) {
if (widget.windowId == null) return false;
if ((HardwareKeyboard.instance.isMetaPressed || HardwareKeyboard.instance.isControlPressed) &&
event.logicalKey == LogicalKeyboardKey.keyW) {
HardwareKeyboard.instance.removeHandler(onKeyEvent);
WindowController.fromWindowId(widget.windowId!).close();
return true;
}

return false;
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down Expand Up @@ -99,7 +124,8 @@ class _CertHashPageState extends State<CertHashPage> {
decoration: decoration(context, label: localizations.inputContent))),
Align(
alignment: Alignment.bottomLeft,
child: TextButton(onPressed: () {}, child: Text("${localizations.output}:", style: TextStyle(fontSize: 16)))),
child: TextButton(
onPressed: () {}, child: Text("${localizations.output}:", style: TextStyle(fontSize: 16)))),
Container(
width: double.infinity,
padding: const EdgeInsets.all(10),
Expand Down Expand Up @@ -139,6 +165,4 @@ class _CertHashPageState extends State<CertHashPage> {
return null;
}
}


}
18 changes: 18 additions & 0 deletions lib/ui/component/toolbox/qr_code_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import 'dart:async';
import 'dart:io';

import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -58,14 +59,31 @@ class _QrCodePageState extends State<QrCodePage> with SingleTickerProviderStateM
if (Platforms.isMobile()) {
tabController = TabController(initialIndex: 0, length: tabs.length, vsync: this);
}

if (Platforms.isDesktop() && widget.windowId != null) {
HardwareKeyboard.instance.addHandler(onKeyEvent);
}
}

@override
void dispose() {
tabController?.dispose();
HardwareKeyboard.instance.removeHandler(onKeyEvent);
super.dispose();
}

bool onKeyEvent(KeyEvent event) {
if (widget.windowId == null) return false;
if ((HardwareKeyboard.instance.isMetaPressed || HardwareKeyboard.instance.isControlPressed) &&
event.logicalKey == LogicalKeyboardKey.keyW) {
HardwareKeyboard.instance.removeHandler(onKeyEvent);
WindowController.fromWindowId(widget.windowId!).close();
return true;
}

return false;
}

@override
Widget build(BuildContext context) {
if (Platforms.isDesktop()) {
Expand Down
23 changes: 22 additions & 1 deletion lib/ui/component/toolbox/regexp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@
* limitations under the License.
*/

import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_toastr/flutter_toastr.dart';
import 'package:proxypin/ui/component/buttons.dart';
import 'package:proxypin/ui/component/text_field.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:proxypin/utils/platform.dart';

///正则表达式工具
///@author Hongen Wang
class RegExpPage extends StatefulWidget {
const RegExpPage({super.key});
final int? windowId;

const RegExpPage({super.key, this.windowId});

@override
State<StatefulWidget> createState() {
Expand All @@ -45,16 +49,33 @@ class _RegExpPageState extends State<RegExpPage> {
super.initState();
pattern.addListener(onInputChangeMatch);
input.addListener(onInputChangeMatch);

if (Platforms.isDesktop() && widget.windowId != null) {
HardwareKeyboard.instance.addHandler(onKeyEvent);
}
}

@override
void dispose() {
pattern.dispose();
input.dispose();
replaceText.dispose();
HardwareKeyboard.instance.removeHandler(onKeyEvent);
super.dispose();
}

bool onKeyEvent(KeyEvent event) {
if (widget.windowId == null) return false;
if ((HardwareKeyboard.instance.isMetaPressed || HardwareKeyboard.instance.isControlPressed) &&
event.logicalKey == LogicalKeyboardKey.keyW) {
HardwareKeyboard.instance.removeHandler(onKeyEvent);
WindowController.fromWindowId(widget.windowId!).close();
return true;
}

return false;
}

@override
Widget build(BuildContext context) {
Color primaryColor = Theme.of(context).colorScheme.primary;
Expand Down
26 changes: 22 additions & 4 deletions lib/ui/component/toolbox/timestamp.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';

import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -48,6 +49,10 @@ class _TimestampPageState extends State<TimestampPage> {
}
nowTimestamp.text = (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString();
});

if (Platforms.isDesktop() && widget.windowId != null) {
HardwareKeyboard.instance.addHandler(onKeyEvent);
}
}

@override
Expand All @@ -57,9 +62,22 @@ class _TimestampPageState extends State<TimestampPage> {
dateTime.dispose();
timestampOut.dispose();
dateTimeOut.dispose();
HardwareKeyboard.instance.removeHandler(onKeyEvent);
super.dispose();
}

bool onKeyEvent(KeyEvent event) {
if (widget.windowId == null) return false;
if ((HardwareKeyboard.instance.isMetaPressed || HardwareKeyboard.instance.isControlPressed) &&
event.logicalKey == LogicalKeyboardKey.keyW) {
HardwareKeyboard.instance.removeHandler(onKeyEvent);
WindowController.fromWindowId(widget.windowId!).close();
return true;
}

return false;
}

TextStyle? get textStyle => Theme.of(context).textTheme.titleMedium;

bool get isCN => Localizations.localeOf(context) == const Locale.fromSubtags(languageCode: 'zh');
Expand Down Expand Up @@ -89,9 +107,9 @@ class _TimestampPageState extends State<TimestampPage> {
if (Platforms.isDesktop())
Wrap(spacing: 10.0, runSpacing: 10.0, crossAxisAlignment: WrapCrossAlignment.center, children: [
timestampLabel(),
SizedBox(width: 210, child: timestampField()),
SizedBox(width: 220, child: timestampField()),
timestampButton(),
SizedBox(width: 200, child: timestampOutField()),
SizedBox(width: 210, child: timestampOutField()),
]),
if (Platforms.isMobile())
Row(children: [
Expand All @@ -112,9 +130,9 @@ class _TimestampPageState extends State<TimestampPage> {
if (Platforms.isDesktop())
Wrap(spacing: 10.0, runSpacing: 10.0, crossAxisAlignment: WrapCrossAlignment.center, children: [
timeLabel(),
SizedBox(width: 210, child: timeField()),
SizedBox(width: 220, child: timeField()),
timeButton(),
SizedBox(width: 200, child: timeOutField())
SizedBox(width: 210, child: timeOutField())
]),
if (Platforms.isMobile())
Row(children: [
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class AppConfiguration {
Locale? _language;

//是否显示更新内容公告
bool upgradeNoticeV15 = true;
bool upgradeNoticeV16 = true;

/// 是否启用画中画
ValueNotifier<bool> pipEnabled = ValueNotifier(Platform.isAndroid);
Expand Down Expand Up @@ -177,7 +177,7 @@ class AppConfiguration {
_theme = ThemeModel(mode: mode, useMaterial3: config['useMaterial3'] ?? true);
_theme.color = config['themeColor'] ?? "Blue";

upgradeNoticeV15 = config['upgradeNoticeV15'] ?? true;
upgradeNoticeV16 = config['upgradeNoticeV16'] ?? true;
_language = config['language'] == null ? null : Locale.fromSubtags(languageCode: config['language']);
pipEnabled.value = config['pipEnabled'] ?? true;
pipIcon.value = config['pipIcon'] ?? false;
Expand Down Expand Up @@ -222,7 +222,7 @@ class AppConfiguration {
'mode': _theme.mode.name,
'themeColor': _theme.color,
'useMaterial3': _theme.useMaterial3,
'upgradeNoticeV15': upgradeNoticeV15,
'upgradeNoticeV16': upgradeNoticeV16,
"language": _language?.languageCode,
"headerExpanded": headerExpanded,

Expand Down
38 changes: 19 additions & 19 deletions lib/ui/desktop/desktop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class _DesktopHomePagePageState extends State<DesktopHomePage> implements EventL
proxyServer.addListener(this);
panel = NetworkTabController(tabStyle: const TextStyle(fontSize: 16), proxyServer: proxyServer);

if (widget.appConfiguration.upgradeNoticeV15) {
if (widget.appConfiguration.upgradeNoticeV16) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showUpgradeNotice();
});
Expand Down Expand Up @@ -142,37 +142,37 @@ class _DesktopHomePagePageState extends State<DesktopHomePage> implements EventL
actions: [
TextButton(
onPressed: () {
widget.appConfiguration.upgradeNoticeV15 = false;
widget.appConfiguration.upgradeNoticeV16 = false;
widget.appConfiguration.flushConfig();
Navigator.pop(context);
},
child: Text(localizations.cancel))
],
title: Text(isCN ? '更新内容V1.1.5' : "Update content V1.1.5", style: const TextStyle(fontSize: 18)),
title: Text(isCN ? '更新内容V1.1.6' : "Update content V1.1.6", style: const TextStyle(fontSize: 18)),
content: Container(
constraints: const BoxConstraints(maxWidth: 600),
child: SelectableText(
isCN
? '提示:默认不会开启HTTPS抓包,请安装证书后再开启HTTPS抓包。\n'
'点击HTTPS抓包(加锁图标),选择安装根证书,按照提示操作即可。\n\n'
'1. 请求重写升级UI优化, 请求修改增加匹配数据查看\n'
'2. 请求弹出菜单UI优化, 支持请求高亮\n'
'3. 脚本内置File Api, 支持文件读取、写入等操作, 详细查看wiki文档\n'
"4. 脚本内置MD5方法, md5('xxx')\n"
'5. 支持内存自动清理设置, 到内存限制自动清理请求\n'
'6. 工具箱增加正则表达式, 支持匹配数据替换\n'
'7. ios支持生成新根证书, 生成需要重新安装根证书\n'
'8. 修复暗黑模式icon展示不清晰\n'
'1. 新增Hosts设置, 支持域名映射\n'
'2. 工具箱新增时间戳转换\n'
'3. 修复脚本编辑键盘弹出安全模式问题\n'
'4. 修复脚本URL编码问题\n'
'5. 修复请求屏蔽编辑多出空格问题\n'
'6. 修复ipad分享点击无效问题\n'
'7. 修复高级重放次数过多不执行问题\n'
'8. 应用黑白名单增加清除无效应用,添加过滤已存在应用\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. Request to rewrite and upgrade UI optimization, request to modify and add matching data viewing\n'
'2. Request pop-up menu UI optimization, support request highlighting\n'
'3. The script has built-in File Api, which supports file reading, writing and other operations. For details, please refer to the wiki document\n'
"4. The script has built-in MD5 method, md5('xxx')\n"
'5. Support memory automatic cleanup settings, memory limit automatic cleanup requests\n'
'6. Toolbox adds regular expressions to support matching data replacement\n'
'7. iOS supports generating new root certificates, which requires reinstalling the root certificate\n'
'8. Fixed unclear display of dark mode icon\n'
'1. Added Hosts settings to support domain name mapping\n'
'2. Toolbox adds timestamp conversion\n'
'3. Fixed script editing keyboard pop-up safe mode issue\n'
'4. Fixed script URL encoding issue\n'
'5. Fixed the issue of extra spaces in request mask editing\n'
'6. Fixed the issue that iPad share clicks are invalid\n'
'7. Fixed the issue that the advanced replay would not execute if there were too many times\n'
'8. Add and remove invalid applications in the application blacklist and whitelist\n'
'',
style: const TextStyle(fontSize: 14))));
});
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/desktop/request/request_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class _HttpState extends State<_HttpWidget> {
message = widget.message;
body = TextEditingController(text: widget.message?.bodyAsString);
if (widget.message?.headers == null && !widget.readOnly) {
initHeader["User-Agent"] = ["ProxyPin/1.1.5"];
initHeader["User-Agent"] = ["ProxyPin/1.1.6"];
initHeader["Accept"] = ["*/*"];
return;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/desktop/toolbar/setting/filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ class _DomainListState extends State<DomainList> {
},
child: Container(
color: selected[index] == true
? primaryColor.withOpacity(0.8)
? primaryColor.withOpacity(0.6)
: index.isEven
? Colors.grey.withOpacity(0.15)
? Colors.grey.withOpacity(0.1)
: null,
height: 38,
padding: const EdgeInsets.symmetric(vertical: 3),
Expand Down
Loading

0 comments on commit ac8e1fd

Please sign in to comment.