merging
This commit is contained in:
parent
0a80312278
commit
54449361c9
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:extera_next/config/app_config.dart';
|
||||||
import 'package:extera_next/utils/platform_infos.dart';
|
import 'package:extera_next/utils/platform_infos.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:http/io_client.dart';
|
import 'package:http/io_client.dart';
|
||||||
|
|
@ -8,7 +9,9 @@ import 'package:http/io_client.dart';
|
||||||
import 'package:extera_next/config/isrg_x1.dart';
|
import 'package:extera_next/config/isrg_x1.dart';
|
||||||
|
|
||||||
class CustomHttpClient {
|
class CustomHttpClient {
|
||||||
static HttpClient customHttpClient(String? cert) {
|
static HttpClient? customHttpClient(String? cert) {
|
||||||
|
if (PlatformInfos.isWeb) return null;
|
||||||
|
|
||||||
final context = SecurityContext.defaultContext;
|
final context = SecurityContext.defaultContext;
|
||||||
|
|
||||||
if (PlatformInfos.isAndroid) {
|
if (PlatformInfos.isAndroid) {
|
||||||
|
|
@ -26,14 +29,15 @@ class CustomHttpClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use Nekoray mixed proxy
|
final client = HttpClient(context: context);
|
||||||
// Made it for myself, remove later
|
|
||||||
final httpClient = HttpClient(context: context);
|
|
||||||
// httpClient.findProxy = (uri) {
|
|
||||||
// return 'PROXY localhost:2080;';
|
|
||||||
// };
|
|
||||||
|
|
||||||
return httpClient;
|
if (AppConfig.httpProxy != null) {
|
||||||
|
client.findProxy = (uri) {
|
||||||
|
return "PROXY ${AppConfig.httpProxy};";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
static http.Client createHTTPClient() => IOClient(customHttpClient(ISRG_X1));
|
static http.Client createHTTPClient() => IOClient(customHttpClient(ISRG_X1));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue