z2k/webpanel
Necronicle 1133af483e
Some checks failed
CI / ShellCheck (push) Has been cancelled
CI / Go Build & Test (push) Has been cancelled
CI / Luacheck (push) Has been cancelled
webpanel: defend against empty config values breaking JSON
Two defenses for the same class of bug:

1. read_flag now falls back to the default when the matched line has an
   empty value (e.g. `ROBLOX_UDP_BYPASS=` with nothing after the equals
   sign). Previously only an entirely missing key triggered the default;
   a present-but-empty key propagated as "". Combined with the next fix
   the API now stays consistent regardless of how the config got into
   that state.

2. JSON template in the /status handler quotes toggle values
   (`"key":"%s"` instead of `"key":%s`). Without quotes an empty %s
   collapses to `:,` mid-object and breaks JSON.parse on the frontend.
   With quotes the worst case is `""` which parses fine. Frontend
   already compares with `=== "1"` so it expects strings anyway —
   this also makes the kind=good/warn highlight actually work
   (previously `0 === "1"` was always false).

Reported by Алексей @Guf3477452 2026-04-18 after a reinstall: webpanel
crashed on `Unexpected token ',', ..."ame_mode":,"customd"...`. Same
shape as the 2026-04-15 bug fixed on z2k-enhanced — backport.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 16:27:10 +03:00
..
cgi webpanel: defend against empty config values breaking JSON 2026-04-18 16:27:10 +03:00
init.d webpanel: functional rewrite, LAN-only, menu [P] install 2026-04-13 22:24:14 +03:00
www webpanel: add Credits tab with tester + sponsor recognition 2026-04-14 00:05:24 +03:00
install.sh webpanel: neutralize default Entware lighttpd init on install 2026-04-18 15:09:19 +03:00
lighttpd.conf webpanel: functional rewrite, LAN-only, menu [P] install 2026-04-13 22:24:14 +03:00
uninstall.sh webpanel: functional rewrite, LAN-only, menu [P] install 2026-04-13 22:24:14 +03:00