mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 14:11:00 +00:00
Check URI against block lists
This commit is contained in:
parent
df90a94e7b
commit
76e99796a5
2 changed files with 15 additions and 4 deletions
|
@ -24,6 +24,7 @@ import android.content.SharedPreferences;
|
|||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.core.net.MailTo;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
|
@ -162,7 +163,17 @@ public class DnsBlockList {
|
|||
return (hasDomain ? false : null);
|
||||
}
|
||||
|
||||
static Boolean isJunk(Context context, String domain) {
|
||||
static Boolean isJunk(Context context, Uri uri) {
|
||||
String domain = null;
|
||||
if ("mailto".equalsIgnoreCase(uri.getScheme())) {
|
||||
MailTo email = MailTo.parse(uri.toString());
|
||||
domain = UriHelper.getEmailDomain(email.getTo());
|
||||
} else
|
||||
domain = uri.getHost();
|
||||
|
||||
if (domain == null)
|
||||
return null;
|
||||
|
||||
return isJunk(context, domain, false, BLOCK_LISTS);
|
||||
}
|
||||
|
||||
|
|
|
@ -408,13 +408,13 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
if (check_links_dbl &&
|
||||
tvSuspicious.getVisibility() != View.VISIBLE) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString("host", host);
|
||||
args.putParcelable("uri", uri);
|
||||
|
||||
new SimpleTask<Boolean>() {
|
||||
@Override
|
||||
protected Boolean onExecute(Context context, Bundle args) throws Throwable {
|
||||
String host = args.getString("host");
|
||||
return DnsBlockList.isJunk(context, host);
|
||||
Uri uri = args.getParcelable("uri");
|
||||
return DnsBlockList.isJunk(context, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue