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 { try {
const html = await getHtml(url); const html = await getHtml(url);
const dom = new JSDOM(html); const dom = new JSDOM(html);
const relMeLinks = [ const allLinks = [...dom.window.document.querySelectorAll("a, link")];
...dom.window.document.querySelectorAll("a[rel='me']"), const relMeLinks = allLinks
...dom.window.document.querySelectorAll("link[rel='me']"), .filter((a) => {
].map((a) => (a as HTMLAnchorElement | HTMLLinkElement).href); const relAttribute = a.getAttribute("rel");
return relAttribute ? relAttribute.split(" ").includes("me") : false;
})
.map((a) => (a as HTMLAnchorElement | HTMLLinkElement).href);
return relMeLinks; return relMeLinks;
} catch { } catch {
return []; return [];

View file

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