diff --git a/android/app/src/main/kotlin/com/network/proxy/VpnAlertDialog.kt b/android/app/src/main/kotlin/com/network/proxy/VpnAlertDialog.kt index 0cce647..e8d07b0 100644 --- a/android/app/src/main/kotlin/com/network/proxy/VpnAlertDialog.kt +++ b/android/app/src/main/kotlin/com/network/proxy/VpnAlertDialog.kt @@ -5,7 +5,9 @@ import android.app.AlertDialog import android.os.Bundle import kotlin.system.exitProcess - +/** + * @author wanghongen + */ class VpnAlertDialog : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/lib/main.dart b/lib/main.dart index 84cb767..0ea4e43 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'dart:convert'; import 'dart:io'; @@ -14,6 +30,8 @@ import 'package:network_proxy/utils/navigator.dart'; import 'package:network_proxy/utils/platform.dart'; import 'package:window_manager/window_manager.dart'; +///主入口 +///@author wanghongen void main(List args) async { WidgetsFlutterBinding.ensureInitialized(); diff --git a/lib/network/bin/configuration.dart b/lib/network/bin/configuration.dart index d567405..27b980a 100644 --- a/lib/network/bin/configuration.dart +++ b/lib/network/bin/configuration.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/network/bin/server.dart b/lib/network/bin/server.dart index 01679a3..83088dc 100644 --- a/lib/network/bin/server.dart +++ b/lib/network/bin/server.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/network/channel.dart b/lib/network/channel.dart index 64a8b55..4be0ebd 100644 --- a/lib/network/channel.dart +++ b/lib/network/channel.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,8 @@ import 'package:network_proxy/utils/lang.dart'; import 'handler.dart'; ///处理I/O事件或截获I/O操作 +///[T] 读取的数据类型 +///@author wanghongen abstract class ChannelHandler { var log = logger; diff --git a/lib/network/components/host_filter.dart b/lib/network/components/host_filter.dart index 0c4588b..d3e4b03 100644 --- a/lib/network/components/host_filter.dart +++ b/lib/network/components/host_filter.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + void main() { print(HostFilter.filter("stackoverflow.com")); } diff --git a/lib/network/components/request_block_manager.dart b/lib/network/components/request_block_manager.dart index f75f611..f591a94 100644 --- a/lib/network/components/request_block_manager.dart +++ b/lib/network/components/request_block_manager.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'dart:convert'; import 'dart:io'; diff --git a/lib/network/components/request_rewrite_manager.dart b/lib/network/components/request_rewrite_manager.dart index 9dd35b7..69756e3 100644 --- a/lib/network/components/request_rewrite_manager.dart +++ b/lib/network/components/request_rewrite_manager.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'dart:collection'; import 'dart:convert'; import 'dart:io'; diff --git a/lib/network/components/script_manager.dart b/lib/network/components/script_manager.dart index 5b35634..26dee9a 100644 --- a/lib/network/components/script_manager.dart +++ b/lib/network/components/script_manager.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'dart:convert'; import 'dart:io'; diff --git a/lib/network/handler.dart b/lib/network/handler.dart index f7e7259..ed3ac3d 100644 --- a/lib/network/handler.dart +++ b/lib/network/handler.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/network/host_port.dart b/lib/network/host_port.dart index d674214..d729cc1 100644 --- a/lib/network/host_port.dart +++ b/lib/network/host_port.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/network/http_client.dart b/lib/network/http_client.dart index d8d3c2a..931ac57 100644 --- a/lib/network/http_client.dart +++ b/lib/network/http_client.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ * limitations under the License. */ + import 'dart:async'; import 'dart:io'; diff --git a/lib/network/network.dart b/lib/network/network.dart index 94acf84..e203936 100644 --- a/lib/network/network.dart +++ b/lib/network/network.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/network/proxy_helper.dart b/lib/network/proxy_helper.dart index 9117a2e..04d7117 100644 --- a/lib/network/proxy_helper.dart +++ b/lib/network/proxy_helper.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'dart:convert'; import 'dart:io'; @@ -74,13 +90,16 @@ class ProxyHelper { HttpStatus status = HttpStatus(-1, message); if (error is HandshakeException) { status = HttpStatus( - -2, Localizations.isEN ? 'SSL handshake failed, please check the certificate' : 'SSL handshake failed, 请检查证书安装是否正确'); + -2, + Localizations.isZH + ? 'SSL handshake failed, 请检查证书安装是否正确' + : 'SSL handshake failed, please check the certificate'); } else if (error is ParserException) { status = HttpStatus(-3, error.message); } else if (error is SocketException) { status = HttpStatus(-4, error.message); } else if (error is SignalException) { - status.reason('执行脚本异常'); + status.reason(Localizations.isZH ? '执行脚本异常' : 'Execute script exception'); } request ??= HttpRequest(HttpMethod.connect, hostAndPort.domain) diff --git a/lib/network/util/byte_buf.dart b/lib/network/util/byte_buf.dart index 9787002..31d1155 100644 --- a/lib/network/util/byte_buf.dart +++ b/lib/network/util/byte_buf.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'dart:typed_data'; ///类似于netty ByteBuf diff --git a/lib/network/util/cache.dart b/lib/network/util/cache.dart index e0d6399..17541f7 100644 --- a/lib/network/util/cache.dart +++ b/lib/network/util/cache.dart @@ -1,4 +1,18 @@ - +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:async'; diff --git a/lib/network/util/crts.dart b/lib/network/util/crts.dart index c5b10e3..7d6f6b1 100644 --- a/lib/network/util/crts.dart +++ b/lib/network/util/crts.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/network/util/lists.dart b/lib/network/util/lists.dart index 28d9668..1ac4001 100644 --- a/lib/network/util/lists.dart +++ b/lib/network/util/lists.dart @@ -1,4 +1,5 @@ -//获取list元素类型 +///获取list元素类型 +/// @author wanghongen Type getListElementType(dynamic list) { if (list == null || list.isEmpty || list is! List) { return Null; diff --git a/lib/network/util/localizations.dart b/lib/network/util/localizations.dart index 776df69..4628d10 100644 --- a/lib/network/util/localizations.dart +++ b/lib/network/util/localizations.dart @@ -1,8 +1,14 @@ +import 'dart:ui'; + import 'package:network_proxy/ui/configuration.dart'; +/// @author wanghongen class Localizations { + static bool get isZH { + if (AppConfiguration.current?.language != null) { + return AppConfiguration.current?.language!.languageCode == 'zh'; + } - static bool get isEN { - return AppConfiguration.current?.language?.languageCode == 'en'; + return PlatformDispatcher.instance.locale.languageCode == 'zh'; } } diff --git a/lib/network/util/process_info.dart b/lib/network/util/process_info.dart index 6ce7243..ff782c4 100644 --- a/lib/network/util/process_info.dart +++ b/lib/network/util/process_info.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:convert'; import 'dart:io'; import 'dart:typed_data'; @@ -16,6 +31,8 @@ void main() async { print(processInfo); } +/// 进程信息工具类 用于获取进程信息 +///@author wanghongen class ProcessInfoUtils { static final processInfoCache = ExpiringCache(const Duration(minutes: 5)); diff --git a/lib/network/util/system_proxy.dart b/lib/network/util/system_proxy.dart index d4f1ddc..5db49fd 100644 --- a/lib/network/util/system_proxy.dart +++ b/lib/network/util/system_proxy.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/storage/favorites.dart b/lib/storage/favorites.dart index ebb3223..84f26e6 100644 --- a/lib/storage/favorites.dart +++ b/lib/storage/favorites.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:collection'; import 'dart:convert'; @@ -5,6 +20,8 @@ import 'package:network_proxy/network/http/http.dart'; import 'package:network_proxy/network/util/logger.dart'; import 'package:network_proxy/storage/path.dart'; +/// 收藏存储 +/// @author WangHongEn class FavoriteStorage { static Queue? list; diff --git a/lib/storage/histories.dart b/lib/storage/histories.dart index f718d7f..73d693a 100644 --- a/lib/storage/histories.dart +++ b/lib/storage/histories.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'dart:async'; import 'dart:collection'; import 'dart:convert'; @@ -15,6 +31,7 @@ import 'package:network_proxy/utils/listenable_list.dart'; import 'package:path_provider/path_provider.dart'; ///历史存储 +///@Author WangHongEn class HistoryStorage { static HistoryStorage? _instance; final File _storageFile; diff --git a/lib/ui/component/json/json_text.dart b/lib/ui/component/json/json_text.dart index 33322f6..2f5335b 100644 --- a/lib/ui/component/json/json_text.dart +++ b/lib/ui/component/json/json_text.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:io'; import 'dart:math'; diff --git a/lib/ui/component/json/json_viewer.dart b/lib/ui/component/json/json_viewer.dart index f49a95c..3d9bb97 100644 --- a/lib/ui/component/json/json_viewer.dart +++ b/lib/ui/component/json/json_viewer.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ library flutter_json_widget; import 'dart:convert'; diff --git a/lib/ui/configuration.dart b/lib/ui/configuration.dart index 3c029c6..905d537 100644 --- a/lib/ui/configuration.dart +++ b/lib/ui/configuration.dart @@ -1,3 +1,20 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + import 'dart:convert'; import 'dart:io'; diff --git a/lib/ui/content/body.dart b/lib/ui/content/body.dart index 39bed45..11151d0 100644 --- a/lib/ui/content/body.dart +++ b/lib/ui/content/body.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:convert'; import 'dart:io'; @@ -23,6 +38,8 @@ import 'package:window_manager/window_manager.dart'; import '../component/json/json_text.dart'; +///请求响应的body部分 +///@Author wanghongen class HttpBodyWidget extends StatefulWidget { final HttpMessage? httpMessage; final bool inNewWindow; //是否在新窗口打开 diff --git a/lib/ui/content/panel.dart b/lib/ui/content/panel.dart index 24a74cc..9bc199f 100644 --- a/lib/ui/content/panel.dart +++ b/lib/ui/content/panel.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:network_proxy/network/bin/server.dart'; @@ -12,6 +27,8 @@ import 'package:network_proxy/utils/platform.dart'; import 'body.dart'; +///网络请求详情页 +///@Author: wanghongen class NetworkTabController extends StatefulWidget { static GlobalKey? currentKey; diff --git a/lib/ui/desktop/desktop.dart b/lib/ui/desktop/desktop.dart index 1e71fcc..54c838e 100644 --- a/lib/ui/desktop/desktop.dart +++ b/lib/ui/desktop/desktop.dart @@ -1,3 +1,20 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:network_proxy/network/bin/configuration.dart'; diff --git a/lib/ui/desktop/left_menus/favorite.dart b/lib/ui/desktop/left_menus/favorite.dart index b4b7ec2..21f5f7e 100644 --- a/lib/ui/desktop/left_menus/favorite.dart +++ b/lib/ui/desktop/left_menus/favorite.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'dart:collection'; import 'dart:convert'; import 'dart:io'; diff --git a/lib/ui/desktop/left_menus/history.dart b/lib/ui/desktop/left_menus/history.dart index 7c858a0..0bdc23f 100644 --- a/lib/ui/desktop/left_menus/history.dart +++ b/lib/ui/desktop/left_menus/history.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:async'; import 'dart:io'; import 'dart:math'; diff --git a/lib/ui/desktop/left_menus/navigation.dart b/lib/ui/desktop/left_menus/navigation.dart index c43e01f..9a45dd0 100644 --- a/lib/ui/desktop/left_menus/navigation.dart +++ b/lib/ui/desktop/left_menus/navigation.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:network_proxy/network/bin/server.dart'; @@ -5,6 +20,9 @@ import 'package:network_proxy/ui/configuration.dart'; import 'package:network_proxy/ui/desktop/preference.dart'; import 'package:url_launcher/url_launcher.dart'; +///左侧导航栏 +/// @author wanghongen +/// 2024/8/6 class LeftNavigationBar extends StatefulWidget { final AppConfiguration appConfiguration; final ProxyServer proxyServer; diff --git a/lib/ui/desktop/preference.dart b/lib/ui/desktop/preference.dart index 49a0c13..f50ea50 100644 --- a/lib/ui/desktop/preference.dart +++ b/lib/ui/desktop/preference.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:network_proxy/network/bin/configuration.dart'; diff --git a/lib/ui/desktop/request/list.dart b/lib/ui/desktop/request/list.dart index f57b41a..0c016d1 100644 --- a/lib/ui/desktop/request/list.dart +++ b/lib/ui/desktop/request/list.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:collection'; import 'dart:io'; @@ -24,7 +39,7 @@ import 'package:network_proxy/ui/desktop/request/search.dart'; import 'package:network_proxy/utils/har.dart'; import 'package:network_proxy/utils/listenable_list.dart'; -/// @auth wanghongen +/// @author wanghongen class DesktopRequestListWidget extends StatefulWidget { final ProxyServer proxyServer; final ListenableList? list; diff --git a/lib/ui/desktop/request/model/search_model.dart b/lib/ui/desktop/request/model/search_model.dart index bced810..ae6c6c2 100644 --- a/lib/ui/desktop/request/model/search_model.dart +++ b/lib/ui/desktop/request/model/search_model.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:network_proxy/network/http/http.dart'; /// @author wanghongen diff --git a/lib/ui/desktop/request/repeat.dart b/lib/ui/desktop/request/repeat.dart index aa25085..c8618e1 100644 --- a/lib/ui/desktop/request/repeat.dart +++ b/lib/ui/desktop/request/repeat.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:async'; import 'dart:convert'; import 'dart:math'; diff --git a/lib/ui/desktop/request/request.dart b/lib/ui/desktop/request/request.dart index d2b5f1e..89f5553 100644 --- a/lib/ui/desktop/request/request.dart +++ b/lib/ui/desktop/request/request.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:convert'; import 'dart:io'; diff --git a/lib/ui/desktop/request/request_editor.dart b/lib/ui/desktop/request/request_editor.dart index 06a79d7..5beed48 100644 --- a/lib/ui/desktop/request/request_editor.dart +++ b/lib/ui/desktop/request/request_editor.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/ui/desktop/request/request_sequence.dart b/lib/ui/desktop/request/request_sequence.dart index 875b57f..86317ba 100644 --- a/lib/ui/desktop/request/request_sequence.dart +++ b/lib/ui/desktop/request/request_sequence.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:collection'; import 'dart:io'; @@ -11,7 +26,7 @@ import 'package:network_proxy/ui/desktop/request/request.dart'; import 'package:network_proxy/utils/listenable_list.dart'; ///请求序列 列表 -/// @auth wanghongen +/// @author wanghongen class RequestSequence extends StatefulWidget { final ListenableList container; final ProxyServer proxyServer; diff --git a/lib/ui/desktop/request/search.dart b/lib/ui/desktop/request/search.dart index ccfed92..d513bf4 100644 --- a/lib/ui/desktop/request/search.dart +++ b/lib/ui/desktop/request/search.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:network_proxy/network/http/http.dart'; diff --git a/lib/ui/desktop/request/search_condition.dart b/lib/ui/desktop/request/search_condition.dart index c52d09e..d9f4944 100644 --- a/lib/ui/desktop/request/search_condition.dart +++ b/lib/ui/desktop/request/search_condition.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2024 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; diff --git a/lib/ui/desktop/toolbar/phone_connect.dart b/lib/ui/desktop/toolbar/phone_connect.dart index 216c87e..53c0a69 100644 --- a/lib/ui/desktop/toolbar/phone_connect.dart +++ b/lib/ui/desktop/toolbar/phone_connect.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:network_proxy/network/bin/server.dart'; import 'package:qr_flutter/qr_flutter.dart'; diff --git a/lib/ui/desktop/toolbar/setting/external_proxy.dart b/lib/ui/desktop/toolbar/setting/external_proxy.dart index a69b12b..01e890d 100644 --- a/lib/ui/desktop/toolbar/setting/external_proxy.dart +++ b/lib/ui/desktop/toolbar/setting/external_proxy.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:io'; import 'package:flutter/material.dart'; diff --git a/lib/ui/desktop/toolbar/setting/filter.dart b/lib/ui/desktop/toolbar/setting/filter.dart index c58f0e3..305aa43 100644 --- a/lib/ui/desktop/toolbar/setting/filter.dart +++ b/lib/ui/desktop/toolbar/setting/filter.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:convert'; import 'package:file_selector/file_selector.dart'; diff --git a/lib/ui/desktop/toolbar/setting/request_block.dart b/lib/ui/desktop/toolbar/setting/request_block.dart index 3f19f3f..13fe6eb 100644 --- a/lib/ui/desktop/toolbar/setting/request_block.dart +++ b/lib/ui/desktop/toolbar/setting/request_block.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:network_proxy/network/components/request_block_manager.dart'; diff --git a/lib/ui/desktop/toolbar/setting/request_rewrite.dart b/lib/ui/desktop/toolbar/setting/request_rewrite.dart index 9c2d0c2..e9b971d 100644 --- a/lib/ui/desktop/toolbar/setting/request_rewrite.dart +++ b/lib/ui/desktop/toolbar/setting/request_rewrite.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:convert'; import 'dart:io'; diff --git a/lib/ui/desktop/toolbar/setting/rewrite/rewrite_replace.dart b/lib/ui/desktop/toolbar/setting/rewrite/rewrite_replace.dart index 87c5f76..f5c442a 100644 --- a/lib/ui/desktop/toolbar/setting/rewrite/rewrite_replace.dart +++ b/lib/ui/desktop/toolbar/setting/rewrite/rewrite_replace.dart @@ -1,4 +1,19 @@ -import 'dart:math'; +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import 'dart:math'; import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:flutter/material.dart'; diff --git a/lib/ui/desktop/toolbar/setting/rewrite/rewrite_update.dart b/lib/ui/desktop/toolbar/setting/rewrite/rewrite_update.dart index 82e8c9e..b8e078c 100644 --- a/lib/ui/desktop/toolbar/setting/rewrite/rewrite_update.dart +++ b/lib/ui/desktop/toolbar/setting/rewrite/rewrite_update.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:flutter_toastr/flutter_toastr.dart'; import 'package:network_proxy/network/components/request_rewrite_manager.dart'; diff --git a/lib/ui/desktop/toolbar/setting/script.dart b/lib/ui/desktop/toolbar/setting/script.dart index e677838..7afc5d2 100644 --- a/lib/ui/desktop/toolbar/setting/script.dart +++ b/lib/ui/desktop/toolbar/setting/script.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/ui/desktop/toolbar/setting/setting.dart b/lib/ui/desktop/toolbar/setting/setting.dart index f9642dd..0ba5e65 100644 --- a/lib/ui/desktop/toolbar/setting/setting.dart +++ b/lib/ui/desktop/toolbar/setting/setting.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; diff --git a/lib/ui/desktop/toolbar/toolbar.dart b/lib/ui/desktop/toolbar/toolbar.dart index 246943f..8597412 100644 --- a/lib/ui/desktop/toolbar/toolbar.dart +++ b/lib/ui/desktop/toolbar/toolbar.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:io'; import 'package:flutter/material.dart'; diff --git a/lib/ui/desktop/window_listener.dart b/lib/ui/desktop/window_listener.dart index 58ee276..2cb8950 100644 --- a/lib/ui/desktop/window_listener.dart +++ b/lib/ui/desktop/window_listener.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'package:network_proxy/network/util/logger.dart'; import 'package:network_proxy/ui/configuration.dart'; import 'package:window_manager/window_manager.dart'; diff --git a/lib/ui/launch/launch.dart b/lib/ui/launch/launch.dart index 54e1a78..5fc8935 100644 --- a/lib/ui/launch/launch.dart +++ b/lib/ui/launch/launch.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:io'; import 'dart:ui'; @@ -9,6 +24,9 @@ import 'package:network_proxy/utils/lang.dart'; import 'package:network_proxy/utils/platform.dart'; import 'package:window_manager/window_manager.dart'; +///启动按钮 +///@author wanghongen +///2023/10/8 class SocketLaunch extends StatefulWidget { static ValueNotifier> startStatus = ValueNotifier(ValueWrap()); diff --git a/lib/ui/mobile/menu/drawer.dart b/lib/ui/mobile/menu/drawer.dart index fbac7b0..097b872 100644 --- a/lib/ui/mobile/menu/drawer.dart +++ b/lib/ui/mobile/menu/drawer.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:io'; import 'package:flutter/material.dart'; diff --git a/lib/ui/mobile/menu/menu.dart b/lib/ui/mobile/menu/menu.dart index c260e91..39f55c5 100644 --- a/lib/ui/mobile/menu/menu.dart +++ b/lib/ui/mobile/menu/menu.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:io'; import 'package:date_format/date_format.dart'; diff --git a/lib/ui/mobile/menu/preference.dart b/lib/ui/mobile/menu/preference.dart index 7ae2955..1d05721 100644 --- a/lib/ui/mobile/menu/preference.dart +++ b/lib/ui/mobile/menu/preference.dart @@ -10,6 +10,7 @@ import 'package:network_proxy/ui/mobile/setting/proxy.dart'; import 'package:network_proxy/ui/mobile/setting/theme.dart'; ///设置 +///@author wanghongen class SettingMenu extends StatelessWidget { final ProxyServer proxyServer; final AppConfiguration appConfiguration; diff --git a/lib/ui/mobile/mobile.dart b/lib/ui/mobile/mobile.dart index 900fe2a..ec1b4fe 100644 --- a/lib/ui/mobile/mobile.dart +++ b/lib/ui/mobile/mobile.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'dart:async'; import 'dart:io'; @@ -28,6 +44,8 @@ import 'package:network_proxy/utils/ip.dart'; import 'package:network_proxy/utils/lang.dart'; import 'package:network_proxy/utils/listenable_list.dart'; +///移动端首页 +///@author wanghongen class MobileHomePage extends StatefulWidget { final Configuration configuration; final AppConfiguration appConfiguration; @@ -49,9 +67,6 @@ class MobileHomeState extends State implements EventListener, Li late ProxyServer proxyServer; - ///画中画 - // bool pictureInPicture = false; - AppLocalizations get localizations => AppLocalizations.of(context)!; @override @@ -157,7 +172,7 @@ class MobileHomeState extends State implements EventListener, Li Widget build(BuildContext context) { return PopScope( canPop: false, - onPopInvoked: (d) async { + onPopInvokedWithResult: (d, result) async { if (await enterPictureInPicture()) { return; } diff --git a/lib/ui/mobile/request/domians.dart b/lib/ui/mobile/request/domians.dart new file mode 100644 index 0000000..85f1b3a --- /dev/null +++ b/lib/ui/mobile/request/domians.dart @@ -0,0 +1,327 @@ +/* + * Copyright 2024 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import 'dart:collection'; + +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'; +import 'package:network_proxy/network/bin/server.dart'; +import 'package:network_proxy/network/components/host_filter.dart'; +import 'package:network_proxy/network/host_port.dart'; +import 'package:network_proxy/network/http/http.dart'; +import 'package:network_proxy/network/http_client.dart'; +import 'package:network_proxy/ui/mobile/request/request_sequence.dart'; +import 'package:network_proxy/utils/listenable_list.dart'; + +///域名列表 +///@author wanghongen +class DomainList extends StatefulWidget { + final ListenableList list; + final ProxyServer proxyServer; + final Function(List)? onRemove; + + const DomainList({super.key, required this.list, required this.proxyServer, this.onRemove}); + + @override + State createState() { + return DomainListState(); + } +} + +class DomainListState extends State with AutomaticKeepAliveClientMixin { + final ScrollController _scrollController = ScrollController(); + + GlobalKey requestSequenceKey = GlobalKey(); + late Configuration configuration; + + //域名和对应请求列表的映射 + Map> containerMap = {}; + + //域名列表 为了维护插入顺序 + LinkedHashSet domainList = LinkedHashSet(); + + //显示的域名 最新的在顶部 + List view = []; + + HostAndPort? showHostAndPort; + + //搜索关键字 + String? searchText; + + AppLocalizations get localizations => AppLocalizations.of(context)!; + + @override + initState() { + super.initState(); + configuration = widget.proxyServer.configuration; + + for (var request in widget.list) { + var hostAndPort = request.hostAndPort!; + domainList.add(hostAndPort); + var list = containerMap[hostAndPort] ??= []; + list.add(request); + } + + view = domainList.toList(); + } + + add(HttpRequest request) { + var hostAndPort = request.hostAndPort!; + domainList.remove(hostAndPort); + domainList.add(hostAndPort); + + var list = containerMap[hostAndPort] ??= []; + list.add(request); + if (showHostAndPort == request.hostAndPort) { + requestSequenceKey.currentState?.add(request); + } + + if (!filter(request.hostAndPort!)) { + return; + } + + view = [...domainList.where(filter)].reversed.toList(); + setState(() {}); + } + + addResponse(HttpResponse response) { + if (showHostAndPort == response.request?.hostAndPort) { + requestSequenceKey.currentState?.addResponse(response); + } + } + + clean() { + setState(() { + view.clear(); + domainList.clear(); + containerMap.clear(); + }); + } + + remove(List list) { + for (var request in list) { + containerMap[request.hostAndPort]?.remove(request); + if (containerMap[request.hostAndPort]!.isEmpty) { + domainList.remove(request.hostAndPort); + view.remove(request.hostAndPort); + } + } + + setState(() {}); + } + + ///搜索域名 + void search(String? text) { + if (text == null) { + setState(() { + view = List.of(domainList.toList().reversed); + searchText = null; + }); + return; + } + + text = text.toLowerCase(); + setState(() { + var contains = text!.contains(searchText ?? ""); + searchText = text.toLowerCase(); + if (contains) { + //包含从上次结果过滤 + view.retainWhere(filter); + } else { + view = List.of(domainList.where(filter).toList().reversed); + } + }); + } + + bool filter(HostAndPort hostAndPort) { + if (searchText?.isNotEmpty == true) { + return hostAndPort.domain.toLowerCase().contains(searchText!); + } + return true; + } + + @override + bool get wantKeepAlive => true; + + @override + void dispose() { + _scrollController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + super.build(context); + + return PrimaryScrollController( + controller: _scrollController, + child: Scrollbar( + controller: _scrollController, + child: ListView.separated( + controller: _scrollController, + padding: EdgeInsets.zero, + separatorBuilder: (context, index) => + Divider(thickness: 0.2, height: 0.5, color: Theme.of(context).dividerColor), + itemCount: view.length, + itemBuilder: (ctx, index) => title(index)))); + } + + Widget title(int index) { + var value = containerMap[view.elementAt(index)]; + var time = value == null ? '' : formatDate(value.last.requestTime, [m, '/', d, ' ', HH, ':', nn, ':', ss]); + + return ListTile( + visualDensity: const VisualDensity(vertical: -4), + title: Text(view.elementAt(index).domain, maxLines: 1, overflow: TextOverflow.ellipsis), + trailing: const Icon(Icons.chevron_right), + subtitle: Text(localizations.domainListSubtitle(value?.length ?? '', time), + maxLines: 1, overflow: TextOverflow.ellipsis), + onLongPress: () => menu(index), + // show menus + contentPadding: const EdgeInsets.only(left: 10), + onTap: () { + Navigator.push(context, MaterialPageRoute(builder: (context) { + showHostAndPort = view.elementAt(index); + return Scaffold( + appBar: AppBar(title: Text(view.elementAt(index).domain, style: const TextStyle(fontSize: 16))), + body: RequestSequence( + key: requestSequenceKey, + displayDomain: false, + container: ListenableList(containerMap[view.elementAt(index)]!), + onRemove: widget.onRemove, + proxyServer: widget.proxyServer)); + })); + }); + } + + scrollToTop() { + _scrollController.animateTo(0, duration: const Duration(milliseconds: 300), curve: Curves.easeInOut); + } + + ///菜单 + menu(int index) { + var hostAndPort = view.elementAt(index); + showModalBottomSheet( + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(10))), + context: context, + enableDrag: true, + builder: (ctx) { + 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)), + onPressed: () { + HostFilter.blacklist.add(hostAndPort.host); + configuration.flushConfig(); + FlutterToastr.show(localizations.addSuccess, context); + Navigator.of(context).pop(); + }), + const Divider(thickness: 0.5), + TextButton( + child: SizedBox( + width: double.infinity, child: Text(localizations.addWhitelist, textAlign: TextAlign.center)), + onPressed: () { + HostFilter.whitelist.add(hostAndPort.host); + configuration.flushConfig(); + FlutterToastr.show(localizations.addSuccess, context); + Navigator.of(context).pop(); + }), + const Divider(thickness: 0.5), + TextButton( + child: SizedBox( + width: double.infinity, child: Text(localizations.deleteWhitelist, textAlign: TextAlign.center)), + onPressed: () { + HostFilter.whitelist.remove(hostAndPort.host); + configuration.flushConfig(); + FlutterToastr.show(localizations.deleteSuccess, context); + Navigator.of(context).pop(); + }), + const Divider(thickness: 0.5), + TextButton( + child: SizedBox( + width: double.infinity, + child: Text(localizations.repeatDomainRequests, textAlign: TextAlign.center)), + onPressed: () { + Navigator.of(context).pop(); + repeatDomainRequests(hostAndPort); + }), + const Divider(thickness: 0.5), + TextButton( + child: + SizedBox(width: double.infinity, child: Text(localizations.delete, textAlign: TextAlign.center)), + onPressed: () { + setState(() { + var requests = containerMap.remove(hostAndPort); + domainList.remove(hostAndPort); + view.removeAt(index); + if (requests != null) { + widget.onRemove?.call(requests); + } + FlutterToastr.show(localizations.deleteSuccess, context); + Navigator.of(context).pop(); + }); + }), + Container( + color: Theme.of(context).hoverColor, + height: 8, + ), + TextButton( + child: Container( + height: 50, + width: double.infinity, + padding: const EdgeInsets.only(top: 10), + child: Text(localizations.cancel, textAlign: TextAlign.center)), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); + } + + //重复域名下请求 + void repeatDomainRequests(HostAndPort hostAndPort) async { + var requests = containerMap[hostAndPort]; + if (requests == null) return; + + for (var httpRequest in requests.toList()) { + var request = httpRequest.copy(uri: httpRequest.requestUrl); + var proxyInfo = widget.proxyServer.isRunning ? ProxyInfo.of("127.0.0.1", widget.proxyServer.port) : null; + try { + await HttpClients.proxyRequest(request, proxyInfo: proxyInfo); + if (mounted) FlutterToastr.show(localizations.reSendRequest, rootNavigator: true, context); + } catch (e) { + if (mounted) FlutterToastr.show('${localizations.fail}$e', rootNavigator: true, context); + } + } + } +} diff --git a/lib/ui/mobile/request/favorite.dart b/lib/ui/mobile/request/favorite.dart index 599e43a..bb427b7 100644 --- a/lib/ui/mobile/request/favorite.dart +++ b/lib/ui/mobile/request/favorite.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'dart:collection'; import 'package:date_format/date_format.dart'; diff --git a/lib/ui/mobile/request/history.dart b/lib/ui/mobile/request/history.dart index 1a1b03f..c8de9e0 100644 --- a/lib/ui/mobile/request/history.dart +++ b/lib/ui/mobile/request/history.dart @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023 WangHongEn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/ui/mobile/request/list.dart b/lib/ui/mobile/request/list.dart index de2d59e..b544396 100644 --- a/lib/ui/mobile/request/list.dart +++ b/lib/ui/mobile/request/list.dart @@ -1,26 +1,35 @@ -import 'dart:collection'; +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + 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'; import 'package:network_proxy/network/bin/server.dart'; import 'package:network_proxy/network/channel.dart'; -import 'package:network_proxy/network/components/host_filter.dart'; -import 'package:network_proxy/network/host_port.dart'; import 'package:network_proxy/network/http/http.dart'; -import 'package:network_proxy/network/http_client.dart'; import 'package:network_proxy/ui/desktop/request/model/search_model.dart'; +import 'package:network_proxy/ui/mobile/request/domians.dart'; import 'package:network_proxy/ui/mobile/request/request_sequence.dart'; import 'package:network_proxy/utils/har.dart'; import 'package:network_proxy/utils/listenable_list.dart'; import 'package:share_plus/share_plus.dart'; /// 请求列表 -/// @auth wanghongen +/// @author wanghongen class RequestListWidget extends StatefulWidget { final ProxyServer proxyServer; final ListenableList? list; @@ -33,6 +42,25 @@ class RequestListWidget extends StatefulWidget { } } +class DoubleClickHandle { + int tabClickTime = 0; + final Function()? handle; + + DoubleClickHandle({this.handle}); + + void call() { + if (handle == null) { + return; + } + + if (DateTime.now().millisecondsSinceEpoch - tabClickTime < 500) { + print("double click"); + handle?.call(); + } + tabClickTime = DateTime.now().millisecondsSinceEpoch; + } +} + class RequestListState extends State { final GlobalKey requestSequenceKey = GlobalKey(); final GlobalKey domainListKey = GlobalKey(); @@ -52,14 +80,20 @@ class RequestListState extends State { @override Widget build(BuildContext context) { - List tabs = [ - Tab(child: Text(localizations.sequence)), - Tab(child: Text(localizations.domainList)), + List tabs = [Tab(child: Text(localizations.sequence)), Tab(child: Text(localizations.domainList))]; + + //double click scroll to top + var tabClickHandles = [ + DoubleClickHandle(handle: () => requestSequenceKey.currentState?.scrollToTop()), + DoubleClickHandle(handle: () => domainListKey.currentState?.scrollToTop()) ]; + return DefaultTabController( length: tabs.length, child: Scaffold( - appBar: AppBar(title: TabBar(tabs: tabs), automaticallyImplyLeading: false), + appBar: AppBar( + title: TabBar(tabs: tabs, onTap: (index) => tabClickHandles[index].call()), + automaticallyImplyLeading: false), body: TabBarView( children: [ RequestSequence( @@ -67,7 +101,8 @@ class RequestListState extends State { container: container, proxyServer: widget.proxyServer, onRemove: sequenceRemove), - DomainList(key: domainListKey, list: container, proxyServer: widget.proxyServer, onRemove: domainListRemove), + DomainList( + key: domainListKey, list: container, proxyServer: widget.proxyServer, onRemove: domainListRemove), ], ), )); @@ -128,291 +163,3 @@ class RequestListState extends State { Share.shareXFiles([file], fileNameOverrides: [fileName]); } } - -///域名列表 -class DomainList extends StatefulWidget { - final ListenableList list; - final ProxyServer proxyServer; - final Function(List)? onRemove; - - const DomainList({super.key, required this.list, required this.proxyServer, this.onRemove}); - - @override - State createState() { - return DomainListState(); - } -} - -class DomainListState extends State with AutomaticKeepAliveClientMixin { - final ScrollController _scrollController = ScrollController(); - - GlobalKey requestSequenceKey = GlobalKey(); - late Configuration configuration; - - //域名和对应请求列表的映射 - Map> containerMap = {}; - - //域名列表 为了维护插入顺序 - LinkedHashSet domainList = LinkedHashSet(); - - //显示的域名 最新的在顶部 - List view = []; - - HostAndPort? showHostAndPort; - - //搜索关键字 - String? searchText; - - AppLocalizations get localizations => AppLocalizations.of(context)!; - - @override - initState() { - super.initState(); - configuration = widget.proxyServer.configuration; - - for (var request in widget.list) { - var hostAndPort = request.hostAndPort!; - domainList.add(hostAndPort); - var list = containerMap[hostAndPort] ??= []; - list.add(request); - } - - view = domainList.toList(); - } - - add(HttpRequest request) { - var hostAndPort = request.hostAndPort!; - domainList.remove(hostAndPort); - domainList.add(hostAndPort); - - var list = containerMap[hostAndPort] ??= []; - list.add(request); - if (showHostAndPort == request.hostAndPort) { - requestSequenceKey.currentState?.add(request); - } - - if (!filter(request.hostAndPort!)) { - return; - } - - view = [...domainList.where(filter)].reversed.toList(); - setState(() {}); - } - - addResponse(HttpResponse response) { - if (showHostAndPort == response.request?.hostAndPort) { - requestSequenceKey.currentState?.addResponse(response); - } - } - - clean() { - setState(() { - view.clear(); - domainList.clear(); - containerMap.clear(); - }); - } - - remove(List list) { - for (var request in list) { - containerMap[request.hostAndPort]?.remove(request); - if (containerMap[request.hostAndPort]!.isEmpty) { - domainList.remove(request.hostAndPort); - view.remove(request.hostAndPort); - } - } - - setState(() {}); - } - - ///搜索域名 - void search(String? text) { - if (text == null) { - setState(() { - view = List.of(domainList.toList().reversed); - searchText = null; - }); - return; - } - - text = text.toLowerCase(); - setState(() { - var contains = text!.contains(searchText ?? ""); - searchText = text.toLowerCase(); - if (contains) { - //包含从上次结果过滤 - view.retainWhere(filter); - } else { - view = List.of(domainList.where(filter).toList().reversed); - } - }); - } - - bool filter(HostAndPort hostAndPort) { - if (searchText?.isNotEmpty == true) { - return hostAndPort.domain.toLowerCase().contains(searchText!); - } - return true; - } - - @override - bool get wantKeepAlive => true; - - @override - void dispose() { - _scrollController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - super.build(context); - return Scrollbar( - controller: _scrollController, - child: ListView.separated( - controller: _scrollController, - padding: EdgeInsets.zero, - separatorBuilder: (context, index) => - Divider(thickness: 0.2, height: 0.5, color: Theme.of(context).dividerColor), - itemCount: view.length, - itemBuilder: (ctx, index) => title(index))); - } - - Widget title(int index) { - var value = containerMap[view.elementAt(index)]; - var time = value == null ? '' : formatDate(value.last.requestTime, [m, '/', d, ' ', HH, ':', nn, ':', ss]); - - return ListTile( - visualDensity: const VisualDensity(vertical: -4), - title: Text(view.elementAt(index).domain, maxLines: 1, overflow: TextOverflow.ellipsis), - trailing: const Icon(Icons.chevron_right), - subtitle: Text(localizations.domainListSubtitle(value?.length ?? '', time), - maxLines: 1, overflow: TextOverflow.ellipsis), - onLongPress: () => menu(index), - // show menus - contentPadding: const EdgeInsets.only(left: 10), - onTap: () { - Navigator.push(context, MaterialPageRoute(builder: (context) { - showHostAndPort = view.elementAt(index); - return Scaffold( - appBar: AppBar(title: Text(view.elementAt(index).domain, style: const TextStyle(fontSize: 16))), - body: RequestSequence( - key: requestSequenceKey, - displayDomain: false, - container: ListenableList(containerMap[view.elementAt(index)]!), - onRemove: widget.onRemove, - proxyServer: widget.proxyServer)); - })); - }); - } - - ///菜单 - menu(int index) { - var hostAndPort = view.elementAt(index); - showModalBottomSheet( - shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(10))), - context: context, - enableDrag: true, - builder: (ctx) { - 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)), - onPressed: () { - HostFilter.blacklist.add(hostAndPort.host); - configuration.flushConfig(); - FlutterToastr.show(localizations.addSuccess, context); - Navigator.of(context).pop(); - }), - const Divider(thickness: 0.5), - TextButton( - child: SizedBox( - width: double.infinity, child: Text(localizations.addWhitelist, textAlign: TextAlign.center)), - onPressed: () { - HostFilter.whitelist.add(hostAndPort.host); - configuration.flushConfig(); - FlutterToastr.show(localizations.addSuccess, context); - Navigator.of(context).pop(); - }), - const Divider(thickness: 0.5), - TextButton( - child: SizedBox( - width: double.infinity, child: Text(localizations.deleteWhitelist, textAlign: TextAlign.center)), - onPressed: () { - HostFilter.whitelist.remove(hostAndPort.host); - configuration.flushConfig(); - FlutterToastr.show(localizations.deleteSuccess, context); - Navigator.of(context).pop(); - }), - const Divider(thickness: 0.5), - TextButton( - child: SizedBox( - width: double.infinity, - child: Text(localizations.repeatDomainRequests, textAlign: TextAlign.center)), - onPressed: () { - Navigator.of(context).pop(); - repeatDomainRequests(hostAndPort); - }), - const Divider(thickness: 0.5), - TextButton( - child: - SizedBox(width: double.infinity, child: Text(localizations.delete, textAlign: TextAlign.center)), - onPressed: () { - setState(() { - var requests = containerMap.remove(hostAndPort); - domainList.remove(hostAndPort); - view.removeAt(index); - if (requests != null) { - widget.onRemove?.call(requests); - } - FlutterToastr.show(localizations.deleteSuccess, context); - Navigator.of(context).pop(); - }); - }), - Container( - color: Theme.of(context).hoverColor, - height: 8, - ), - TextButton( - child: Container( - height: 50, - width: double.infinity, - padding: const EdgeInsets.only(top: 10), - child: Text(localizations.cancel, textAlign: TextAlign.center)), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ], - ); - }); - } - - //重复域名下请求 - void repeatDomainRequests(HostAndPort hostAndPort) async { - var requests = containerMap[hostAndPort]; - if (requests == null) return; - - for (var httpRequest in requests.toList()) { - var request = httpRequest.copy(uri: httpRequest.requestUrl); - var proxyInfo = widget.proxyServer.isRunning ? ProxyInfo.of("127.0.0.1", widget.proxyServer.port) : null; - try { - await HttpClients.proxyRequest(request, proxyInfo: proxyInfo); - if (mounted) FlutterToastr.show(localizations.reSendRequest, rootNavigator: true, context); - } catch (e) { - if (mounted) FlutterToastr.show('${localizations.fail}$e', rootNavigator: true, context); - } - } - } -} diff --git a/lib/ui/mobile/request/repeat.dart b/lib/ui/mobile/request/repeat.dart index 22ad89b..75cd400 100644 --- a/lib/ui/mobile/request/repeat.dart +++ b/lib/ui/mobile/request/repeat.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:async'; import 'dart:convert'; import 'dart:math'; diff --git a/lib/ui/mobile/request/request.dart b/lib/ui/mobile/request/request.dart index 5fb7e42..719cc7a 100644 --- a/lib/ui/mobile/request/request.dart +++ b/lib/ui/mobile/request/request.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:io'; import 'package:date_format/date_format.dart'; diff --git a/lib/ui/mobile/request/request_editor.dart b/lib/ui/mobile/request/request_editor.dart index 02eba83..d679313 100644 --- a/lib/ui/mobile/request/request_editor.dart +++ b/lib/ui/mobile/request/request_editor.dart @@ -1,3 +1,19 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'dart:convert'; import 'package:flutter/material.dart'; diff --git a/lib/ui/mobile/request/request_sequence.dart b/lib/ui/mobile/request/request_sequence.dart index a773c27..b54912a 100644 --- a/lib/ui/mobile/request/request_sequence.dart +++ b/lib/ui/mobile/request/request_sequence.dart @@ -9,6 +9,7 @@ import 'package:network_proxy/ui/mobile/widgets/highlight.dart'; import 'package:network_proxy/utils/listenable_list.dart'; ///请求序列 列表 +///@author wanghongen class RequestSequence extends StatefulWidget { final ListenableList container; final ProxyServer proxyServer; @@ -137,29 +138,35 @@ class RequestSequenceState extends State with AutomaticKeepAliv Widget build(BuildContext context) { super.build(context); - return Scrollbar( + return PrimaryScrollController( controller: _scrollController, - child: ListView.separated( + child: Scrollbar( controller: _scrollController, - cacheExtent: 1000, - separatorBuilder: (context, index) => - Divider(thickness: 0.2, height: 0, color: Theme.of(context).dividerColor), - itemCount: view.length, - itemBuilder: (context, index) { - GlobalKey key = GlobalKey(); - indexes[view.elementAt(index)] = key; - return RequestRow( - index: view.length - index, - key: key, - request: view.elementAt(index), - proxyServer: widget.proxyServer, - displayDomain: widget.displayDomain, - onRemove: (request) { - setState(() { - view.remove(request); - }); - widget.onRemove?.call([request]); - }); - })); + child: ListView.separated( + controller: _scrollController, + cacheExtent: 1000, + separatorBuilder: (context, index) => + Divider(thickness: 0.2, height: 0, color: Theme.of(context).dividerColor), + itemCount: view.length, + itemBuilder: (context, index) { + GlobalKey key = GlobalKey(); + indexes[view.elementAt(index)] = key; + return RequestRow( + index: view.length - index, + key: key, + request: view.elementAt(index), + proxyServer: widget.proxyServer, + displayDomain: widget.displayDomain, + onRemove: (request) { + setState(() { + view.remove(request); + }); + widget.onRemove?.call([request]); + }); + }))); + } + + scrollToTop() { + _scrollController.animateTo(0, duration: const Duration(milliseconds: 300), curve: Curves.ease); } } diff --git a/lib/ui/mobile/request/search.dart b/lib/ui/mobile/request/search.dart index f91e1fd..3253fd4 100644 --- a/lib/ui/mobile/request/search.dart +++ b/lib/ui/mobile/request/search.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:network_proxy/ui/desktop/request/model/search_model.dart'; import 'package:network_proxy/ui/desktop/request/search_condition.dart'; diff --git a/lib/ui/mobile/setting/app_filter.dart b/lib/ui/mobile/setting/app_filter.dart index 8e58b94..b78324f 100644 --- a/lib/ui/mobile/setting/app_filter.dart +++ b/lib/ui/mobile/setting/app_filter.dart @@ -1,4 +1,19 @@ -import 'dart:typed_data'; +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -8,7 +23,8 @@ import 'package:network_proxy/network/bin/configuration.dart'; import 'package:network_proxy/network/bin/server.dart'; import 'package:network_proxy/ui/component/widgets.dart'; -//应用白名单 目前只支持安卓 ios没办法获取安装的列表 +///应用白名单 目前只支持安卓 ios没办法获取安装的列表 +///@author wang class AppWhitelist extends StatefulWidget { final ProxyServer proxyServer; diff --git a/lib/ui/mobile/setting/filter.dart b/lib/ui/mobile/setting/filter.dart index 2640917..fc061e6 100644 --- a/lib/ui/mobile/setting/filter.dart +++ b/lib/ui/mobile/setting/filter.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:collection'; import 'dart:convert'; diff --git a/lib/ui/mobile/setting/proxy.dart b/lib/ui/mobile/setting/proxy.dart index 976e223..6572e9d 100644 --- a/lib/ui/mobile/setting/proxy.dart +++ b/lib/ui/mobile/setting/proxy.dart @@ -4,45 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:network_proxy/network/bin/configuration.dart'; -import 'package:network_proxy/network/bin/server.dart'; import 'package:network_proxy/network/host_port.dart'; import 'package:network_proxy/ui/component/widgets.dart'; -import 'package:network_proxy/ui/desktop/toolbar/setting/setting.dart'; - -class ProxySetting extends StatefulWidget { - final ProxyServer proxyServer; - - const ProxySetting({super.key, required this.proxyServer}); - - @override - State createState() { - return _ProxySettingState(); - } -} - -class _ProxySettingState extends State { - AppLocalizations get localizations => AppLocalizations.of(context)!; - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text(localizations.proxySetting, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500))), - body: ListView(children: [ - PortWidget(proxyServer: widget.proxyServer), - const Divider(height: 20, thickness: 0.3), - ListTile( - title: Text(localizations.externalProxy), - trailing: const Icon(Icons.keyboard_arrow_right), - onTap: () { - showDialog( - context: context, builder: (_) => ExternalProxyDialog(configuration: widget.proxyServer.configuration)); - }, - ), - ]), - ); - } -} class ExternalProxyDialog extends StatefulWidget { final Configuration configuration; diff --git a/lib/ui/mobile/setting/request_rewrite.dart b/lib/ui/mobile/setting/request_rewrite.dart index f8d2dad..b463948 100644 --- a/lib/ui/mobile/setting/request_rewrite.dart +++ b/lib/ui/mobile/setting/request_rewrite.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:collection'; import 'dart:convert'; diff --git a/lib/ui/mobile/setting/rewrite/rewrite_replace.dart b/lib/ui/mobile/setting/rewrite/rewrite_replace.dart index 22d0acc..2660b70 100644 --- a/lib/ui/mobile/setting/rewrite/rewrite_replace.dart +++ b/lib/ui/mobile/setting/rewrite/rewrite_replace.dart @@ -8,6 +8,7 @@ import 'package:network_proxy/ui/component/widgets.dart'; import 'package:network_proxy/utils/lang.dart'; /// 重写替换 +/// @author wanghongen class RewriteReplaceWidget extends StatefulWidget { final String subtitle; final RuleType ruleType; diff --git a/lib/ui/mobile/setting/script.dart b/lib/ui/mobile/setting/script.dart index 2723598..f505a87 100644 --- a/lib/ui/mobile/setting/script.dart +++ b/lib/ui/mobile/setting/script.dart @@ -1,4 +1,19 @@ -import 'dart:convert'; +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import 'dart:convert'; import 'package:file_selector/file_selector.dart'; import 'package:flutter/gestures.dart'; diff --git a/lib/ui/mobile/setting/ssl.dart b/lib/ui/mobile/setting/ssl.dart index d8ad688..79c0958 100644 --- a/lib/ui/mobile/setting/ssl.dart +++ b/lib/ui/mobile/setting/ssl.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:io'; import 'dart:typed_data'; diff --git a/lib/ui/mobile/setting/theme.dart b/lib/ui/mobile/setting/theme.dart index 4fc5e1f..c95d4bc 100644 --- a/lib/ui/mobile/setting/theme.dart +++ b/lib/ui/mobile/setting/theme.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:network_proxy/ui/configuration.dart'; diff --git a/lib/ui/mobile/widgets/about.dart b/lib/ui/mobile/widgets/about.dart index 119d16a..e9a4f2b 100644 --- a/lib/ui/mobile/widgets/about.dart +++ b/lib/ui/mobile/widgets/about.dart @@ -1,3 +1,20 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; diff --git a/lib/ui/mobile/widgets/connect_remote.dart b/lib/ui/mobile/widgets/connect_remote.dart index b3b5c63..f5929f4 100644 --- a/lib/ui/mobile/widgets/connect_remote.dart +++ b/lib/ui/mobile/widgets/connect_remote.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:convert'; import 'package:flutter/material.dart'; diff --git a/lib/ui/mobile/widgets/highlight.dart b/lib/ui/mobile/widgets/highlight.dart index 25fb3fb..c55d6af 100644 --- a/lib/ui/mobile/widgets/highlight.dart +++ b/lib/ui/mobile/widgets/highlight.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:network_proxy/ui/component/state_component.dart'; diff --git a/lib/ui/mobile/widgets/pip.dart b/lib/ui/mobile/widgets/pip.dart index a558f45..bea9cf3 100644 --- a/lib/ui/mobile/widgets/pip.dart +++ b/lib/ui/mobile/widgets/pip.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:io'; import 'package:flutter/material.dart'; diff --git a/lib/utils/curl.dart b/lib/utils/curl.dart index 81fe25a..dbd759a 100644 --- a/lib/utils/curl.dart +++ b/lib/utils/curl.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'package:network_proxy/network/http/http.dart'; import 'package:network_proxy/network/http/http_headers.dart'; import 'package:network_proxy/utils/lang.dart'; @@ -104,7 +119,7 @@ HttpRequest parseCurl(String curl) { } try { requestUrl = Uri.decodeFull(value); - } catch (e) { + } catch (e) { requestUrl = value; } } diff --git a/lib/utils/har.dart b/lib/utils/har.dart index 29608ba..5dccd26 100644 --- a/lib/utils/har.dart +++ b/lib/utils/har.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import 'dart:convert'; import 'dart:io'; diff --git a/lib/utils/listenable_list.dart b/lib/utils/listenable_list.dart index 1d8199a..6f9dcee 100644 --- a/lib/utils/listenable_list.dart +++ b/lib/utils/listenable_list.dart @@ -1,3 +1,18 @@ +/* + * Copyright 2023 WangHongEn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ abstract class ListenerListEvent { /// 监听的源 sourceAware(List source) {}