Skip to content

Commit

Permalink
feat(routes): "/" redirect to client backend
Browse files Browse the repository at this point in the history
  • Loading branch information
jayceslesar committed Aug 9, 2024
1 parent b4e359c commit c32dc9c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions masterbase/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import logging
import os
import time
from datetime import datetime, timezone
from hmac import compare_digest
from urllib.parse import unquote, urlencode
Expand Down Expand Up @@ -61,6 +62,12 @@
streaming_sessions: SocketManagerMapType = {}


@get("/", sync_to_thread=False)
def landing() -> Redirect:
"""Redirect to github page."""
return Redirect(path="https://github.com/MegaAntiCheat/client-backend")


@get("/session_id", guards=[valid_key_guard, user_in_session_guard, valid_session_guard], sync_to_thread=False)
def session_id(
request: Request,
Expand Down Expand Up @@ -116,6 +123,8 @@ def late_bytes(request: Request, api_key: str, data: LateBytesBody) -> dict[str,
Returns:
{"late_bytes": True}
"""
# sleep for 2 seconds to prevent race condition from user workflow
time.sleep(2)
engine = request.app.state.engine
current_time = datetime.now().astimezone(timezone.utc)
steam_id = steam_id_from_api_key(engine, api_key)
Expand Down Expand Up @@ -397,6 +406,7 @@ def plain_text_exception_handler(_: Request, exception: Exception) -> Response:
app = Litestar(
on_startup=startup_registers,
route_handlers=[
landing,
session_id,
close_session,
DemoHandler,
Expand Down

0 comments on commit c32dc9c

Please sign in to comment.