fix(patches): update repost-commentary patch to detect native fork implementation

Fix D's old snippet (the bare `} else {` content block) still matched after
the fork absorbed the repost-commentary changes natively, causing a duplicate
`} else if (postType === "repost") {` block to be inserted on every deploy
and preventing startup. Added NATIVE_MARKER check for the fork's own repost
branch so the patch skips cleanly when the changes are already present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Sven
2026-03-22 20:13:48 +01:00
parent c230feff7f
commit dc850c350f

View File

@@ -34,6 +34,8 @@ const candidates = [
];
const MARKER = "// repost-commentary fix";
// Also present when the fork has this change baked in natively (no comment marker needed)
const NATIVE_MARKER = '} else if (postType === "repost") {';
// ---------------------------------------------------------------------------
// Fix A jf2ToActivityStreams(): add commentary variable before the return
@@ -123,7 +125,7 @@ for (const filePath of candidates) {
checked += 1;
let source = await readFile(filePath, "utf8");
if (source.includes(MARKER)) {
if (source.includes(MARKER) || source.includes(NATIVE_MARKER)) {
console.log(`[postinstall] patch-ap-repost-commentary: already applied to ${filePath}`);
continue;
}