Merge pull request '44-redit-proof-fix' (#45) from yisraeldov/keyoxide-web:44-redit-proof-fix into dev

Reviewed-on: https://codeberg.org/keyoxide/web/pulls/45
This commit is contained in:
Yarmo Mackenbach 2020-10-23 18:22:57 +02:00
commit eb0e86bdcb

View file

@ -435,6 +435,7 @@ async function verifyProof(url, fingerprint) {
// Init
let reVerify, match, output = {url: url, type: null, proofUrl: url, proofUrlFetch: null, isVerified: false, display: null, qr: null};
try {
// DNS
if (/^dns:/.test(url)) {
output.type = "domain";
@ -579,7 +580,7 @@ async function verifyProof(url, fingerprint) {
// Reddit
if (/^https:\/\/(?:www\.)?reddit\.com\/user/.test(url)) {
output.type = "reddit";
match = url.match(/https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/(.*)\//);
match = url.match(/https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/([^/]*)/);
output.display = match[1];
output.url = `https://www.reddit.com/user/${match[1]}`;
output.proofUrl = `https://www.reddit.com/user/${match[1]}/comments/${match[2]}.json`;
@ -791,6 +792,9 @@ async function verifyProof(url, fingerprint) {
} catch (e) {
console.warn(e);
}
} catch (e) {
console.warn(e);
}
// Return output without confirmed proof
return output;