From ae583a8e35af59817396582d722796951e3aa173 Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Mon, 9 Mar 2026 19:51:57 +0100 Subject: [PATCH] Require token for Funkwhale scope=me sync --- ...atch-listening-endpoint-runtime-guards.mjs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/patch-listening-endpoint-runtime-guards.mjs b/scripts/patch-listening-endpoint-runtime-guards.mjs index c5d30596..8d3e9c4c 100644 --- a/scripts/patch-listening-endpoint-runtime-guards.mjs +++ b/scripts/patch-listening-endpoint-runtime-guards.mjs @@ -10,6 +10,20 @@ const patchSpecs = [ scope: "all", });`, newSnippet: ` return this.fetch("/api/v2/history/listenings", { + page, + page_size: pageSize, + // prefer user-scoped history to avoid instance-wide sync volume + scope: this.username && this.token ? "me" : "all", + });`, + candidates: [ + "node_modules/@rmdes/indiekit-endpoint-funkwhale/lib/funkwhale-client.js", + "node_modules/@indiekit/indiekit/node_modules/@rmdes/indiekit-endpoint-funkwhale/lib/funkwhale-client.js", + ], + }, + { + name: "funkwhale-client-scope-me-token-guard", + marker: "require token for user-scoped history", + oldSnippet: ` return this.fetch("/api/v2/history/listenings", { page, page_size: pageSize, // prefer user-scoped history to avoid instance-wide sync volume @@ -19,6 +33,13 @@ const patchSpecs = [ "node_modules/@rmdes/indiekit-endpoint-funkwhale/lib/funkwhale-client.js", "node_modules/@indiekit/indiekit/node_modules/@rmdes/indiekit-endpoint-funkwhale/lib/funkwhale-client.js", ], + newSnippet: ` return this.fetch("/api/v2/history/listenings", { + page, + page_size: pageSize, + // prefer user-scoped history to avoid instance-wide sync volume + // require token for user-scoped history + scope: this.username && this.token ? "me" : "all", + });`, }, { name: "lastfm-invalid-json-guard",