From d76b4f23210413d3f75129964ee297f5642facee Mon Sep 17 00:00:00 2001
From: ThatOneCalculator <kainoa@t1c.dev>
Date: Sun, 30 Jul 2023 13:30:25 -0700
Subject: [PATCH] fix: :bug: rel=me verification with multiple rels besides me

Closes #10595
---
 packages/backend/src/services/fetch-rel-me.ts  | 11 +++++++----
 packages/client/src/pages/settings/profile.vue |  4 ++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/packages/backend/src/services/fetch-rel-me.ts b/packages/backend/src/services/fetch-rel-me.ts
index f7dbf72c1..3e9f3c118 100644
--- a/packages/backend/src/services/fetch-rel-me.ts
+++ b/packages/backend/src/services/fetch-rel-me.ts
@@ -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 [];
diff --git a/packages/client/src/pages/settings/profile.vue b/packages/client/src/pages/settings/profile.vue
index 3b94a8248..fa33ac887 100644
--- a/packages/client/src/pages/settings/profile.vue
+++ b/packages/client/src/pages/settings/profile.vue
@@ -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>