mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
DNS overrides
This commit is contained in:
@@ -222,6 +222,22 @@ class AppDio with DioMixin {
|
||||
class RHttpAdapter implements HttpClientAdapter {
|
||||
rhttp.ClientSettings settings;
|
||||
|
||||
static Map<String, List<String>> _getOverrides() {
|
||||
if (!appdata.settings['enableDnsOverrides'] == true) {
|
||||
return {};
|
||||
}
|
||||
var config = appdata.settings["dnsOverrides"];
|
||||
var result = <String, List<String>>{};
|
||||
if (config is Map) {
|
||||
for (var entry in config.entries) {
|
||||
if (entry.key is String && entry.value is String) {
|
||||
result[entry.key] = [entry.value];
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
RHttpAdapter([this.settings = const rhttp.ClientSettings()]) {
|
||||
settings = settings.copyWith(
|
||||
redirectSettings: const rhttp.RedirectSettings.limited(5),
|
||||
@@ -234,6 +250,7 @@ class RHttpAdapter implements HttpClientAdapter {
|
||||
tlsSettings: rhttp.TlsSettings(
|
||||
verifyCertificates: !AppDio.ignoreCertificateErrors,
|
||||
),
|
||||
dnsSettings: rhttp.DnsSettings.static(overrides: _getOverrides()),
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user