From 540d83afc3aa2934c0d2d07b90d2abc72249a61f Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Sun, 8 Mar 2026 06:04:12 +0100 Subject: [PATCH] Enable optional Funkwhale and Last.fm listening endpoints --- README.md | 13 +++++++++++++ indiekit.config.mjs | 22 ++++++++++++++++++++++ package-lock.json | 35 +++++++++++++++++++++++++++++++++++ package.json | 2 ++ 4 files changed, 72 insertions(+) diff --git a/README.md b/README.md index 962b8cc4..2a48b7be 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ - Webmentions moderation + API: `/webmentions` - Conversations + API: `/conversations` - GitHub activity + API: `/github` +- Funkwhale activity + API: `/funkwhale` (enabled when `FUNKWHALE_INSTANCE`, `FUNKWHALE_USERNAME`, `FUNKWHALE_TOKEN` are set) +- Last.fm activity + API: `/lastfmapi` (enabled when `LASTFM_API_KEY`, `LASTFM_USERNAME` are set) ## MongoDB @@ -64,6 +66,17 @@ - `GITHUB_USERNAME`: GitHub user/owner name. - Backward compatibility: if `GH_CONTENT_TOKEN` or `GH_ACTIVITY_TOKEN` are not set, config falls back to `GITHUB_TOKEN`. +## Listening tokens + +- Funkwhale endpoint requirements: +- `FUNKWHALE_INSTANCE` (for example `https://your-funkwhale.example`) +- `FUNKWHALE_USERNAME` +- `FUNKWHALE_TOKEN` (read API token) +- Last.fm endpoint requirements: +- `LASTFM_API_KEY` +- `LASTFM_USERNAME` +- If these variables are missing, the related endpoint plugin is not enabled and `/listening` will show no listening history. + ## Startup script - `start.sh` is intentionally ignored by Git (`.gitignore`) so server secrets are not committed. diff --git a/indiekit.config.mjs b/indiekit.config.mjs index a941c7ce..24c8e0f0 100644 --- a/indiekit.config.mjs +++ b/indiekit.config.mjs @@ -31,6 +31,15 @@ const githubContentToken = process.env.GH_CONTENT_TOKEN || process.env.GITHUB_TOKEN; const githubActivityToken = process.env.GH_ACTIVITY_TOKEN || process.env.GITHUB_TOKEN; +const funkwhaleInstance = process.env.FUNKWHALE_INSTANCE; +const funkwhaleUsername = process.env.FUNKWHALE_USERNAME; +const funkwhaleToken = process.env.FUNKWHALE_TOKEN; +const lastfmApiKey = process.env.LASTFM_API_KEY; +const lastfmUsername = process.env.LASTFM_USERNAME; +const enableFunkwhaleEndpoint = Boolean( + funkwhaleInstance && funkwhaleUsername && funkwhaleToken, +); +const enableLastfmEndpoint = Boolean(lastfmApiKey && lastfmUsername); const publicationBaseUrl = ( process.env.PUBLICATION_URL || "https://blog.giersig.eu" ).replace(/\/+$/, ""); @@ -118,6 +127,8 @@ export default { "@rmdes/indiekit-endpoint-github", "@rmdes/indiekit-endpoint-webmention-io", "@rmdes/indiekit-endpoint-conversations", + ...(enableFunkwhaleEndpoint ? ["@rmdes/indiekit-endpoint-funkwhale"] : []), + ...(enableLastfmEndpoint ? ["@rmdes/indiekit-endpoint-lastfm"] : []), //"@rmdes/indiekit-endpoint-activitypub", ], "@indiekit/store-github": { @@ -140,6 +151,17 @@ export default { "@rmdes/indiekit-endpoint-conversations": { mountPath: "/conversations", }, + "@rmdes/indiekit-endpoint-funkwhale": { + mountPath: "/funkwhale", + instanceUrl: funkwhaleInstance, + username: funkwhaleUsername, + token: funkwhaleToken, + }, + "@rmdes/indiekit-endpoint-lastfm": { + mountPath: "/lastfmapi", + apiKey: lastfmApiKey, + username: lastfmUsername, + }, "@rmdes/indiekit-endpoint-activitypub": { username: "blog.giersig.eu", }, diff --git a/package-lock.json b/package-lock.json index 64ef41f4..8e36654e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,9 @@ "@indiekit/indiekit": "^1.0.0-beta.25", "@indiekit/store-github": "^1.0.0-beta.25", "@rmdes/indiekit-endpoint-conversations": "^2.1.6", + "@rmdes/indiekit-endpoint-funkwhale": "^1.0.11", "@rmdes/indiekit-endpoint-github": "^1.2.3", + "@rmdes/indiekit-endpoint-lastfm": "^1.0.12", "@rmdes/indiekit-endpoint-posts": "^1.0.0-beta.25", "@rmdes/indiekit-endpoint-webmention-io": "^1.0.7", "@rmdes/indiekit-post-type-page": "^1.0.4", @@ -1784,6 +1786,22 @@ "node": ">=20" } }, + "node_modules/@rmdes/indiekit-endpoint-funkwhale": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@rmdes/indiekit-endpoint-funkwhale/-/indiekit-endpoint-funkwhale-1.0.11.tgz", + "integrity": "sha512-AbPobqh5P/2SG8l+fJ4IGJmelGr0u0lfNsNHOxkOfhEckC5iIELssj/1e/E+eW42y58StpzsdQ+xqPIT5ur9PA==", + "license": "MIT", + "dependencies": { + "@indiekit/error": "^1.0.0-beta.25", + "express": "^5.0.0" + }, + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "@indiekit/indiekit": ">=1.0.0-beta.25" + } + }, "node_modules/@rmdes/indiekit-endpoint-github": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/@rmdes/indiekit-endpoint-github/-/indiekit-endpoint-github-1.2.3.tgz", @@ -1800,6 +1818,22 @@ "@indiekit/indiekit": ">=1.0.0-beta.25" } }, + "node_modules/@rmdes/indiekit-endpoint-lastfm": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@rmdes/indiekit-endpoint-lastfm/-/indiekit-endpoint-lastfm-1.0.12.tgz", + "integrity": "sha512-emR3teALxLqj7o3wpxeF6zvTiahf6+Fi0qUblytuV9tZ1W0NOKUKGh8Tf5aeC0Gzt6+XJBS2JLP6AHAlTiW5Mg==", + "license": "MIT", + "dependencies": { + "@indiekit/error": "^1.0.0-beta.25", + "express": "^5.0.0" + }, + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "@indiekit/indiekit": ">=1.0.0-beta.25" + } + }, "node_modules/@rmdes/indiekit-endpoint-posts": { "version": "1.0.0-beta.25", "resolved": "https://registry.npmjs.org/@rmdes/indiekit-endpoint-posts/-/indiekit-endpoint-posts-1.0.0-beta.25.tgz", @@ -5556,6 +5590,7 @@ "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz", "integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==", "license": "MIT", + "peer": true, "dependencies": { "ip-address": "^10.0.1", "smart-buffer": "^4.2.0" diff --git a/package.json b/package.json index 63c31c3a..75e341df 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,9 @@ "@indiekit/indiekit": "^1.0.0-beta.25", "@indiekit/store-github": "^1.0.0-beta.25", "@rmdes/indiekit-endpoint-conversations": "^2.1.6", + "@rmdes/indiekit-endpoint-funkwhale": "^1.0.11", "@rmdes/indiekit-endpoint-github": "^1.2.3", + "@rmdes/indiekit-endpoint-lastfm": "^1.0.12", "@rmdes/indiekit-endpoint-posts": "^1.0.0-beta.25", "@rmdes/indiekit-endpoint-webmention-io": "^1.0.7", "@rmdes/indiekit-post-type-page": "^1.0.4",