fixed port input validation
This commit is contained in:
11
webui.py
11
webui.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user