From ec9887a6d7d8cfc00a5486e5d68d70f4cc6baf1a Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Tue, 10 Mar 2026 01:31:19 +0100 Subject: [PATCH] fix: social activity widget - Bluesky and Mastodon feeds not rendering - deploy.yml: add missing BLUESKY_HANDLE env var to Build site step - deploy.yml: fix GITHUB_USERNAME secret name (was GH_USERNAME) - mastodonFeed.js: read MASTODON_URL first, fall back to MASTODON_INSTANCE - mastodonFeed.js: add early-return guard when instance/user vars are empty - mastodonFeed.js: also accept MASTODON_USERNAME as fallback for MASTODON_USER Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/deploy.yml | 3 ++- _data/mastodonFeed.js | 19 +++++++++++++++++-- theme/_data/mastodonFeed.js | 19 +++++++++++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ac80cda..c35dc72 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -86,9 +86,10 @@ jobs: AUTHOR_AVATAR: ${{ secrets.AUTHOR_AVATAR }} AUTHOR_BIO: ${{ secrets.AUTHOR_BIO }} AUTHOR_EMAIL: ${{ secrets.AUTHOR_EMAIL }} - GITHUB_USERNAME: ${{ secrets.GH_USERNAME }} + GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }} MASTODON_INSTANCE: ${{ secrets.MASTODON_INSTANCE }} MASTODON_USER: ${{ secrets.MASTODON_USER }} + BLUESKY_HANDLE: ${{ secrets.BLUESKY_HANDLE }} OWNYOURSWARM_FEED_URL: ${{ secrets.OWNYOURSWARM_FEED_URL }} OWNYOURSWARM_FEED_TOKEN: ${{ secrets.OWNYOURSWARM_FEED_TOKEN }} LISTENING_FETCH_CACHE_DURATION: ${{ secrets.LISTENING_FETCH_CACHE_DURATION }} diff --git a/_data/mastodonFeed.js b/_data/mastodonFeed.js index 0c79abf..4255b48 100644 --- a/_data/mastodonFeed.js +++ b/_data/mastodonFeed.js @@ -6,8 +6,23 @@ import EleventyFetch from "@11ty/eleventy-fetch"; export default async function () { - const instance = process.env.MASTODON_INSTANCE?.replace("https://", "") || ""; - const username = process.env.MASTODON_USER || ""; + const instance = ( + process.env.MASTODON_URL || + process.env.MASTODON_INSTANCE || + "" + ) + .replace(/^https?:\/\//, "") + .replace(/\/+$/, ""); + const username = ( + process.env.MASTODON_USER || + process.env.MASTODON_USERNAME || + "" + ).trim().replace(/^@+/, ""); + + if (!instance || !username) { + console.log("[mastodonFeed] MASTODON_URL/MASTODON_USER not set, skipping"); + return []; + } try { // First, look up the account ID diff --git a/theme/_data/mastodonFeed.js b/theme/_data/mastodonFeed.js index 0c79abf..4255b48 100644 --- a/theme/_data/mastodonFeed.js +++ b/theme/_data/mastodonFeed.js @@ -6,8 +6,23 @@ import EleventyFetch from "@11ty/eleventy-fetch"; export default async function () { - const instance = process.env.MASTODON_INSTANCE?.replace("https://", "") || ""; - const username = process.env.MASTODON_USER || ""; + const instance = ( + process.env.MASTODON_URL || + process.env.MASTODON_INSTANCE || + "" + ) + .replace(/^https?:\/\//, "") + .replace(/\/+$/, ""); + const username = ( + process.env.MASTODON_USER || + process.env.MASTODON_USERNAME || + "" + ).trim().replace(/^@+/, ""); + + if (!instance || !username) { + console.log("[mastodonFeed] MASTODON_URL/MASTODON_USER not set, skipping"); + return []; + } try { // First, look up the account ID