Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenID HTTPS redirect fix #91

Merged
merged 6 commits into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions masterbase/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,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"
Comment on lines +87 to +89
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what with this custom port?

Copy link
Contributor Author

@megascatterbomb megascatterbomb Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is the port TF2 assumes if none is specified.

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 @@ -268,8 +270,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