mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-05-20 16:15:47 +08:00
copy host menu
This commit is contained in:
@@ -119,6 +119,7 @@
|
||||
"domainListSubtitle": "Last Request Time: {time}, Count: {count}",
|
||||
|
||||
"copy": "Copy",
|
||||
"copyHost": "Copy Host",
|
||||
"copyUrl": "Copy URL",
|
||||
"copyRequestResponse": "Copy Request and Response",
|
||||
"copyCurl": "Copy cURL",
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
"domainListSubtitle": "最后请求时间: {time}, 次数: {count}",
|
||||
|
||||
"copy": "复制",
|
||||
"copyHost": "复制域名",
|
||||
"copyUrl": "复制URL",
|
||||
"copyRequestResponse": "复制请求和响应",
|
||||
"copyCurl": "复制 cURL 请求",
|
||||
|
||||
@@ -154,7 +154,7 @@ class HttpProxyChannelHandler extends ChannelHandler<HttpRequest> {
|
||||
|
||||
var redirectUri = UriBuild.build(redirectUrl, params: httpRequest.queries);
|
||||
httpRequest.uri = redirectUri.toString();
|
||||
httpRequest.headers.host = redirectUri.host;
|
||||
httpRequest.headers.host = redirectUri.hasPort ? "${redirectUri.host}:${redirectUri.port}" : redirectUri.host;
|
||||
var redirectChannel = await HttpClients.connect(Uri.parse(redirectUrl), proxyHandler, channelContext);
|
||||
channelContext.serverChannel = redirectChannel;
|
||||
await redirectChannel.write(httpRequest);
|
||||
|
||||
@@ -197,7 +197,7 @@ class NetworkTabState extends State<NetworkTabController> with SingleTickerProvi
|
||||
const SizedBox(height: 20),
|
||||
rowWidget("Remote Address", response?.remoteAddress),
|
||||
const SizedBox(height: 20),
|
||||
rowWidget("Request Time", request.requestTime.format()),
|
||||
rowWidget("Request Time", request.requestTime.formatMillisecond()),
|
||||
const SizedBox(height: 20),
|
||||
rowWidget("Duration", response?.costTime()),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:file_selector/file_selector.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:network_proxy/network/bin/configuration.dart';
|
||||
@@ -401,6 +402,13 @@ class _DomainRequestsState extends State<DomainRequests> {
|
||||
context,
|
||||
details.globalPosition,
|
||||
items: <PopupMenuEntry>[
|
||||
CustomPopupMenuItem(
|
||||
height: 35,
|
||||
child: Text(localizations.copyHost, style: const TextStyle(fontSize: 13)),
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: Uri.parse(widget.domain).host));
|
||||
FlutterToastr.show(localizations.copied, context);
|
||||
}),
|
||||
CustomPopupMenuItem(
|
||||
height: 35,
|
||||
child: Text(localizations.domainBlacklist, style: const TextStyle(fontSize: 13)),
|
||||
|
||||
@@ -302,7 +302,7 @@ class _DomainListState extends State<DomainList> {
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
hoverColor: primaryColor.withOpacity(0.3),
|
||||
onSecondaryTapDown: (details) => showMenus(details, index),
|
||||
onSecondaryTapDown: (details) => showMenus(details, index), //right click menus
|
||||
onDoubleTap: () => showEdit(index),
|
||||
onHover: (hover) {
|
||||
if (isPress && selected[index] != true) {
|
||||
@@ -425,6 +425,10 @@ class _DomainListState extends State<DomainList> {
|
||||
});
|
||||
|
||||
showContextMenu(context, details.globalPosition, items: [
|
||||
PopupMenuItem(height: 35, child: Text(localizations.copy), onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: widget.hostList.list[index].pattern.replaceAll(".*", "*")));
|
||||
FlutterToastr.show(localizations.copied, context);
|
||||
}),
|
||||
PopupMenuItem(height: 35, child: Text(localizations.edit), onTap: () => showEdit(index)),
|
||||
PopupMenuItem(height: 35, onTap: () => export([index]), child: Text(localizations.export)),
|
||||
const PopupMenuDivider(),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:date_format/date_format.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:network_proxy/network/bin/configuration.dart';
|
||||
@@ -422,7 +423,7 @@ class DomainListState extends State<DomainList> with AutomaticKeepAliveClientMix
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
subtitle: Text(localizations.domainListSubtitle(value?.length ?? '', time),
|
||||
maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
onLongPress: () => menu(index),
|
||||
onLongPress: () => menu(index), // show menus
|
||||
contentPadding: const EdgeInsets.only(left: 10),
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) {
|
||||
@@ -450,6 +451,15 @@ class DomainListState extends State<DomainList> with AutomaticKeepAliveClientMix
|
||||
return Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
child: SizedBox(
|
||||
width: double.infinity, child: Text(localizations.copyHost, textAlign: TextAlign.center)),
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: hostAndPort.host));
|
||||
FlutterToastr.show(localizations.copied, context);
|
||||
Navigator.of(context).pop();
|
||||
}),
|
||||
const Divider(thickness: 0.5),
|
||||
TextButton(
|
||||
child: SizedBox(
|
||||
width: double.infinity, child: Text(localizations.addBlacklist, textAlign: TextAlign.center)),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:file_selector/file_selector.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:network_proxy/network/bin/configuration.dart';
|
||||
@@ -299,7 +300,7 @@ class _DomainListState extends State<DomainList> {
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
hoverColor: primaryColor.withOpacity(0.3),
|
||||
onLongPress: () => showMenus(index),
|
||||
onLongPress: () => showMenus(index), // menus
|
||||
onDoubleTap: () => showEdit(index),
|
||||
onTap: () {
|
||||
if (multiple) {
|
||||
@@ -363,6 +364,11 @@ class _DomainListState extends State<DomainList> {
|
||||
setState(() => multiple = true);
|
||||
}),
|
||||
const Divider(thickness: 0.5, height: 5),
|
||||
BottomSheetItem(text: localizations.copy, onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: widget.hostList.list[index].pattern.replaceAll(".*", "*")));
|
||||
FlutterToastr.show(localizations.copied, context);
|
||||
}),
|
||||
const Divider(thickness: 0.5, height: 5),
|
||||
BottomSheetItem(text: localizations.edit, onPressed: () => showEdit(index)),
|
||||
const Divider(thickness: 0.5, height: 5),
|
||||
BottomSheetItem(onPressed: () => export([index]), text: localizations.share),
|
||||
|
||||
@@ -18,6 +18,10 @@ extension DateTimeFormat on DateTime {
|
||||
return formatDate(this, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]);
|
||||
}
|
||||
|
||||
String formatMillisecond() {
|
||||
return formatDate(this, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss, '.', SSS]);
|
||||
}
|
||||
|
||||
String timeFormat() {
|
||||
return formatDate(this, [HH, ':', nn, ':', ss]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user