fixed port input validation

This commit is contained in:
2026-06-01 13:48:36 +02:00
parent 6ca35c12e2
commit 29df7b2a53

View File

@@ -48,14 +48,15 @@ def creator_page():
).value
# Port
load_dotenv()
port_min = os.getenv("PORT_MIN")
port_max = os.getenv("PORT_MAX")
port_min = int(os.getenv("PORT_MIN", 1024))
port_max = int(os.getenv("PORT_MAX", 65535))
port = ui.input(
label="Port",
validation={
f"Port must be between {str(port_min)} and {str(port_max)}": lambda value: port_min
<= value
<= port_max
f"Port must be between {str(port_min)} and {str(port_max)}": lambda value: value.isdigit()
and port_min <= int(value) <= port_max,
"Port in use": lambda value: value.isdigit()
and not servermanager.is_port_in_use(int(value)),
},
)
# Era