The build page says a damaged link is damaged, and how to bring its source
Merged
AL
2h ago+62+62+01234567890123456789-6-6-0123456789
Closes #38.
For a link whose source cannot be read, the build page now says the link arrived damaged and shows what to do, above the source box. Before this, it said the link carried an activity, over an empty box, and put the only message under Build, out of sight.
What changes
- The hero: "The link you opened arrived damaged, so the activity in it cannot be read" replaces "The link you opened carries an activity an AI chat wrote". It stays for the visit, since that link carried nothing whatever comes after.
- Step 1: a message above the box gives the three ways on: ask the chat for the link again, open the
.source.jsonfile it gave (a button opens the file picker), or paste the source. "The link carried it here" is hidden. The step's marker turns red, as for a source that is not JSON. - Once a source arrives by file or paste, the message goes, the step turns done, and Build works as before. The page's address then carries that source, so a reload is an ordinary link.
- The technical reason ("not base64url", "neither JSON nor deflated JSON") goes to the console instead of the status under Build.
- Unchanged: a link that can be read, a link whose source names files, and the landing page with no link.
Files: src/h5p/build/index.njk, src/h5p/build/build-page.ts, and one rule in src/assets/site.css (a class unread on <html>, beside linked).
Tested
pnpm install --frozen-lockfile,pnpm typecheckandpnpm buildpass.- A Playwright script, kept outside the repo since the site has no e2e tests, ran 34 checks in Chromium against the built site. All 34 pass with this change. Against the live site, the same script fails 18 of them.
- Three damaged links: ChatGPT's real one, a good link cut short, and random bytes.
- On a 1280 × 800 window, the message sits at 456–552 px, on the first screen. On a 390 × 844 phone it starts at 502 px, with the button at 614 px.
- Opening ChatGPT's
.source.jsonfrom the damaged state built and played the quiz. The address then carried that source exactly, and a reload behaved as an ordinary link. - Typing a source into the box also removes the message.
- A good link still builds at once. Changing the address from good to damaged and back switches the page both ways.
- A source that names files still asks for them, and the landing page is unchanged.
- Not run: Firefox and WebKit, whose Playwright browsers are not installed here.
Summary by cubic
Fixes the build page so a link whose source cannot be read now says the link arrived damaged and shows how to bring the source, instead of claiming it carried an activity over an empty box.
- The hero and the source step say the link is damaged and give three ways in: ask the chat for the link again, open the
.source.jsonfile it gave, or paste the source. - The message stays until a source arrives by file or paste, after which the step turns done, Build works as before, and the page address carries that source.
- The technical reason moves from the status under Build to the console.
- Readable links, links whose source names files, and the landing page with no link are unchanged.
Closes #38.