Merge branch 'design' into alpha

This commit is contained in:
guozhigq
2023-11-06 00:05:12 +08:00
4 changed files with 180 additions and 0 deletions

28
lib/utils/proxy.dart Normal file
View File

@ -0,0 +1,28 @@
import 'dart:io';
import 'package:system_proxy/system_proxy.dart';
class CustomProxy {
init() async {
Map<String, String>? proxy = await SystemProxy.getProxySettings();
if (proxy != null) {
HttpOverrides.global =
ProxiedHttpOverrides(proxy['host']!, proxy['port']!);
}
}
}
class ProxiedHttpOverrides extends HttpOverrides {
final String _port;
final String _host;
ProxiedHttpOverrides(this._host, this._port);
@override
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)
// set proxy
..findProxy = (uri) {
return "PROXY $_host:$_port;";
};
}
}

View File

@ -126,6 +126,7 @@ class SettingBoxKey {
static const String enableSearchWord = 'enableSearchWord';
static const String enableRcmdDynamic = 'enableRcmdDynamic';
static const String enableSaveLastData = 'enableSaveLastData';
static const String enableSystemProxy = 'enableSystemProxy';
/// 外观
static const String themeMode = 'themeMode';
@ -155,6 +156,10 @@ class LocalCacheKey {
static const String danmakuOpacity = 'danmakuOpacity';
static const String danmakuFontScale = 'danmakuFontScale';
static const String danmakuSpeed = 'danmakuSpeed';
// 代理host port
static const String systemProxyHost = 'systemProxyHost';
static const String systemProxyPort = 'systemProxyPort';
}
class VideoBoxKey {