diff --git a/ci/version.info.txt b/ci/version.info.txt index a5a49ba..8c073eb 100644 --- a/ci/version.info.txt +++ b/ci/version.info.txt @@ -1,6 +1,8 @@ v1.6.8 - [x] ✨选择API分流以及图片分流时进行测速 +- [x] ✨启用Web服务器, 在局域网内使用浏览器观看已下载的漫画 +- [x] ✨导入其他软件的历史记录 - [x] ♻️优化安卓文件关联 - [x] ♻️优化安卓URL匹配 - [x] 🐛修复切换全屏时的屏幕抖动 diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 58b975d..cf908ec 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -95,14 +95,14 @@ SPEC CHECKSUMS: file_picker: ce3938a0df3cc1ef404671531facef740d03f920 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 image_cropper: 60c2789d1f1a78c873235d4319ca0c34a69f2d98 - image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb + image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3 SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780 TOCropViewController: edfd4f25713d56905ad1e0b9f5be3fbe0f59c863 uni_links: d97da20c7701486ba192624d99bffaaffcfc298a uri_to_file: c4726881848febf4806f0a5707bd12903e02b0f0 - url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2 + url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 diff --git a/lib/basic/Method.dart b/lib/basic/Method.dart index 99cb39f..29261ee 100644 --- a/lib/basic/Method.dart +++ b/lib/basic/Method.dart @@ -985,4 +985,12 @@ class Method { Future importComicViewFormOff(String dbPath) { return _flatInvoke("importComicViewFormOff", dbPath); } + + Future startWebServer() { + return _flatInvoke("startWebServer", ""); + } + + Future stopWebServer() { + return _flatInvoke("stopWebServer", ""); + } } diff --git a/lib/screens/SettingsScreen.dart b/lib/screens/SettingsScreen.dart index 6d1ae3c..50d76b1 100644 --- a/lib/screens/SettingsScreen.dart +++ b/lib/screens/SettingsScreen.dart @@ -41,6 +41,7 @@ import 'CleanScreen.dart'; import 'MigrateScreen.dart'; import 'ModifyPasswordScreen.dart'; import 'ThemeScreen.dart'; +import 'WebServerScreen.dart'; class SettingsScreen extends StatefulWidget { final bool hiddenAccountInfo; @@ -165,6 +166,20 @@ class _SettingsScreenState extends State { subtitle: Text("下载&缓存"), ), const Divider(), + ListTile( + title: const Text("启动Web服务器"), + subtitle: const Text("让局域网内的设备通过浏览器看下载的漫画"), + onTap: (){ + Navigator.of(context).push( + mixRoute( + builder: (BuildContext context) => + const WebServerScreen(), + ), + ); + + }, + ), + const Divider(), autoCleanSecSetting(), ListTile( onTap: () { diff --git a/lib/screens/WebServerScreen.dart b/lib/screens/WebServerScreen.dart new file mode 100644 index 0000000..a3f8b1e --- /dev/null +++ b/lib/screens/WebServerScreen.dart @@ -0,0 +1,88 @@ +import 'package:flutter/material.dart'; + +import '../basic/Method.dart'; +import 'components/ContentError.dart'; +import 'components/ContentLoading.dart'; +import 'components/RightClickPop.dart'; + +class WebServerScreen extends StatefulWidget { + const WebServerScreen({Key? key}) : super(key: key); + + @override + State createState() => _WebServerScreenState(); +} + +class _WebServerScreenState extends State { + late final Future _ipFuture = method.clientIpSet(); + late Future _future = method.startWebServer(); + + @override + void dispose() { + method.stopWebServer(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return rightClickPop( + child: buildScreen(context), + context: context, + canPop: true, + ); + } + + Widget buildScreen(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text("下载 - Web服务器"), + ), + body: FutureBuilder( + future: _future, + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.hasError) { + return ContentError( + error: snapshot.error, + stackTrace: snapshot.stackTrace, + onRefresh: () async { + setState(() { + _future = method.startWebServer(); + }); + }); + } + if (snapshot.connectionState != ConnectionState.done) { + return const ContentLoading(label: '加载中'); + } + return ListView( + children: [ + Container( + padding: const EdgeInsets.all(8), + child: Column( + children: [ + FutureBuilder( + future: _ipFuture, + builder: (BuildContext context, + AsyncSnapshot snapshot) { + if (snapshot.hasError) { + return const Text('获取IP失败'); + } + if (snapshot.connectionState != ConnectionState.done) { + return const Text('正在获取IP'); + } + return Text('${snapshot.data}'); + }, + ), + const Text('端口号:8080'), + const Text(''), + const Text('在浏览器中输入"http://本设备ip:8080/"访问下载的漫画'), + const Text(''), + const Text('离开页面后服务器将关闭'), + ], + ), + ), + ], + ); + }, + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index ef6a559..070d137 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -257,10 +257,10 @@ packages: dependency: transitive description: name: image_picker_android - sha256: b81db5f5ed8a69d54d5f0932c2af8120e8c0518a037d8beee494eec671da4d4c + sha256: dfb5b0f28b8786fcc662b7ed42bfb4b82a6cbbd74da1958384b10d40bdf212a7 url: "https://pub.dev" source: hosted - version: "0.8.6+5" + version: "0.8.6+6" image_picker_for_web: dependency: transitive description: @@ -401,10 +401,10 @@ packages: dependency: transitive description: name: permission_handler_apple - sha256: "9c370ef6a18b1c4b2f7f35944d644a56aa23576f23abee654cf73968de93f163" + sha256: ee96ac32f5a8e6f80756e25b25b9f8e535816c8e6665a96b6d70681f8c4f7e85 url: "https://pub.dev" source: hosted - version: "9.0.7" + version: "9.0.8" permission_handler_platform_interface: dependency: transitive description: @@ -449,10 +449,10 @@ packages: dependency: transitive description: name: pointycastle - sha256: "57b6b78df14175658f09c5dfcfc51a46ad9561a3504fe679913dab404d0cc0f2" + sha256: c3120a968135aead39699267f4c74bc9a08e4e909e86bc1b0af5bfd78691123c url: "https://pub.dev" source: hosted - version: "3.7.0" + version: "3.7.2" scrollable_positioned_list: dependency: "direct main" description: @@ -566,10 +566,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "845530e5e05db5500c1a4c1446785d60cbd8f9bd45e21e7dd643a3273bb4bbd1" + sha256: dd729390aa936bf1bdf5cd1bc7468ff340263f80a2c4f569416507667de8e3c8 url: "https://pub.dev" source: hosted - version: "6.0.25" + version: "6.0.26" url_launcher_ios: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index df935a3..6a6fc73 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.6.7+14 +version: 1.6.8+15 environment: sdk: ">=2.12.0 <3.0.0"