Merge branch 'design' into alpha
This commit is contained in:
28
lib/utils/proxy.dart
Normal file
28
lib/utils/proxy.dart
Normal 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;";
|
||||
};
|
||||
}
|
||||
}
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user