Check DBL for suspicious links

This commit is contained in:
M66B 2021-08-07 13:51:51 +02:00
parent 771ff11ba8
commit 24bc078cf8
2 changed files with 29 additions and 0 deletions

View File

@ -162,6 +162,10 @@ public class DnsBlockList {
return (hasDomain ? false : null);
}
static Boolean isJunk(Context context, String domain) {
return isJunk(context, domain, false, BLOCK_LISTS);
}
private static boolean isJunk(Context context, String host, boolean numeric, List<BlockList> blocklists) {
synchronized (cache) {
CacheEntry entry = cache.get(host);

View File

@ -403,6 +403,31 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
tvSuspicious.setVisibility(Helper.isSingleScript(host) ? View.GONE : View.VISIBLE);
}
if (BuildConfig.DEBUG &&
tvSuspicious.getVisibility() != View.VISIBLE) {
Bundle args = new Bundle();
args.putString("host", host);
new SimpleTask<Boolean>() {
@Override
protected Boolean onExecute(Context context, Bundle args) throws Throwable {
String host = args.getString("host");
return DnsBlockList.isJunk(context, host);
}
@Override
protected void onExecuted(Bundle args, Boolean blocklist) {
if (blocklist != null && blocklist)
tvSuspicious.setVisibility(View.VISIBLE);
}
@Override
protected void onException(Bundle args, Throwable ex) {
// Ignored
}
}.execute(this, args, "link:blocklist");
}
grpDifferent.setVisibility(
host == null || thost == null || host.equalsIgnoreCase(thost)
? View.GONE : View.VISIBLE);