mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 03:29:20 +03:00
Bugfix for whitelist to show images directly #201
This commit is contained in:
parent
539ddcc51f
commit
b0a4fb77be
1 changed files with 17 additions and 8 deletions
|
|
@ -384,23 +384,32 @@ export class MessageModel extends AbstractModel {
|
|||
showExternalImages(regex) {
|
||||
const body = this.body;
|
||||
if (body && this.hasImages()) {
|
||||
this.hasImages(false);
|
||||
body.rlHasImages = false;
|
||||
|
||||
let attr = 'data-x-src',
|
||||
let hasImages = false,
|
||||
isValid = src => {
|
||||
if (!regex || src.match(regex)) {
|
||||
return true;
|
||||
}
|
||||
hasImages = true;
|
||||
},
|
||||
attr = 'data-x-src',
|
||||
src, useProxy = !!SettingsGet('UseLocalProxyForExternalImages');
|
||||
body.querySelectorAll('img[' + attr + ']').forEach(node => {
|
||||
src = node.getAttribute(attr);
|
||||
if (!regex || src.match(regex)) {
|
||||
if (isValid(src)) {
|
||||
node.src = useProxy ? proxy(src) : src;
|
||||
}
|
||||
});
|
||||
|
||||
body.querySelectorAll('[data-x-style-url]').forEach(node => {
|
||||
JSON.parse(node.dataset.xStyleUrl).forEach(data =>
|
||||
node.style[data[0]] = "url('" + (useProxy ? proxy(data[1]) : data[1]) + "')"
|
||||
);
|
||||
JSON.parse(node.dataset.xStyleUrl).forEach(data => {
|
||||
if (isValid(data[1])) {
|
||||
node.style[data[0]] = "url('" + (useProxy ? proxy(data[1]) : data[1]) + "')"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.hasImages(hasImages);
|
||||
body.rlHasImages = hasImages;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue