From 630edf2b77fda8aa5a586c5568a142d295b98a36 Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Fri, 13 Mar 2026 07:56:41 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20drop=20compose.js=20docloader=20patch=20?= =?UTF-8?q?=E2=80=94=20now=20in=20fork?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit createPublicationAwareDocumentLoader and rawDocumentLoader wrapping are built into the fork's compose.js; the patch was re-injecting the function and causing a duplicate-declaration SyntaxError at startup. Co-Authored-By: Claude Sonnet 4.6 --- ...oint-activitypub-private-url-docloader.mjs | 71 +------------------ 1 file changed, 2 insertions(+), 69 deletions(-) diff --git a/scripts/patch-endpoint-activitypub-private-url-docloader.mjs b/scripts/patch-endpoint-activitypub-private-url-docloader.mjs index 4b731017..db56d554 100644 --- a/scripts/patch-endpoint-activitypub-private-url-docloader.mjs +++ b/scripts/patch-endpoint-activitypub-private-url-docloader.mjs @@ -1,75 +1,8 @@ import { access, readFile, writeFile } from "node:fs/promises"; const patchSpecs = [ - { - name: "activitypub-compose-publication-private-docloader", - candidates: [ - "node_modules/@rmdes/indiekit-endpoint-activitypub/lib/controllers/compose.js", - "node_modules/@indiekit/indiekit/node_modules/@rmdes/indiekit-endpoint-activitypub/lib/controllers/compose.js", - ], - replacements: [ - { - oldSnippet: [ - "import { getToken, validateToken } from \"../csrf.js\";", - "import { sanitizeContent } from \"../timeline-store.js\";", - ].join("\n"), - newSnippet: [ - "import { getToken, validateToken } from \"../csrf.js\";", - "import { sanitizeContent } from \"../timeline-store.js\";", - "", - "function createPublicationAwareDocumentLoader(documentLoader, publicationUrl) {", - " if (typeof documentLoader !== \"function\") {", - " return documentLoader;", - " }", - "", - " let publicationHost = \"\";", - " try {", - " publicationHost = new URL(publicationUrl).hostname;", - " } catch {", - " return documentLoader;", - " }", - "", - " return (url, options = {}) => {", - " try {", - " const parsed = new URL(", - " typeof url === \"string\" ? url : (url?.href || String(url)),", - " );", - " if (parsed.hostname === publicationHost) {", - " return documentLoader(url, { ...options, allowPrivateAddress: true });", - " }", - " } catch {", - " // Fall through to default loader behavior.", - " }", - "", - " return documentLoader(url, options);", - " };", - "}", - ].join("\n"), - }, - { - oldSnippet: [ - " const documentLoader = await ctx.getDocumentLoader({", - " identifier: handle,", - " });", - " const remoteObject = await ctx.lookupObject(new URL(replyTo), {", - " documentLoader,", - " });", - ].join("\n"), - newSnippet: [ - " const rawDocumentLoader = await ctx.getDocumentLoader({", - " identifier: handle,", - " });", - " const documentLoader = createPublicationAwareDocumentLoader(", - " rawDocumentLoader,", - " plugin._publicationUrl,", - " );", - " const remoteObject = await ctx.lookupObject(new URL(replyTo), {", - " documentLoader,", - " });", - ].join("\n"), - }, - ], - }, + // compose.js: createPublicationAwareDocumentLoader and rawDocumentLoader wrapping + // are now built into the fork — no patch needed. { name: "activitypub-resolve-author-publication-private-docloader", candidates: [