diff --git a/masterbase/app.py b/masterbase/app.py index a7c642e..1959952 100644 --- a/masterbase/app.py +++ b/masterbase/app.py @@ -91,7 +91,9 @@ def session_id( steam_id = steam_id_from_api_key(engine, api_key) fake_ip = unquote(fake_ip) - if not fake_ip.startswith("169"): + if not fake_ip.startswith("169.254"): + if ":" not in fake_ip: + fake_ip = f"{fake_ip}:27015" to_resolve, port = fake_ip.split(":") fake_ip = f"{resolve_hostname(to_resolve)}:{port}" start_session_helper(engine, steam_id, str(_session_id), demo_name, fake_ip, map) @@ -277,8 +279,9 @@ def provision(request: Request) -> Redirect: """ # enforce https on base_url base_url = str(request.base_url) - if not base_url.startswith("https") and not os.environ["DEVELOPMENT"]: - base_url = base_url.replace("http", "https") + dev_mode = os.getenv('DEVELOPMENT', 'false') + proto = "http://" if dev_mode.lower() == 'true' else "https://" + base_url = proto + base_url.split("//")[-1] auth_params = { "openid.ns": "http://specs.openid.net/auth/2.0",