mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2025-01-10 15:19:28 -07:00
Fix CORS related fetch errors
This commit is contained in:
parent
e5e9f70344
commit
20a552cc41
1 changed files with 14 additions and 8 deletions
|
@ -211,19 +211,25 @@ async function displayProfile(opts) {
|
||||||
const urlAdvanced = `https://openpgpkey.${domain}/.well-known/openpgpkey/${domain}/hu/${localEncoded}`;
|
const urlAdvanced = `https://openpgpkey.${domain}/.well-known/openpgpkey/${domain}/hu/${localEncoded}`;
|
||||||
const urlDirect = `https://${domain}/.well-known/openpgpkey/hu/${localEncoded}`;
|
const urlDirect = `https://${domain}/.well-known/openpgpkey/hu/${localEncoded}`;
|
||||||
|
|
||||||
|
try {
|
||||||
keyLink = await fetch(urlAdvanced).then(function(response) {
|
keyLink = await fetch(urlAdvanced).then(function(response) {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
return urlAdvanced;
|
return urlAdvanced;
|
||||||
} else {
|
}
|
||||||
return fetch(urlDirect).then(function(response) {
|
});
|
||||||
|
}
|
||||||
|
if (!keyLink) {
|
||||||
|
try {
|
||||||
|
keyLink = await fetch(urlDirect).then(function(response) {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
return urlDirect;
|
return urlDirect;
|
||||||
} else {
|
|
||||||
return "#";
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
if (!keyLink) {
|
||||||
|
keyLink = `https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0x${keyData.fingerprint}`;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
keyLink = `https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0x${keyData.fingerprint}`;
|
keyLink = `https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0x${keyData.fingerprint}`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue