mirror of https://github.com/M66B/FairEmail.git
Added tracking hosts
This commit is contained in:
parent
8cb4c89c76
commit
f21a133902
|
@ -107,6 +107,7 @@ import java.io.InputStream;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -321,6 +322,10 @@ public class HtmlHelper {
|
||||||
0x2B02, 0x1F8AC, 0x1F8AD, 0x1F5F6, 0x2714, 0x1F5F7, 0x1F5F9, 0x0077
|
0x2B02, 0x1F8AC, 0x1F8AD, 0x1F5F6, 0x2714, 0x1F5F7, 0x1F5F9, 0x0077
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static final List<String> TRACKING_HOSTS = Collections.unmodifiableList(Arrays.asList(
|
||||||
|
"www.google-analytics.com"
|
||||||
|
));
|
||||||
|
|
||||||
static Document sanitizeCompose(Context context, String html, boolean show_images) {
|
static Document sanitizeCompose(Context context, String html, boolean show_images) {
|
||||||
try {
|
try {
|
||||||
Document parsed = JsoupEx.parse(html);
|
Document parsed = JsoupEx.parse(html);
|
||||||
|
@ -1533,6 +1538,17 @@ public class HtmlHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isTrackingPixel(Element img) {
|
private static boolean isTrackingPixel(Element img) {
|
||||||
|
String src = img.attr("src");
|
||||||
|
if (!TextUtils.isEmpty(src))
|
||||||
|
try {
|
||||||
|
Uri uri = Uri.parse(src);
|
||||||
|
String host = uri.getHost();
|
||||||
|
if (!TextUtils.isEmpty(host) && TRACKING_HOSTS.contains(host))
|
||||||
|
return true;
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.w(ex);
|
||||||
|
}
|
||||||
|
|
||||||
String width = img.attr("width").trim();
|
String width = img.attr("width").trim();
|
||||||
String height = img.attr("height").trim();
|
String height = img.attr("height").trim();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue