diff --git a/rcongui/src/pages/settings/autosettings/index.jsx b/rcongui/src/pages/settings/autosettings/index.jsx index e0cc92e64..fe333217f 100644 --- a/rcongui/src/pages/settings/autosettings/index.jsx +++ b/rcongui/src/pages/settings/autosettings/index.jsx @@ -76,11 +76,11 @@ const Autosettings = () => { const submit = useSubmit(); const theme = useTheme(); - const handleApplyClick = (intent) => (e) => { + const handleApplyClick = (intent) => () => { setSubmitting(true); const formData = new FormData(); formData.append("intent", intent); - formData.append("forward", intent === INTENT.APPLY_ALL); + formData.append("forward", intent === INTENT.APPLY_ALL ? "true" : "false"); formData.append("settings", editorContent); submit(formData, {method: "post"}); }; diff --git a/rconweb/api/auto_settings.py b/rconweb/api/auto_settings.py index 412d2bf55..f27cc4c77 100644 --- a/rconweb/api/auto_settings.py +++ b/rconweb/api/auto_settings.py @@ -70,6 +70,12 @@ def set_auto_settings(request): return api_response(error="Invalid server number", failed=True, status_code=400) do_restart_service = data.get("restart_service", True) do_forward = data.get("forward", False) + if do_forward == "false" or do_forward == "0": + do_forward = False + if do_forward == "true" or do_forward == "1": + do_forward = True + if not isinstance(do_forward, bool): + return api_response(error="forward needs to be a boolean value or empty", failed=True, status_code=400) settings = data.get("settings") if not settings: