Repository navigation
Fix the web client crashing on the TV's plain-HTTP origin - #7
Merged
Merged
Conversation
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.
Summary
The client served by the TV at
http://TV_IP:8090/went blank after the first send and needed a reload. Browsers only exposecrypto.randomUUIDandnavigator.clipboardon secure origins (HTTPS or localhost); the TV-served page is plain HTTP, so recording the send into history threwTypeError: crypto.randomUUID is not a functionand React unmounted the page. The GitHub Pages copy is HTTPS, which is why it never showed there.Changes
Generate ids without a secure context:newId()usescrypto.randomUUIDwhen available and otherwise builds a v4-shaped id fromcrypto.getRandomValues, with aMath.randomfallback. Used for history entries, presets and devices.Copy to the clipboard on plain HTTP pages:copyText()falls back to a hidden textarea andexecCommand('copy'), so "Copy as curl" and "Copy JSON" work on the TV-served copy.Show a crash screen instead of a blank page: an error boundary around the app renders the error and a Reload button if anything else ever throws.Note insecure-context shims in the client README.Testing
distserved on a fakehttp://192.168.1.50:8090origin in headless Chromium, one send, page errorcrypto.randomUUID is not a function, body empty.npm run build && npm run lintclean;./gradlew assembleDebugbundles the fixed client into the APK.Checklist
cd tv && ./gradlew testDebugUnitTest assembleDebugpasses (bundling verified; no Kotlin change)cd client && npm run lint && npm run buildpasses