mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-28 17:48:10 +00:00
Added client queries and statistics settings
This commit is contained in:
parent
c3530f17ab
commit
cc12a8504e
6 changed files with 69 additions and 7 deletions
|
@ -702,5 +702,9 @@
|
||||||
"useCustomIpEdnsDescription": "Allow to use custom IP for EDNS",
|
"useCustomIpEdnsDescription": "Allow to use custom IP for EDNS",
|
||||||
"sortingOptions": "Sorting options",
|
"sortingOptions": "Sorting options",
|
||||||
"fromHighestToLowest": "From highest to lowest",
|
"fromHighestToLowest": "From highest to lowest",
|
||||||
"fromLowestToHighest": "From lowest to highest"
|
"fromLowestToHighest": "From lowest to highest",
|
||||||
|
"queryLogsAndStatistics": "Query logs and statistics",
|
||||||
|
"ignoreClientQueryLog": "Ignore this client in query log",
|
||||||
|
"ignoreClientStatistics": "Ignore this client in statistics",
|
||||||
|
"savingChanges": "Saving changes..."
|
||||||
}
|
}
|
|
@ -702,5 +702,9 @@
|
||||||
"useCustomIpEdnsDescription": "Permitir usar IP personalizada para EDNS",
|
"useCustomIpEdnsDescription": "Permitir usar IP personalizada para EDNS",
|
||||||
"sortingOptions": "Opciones de ordenación",
|
"sortingOptions": "Opciones de ordenación",
|
||||||
"fromHighestToLowest": "De mayor a menor",
|
"fromHighestToLowest": "De mayor a menor",
|
||||||
"fromLowestToHighest": "De menor a mayor"
|
"fromLowestToHighest": "De menor a mayor",
|
||||||
|
"queryLogsAndStatistics": "Registro de consultas y estadísticas",
|
||||||
|
"ignoreClientQueryLog": "Ignorar este cliente en el registro de consultas",
|
||||||
|
"ignoreClientStatistics": "Ignorar este cliente en las estadísticas",
|
||||||
|
"savingChanges": "Guardando cambios..."
|
||||||
}
|
}
|
|
@ -87,6 +87,8 @@ class Client {
|
||||||
final bool useGlobalBlockedServices;
|
final bool useGlobalBlockedServices;
|
||||||
final bool useGlobalSettings;
|
final bool useGlobalSettings;
|
||||||
final SafeSearch? safeSearch;
|
final SafeSearch? safeSearch;
|
||||||
|
final bool? ignoreQuerylog;
|
||||||
|
final bool? ignoreStatistics;
|
||||||
|
|
||||||
Client({
|
Client({
|
||||||
required this.name,
|
required this.name,
|
||||||
|
@ -100,6 +102,8 @@ class Client {
|
||||||
required this.useGlobalBlockedServices,
|
required this.useGlobalBlockedServices,
|
||||||
required this.useGlobalSettings,
|
required this.useGlobalSettings,
|
||||||
required this.safeSearch,
|
required this.safeSearch,
|
||||||
|
required this.ignoreQuerylog,
|
||||||
|
required this.ignoreStatistics,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory Client.fromJson(Map<String, dynamic> json) => Client(
|
factory Client.fromJson(Map<String, dynamic> json) => Client(
|
||||||
|
@ -115,7 +119,9 @@ class Client {
|
||||||
useGlobalSettings: json["use_global_settings"],
|
useGlobalSettings: json["use_global_settings"],
|
||||||
safeSearch: json["safe_search"] != null
|
safeSearch: json["safe_search"] != null
|
||||||
? SafeSearch.fromJson(json["safe_search"])
|
? SafeSearch.fromJson(json["safe_search"])
|
||||||
: null
|
: null,
|
||||||
|
ignoreQuerylog: json["ignore_querylog"],
|
||||||
|
ignoreStatistics: json["ignore_statistics"]
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
|
@ -130,5 +136,7 @@ class Client {
|
||||||
"safe_search": safeSearch,
|
"safe_search": safeSearch,
|
||||||
"use_global_blocked_services": useGlobalBlockedServices,
|
"use_global_blocked_services": useGlobalBlockedServices,
|
||||||
"use_global_settings": useGlobalSettings,
|
"use_global_settings": useGlobalSettings,
|
||||||
|
"ignore_querylog": ignoreQuerylog,
|
||||||
|
"ignore_statistics": ignoreStatistics,
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -29,13 +29,13 @@ class AddedList extends StatefulWidget {
|
||||||
final bool splitView;
|
final bool splitView;
|
||||||
|
|
||||||
const AddedList({
|
const AddedList({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.scrollController,
|
required this.scrollController,
|
||||||
required this.data,
|
required this.data,
|
||||||
required this.onClientSelected,
|
required this.onClientSelected,
|
||||||
this.selectedClient,
|
this.selectedClient,
|
||||||
required this.splitView
|
required this.splitView
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AddedList> createState() => _AddedListState();
|
State<AddedList> createState() => _AddedListState();
|
||||||
|
@ -75,7 +75,7 @@ class _AddedListState extends State<AddedList> {
|
||||||
|
|
||||||
void confirmEditClient(Client client) async {
|
void confirmEditClient(Client client) async {
|
||||||
ProcessModal processModal = ProcessModal();
|
ProcessModal processModal = ProcessModal();
|
||||||
processModal.open(AppLocalizations.of(context)!.addingClient);
|
processModal.open(AppLocalizations.of(context)!.savingChanges);
|
||||||
|
|
||||||
final result = await clientsProvider.editClient(client);
|
final result = await clientsProvider.editClient(client);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:adguard_home_manager/widgets/custom_switch_list_tile.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
@ -45,6 +46,10 @@ class ClientForm extends StatelessWidget {
|
||||||
final void Function(bool) updateEnableSafeSearch;
|
final void Function(bool) updateEnableSafeSearch;
|
||||||
final void Function(SafeSearch) updateSafeSearch;
|
final void Function(SafeSearch) updateSafeSearch;
|
||||||
final void Function(bool) updateUseGlobalSettingsServices;
|
final void Function(bool) updateUseGlobalSettingsServices;
|
||||||
|
final bool ignoreClientQueryLog;
|
||||||
|
final void Function(bool) updateIgnoreClientQueryLog;
|
||||||
|
final bool ignoreClientStatistics;
|
||||||
|
final void Function(bool) updateIgnoreClientStatistics;
|
||||||
|
|
||||||
const ClientForm({
|
const ClientForm({
|
||||||
super.key,
|
super.key,
|
||||||
|
@ -75,6 +80,10 @@ class ClientForm extends StatelessWidget {
|
||||||
required this.updateEnableSafeSearch,
|
required this.updateEnableSafeSearch,
|
||||||
required this.updateSafeSearch,
|
required this.updateSafeSearch,
|
||||||
required this.updateUseGlobalSettingsServices,
|
required this.updateUseGlobalSettingsServices,
|
||||||
|
required this.ignoreClientQueryLog,
|
||||||
|
required this.ignoreClientStatistics,
|
||||||
|
required this.updateIgnoreClientQueryLog,
|
||||||
|
required this.updateIgnoreClientStatistics,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -217,6 +226,28 @@ class ClientForm extends StatelessWidget {
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
SectionLabel(
|
||||||
|
label: AppLocalizations.of(context)!.queryLogsAndStatistics,
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
),
|
||||||
|
CustomSwitchListTile(
|
||||||
|
title: AppLocalizations.of(context)!.ignoreClientQueryLog,
|
||||||
|
value: ignoreClientQueryLog,
|
||||||
|
onChanged: updateIgnoreClientQueryLog,
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 24,
|
||||||
|
vertical: 4
|
||||||
|
),
|
||||||
|
),
|
||||||
|
CustomSwitchListTile(
|
||||||
|
title: AppLocalizations.of(context)!.ignoreClientStatistics,
|
||||||
|
value: ignoreClientStatistics,
|
||||||
|
onChanged: updateIgnoreClientStatistics,
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 24,
|
||||||
|
vertical: 4
|
||||||
|
),
|
||||||
|
),
|
||||||
SectionLabel(
|
SectionLabel(
|
||||||
label: AppLocalizations.of(context)!.blockedServices,
|
label: AppLocalizations.of(context)!.blockedServices,
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.all(24),
|
||||||
|
|
|
@ -73,6 +73,9 @@ class _ClientScreenState extends State<ClientScreen> {
|
||||||
|
|
||||||
List<ControllerListItem> upstreamServers = [];
|
List<ControllerListItem> upstreamServers = [];
|
||||||
|
|
||||||
|
bool _ignoreClientQueryLog = false;
|
||||||
|
bool _ignoreClientStatistics = false;
|
||||||
|
|
||||||
void enableDisableGlobalSettingsFiltering() {
|
void enableDisableGlobalSettingsFiltering() {
|
||||||
if (useGlobalSettingsFiltering == true) {
|
if (useGlobalSettingsFiltering == true) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
@ -120,6 +123,8 @@ class _ClientScreenState extends State<ClientScreen> {
|
||||||
id: uuid.v4(),
|
id: uuid.v4(),
|
||||||
controller: TextEditingController(text: e)
|
controller: TextEditingController(text: e)
|
||||||
)).toList();
|
)).toList();
|
||||||
|
_ignoreClientQueryLog = widget.client!.ignoreQuerylog ?? false;
|
||||||
|
_ignoreClientStatistics = widget.client!.ignoreStatistics ?? false;
|
||||||
}
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
@ -140,7 +145,9 @@ class _ClientScreenState extends State<ClientScreen> {
|
||||||
useGlobalBlockedServices: useGlobalSettingsServices,
|
useGlobalBlockedServices: useGlobalSettingsServices,
|
||||||
blockedServices: blockedServices,
|
blockedServices: blockedServices,
|
||||||
upstreams: List<String>.from(upstreamServers.map((e) => e.controller.text)),
|
upstreams: List<String>.from(upstreamServers.map((e) => e.controller.text)),
|
||||||
tags: selectedTags
|
tags: selectedTags,
|
||||||
|
ignoreQuerylog: _ignoreClientQueryLog,
|
||||||
|
ignoreStatistics: _ignoreClientStatistics
|
||||||
);
|
);
|
||||||
widget.onConfirm(client);
|
widget.onConfirm(client);
|
||||||
}
|
}
|
||||||
|
@ -214,6 +221,10 @@ class _ClientScreenState extends State<ClientScreen> {
|
||||||
updateEnableSafeSearch: (v) => setState(() => enableSafeSearch = v),
|
updateEnableSafeSearch: (v) => setState(() => enableSafeSearch = v),
|
||||||
updateSafeSearch: (v) => setState(() => safeSearch = v),
|
updateSafeSearch: (v) => setState(() => safeSearch = v),
|
||||||
updateUseGlobalSettingsServices: (v) => setState(() => useGlobalSettingsServices = v),
|
updateUseGlobalSettingsServices: (v) => setState(() => useGlobalSettingsServices = v),
|
||||||
|
ignoreClientQueryLog: _ignoreClientQueryLog,
|
||||||
|
ignoreClientStatistics: _ignoreClientStatistics,
|
||||||
|
updateIgnoreClientQueryLog: (v) => setState(() => _ignoreClientQueryLog = v),
|
||||||
|
updateIgnoreClientStatistics: (v) => setState(() => _ignoreClientStatistics = v),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -281,6 +292,10 @@ class _ClientScreenState extends State<ClientScreen> {
|
||||||
updateEnableSafeSearch: (v) => setState(() => enableSafeSearch = v),
|
updateEnableSafeSearch: (v) => setState(() => enableSafeSearch = v),
|
||||||
updateSafeSearch: (v) => setState(() => safeSearch = v),
|
updateSafeSearch: (v) => setState(() => safeSearch = v),
|
||||||
updateUseGlobalSettingsServices: (v) => setState(() => useGlobalSettingsServices = v),
|
updateUseGlobalSettingsServices: (v) => setState(() => useGlobalSettingsServices = v),
|
||||||
|
ignoreClientQueryLog: _ignoreClientQueryLog,
|
||||||
|
ignoreClientStatistics: _ignoreClientStatistics,
|
||||||
|
updateIgnoreClientQueryLog: (v) => setState(() => _ignoreClientQueryLog = v),
|
||||||
|
updateIgnoreClientStatistics: (v) => setState(() => _ignoreClientStatistics = v),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Reference in a new issue