Repository navigation
Commit 9d0a2fb
authored
fix: load subsection sub-option defaults (#944)
fix(presets/newznab): set appropriate fallbacks for singleIp and showUnknown options
The Single-IP Mode toggle in Newznab's Zyclops health proxy subsection
has default: true. The boolean renderer falls back to the schema default
at display time (template-option.tsx:335), so the toggle correctly reads
ON when localValue is undefined. But the subsection modal seeds
localValue from the saved object only — sub-option defaults are never
merged in — so a user who never explicitly toggles the field saves
zyclopsHealthProxy without singleIp, and downstream the addon coerces
undefined → '0'.
Result for affected users: outbound proxy requests include single_ip=0
while the UI shows Single-IP Mode enabled. For an indexer-fronting
proxy where each request hits the upstream indexer from the user's
own IP, this is the difference between TOS-compliant and ban-risking
traffic.
Fix is in two parts:
1. Newznab preset (generateAddons): apply the schema defaults
(singleIp ?? true, showUnknown ?? false) so existing user configs
missing the field — saved before this fix, or saved without
toggling — are corrected on next manifest generation. No user
resave required. This pattern is already used in other presets
(meteor.ts, flixStreams.ts).
2. TemplateOption subsection: seed the modal's localValue with
sub-option defaults merged under the saved value. This prevents
the same class of bug recurring for any future subsection that
defines a `default: true` (or any non-undefined default) field.
Saved values still win — only undefined sub-options pick up
defaults.1 parent 1c142de commit 9d0a2fb
2 files changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
409 | | - | |
| 408 | + | |
| 409 | + | |
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
569 | | - | |
| 569 | + | |
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
573 | 580 | | |
574 | 581 | | |
575 | 582 | | |
| |||
0 commit comments