mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-05-09 00:34:17 +08:00
fix base64 decode
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -157,7 +157,7 @@ async function onResponse(context, request, response) {
|
||||
_path.then((value) => value.writeAsString(jsonEncode({'enabled': enabled, 'list': list})));
|
||||
}
|
||||
|
||||
Map<String, dynamic> scriptSession = {};
|
||||
Map<dynamic, dynamic> scriptSession = {};
|
||||
|
||||
///脚本上下文
|
||||
Map<String, dynamic> scriptContext(ScriptItem item) {
|
||||
|
||||
@@ -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<EncoderWidget> 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<String, List<String>>? 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<StatefulWidget> createState() {
|
||||
@@ -480,7 +484,7 @@ class KeyValState extends State<KeyValWidget> {
|
||||
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(),
|
||||
|
||||
@@ -87,11 +87,13 @@ class _AppWhitelistState extends State<AppWhitelist> {
|
||||
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))),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user