mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-18 21:12:04 +00:00
Fixed some bugs
This commit is contained in:
parent
7579e2d580
commit
7bb7ad40c4
8 changed files with 28 additions and 15 deletions
|
@ -5,7 +5,7 @@ DnsStatistics dnsStatisticsFromJson(String str) => DnsStatistics.fromJson(json.d
|
|||
String dnsStatisticsToJson(DnsStatistics data) => json.encode(data.toJson());
|
||||
|
||||
class DnsStatistics {
|
||||
final String timeUnits;
|
||||
final String? timeUnits;
|
||||
final List<Map<String, int>> topQueriedDomains;
|
||||
final List<Map<String, int>> topClients;
|
||||
final List<Map<String, int>> topBlockedDomains;
|
||||
|
|
|
@ -151,20 +151,26 @@ class DnsProvider with ChangeNotifier {
|
|||
final result = await _serversProvider!.apiClient2!.setDnsConfig(
|
||||
data: value
|
||||
);
|
||||
|
||||
void updateValue(dynamic parameter, dynamic value) {
|
||||
if (value != null) {
|
||||
parameter = value;
|
||||
}
|
||||
}
|
||||
|
||||
if (result.successful == true) {
|
||||
DnsInfo data = dnsInfo!;
|
||||
data.ratelimit = value['ratelimit'];
|
||||
data.ednsCsEnabled = value['edns_cs_enabled'];
|
||||
data.dnssecEnabled = value['dnssec_enabled'];
|
||||
data.disableIpv6 = value['disable_ipv6'];
|
||||
data.blockingMode = value['blocking_mode'];
|
||||
data.blockingIpv4 = value['blocking_ipv4'];
|
||||
data.blockingIpv6 = value['blocking_ipv6'];
|
||||
data.blockedResponseTtl = value['blocked_response_ttl'];
|
||||
data.ratelimitSubnetLenIpv4 = value['ratelimit_subnet_len_ipv4'];
|
||||
data.ratelimitSubnetLenIpv6 = value['ratelimit_subnet_len_ipv6'];
|
||||
data.ratelimitWhitelist = value['ratelimit_whitelist'];
|
||||
updateValue(data.ratelimit, value['ratelimit']);
|
||||
updateValue(data.ednsCsEnabled, value['edns_cs_enabled']);
|
||||
updateValue(data.dnssecEnabled, value['dnssec_enabled']);
|
||||
updateValue(data.disableIpv6, value['disable_ipv6']);
|
||||
updateValue(data.blockingMode, value['blocking_mode']);
|
||||
updateValue(data.blockingIpv4, value['blocking_ipv4']);
|
||||
updateValue(data.blockingIpv6, value['blocking_ipv6']);
|
||||
updateValue(data.blockedResponseTtl, value['blocked_response_ttl']);
|
||||
updateValue(data.ratelimitSubnetLenIpv4, value['ratelimit_subnet_len_ipv4']);
|
||||
updateValue(data.ratelimitSubnetLenIpv6, value['ratelimit_subnet_len_ipv6']);
|
||||
updateValue(data.ratelimitWhitelist, value['ratelimit_whitelist']);
|
||||
setDnsInfoData(data);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -137,6 +137,8 @@ class AddFiltersButton extends StatelessWidget {
|
|||
}
|
||||
|
||||
void confirmAddList({required String name, required String url, required String type}) async {
|
||||
if (!context.mounted) return;
|
||||
|
||||
ProcessModal processModal = ProcessModal();
|
||||
processModal.open(AppLocalizations.of(context)!.addingList);
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class _CustomRulesListState extends State<CustomRulesList> {
|
|||
TextButton.icon(
|
||||
onPressed: () async {
|
||||
final result = await filteringProvider.fetchFilters();
|
||||
if (result == false) {
|
||||
if (result == false && context.mounted) {
|
||||
showSnackbar(
|
||||
appConfigProvider: appConfigProvider,
|
||||
label: AppLocalizations.of(context)!.errorLoadFilters,
|
||||
|
|
|
@ -34,6 +34,7 @@ class HomeAppBar extends StatelessWidget {
|
|||
|
||||
void navigateServers() {
|
||||
Future.delayed(const Duration(milliseconds: 0), (() {
|
||||
if (!context.mounted) return;
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => const Servers())
|
||||
);
|
||||
|
|
|
@ -115,7 +115,7 @@ class _ClientsModalState extends State<ClientsModal> {
|
|||
|
||||
void searchAddedClient(_ClientLog client) {
|
||||
final notIps = client.ids?.where((e) => isIpAddress(e) == false).toList();
|
||||
if (notIps == null) return;
|
||||
if (notIps == null || notIps.isEmpty) return;
|
||||
logsProvider.setSearchText('"${notIps[0]}"');
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
|
|
@ -96,6 +96,8 @@ class LogTile extends StatelessWidget {
|
|||
}
|
||||
|
||||
void blockUnblock({required String domain, required String newStatus}) async {
|
||||
if (!context.mounted) return;
|
||||
|
||||
final ProcessModal processModal = ProcessModal();
|
||||
processModal.open(AppLocalizations.of(context)!.savingUserFilters);
|
||||
|
||||
|
@ -124,6 +126,8 @@ class LogTile extends StatelessWidget {
|
|||
}
|
||||
|
||||
void confirmAddClient(Client client) async {
|
||||
if (!context.mounted) return;
|
||||
|
||||
ProcessModal processModal = ProcessModal();
|
||||
processModal.open(AppLocalizations.of(context)!.addingClient);
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ class _StatisticsSettingsState extends State<StatisticsSettings> {
|
|||
"enabled": _generalSwitch,
|
||||
"interval": _retentionTime == "custom"
|
||||
? Duration(hours: int.parse(_customTimeController.text)).inMilliseconds
|
||||
: int.parse(_retentionTime!),
|
||||
: int.parse(_retentionTime ?? _retentionItems[0]),
|
||||
"ignored": _ignoredDomainsControllers.map((e) => e.controller.text).toList()
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue