Skip to content

Commit

Permalink
Disable DuckDuckGo tracker list (fixes #435)
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-klode committed Mar 23, 2021
1 parent 90113fa commit e95be5e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/src/main/assets/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": 1,
"minorVersion": 2,
"minorVersion": 3,
"autoStart": true,
"showNotification": true,
"nightMode": false,
Expand Down
16 changes: 15 additions & 1 deletion app/src/main/java/org/jak_linux/dns66/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public class Configuration {
public static final Gson GSON = new Gson();
static final int VERSION = 1;
/* Default tweak level */
static final int MINOR_VERSION = 2;
static final int MINOR_VERSION = 3;
private static final String TAG = "Configuration";
public int version = 1;
public int minorVersion = 0;
public boolean autoStart;
Expand Down Expand Up @@ -87,6 +88,8 @@ public void runUpdate(int level) {
case 2:
removeURL("https://hosts-file.net/ad_servers.txt");
break;
case 3:
disableURL("https://blokada.org/blocklists/ddgtrackerradar/standard/hosts.txt");
}
this.minorVersion = level;
}
Expand Down Expand Up @@ -134,6 +137,17 @@ public void removeURL(String oldURL) {
}
}


public void disableURL(String oldURL) {
Log.d(TAG, String.format("disableURL: Disabling %s", oldURL));
Iterator itr = hosts.items.iterator();
while (itr.hasNext()) {
Item host = (Item) itr.next();
if (host.location.equals(oldURL))
host.state = Item.STATE_IGNORE;
}
}

public void write(Writer writer) throws IOException {
GSON.toJson(this, writer);
}
Expand Down

0 comments on commit e95be5e

Please sign in to comment.