Skip to content

Fix inline transcript script parse errors killing all UI features - #1

Merged
kaarude merged 1 commit into
mainfrom
fix/transcript-inline-script-parse-error
Sep 4, 2026
Merged

kaarude merged 1 commit into
mainfrom
fix/transcript-inline-script-parse-error

Conversation

@kaarude

@kaarude kaarude commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Problem

On rendered transcript pages, the theme toggle, download menu, and all other interactive features did nothing when clicked.

Root cause

The embedded transcript.js had two syntax errors that discarded the entire inline <script> block at parse time, so no event listeners were ever attached:

  1. A regex literal used double-escaped forward slashes: /^(?:https:\\\/\\/|\\/)/. In regex syntax \\ matches a literal backslash, so the following / terminated the regex early → Invalid regular expression flags.
  2. The wrapping IIFE opened with (function () { but was never closed with })();.

Fix

  • Correct the regex to /^(?:https:\/|\/)/
  • Close the IIFE
  • Bump RendererVersion 10 → 11 so the existing startup migration (RefreshStoredHTML) re-renders already-stored transcript bundles from their saved transcript.json — no Discord credentials needed
  • Add TestEmbeddedScriptIsWellFormed regression test (no \\/ sequences, IIFE open/close, balanced braces)

Verification

  • node --check internal/render/transcript.js passes
  • go build ./... && go test ./internal/... all pass
  • Ran the server locally: startup log showed refreshed:1, and the stored bundle's index.html now contains neither bug; registry records version 11

Two syntax errors in the embedded transcript.js caused the entire
inline script to be discarded at parse time, disabling the theme
toggle, download menu, spoilers, profile cards, and lightbox:

- Regex literal used double-escaped forward slashes (\\/), which
  terminated the regex early and produced invalid flags
- The wrapping IIFE was never closed with })();

Bump RendererVersion to 11 so RefreshStoredHTML re-renders stored
bundles from their saved transcript.json on next startup.

Add TestEmbeddedScriptIsWellFormed to pin the structural checks.
@kaarude
kaarude merged commit 07f1035 into main Sep 4, 2026
1 check passed
@kaarude
kaarude deleted the fix/transcript-inline-script-parse-error branch September 4, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant