Skip to content

Commit

Permalink
OpenID HTTPS redirect fix (#91)
Browse files Browse the repository at this point in the history
Co-authored-by: megascatterbomb <[email protected]>
  • Loading branch information
megascatterbomb and megascatterbomb authored Oct 8, 2024
1 parent c32dc9c commit a99809c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions masterbase/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit a99809c

Please sign in to comment.