fixed port input validation
This commit is contained in:
11
webui.py
11
webui.py
@@ -48,14 +48,15 @@ def creator_page():
|
|||||||
).value
|
).value
|
||||||
# Port
|
# Port
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
port_min = os.getenv("PORT_MIN")
|
port_min = int(os.getenv("PORT_MIN", 1024))
|
||||||
port_max = os.getenv("PORT_MAX")
|
port_max = int(os.getenv("PORT_MAX", 65535))
|
||||||
port = ui.input(
|
port = ui.input(
|
||||||
label="Port",
|
label="Port",
|
||||||
validation={
|
validation={
|
||||||
f"Port must be between {str(port_min)} and {str(port_max)}": lambda value: port_min
|
f"Port must be between {str(port_min)} and {str(port_max)}": lambda value: value.isdigit()
|
||||||
<= value
|
and port_min <= int(value) <= port_max,
|
||||||
<= port_max
|
"Port in use": lambda value: value.isdigit()
|
||||||
|
and not servermanager.is_port_in_use(int(value)),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
# Era
|
# Era
|
||||||
|
|||||||
Reference in New Issue
Block a user