Allow Mastodon backlinks to be URLs containing fingerprint

This commit is contained in:
Yarmo Mackenbach 2020-09-06 18:58:20 +02:00
parent 9eebea8405
commit 58b6d37b4f

View file

@ -738,7 +738,8 @@ async function verifyProof(url, fingerprint) {
if ('attachment' in json) { if ('attachment' in json) {
match = url.match(/https:\/\/(.*)\/@(.*)/); match = url.match(/https:\/\/(.*)\/@(.*)/);
json.attachment.forEach((item, i) => { json.attachment.forEach((item, i) => {
if (item.value.toUpperCase() === fingerprint.toUpperCase()) { reVerify = new RegExp(fingerprint, 'i');
if (reVerify.test(item.value)) {
output.type = "fediverse"; output.type = "fediverse";
output.display = `@${json.preferredUsername}@${[match[1]]}`; output.display = `@${json.preferredUsername}@${[match[1]]}`;
output.proofUrlFetch = json.url; output.proofUrlFetch = json.url;