Apply suggestions from code review

Co-authored-by: Duck <31627079+duckboycool@users.noreply.github.com>
This commit is contained in:
Uriel
2026-03-05 15:51:09 -03:00
committed by GitHub
parent 08a6ee2b3a
commit 61f893437a
2 changed files with 3 additions and 9 deletions

View File

@@ -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.

View File

@@ -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