diff --git a/WebHostLib/__init__.py b/WebHostLib/__init__.py index 11a9619a7e..9ef642c4d6 100644 --- a/WebHostLib/__init__.py +++ b/WebHostLib/__init__.py @@ -41,13 +41,7 @@ app.config["SELFLAUNCH"] = True # application process is in charge of launching app.config["SELFLAUNCHCERT"] = None # can point to a SSL Certificate to encrypt Room websocket connections app.config["SELFLAUNCHKEY"] = None # can point to a SSL Certificate Key to encrypt Room websocket connections app.config["SELFGEN"] = True # application process is in charge of scheduling Generations. -app.config["DEBUG"] = False -app.config["PORT"] = 80 app.config["GAME_PORTS"] = ["49152-65535", 0] -app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER -app.config['MAX_CONTENT_LENGTH'] = 64 * 1024 * 1024 # 64 megabyte limit -# if you want to deploy, make sure you have a non-guessable secret key -app.config["SECRET_KEY"] = bytes(socket.gethostname(), encoding="utf-8") # at what amount of worlds should scheduling be used, instead of rolling in the web-thread app.config["JOB_THRESHOLD"] = 1 # after what time in seconds should generation be aborted, freeing the queue slot. Can be set to None to disable. diff --git a/WebHostLib/customserver.py b/WebHostLib/customserver.py index 45f6ac4ba9..99d86da3a4 100644 --- a/WebHostLib/customserver.py +++ b/WebHostLib/customserver.py @@ -184,12 +184,12 @@ class WebHostContext(Context): return d -def get_random_port(game_ports: list, host): +def get_random_port(game_ports: list[str | int], host: str): available_ports = [] ephemeral_allowed = False for item in game_ports: - if type(item) is str and '-' in item: - start, end = map(int, item.split('-')) + if isinstance(item, str) and "-" in item: + start, end = map(int, item.split("-")) available_ports.append(range(start, end+1)) elif int(item) == 0: ephemeral_allowed = True