Merge branch 'design' into alpha
This commit is contained in:
26
lib/utils/proxy.dart
Normal file
26
lib/utils/proxy.dart
Normal file
@ -0,0 +1,26 @@
|
||||
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;";
|
||||
};
|
||||
}
|
||||
}
|
@ -113,6 +113,8 @@ class SettingBoxKey {
|
||||
static const String enableHotKey = 'enableHotKey';
|
||||
static const String enableQuickFav = 'enableQuickFav';
|
||||
static const String enableWordRe = 'enableWordRe';
|
||||
static const String enableSearchWord = 'enableSearchWord';
|
||||
static const String enableRcmdDynamic = 'enableRcmdDynamic';
|
||||
|
||||
/// 外观
|
||||
static const String themeMode = 'themeMode';
|
||||
|
Reference in New Issue
Block a user