fix: 🐛 rel=me verification with multiple rels besides me

Closes #10595
This commit is contained in:
ThatOneCalculator 2023-07-30 13:30:25 -07:00
parent 5d931fc41b
commit d76b4f2321
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
2 changed files with 9 additions and 6 deletions

View File

@ -6,10 +6,13 @@ async function getRelMeLinks(url: string): Promise<string[]> {
try {
const html = await getHtml(url);
const dom = new JSDOM(html);
const relMeLinks = [
...dom.window.document.querySelectorAll("a[rel='me']"),
...dom.window.document.querySelectorAll("link[rel='me']"),
].map((a) => (a as HTMLAnchorElement | HTMLLinkElement).href);
const allLinks = [...dom.window.document.querySelectorAll("a, link")];
const relMeLinks = allLinks
.filter((a) => {
const relAttribute = a.getAttribute("rel");
return relAttribute ? relAttribute.split(" ").includes("me") : false;
})
.map((a) => (a as HTMLAnchorElement | HTMLLinkElement).href);
return relMeLinks;
} catch {
return [];

View File

@ -127,8 +127,8 @@
</FormFolder>
<template #caption>{{
i18n.t("_profile.metadataDescription", {
a: "\<code\>\<a\>\</code\>",
l: "\<code\>\<a\>\</code\>",
a: "\<a\>",
l: "\<a\>",
rel: `rel="me" href="https://${host}/@${$i.username}"`,
})
}}</template>