Revert "fix(site): normalize malformed SITE_SOCIAL input"
This reverts commit 435be45517.
This commit is contained in:
+3
-21
@@ -8,30 +8,12 @@
|
|||||||
// Parse social links from env (format: "name|url|icon,name|url|icon")
|
// Parse social links from env (format: "name|url|icon,name|url|icon")
|
||||||
function parseSocialLinks(envVar) {
|
function parseSocialLinks(envVar) {
|
||||||
if (!envVar) return [];
|
if (!envVar) return [];
|
||||||
|
return envVar.split(",").map((link) => {
|
||||||
// Normalize common secret copy/paste mistakes, e.g. SITE_SOCIAL="..."
|
const [name, url, icon] = link.split("|").map((s) => s.trim());
|
||||||
const cleaned = String(envVar)
|
|
||||||
.trim()
|
|
||||||
.replace(/^SITE_SOCIAL\s*=\s*/i, "")
|
|
||||||
.replace(/^['"]|['"]$/g, "");
|
|
||||||
|
|
||||||
return cleaned
|
|
||||||
.split(",")
|
|
||||||
.map((link) => link.trim())
|
|
||||||
.filter(Boolean)
|
|
||||||
.map((link) => {
|
|
||||||
const [rawName, rawUrl, rawIcon] = link.split("|");
|
|
||||||
const name = (rawName || "").trim().replace(/^['"]|['"]$/g, "");
|
|
||||||
const url = (rawUrl || "").trim().replace(/^['"]|['"]$/g, "");
|
|
||||||
const icon = (rawIcon || "").trim().replace(/^['"]|['"]$/g, "");
|
|
||||||
|
|
||||||
if (!name || !url) return null;
|
|
||||||
|
|
||||||
// Bluesky requires "me atproto" for verification
|
// Bluesky requires "me atproto" for verification
|
||||||
const rel = url.includes("bsky.app") ? "me atproto" : "me";
|
const rel = url.includes("bsky.app") ? "me atproto" : "me";
|
||||||
return { name, url, rel, icon: icon || name.toLowerCase() };
|
return { name, url, rel, icon: icon || name.toLowerCase() };
|
||||||
})
|
});
|
||||||
.filter(Boolean);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get fediverse handle for fediverse:creator meta tag
|
// Get fediverse handle for fediverse:creator meta tag
|
||||||
|
|||||||
Reference in New Issue
Block a user