mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Allow CSP connect-src CORS for keys.openpgp.org to directly fetch PGP keys
This commit is contained in:
parent
bfb0874c47
commit
62f0bac381
3 changed files with 25 additions and 2 deletions
|
|
@ -32,7 +32,7 @@ export class OpenPgpImportPopupView extends AbstractViewPopup {
|
|||
|
||||
searchPGP() {
|
||||
this.key(i18n('SUGGESTIONS/SEARCHING_DESC'));
|
||||
Remote.request('SearchPGPKey',
|
||||
const fn = () => Remote.request('SearchPGPKey',
|
||||
(iError, oData) => {
|
||||
if (iError) {
|
||||
this.key(oData.ErrorMessage);
|
||||
|
|
@ -43,6 +43,29 @@ export class OpenPgpImportPopupView extends AbstractViewPopup {
|
|||
query: this.search()
|
||||
}
|
||||
);
|
||||
fetch(
|
||||
`https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=${this.search()}`,
|
||||
{
|
||||
method: 'GET',
|
||||
mode: 'cors',
|
||||
cache: 'no-cache',
|
||||
redirect: 'error',
|
||||
referrerPolicy: 'no-referrer',
|
||||
credentials: 'omit'
|
||||
}
|
||||
)
|
||||
.then(response => {
|
||||
if ('application/pgp-keys' == response.headers.get('Content-Type')) {
|
||||
response.text().then(body => this.key(body));
|
||||
} else {
|
||||
fn();
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
this.key('keys.openpgp.org: ' + e?.message + '\nTrying local...');
|
||||
fn();
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
|
||||
submitForm() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue