fix: normalize site URL with trailing slash for Mastodon rel=me verification

Mastodon's VerifyLinkService uses strict string comparison against
account.url (which includes trailing slash from the AP actor's url
field). The h-card self-link used SITE_URL without trailing slash,
causing the comparison to fail silently.
This commit is contained in:
Ricardo
2026-02-24 13:56:29 +01:00
parent 90ff9068a1
commit f5f77cb4a3
+6 -3
View File
@@ -62,11 +62,14 @@ function buildSocialFromFeeds() {
return links; return links;
} }
// Ensure URL has trailing slash (Mastodon rel="me" verification uses strict string match)
const siteUrl = (process.env.SITE_URL || "https://example.com").replace(/\/$/, "") + "/";
export default { export default {
// Basic site info // Basic site info
name: process.env.SITE_NAME || "My IndieWeb Blog", name: process.env.SITE_NAME || "My IndieWeb Blog",
url: process.env.SITE_URL || "https://example.com", url: siteUrl,
me: process.env.SITE_URL || "https://example.com", me: siteUrl,
locale: process.env.SITE_LOCALE || "en", locale: process.env.SITE_LOCALE || "en",
description: description:
process.env.SITE_DESCRIPTION || process.env.SITE_DESCRIPTION ||
@@ -75,7 +78,7 @@ export default {
// Author info (shown in h-card, about page, etc.) // Author info (shown in h-card, about page, etc.)
author: { author: {
name: process.env.AUTHOR_NAME || "Blog Author", name: process.env.AUTHOR_NAME || "Blog Author",
url: process.env.SITE_URL || "https://example.com", url: siteUrl,
avatar: process.env.AUTHOR_AVATAR || "/images/default-avatar.svg", avatar: process.env.AUTHOR_AVATAR || "/images/default-avatar.svg",
title: process.env.AUTHOR_TITLE || "", title: process.env.AUTHOR_TITLE || "",
bio: process.env.AUTHOR_BIO || "Welcome to my IndieWeb blog.", bio: process.env.AUTHOR_BIO || "Welcome to my IndieWeb blog.",