diff --git a/app/src/main/java/com/trianguloy/urlchecker/modules/companions/Hosts.java b/app/src/main/java/com/trianguloy/urlchecker/modules/companions/Hosts.java index 5af75d8..9cf2492 100644 --- a/app/src/main/java/com/trianguloy/urlchecker/modules/companions/Hosts.java +++ b/app/src/main/java/com/trianguloy/urlchecker/modules/companions/Hosts.java @@ -90,10 +90,13 @@ public class Hosts { Log.d("HOSTS", "Downloading " + file); HttpUtils.streamFromUrl(file, line -> { - var parts = line.replaceAll("#.*", "").trim().split(" +"); - if (parts.length != 2) return; - // valid, add - add(parts[1], Pair.create(label, color), replace); + var parts = line.replaceAll("#.*", "").trim().split("\\s+"); + // everything except the first entry is a possible host + for (int i = 1; i < parts.length; i++) { + add(parts[i], Pair.create(label, color), replace); + } + // just the host, special syntax + if (parts.length == 1) add(parts[0], Pair.create(label, color), replace); }); } if (entry.has("hosts")) { diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 95c573d..923eb15 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -272,7 +272,7 @@ Hay algunos enlaces cuyo único propósito es redirigirte a otro enlace. Si el e Sin datos Etiquetador de hosts - Este módulo etiqueta hosts, configurado al especificarlos directamente o al usar un fichero remoto tipo hosts. Puedes usarlo para avisar sobre sitios peligrosos o especiales. La configuración incluida corresponde a los hosts de StevenBlack (software dañino, noticias falsas, juego/apuestas y contenido de adulto) de https://github.com/StevenBlack/hosts + "Este módulo etiqueta hosts, configurado al especificarlos directamente o al usar un fichero remoto tipo hosts. Puedes usarlo para avisar sobre sitios peligrosos o especiales. La configuración incluida corresponde a los hosts de StevenBlack (software dañino, noticias falsas, juego/apuestas y contenido de adulto) de https://github.com/StevenBlack/hosts. Nota: subdominios también se comprobarán, con lo que 'x.y.z' e 'y.z' serán detectados para la entrada 'y.z'" software dañino Host: sin etiqueta @@ -283,7 +283,7 @@ Hay algunos enlaces cuyo único propósito es redirigirte a otro enlace. Si el e Catálogo de hosts sin inicializar. Pulsa para generarlo No se puede analizar la URL del host Configuración de hosts. Formato: Lista de objectos en los que la clave es la etiqueta de los hosts y el contenido incluye los siguientes campos opcionales: -\n- file: Enlace a un fichero remoto tipo hosts para descargar. Todos los hosts válidos que incluya serán añadidos. +\n- file: Enlace a un fichero remoto tipo hosts para descargar. Todos los hosts válidos que incluya serán añadidos. Las líneas deben seguir el formato host: \'ip host [alias…]\', aunque aquellas con solo \'host\' también son validas. \n- hosts: Lista de hosts (strings) para añadir. \n- color: El color de la etiqueta. Un string de color de Android (#AARRGGBB, #RRGGBB o un color válido). Rojo \'peligro\' por defecto. \n- replace: si es \'false\' hosts existentes no serán reemplazados. Notar que los objetos se evalúan de arriba a abajo. \'true\' por defecto. diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 58855ab..3fbae47 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -324,7 +324,7 @@ This module has been deprecated in favor of the 'Uri parts' module" Unlimited Hosts labeler - "This module labels hosts, configured either by specifying them manually or by using a remote hosts-like file. You can use it to warn about dangerous or special sites. The builtin configuration specifies StevenBlack's hosts (adware/malware, fakenews, gambling and adult content) from https://github.com/StevenBlack/hosts" + "This module labels hosts, configured either by specifying them manually or by using a remote hosts-like file. You can use it to warn about dangerous or special sites. The builtin configuration specifies StevenBlack's hosts (adware/malware, fakenews, gambling and adult content) from https://github.com/StevenBlack/hosts. Note: subdomains will also be checked, so 'x.y.z' and 'y.z' will be detected for the entry 'y.z'" adware/malware Host: no label @@ -335,7 +335,7 @@ This module has been deprecated in favor of the 'Uri parts' module" Hosts database uninitialized. Press to build Can not parse URL host "Hosts configuration. Format: List of objects where the key is the hosts label and the content includes the following optional values: -- file: An url of a remote hosts-file to download. All valid hosts present will be added. +- file: An url of a remote hosts-file to download. All valid hosts present will be added. The lines should follow the hosts syntax: 'ip host [alias…]', but those with only 'host' are valid too. - hosts: List of raw hosts (strings) to add. - color: The label's color. An Android color string (#AARRGGBB, #RRGGBB or a valid color name). Defaults to a 'danger' red. - replace: if false existing hosts won't be replaced. Note that objects are evaluated from top to bottom. True by default.