Repository navigation
Build page: read a source written into the link as readable JSON - #54
Merged
Merged
Conversation
…e it breaks, for the chat to fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #53.
The build page now also reads a source written straight into its link as JSON,
#source={…}. A chat with no code tool can then write the link itself, since a model can write its own JSON but cannot compress it. The skill's side is missing-elements/h5p-toolkit#207, which should merge once this is live.What changes
All in
sourceFromFragment(src/h5p/build/build-source.ts):source=whose value starts with{or%7Bis JSON. The value runs to the end of the fragment, since JSON text holds&and+, whichURLSearchParamswould split on or turn into spaces. Base64url never holds{or%, so the two forms cannot be mistaken.%that starts no escape stays a%.}., is read up to its last}.}out of a True/False. What is closed is only where the source ends, and the build still checks every field.#source=<base64url>links the skill's commands print, thelinkedclass, which already checks forsource, and the compressed form the page writes back as the person edits.Tested
pnpm build, which type-checks, passes. Then the built site, served byvite preview, opened eleven kinds of link in Chromium, Firefox and WebKit (Playwright 1.64). Each link was first rendered from[Build and play it](…)by markdown-it, as a chat shows one, and the page was opened at thehrefthat came out. 33 of 33 did what they should:<p>,&,+,",°C, a backslash%left bare, "50% off".after the closing}encodeURIComponentwrites it}left outphoto.jpgThe skill's Haiku runs in h5p-offline-player#207 decode their links with this code: 12 of 12 built and passed with its final text.
Not tested: how ChatGPT's renderer treats such a link, and how long a link it keeps clickable. That is the owner's run once both are live.
Summary by cubic
The build page now reads a source written directly into a link as readable JSON (
#source={…}), so a chat with no code tool can write a working link itself — a model can write JSON but cannot compress it.&and+thatURLSearchParamswould split on or turn into spaces.%not starting a valid escape) as written, so a model that missed one still gets its source.}.) is read up to its last}.#source=<base64url>links, thelinkedclass, and the compressed form written back on edit are unchanged; the two forms cannot be confused since base64url never holds{or%.Written for commit 2b26f89. Summary will update on new commits.