Fix checkbox config values always returning "1" in Test config#1577
Merged
Conversation
Checkbox-type config options (e.g. ignore_tls) always tested as "1"
regardless of the checkbox state. The Test-button config gatherer used
$(this).val() for every .config-item, and jQuery .val() on a checkbox
returns its value attribute ("1") regardless of checked state. App
config blades pair a hidden input (0) with a checkbox (1) sharing the
same data-config, and the checkbox is last in DOM order, so it always
overwrote the value with "1". Normal form saves were unaffected.
Use the :checked state for checkboxes so unchecking now tests as "0".
Also rebuilds the committed compiled bundle (public/js/app.js) so the
fix takes effect at runtime; the edit is byte-identical to the Laravel
Mix development build output for this block.
Fixes linuxserver/Heimdall-Apps#782
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.
Revives #1536 (closed as stale, original work by @jaycollett — his commit authorship is preserved). Fixes linuxserver/Heimdall-Apps#782.
The Test-button config gatherer wrote
$(this).val()for every.config-item; jQuery.val()on a checkbox returns its value attribute regardless of checked state, and app config blades pair a hidden input (0) with a checkbox (1) sharing the samedata-config, so options likeignore_tlsalways tested as "1". Checkboxes now report their checked state ("1"/"0"). Normal form saves were never affected — only the Test path.Beyond the original PR: Heimdall serves the committed compiled bundle
public/js/app.js, which #1536 didn't touch, so it would have had no runtime effect until a rebuild. This PR mirrors the fix there; the edit is byte-identical to whatnpm run developmentemits for that block (a full rebuild was avoided because dependency drift churns ~1200 unrelated lines).Verified with jsdom + the repo's bundled jQuery against a real hidden+checkbox blade pairing: old code returns "1" checked and unchecked; fixed code returns "1"/"0". ESLint passes.