|
|
|
@ -1430,14 +1430,32 @@ public class HtmlHelper {
|
|
|
|
|
sb.append("data:image/png;base64,");
|
|
|
|
|
sb.append(Base64.encodeToString(bos.toByteArray(), Base64.NO_WRAP));
|
|
|
|
|
|
|
|
|
|
// Build list of allowed hosts
|
|
|
|
|
List<String> hosts = new ArrayList<>();
|
|
|
|
|
for (Element img : document.select("img")) {
|
|
|
|
|
String src = img.attr("src");
|
|
|
|
|
if (!TextUtils.isEmpty(src) && !isTrackingPixel(img)) {
|
|
|
|
|
Uri uri = Uri.parse(img.attr("src"));
|
|
|
|
|
String host = uri.getHost();
|
|
|
|
|
if (host != null && !hosts.contains(host))
|
|
|
|
|
hosts.add(host);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Images
|
|
|
|
|
for (Element img : document.select("img")) {
|
|
|
|
|
img.removeAttr("x-tracking");
|
|
|
|
|
String src = img.attr("src");
|
|
|
|
|
if (TextUtils.isEmpty(src))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
Uri uri = Uri.parse(src);
|
|
|
|
|
String host = uri.getHost();
|
|
|
|
|
if (host == null || hosts.contains(host))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (isTrackingPixel(img) ||
|
|
|
|
|
(disconnect_images && DisconnectBlacklist.isTracking(Uri.parse(src).getHost()))) {
|
|
|
|
|
(disconnect_images && DisconnectBlacklist.isTracking(host))) {
|
|
|
|
|
img.attr("src", sb.toString());
|
|
|
|
|
img.attr("alt", context.getString(R.string.title_legend_tracking_pixel));
|
|
|
|
|
img.attr("height", "24");
|
|
|
|
|