mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-21 22:39:11 +00:00
Fixed fallback dns regex
This commit is contained in:
parent
9de9b0afec
commit
ba2a27fef0
4 changed files with 8 additions and 5 deletions
|
@ -778,5 +778,6 @@
|
||||||
"enablePlainDns": "Enable plain DNS",
|
"enablePlainDns": "Enable plain DNS",
|
||||||
"enablePlainDnsDescription": "Plain DNS is enabled by default. You can disable it to force all devices to use encrypted DNS. To do this, you must enable at least one encrypted DNS protocol.",
|
"enablePlainDnsDescription": "Plain DNS is enabled by default. You can disable it to force all devices to use encrypted DNS. To do this, you must enable at least one encrypted DNS protocol.",
|
||||||
"date": "Date",
|
"date": "Date",
|
||||||
"loadingChangelog": "Loading changelog..."
|
"loadingChangelog": "Loading changelog...",
|
||||||
|
"invalidIpOrUrl": "Invalid IP address or URL"
|
||||||
}
|
}
|
|
@ -778,5 +778,6 @@
|
||||||
"enablePlainDns": "Activar DNS simple (sin cifrado)",
|
"enablePlainDns": "Activar DNS simple (sin cifrado)",
|
||||||
"enablePlainDnsDescription": "El DNS simple (sin cifrado) está activado de forma predeterminada. Puedes desactivarlo para obligar a todos los dispositivos a utilizar DNS cifrado. Para ello, debes habilitar al menos un protocolo DNS cifrado.",
|
"enablePlainDnsDescription": "El DNS simple (sin cifrado) está activado de forma predeterminada. Puedes desactivarlo para obligar a todos los dispositivos a utilizar DNS cifrado. Para ello, debes habilitar al menos un protocolo DNS cifrado.",
|
||||||
"date": "Fecha",
|
"date": "Fecha",
|
||||||
"loadingChangelog": "Cargando registro de cambios..."
|
"loadingChangelog": "Cargando registro de cambios...",
|
||||||
|
"invalidIpOrUrl": "Dirección IP o URL no válida"
|
||||||
}
|
}
|
|
@ -24,11 +24,12 @@ class _FallbackDnsScreenState extends State<FallbackDnsScreen> {
|
||||||
|
|
||||||
void validateIp(Map<String, dynamic> field, String value) {
|
void validateIp(Map<String, dynamic> field, String value) {
|
||||||
RegExp ipAddress = RegExp(r'(?:^(?:25[0-5]|2[0-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fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)');
|
||||||
if (ipAddress.hasMatch(value) == true) {
|
RegExp url = RegExp(r'(https?|tls):\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)');
|
||||||
|
if (ipAddress.hasMatch(value) == true || url.hasMatch(value) == true) {
|
||||||
setState(() => field['error'] = null);
|
setState(() => field['error'] = null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setState(() => field['error'] = AppLocalizations.of(context)!.invalidIp);
|
setState(() => field['error'] = AppLocalizations.of(context)!.invalidIpOrUrl);
|
||||||
}
|
}
|
||||||
checkValidValues();
|
checkValidValues();
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ class _UpstreamDnsScreenState extends State<UpstreamDnsScreen> {
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)).toList(),
|
)),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
|
Loading…
Add table
Reference in a new issue