control: settings save no longer wipes unsent config fields#18
Merged
Conversation
handleSetSettings decoded the POST body into a fresh zero-valued config.Config and persisted it wholesale, so any field the settings form does not send was silently reset. A user with a preload list lost it on any unrelated settings change, and app.js hardcoding advertise:true re-enabled LAN advertising on every save (with no way to turn it off from the panel). Decode into a copy of the CURRENT config instead, so omitted fields keep their value; drop the hardcoded advertise from the form body so it is preserved rather than forced on. The api_key/hf_token redacted-placeholder handling is unchanged. Test posts a realistic form body and asserts Preload and Advertise survive while the sent field applies. Assisted-by: Claude:claude-fable-5
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.
Found by a WebUI-consistency review pass — the highest-severity of the batch.
handleSetSettingsdecoded the settings POST body into a fresh zero-valuedconfig.Configand persisted it wholesale viaSetConfig. Any field thesettings form doesn't send was therefore silently reset:
preload: [...]lost their warm-load list on any unrelatedsettings change (e.g. bumping the idle timeout).
app.jshardcodedadvertise: truein the body, so every save re-enabled LANadvertising — with no UI control to turn it back off.
Fix: decode into a copy of the current config, so fields the form omits keep
their existing value; drop the hardcoded
advertisefrom the form body so it'spreserved rather than forced on. The
api_key/hf_tokenredacted-placeholderhandling is unchanged.
Test posts a realistic form body (host/port/idle/etc, no advertise/preload) and
asserts
PreloadandAdvertisesurvive while the sent field applies — it failsagainst the old code (Preload wiped) and passes with the fix.
More findings from the same review (download integrity, UI loading/cancel states)
are coming as separate PRs.
Assisted-by: Claude:claude-fable-5