mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-21 22:39:11 +00:00
Bug fix
This commit is contained in:
parent
d43f759662
commit
019fed0f6b
3 changed files with 137 additions and 18 deletions
|
@ -122,3 +122,121 @@ class EncryptionData {
|
||||||
"private_key_saved": privateKeySaved,
|
"private_key_saved": privateKeySaved,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
EncyptionValidation encyptionValidationFromJson(String str) => EncyptionValidation.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String encyptionValidationToJson(EncyptionValidation data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class EncyptionValidation {
|
||||||
|
final String? subject;
|
||||||
|
final String? issuer;
|
||||||
|
final String? keyType;
|
||||||
|
final DateTime? notBefore;
|
||||||
|
final DateTime? notAfter;
|
||||||
|
final String? warningValidation;
|
||||||
|
final List<String>? dnsNames;
|
||||||
|
final bool? validCert;
|
||||||
|
final bool? validChain;
|
||||||
|
final bool? validKey;
|
||||||
|
final bool? validPair;
|
||||||
|
final bool? enabled;
|
||||||
|
final String? serverName;
|
||||||
|
final bool? forceHttps;
|
||||||
|
final int? portHttps;
|
||||||
|
final int? portDnsOverTls;
|
||||||
|
final int? portDnsOverQuic;
|
||||||
|
final int? portDnscrypt;
|
||||||
|
final String? dnscryptConfigFile;
|
||||||
|
final bool? allowUnencryptedDoh;
|
||||||
|
final String? certificateChain;
|
||||||
|
final String? privateKey;
|
||||||
|
final String? certificatePath;
|
||||||
|
final String? privateKeyPath;
|
||||||
|
final bool? privateKeySaved;
|
||||||
|
|
||||||
|
EncyptionValidation({
|
||||||
|
this.subject,
|
||||||
|
this.issuer,
|
||||||
|
this.keyType,
|
||||||
|
this.notBefore,
|
||||||
|
this.notAfter,
|
||||||
|
this.warningValidation,
|
||||||
|
this.dnsNames,
|
||||||
|
this.validCert,
|
||||||
|
this.validChain,
|
||||||
|
this.validKey,
|
||||||
|
this.validPair,
|
||||||
|
this.enabled,
|
||||||
|
this.serverName,
|
||||||
|
this.forceHttps,
|
||||||
|
this.portHttps,
|
||||||
|
this.portDnsOverTls,
|
||||||
|
this.portDnsOverQuic,
|
||||||
|
this.portDnscrypt,
|
||||||
|
this.dnscryptConfigFile,
|
||||||
|
this.allowUnencryptedDoh,
|
||||||
|
this.certificateChain,
|
||||||
|
this.privateKey,
|
||||||
|
this.certificatePath,
|
||||||
|
this.privateKeyPath,
|
||||||
|
this.privateKeySaved,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory EncyptionValidation.fromJson(Map<String, dynamic> json) => EncyptionValidation(
|
||||||
|
subject: json["subject"],
|
||||||
|
issuer: json["issuer"],
|
||||||
|
keyType: json["key_type"],
|
||||||
|
notBefore: json["not_before"] == null ? null : DateTime.parse(json["not_before"]),
|
||||||
|
notAfter: json["not_after"] == null ? null : DateTime.parse(json["not_after"]),
|
||||||
|
warningValidation: json["warning_validation"],
|
||||||
|
dnsNames: json["dns_names"] == null ? [] : List<String>.from(json["dns_names"]!.map((x) => x)),
|
||||||
|
validCert: json["valid_cert"],
|
||||||
|
validChain: json["valid_chain"],
|
||||||
|
validKey: json["valid_key"],
|
||||||
|
validPair: json["valid_pair"],
|
||||||
|
enabled: json["enabled"],
|
||||||
|
serverName: json["server_name"],
|
||||||
|
forceHttps: json["force_https"],
|
||||||
|
portHttps: json["port_https"],
|
||||||
|
portDnsOverTls: json["port_dns_over_tls"],
|
||||||
|
portDnsOverQuic: json["port_dns_over_quic"],
|
||||||
|
portDnscrypt: json["port_dnscrypt"],
|
||||||
|
dnscryptConfigFile: json["dnscrypt_config_file"],
|
||||||
|
allowUnencryptedDoh: json["allow_unencrypted_doh"],
|
||||||
|
certificateChain: json["certificate_chain"],
|
||||||
|
privateKey: json["private_key"],
|
||||||
|
certificatePath: json["certificate_path"],
|
||||||
|
privateKeyPath: json["private_key_path"],
|
||||||
|
privateKeySaved: json["private_key_saved"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"subject": subject,
|
||||||
|
"issuer": issuer,
|
||||||
|
"key_type": keyType,
|
||||||
|
"not_before": notBefore?.toIso8601String(),
|
||||||
|
"not_after": notAfter?.toIso8601String(),
|
||||||
|
"warning_validation": warningValidation,
|
||||||
|
"dns_names": dnsNames == null ? [] : List<dynamic>.from(dnsNames!.map((x) => x)),
|
||||||
|
"valid_cert": validCert,
|
||||||
|
"valid_chain": validChain,
|
||||||
|
"valid_key": validKey,
|
||||||
|
"valid_pair": validPair,
|
||||||
|
"enabled": enabled,
|
||||||
|
"server_name": serverName,
|
||||||
|
"force_https": forceHttps,
|
||||||
|
"port_https": portHttps,
|
||||||
|
"port_dns_over_tls": portDnsOverTls,
|
||||||
|
"port_dns_over_quic": portDnsOverQuic,
|
||||||
|
"port_dnscrypt": portDnscrypt,
|
||||||
|
"dnscrypt_config_file": dnscryptConfigFile,
|
||||||
|
"allow_unencrypted_doh": allowUnencryptedDoh,
|
||||||
|
"certificate_chain": certificateChain,
|
||||||
|
"private_key": privateKey,
|
||||||
|
"certificate_path": certificatePath,
|
||||||
|
"private_key_path": privateKeyPath,
|
||||||
|
"private_key_saved": privateKeySaved,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -138,23 +138,22 @@ class _EncryptionSettingsState extends State<EncryptionSettings> {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mounted) {
|
if (!mounted) return;
|
||||||
if (result.successful == true) {
|
if (result.successful == true) {
|
||||||
setState(() {
|
final data = result.content as EncyptionValidation;
|
||||||
if (result.content['warning_validation'] != null && result.content['warning_validation'] != '') {
|
setState(() {
|
||||||
certKeyValidApi = 2;
|
if (data.warningValidation != null && data.warningValidation != '') {
|
||||||
validDataError = result.content['warning_validation'];
|
certKeyValidApi = 2;
|
||||||
}
|
validDataError = data.warningValidation;
|
||||||
else {
|
}
|
||||||
certKeyValidApi = 1;
|
else {
|
||||||
validDataError = null;
|
certKeyValidApi = 1;
|
||||||
}
|
validDataError = null;
|
||||||
certKeyValid = result.content;
|
}
|
||||||
});
|
certKeyValid = result.content;
|
||||||
}
|
});
|
||||||
else {
|
}
|
||||||
setState(() => certKeyValidApi = 2);
|
else {
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -698,7 +698,9 @@ class ApiClientV2 {
|
||||||
try {
|
try {
|
||||||
return ApiResponse(
|
return ApiResponse(
|
||||||
successful: result.successful,
|
successful: result.successful,
|
||||||
content: result.body != null ? jsonDecode(result.body!) : null
|
content: result.body != null
|
||||||
|
? EncyptionValidation.fromJson(jsonDecode(result.body!))
|
||||||
|
: null
|
||||||
);
|
);
|
||||||
} catch (e, stackTrace) {
|
} catch (e, stackTrace) {
|
||||||
Sentry.captureException(e, stackTrace: stackTrace);
|
Sentry.captureException(e, stackTrace: stackTrace);
|
||||||
|
|
Loading…
Add table
Reference in a new issue