From 785a425b8c6f75539b5cf54f39412646fd010856 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 16 Aug 2020 21:35:36 +0200 Subject: [PATCH] Direct StevenBlack's hosts file download --- .../main/java/eu/faircode/netguard/ActivitySettings.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/netguard/ActivitySettings.java b/app/src/main/java/eu/faircode/netguard/ActivitySettings.java index 57e16f3c..37ce4f78 100644 --- a/app/src/main/java/eu/faircode/netguard/ActivitySettings.java +++ b/app/src/main/java/eu/faircode/netguard/ActivitySettings.java @@ -359,9 +359,14 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere public boolean onPreferenceClick(Preference preference) { final File tmp = new File(getFilesDir(), "hosts.tmp"); final File hosts = new File(getFilesDir(), "hosts.txt"); + EditTextPreference pref_hosts_url = (EditTextPreference) screen.findPreference("hosts_url"); + String hosts_url = pref_hosts_url.getText(); + if ("https://www.netguard.me/hosts".equals(hosts_url)) + hosts_url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"; + try { - new DownloadTask(ActivitySettings.this, new URL(pref_hosts_url.getText()), tmp, new DownloadTask.Listener() { + new DownloadTask(ActivitySettings.this, new URL(hosts_url), tmp, new DownloadTask.Listener() { @Override public void onCompleted() { if (hosts.exists())