feat(radioHardware): save through update_radio_hardware_config - #92
Draft
npdgm wants to merge 1 commit into
Draft
Conversation
The Radio Hardware tab saved through ApiService.importConfig →
/api/config_import. That endpoint is auth-exempt for first-run restore
and never sees an authenticated user, so on a configured node every save
returned 403 "Unauthorized restore" — masked as "Unknown error occurred"
because handleError only understood axios errors, not the HttpResponse
objects thrown by the generated fetch client.
* Save through the new authenticated /api/update_radio_hardware_config
(generated client refreshed from the repeater openapi.yaml). With a
board preset selected the payload is {hardware_key, overrides}: the
backend applies the full preset — including fields this form has no
widgets for (use_dio3_tcxo, use_dio2_rf, gpio backend, ...), which
were silently dropped before — and the visible form fields ride along
as overrides (values equal to the preset are no-ops, deliberate edits
win). Without a preset the payload stays {radio_type, <section>}
(manual mode).
* applyBoardPreset() resets fields absent from the preset to neutral
defaults instead of keeping the previous board's values, so the form
always reads "preset + deliberate edits".
* New read-only "Preset-managed settings" block listing every preset
field without an editable widget — server-applied values become
visible, and a preset field added upstream shows up automatically
with no UI change. The note warns that presets defining tx_power /
preamble_length override those Radio Settings values on save.
* handleError() surfaces the server's error message from non-2xx
responses thrown by the generated client instead of the generic
"Unknown error occurred".
Requires the repeater branch adding /api/update_radio_hardware_config.
Signed-off-by: Thibault VINCENT <root@devcat.org>
3 tasks
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.
Problem
The Radio Hardware tab saves through
ApiService.importConfig→/api/config_import. That endpoint is auth-exempt for first-run restore and never sees an authenticated user, so on a configured node every save returns 403 "Unauthorized restore" — masked as "Unknown error occurred" becausehandleErroronly understands axios errors, not theHttpResponseobjects thrown by the generated fetch client (src/generated/openapi.ts:if (!response.ok) throw data).The tab also only sent the form's visible pin fields: preset fields without widgets (
use_dio3_tcxo,use_dio2_rf,gpio_chip, ...) were silently dropped — a Station G3 configured from the tab would lose its TCXO settings.Change
POST /api/update_radio_hardware_config(generated client refreshed from the repeateropenapi.yamlvianpm run api:generate). With a board preset selected the payload is{hardware_key, overrides}: the backend applies the full preset — hidden fields included — and the visible form fields ride along as overrides (values equal to the preset are no-ops, deliberate edits win). Without a preset the payload stays{radio_type, <section>}(manual mode).applyBoardPreset()resets fields absent from the preset to neutral defaults instead of keeping the previous board's values, so the form always reads "preset + deliberate edits" and a staletxen_pincan't leak into the new board.tx_power/preamble_lengthoverride those Radio Settings values on save.handleError()fix: surfaces the server's error message from non-2xx responses thrown by the generated client (body in.error), instead of the generic "Unknown error occurred". This benefits every generated-client call, not just this tab. Note this changes user-visible error strings globally (e.g. 401s now read "Unauthorized - Valid JWT or API token required").Depends on
Backend PR adding the endpoint: openhop-dev/openhop_repeater#384
Test plan
npm run type-checkcleaneslint— zero new findings (9 pre-existingno-explicit-anyon untouched lines, present ondev)vitest— 200 passed, 1 pre-existing failure ondev(nav styles, unrelated)npm run api:generateoutput committed (api:check stays green against the backend branch)