parent
5d931fc41b
commit
d76b4f2321
2 changed files with 9 additions and 6 deletions
|
@ -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 [];
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue