Skip to content

Commit

Permalink
??? somehow lost this???
Browse files Browse the repository at this point in the history
  • Loading branch information
jayceslesar committed Jun 2, 2024
1 parent 7a934ad commit b5747d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions masterbase/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
import os
from datetime import datetime, timezone
from urllib.parse import urlencode
from urllib.parse import unquote, urlencode

import requests
import uvicorn
Expand Down Expand Up @@ -81,8 +81,11 @@ def session_id(
_session_id = generate_uuid4_int()
engine = request.app.state.engine
steam_id = steam_id_from_api_key(engine, api_key)
to_resolve, port = fake_ip.split(":")
fake_ip = f"{resolve_hostname(fake_ip)}:{port}"

fake_ip = unquote(fake_ip)
if not fake_ip.startswith("169"):
to_resolve, port = fake_ip.split(":")
fake_ip = f"{resolve_hostname(fake_ip)}:{port}"
start_session_helper(engine, steam_id, str(_session_id), demo_name, fake_ip, map)

return {"session_id": _session_id}
Expand Down
4 changes: 3 additions & 1 deletion masterbase/guards.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Guards for the application."""

from urllib.parse import unquote

from litestar.connection import ASGIConnection
from litestar.exceptions import NotAuthorizedException, PermissionDeniedException
from litestar.handlers.base import BaseRouteHandler
Expand Down Expand Up @@ -85,7 +87,7 @@ async def valid_session_guard(connection: ASGIConnection, _: BaseRouteHandler) -
return

api_key = get_steam_api_key()
fake_ip = connection.query_params["fake_ip"]
fake_ip = unquote(connection.query_params["fake_ip"])

# 169 servers are behind SDR...
if fake_ip.startswith("169"):
Expand Down

0 comments on commit b5747d4

Please sign in to comment.