diff --git a/android/app/build.gradle b/android/app/build.gradle index ce1a196..ffba0cc 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -48,7 +48,7 @@ android { defaultConfig { applicationId "com.network.proxy" - ndk { abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64' } + ndk { abiFilters 'armeabi-v7a', 'arm64-v8a', "x86", 'x86_64' } // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 21 targetSdkVersion flutter.targetSdkVersion diff --git a/lib/network/components/script_manager.dart b/lib/network/components/script_manager.dart index 3a64470..5a4807a 100644 --- a/lib/network/components/script_manager.dart +++ b/lib/network/components/script_manager.dart @@ -157,7 +157,7 @@ async function onResponse(context, request, response) { _path.then((value) => value.writeAsString(jsonEncode({'enabled': enabled, 'list': list}))); } - Map scriptSession = {}; + Map scriptSession = {}; ///脚本上下文 Map scriptContext(ScriptItem item) { diff --git a/lib/ui/component/encoder.dart b/lib/ui/component/encoder.dart index 4666c9b..95e1aa6 100644 --- a/lib/ui/component/encoder.dart +++ b/lib/ui/component/encoder.dart @@ -6,6 +6,8 @@ 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:network_proxy/network/util/logger.dart'; +import 'package:network_proxy/utils/lang.dart'; ///编码类型 enum EncoderType { @@ -167,12 +169,23 @@ class _EncoderState extends State with SingleTickerProviderStateM case EncoderType.url: result = Uri.decodeFull(inputText); case EncoderType.base64: - result = utf8.decode(base64Decode(inputText)); + // base64. + var text = inputText.replaceAll('.', ''); + if (text.length % 4 != 0) { + text = text.padRight(text.length + (4 - text.length % 4), '='); + } + Uint8List compressed = base64.decode(text); + try { + result = utf8.decode(compressed); + } catch (e) { + result = String.fromCharCodes(compressed); + } case EncoderType.md5: } - } catch (e) { + } catch (e, t) { + logger.e("$e", error: e, stackTrace: t); FlutterToastr.show(localizations.decodeFail, context); } - outputTextController.text = result; + outputTextController.text = result.fixAutoLines(); } } diff --git a/lib/ui/mobile/request/request_editor.dart b/lib/ui/mobile/request/request_editor.dart index c898e17..6057b01 100644 --- a/lib/ui/mobile/request/request_editor.dart +++ b/lib/ui/mobile/request/request_editor.dart @@ -255,9 +255,11 @@ class _HttpState extends State<_HttpWidget> with AutomaticKeepAliveClientMixin { widget.title, if (widget.urlQueryNotifier != null) KeyValWidget( - title: 'URL${localizations.param}', - paramNotifier: widget.urlQueryNotifier, - params: message is HttpRequest ? (message as HttpRequest).requestUri?.queryParametersAll : null), + title: 'URL${localizations.param}', + paramNotifier: widget.urlQueryNotifier, + params: message is HttpRequest ? (message as HttpRequest).requestUri?.queryParametersAll : null, + expanded: false, + ), KeyValWidget( title: "Headers", params: message?.headers.getHeaders() ?? initHeader, @@ -390,8 +392,10 @@ class KeyValWidget extends StatefulWidget { final Map>? params; final bool readOnly; //只读 final UrlQueryNotifier? paramNotifier; + final bool expanded; - const KeyValWidget({super.key, this.params, this.readOnly = false, this.paramNotifier, required this.title}); + const KeyValWidget( + {super.key, this.params, this.readOnly = false, this.paramNotifier, required this.title, this.expanded = true}); @override State createState() { @@ -480,7 +484,7 @@ class KeyValState extends State { return ExpansionTile( title: Text(widget.title, style: const TextStyle(fontWeight: FontWeight.w500, color: Colors.blue)), tilePadding: const EdgeInsets.only(left: 0, top: 10, bottom: 10), - initiallyExpanded: true, + initiallyExpanded: widget.expanded, shape: const Border(), children: [ ..._buildRows(), diff --git a/lib/ui/mobile/setting/app_whitelist.dart b/lib/ui/mobile/setting/app_whitelist.dart index f45ad56..5b8f296 100644 --- a/lib/ui/mobile/setting/app_whitelist.dart +++ b/lib/ui/mobile/setting/app_whitelist.dart @@ -87,11 +87,13 @@ class _AppWhitelistState extends State { if (snapshot.hasData) { if (snapshot.data!.isEmpty) { return Center( - child: Text( - isCN - ? "未设置白名单应用时会对所有应用抓包" - : "When no whitelist application is set, all applications will be captured", - style: const TextStyle(color: Colors.grey)), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 15), + child: Text( + isCN + ? "未设置白名单应用时会对所有应用抓包" + : "When no whitelist application is set, all applications will be captured", + style: const TextStyle(color: Colors.grey))), ); }