mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-09 06:28:28 +03:00
Improved broken PGP implementation
This commit is contained in:
parent
45c74370d0
commit
e49405cd85
7 changed files with 101 additions and 230 deletions
|
|
@ -435,7 +435,6 @@ export const MessageUserStore = new class {
|
|||
id = '',
|
||||
plain = '',
|
||||
resultHtml = '',
|
||||
pgpSigned = false,
|
||||
messagesDom = this.messagesBodiesDom(),
|
||||
selectedMessage = this.selectorMessageSelected(),
|
||||
message = this.message();
|
||||
|
|
@ -495,27 +494,17 @@ export const MessageUserStore = new class {
|
|||
|
||||
if ((message.isPgpSigned() || message.isPgpEncrypted()) && PgpUserStore.capaOpenPGP()) {
|
||||
plain = pString(json.Plain);
|
||||
|
||||
const isPgpEncrypted = /---BEGIN PGP MESSAGE---/.test(plain);
|
||||
if (!isPgpEncrypted) {
|
||||
pgpSigned =
|
||||
/-----BEGIN PGP SIGNED MESSAGE-----/.test(plain) && /-----BEGIN PGP SIGNATURE-----/.test(plain);
|
||||
}
|
||||
|
||||
const pre = createElement('pre');
|
||||
if (pgpSigned && message.isPgpSigned()) {
|
||||
if (message.isPgpSigned()) {
|
||||
pre.className = 'b-plain-openpgp signed';
|
||||
pre.textContent = plain;
|
||||
} else if (isPgpEncrypted && message.isPgpEncrypted()) {
|
||||
} else if (message.isPgpEncrypted()) {
|
||||
pre.className = 'b-plain-openpgp encrypted';
|
||||
pre.textContent = plain;
|
||||
} else {
|
||||
pre.innerHTML = resultHtml;
|
||||
}
|
||||
resultHtml = pre.outerHTML;
|
||||
|
||||
message.isPgpSigned(pgpSigned);
|
||||
message.isPgpEncrypted(isPgpEncrypted);
|
||||
} else {
|
||||
resultHtml = '<pre>' + resultHtml + '</pre>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,10 +355,10 @@ export const PgpUserStore = new class {
|
|||
verControl = Element.fromHTML('<div class="b-openpgp-control"><i class="fontastic">🔒</i></div>');
|
||||
if (encrypted) {
|
||||
verControl.title = i18n('MESSAGE/PGP_ENCRYPTED_MESSAGE_DESC');
|
||||
verControl.addEventHandler('click', domControlEncryptedClickHelper(this, dom, domText, recipients));
|
||||
verControl.addEventListener('click', domControlEncryptedClickHelper(this, dom, domText, recipients));
|
||||
} else {
|
||||
verControl.title = i18n('MESSAGE/PGP_SIGNED_MESSAGE_DESC');
|
||||
verControl.addEventHandler('click', domControlSignedClickHelper(this, dom, domText));
|
||||
verControl.addEventListener('click', domControlSignedClickHelper(this, dom, domText));
|
||||
}
|
||||
|
||||
dom.before(verControl, createElement('div'));
|
||||
|
|
|
|||
|
|
@ -438,19 +438,21 @@
|
|||
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
color: #777;
|
||||
opacity: 0.5;
|
||||
|
||||
&:hover {
|
||||
color: #111;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&.success {
|
||||
color: green;
|
||||
cursor: help;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&.error {
|
||||
color: red;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue