mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 03:29:20 +03:00
Resolve #201
This commit is contained in:
parent
6129fb4233
commit
07079b519a
44 changed files with 287 additions and 102 deletions
|
|
@ -286,8 +286,22 @@ export class MessageModel extends AbstractModel {
|
|||
body.classList.toggle('html', 1);
|
||||
body.classList.toggle('plain', 0);
|
||||
|
||||
if (SettingsUserStore.showImages() && !this.isSpam() && FolderUserStore.spamFolder() != this.folder) {
|
||||
this.showExternalImages();
|
||||
if (!this.isSpam() && FolderUserStore.spamFolder() != this.folder) {
|
||||
if ('always' === SettingsUserStore.viewImages()) {
|
||||
this.showExternalImages();
|
||||
}
|
||||
if ('match' === SettingsUserStore.viewImages()) {
|
||||
let regex = SettingsUserStore.viewImagesWhitelist()
|
||||
.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||
.replace(/[\s\S,;:]+/g, '|')
|
||||
.replace(/\|+/g, '|');
|
||||
if (regex.length) {
|
||||
regex = new RegExp(regex);
|
||||
this.showExternalImages(
|
||||
(this.from[0]?.email.match(regex)/* || this.sender[0]?.email.match(regex)*/) ? null : regex
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.isHtml(true);
|
||||
|
|
@ -391,7 +405,7 @@ export class MessageModel extends AbstractModel {
|
|||
return self;
|
||||
}
|
||||
|
||||
showExternalImages() {
|
||||
showExternalImages(regex) {
|
||||
const body = this.body;
|
||||
if (body && this.hasImages()) {
|
||||
this.hasImages(false);
|
||||
|
|
@ -401,7 +415,9 @@ export class MessageModel extends AbstractModel {
|
|||
src, useProxy = !!SettingsGet('UseLocalProxyForExternalImages');
|
||||
body.querySelectorAll('img[' + attr + ']').forEach(node => {
|
||||
src = node.getAttribute(attr);
|
||||
node.src = useProxy ? proxy(src) : src;
|
||||
if (!regex || src.match(regex)) {
|
||||
node.src = useProxy ? proxy(src) : src;
|
||||
}
|
||||
});
|
||||
|
||||
body.querySelectorAll('[data-x-style-url]').forEach(node => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue