feat(hud): load a HUD bundle the panel imported - #37
Open
LCrew wants to merge 1 commit into
Open
Conversation
… one
The overlay has always been opened against hudId "default" -- the one bundle
inside the image. HUD_MODE was never a second HUD, only a `?variant=` layout of
that one, which is why hudModeHandler had to warn against sending it as a hudId.
The panel now keeps a HUD library, so the pod has to be able to load a bundle it
did not ship with. It fetches the archive and hands it to JTs Hud Manager's own
POST /api/huds/upload-zip rather than unpacking anything: that endpoint is what
creates ~/jthm-huds/<id>, and it is also what verifies a signed bundle against
the key beside its hud.json.
The installed id is read back out of the response instead of assumed, because
JTHud derives it itself -- from the top-level folder when hud.json sits one level
deep, otherwise from the posted filename. Guessing wrong opens the overlay on an
id with nothing behind it, which renders a blank window and logs nothing.
The app is deliberately not given HUD_ID: it boots before the install can run,
so at app-ready the builtin is the only id that exists. install_custom_hud
performs the switch itself once the bundle is in, which also means an imported
HUD works on a pod that never seeds match data.
An imported bundle declares its own layouts, or none, so an empty HUD_VARIANT
means "whatever this bundle opens with" -- distinct from "not set at all", hence
`${HUD_VARIANT+isset}` rather than the `:=` default form, and `??` rather than
`||` in the spec-server. HUD_MODE stays the legacy input and is what an unset
HUD_VARIANT falls back to, so a pod booted by an older api is unaffected.
Every failure path falls back to the bundled HUD. A stream with the stock HUD is
a much better outcome than a stream with none, and the operator can still switch
at runtime once the cause is fixed.
Depends on the api change that stamps HUD_ID / HUD_BUNDLE_URL onto the pod.
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.
The overlay has always been opened against hudId "default" -- the one bundle inside the image. HUD_MODE was never a second HUD, only a
?variant=layout of that one, which is why hudModeHandler had to warn against sending it as a hudId.The panel now keeps a HUD library, so the pod has to be able to load a bundle it did not ship with. It fetches the archive and hands it to JTs Hud Manager's own POST /api/huds/upload-zip rather than unpacking anything: that endpoint is what creates ~/jthm-huds/, and it is also what verifies a signed bundle against the key beside its hud.json.
The installed id is read back out of the response instead of assumed, because JTHud derives it itself -- from the top-level folder when hud.json sits one level deep, otherwise from the posted filename. Guessing wrong opens the overlay on an id with nothing behind it, which renders a blank window and logs nothing.
The app is deliberately not given HUD_ID: it boots before the install can run, so at app-ready the builtin is the only id that exists. install_custom_hud performs the switch itself once the bundle is in, which also means an imported HUD works on a pod that never seeds match data.
An imported bundle declares its own layouts, or none, so an empty HUD_VARIANT means "whatever this bundle opens with" -- distinct from "not set at all", hence
${HUD_VARIANT+isset}rather than the:=default form, and??rather than||in the spec-server. HUD_MODE stays the legacy input and is what an unset HUD_VARIANT falls back to, so a pod booted by an older api is unaffected.Every failure path falls back to the bundled HUD. A stream with the stock HUD is a much better outcome than a stream with none, and the operator can still switch at runtime once the cause is fixed.
Depends on the api change that stamps HUD_ID / HUD_BUNDLE_URL onto the pod.