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 {
|
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 [];
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue