FIX-CFG-01: Unchecked checkbox → False (statt Wert beibehalten)

Bug: Wenn ein User eine Bool-Checkbox unchecked ließ, sendete der
Browser das Form-Field gar nicht. /api/plugin_config und /plugins/<idx>
machten 'continue' und überschrieben den alten True-Wert nie.

Fix: Bei ftype=bool und form_val=None explizit new_cfg[key] = False setzen.

Betrifft z.B. clock_wordclock.show_date/show_weekday/show_es_ist.
This commit is contained in:
hermes
2026-08-29 18:35:24 +04:00
parent d71b17d5c9
commit 8f3480ee2e
+8 -2
View File
@@ -197,7 +197,10 @@ def save_plugin_config(idx):
new_cfg[key] = form_val new_cfg[key] = form_val
continue continue
if form_val is None: if form_val is None:
continue if ftype == "bool":
new_cfg[key] = False
else:
continue
try: try:
if ftype == "int": if ftype == "int":
new_cfg[key] = int(form_val) new_cfg[key] = int(form_val)
@@ -476,7 +479,10 @@ def api_plugin_config(plugin_name):
form_val = request.form.get(f"config_{key}") form_val = request.form.get(f"config_{key}")
ftype = field.get("type", "string") ftype = field.get("type", "string")
if form_val is None: if form_val is None:
continue if ftype == "bool":
new_cfg[key] = False # unchecked checkbox → False
else:
continue
if ftype == "secret": if ftype == "secret":
# Nur überschreiben wenn nicht leer # Nur überschreiben wenn nicht leer
existing = cfg.get("plugin_configs", {}).get(plugin_name, {}).get(key, "") existing = cfg.get("plugin_configs", {}).get(plugin_name, {}).get(key, "")