From c8d4bc6109e3263bddc4c8e4af59c0c382935532 Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Thu, 9 Mar 2023 10:52:49 -0500 Subject: [PATCH] add special-case ping handlers to mai2, ongeki and chuni --- titles/chuni/base.py | 3 --- titles/chuni/index.py | 3 +++ titles/mai2/base.py | 3 --- titles/mai2/index.py | 3 +++ titles/ongeki/index.py | 3 +++ 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/titles/chuni/base.py b/titles/chuni/base.py index d557583..65d991d 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -21,9 +21,6 @@ class ChuniBase(): self.game = ChuniConstants.GAME_CODE self.version = ChuniConstants.VER_CHUNITHM - def handle_ping_request(self, data: Dict) -> Dict: - return {"returnCode": 1} - def handle_game_login_api_request(self, data: Dict) -> Dict: #self.data.base.log_event("chuni", "login", logging.INFO, {"version": self.version, "user": data["userId"]}) return { "returnCode": 1 } diff --git a/titles/chuni/index.py b/titles/chuni/index.py index 866e9d9..66e8c65 100644 --- a/titles/chuni/index.py +++ b/titles/chuni/index.py @@ -86,6 +86,9 @@ class ChuniServlet(): return (True, f"http://{core_cfg.title.hostname}/{game_code}/$v/", "") def render_POST(self, request: Request, version: int, url_path: str) -> bytes: + if url_path == "/ping": + return zlib.compress(json.dumps({'returnCode': 1}, ensure_ascii=False).encode("utf-8")) + req_raw = request.content.getvalue() url_split = url_path.split("/") encrtped = False diff --git a/titles/mai2/base.py b/titles/mai2/base.py index 3817890..ea98681 100644 --- a/titles/mai2/base.py +++ b/titles/mai2/base.py @@ -16,9 +16,6 @@ class Mai2Base(): self.data = Mai2Data(cfg) self.logger = logging.getLogger("mai2") - def handle_ping_request(self, data: Dict) -> Dict: - return {"returnCode": 1} - def handle_get_game_setting_api_request(self, data: Dict): reboot_start = date.strftime(datetime.now() + timedelta(hours=3), Mai2Constants.DATE_TIME_FORMAT) reboot_end = date.strftime(datetime.now() + timedelta(hours=4), Mai2Constants.DATE_TIME_FORMAT) diff --git a/titles/mai2/index.py b/titles/mai2/index.py index 64a38a6..051cba0 100644 --- a/titles/mai2/index.py +++ b/titles/mai2/index.py @@ -69,6 +69,9 @@ class Mai2Servlet(): return (True, f"http://{core_cfg.title.hostname}/{game_code}/$v/", f"{core_cfg.title.hostname}/") def render_POST(self, request: Request, version: int, url_path: str) -> bytes: + if url_path == "/ping": + return zlib.compress(json.dumps({'returnCode': 1}, ensure_ascii=False).encode("utf-8")) + req_raw = request.content.getvalue() url = request.uri.decode() url_split = url_path.split("/") diff --git a/titles/ongeki/index.py b/titles/ongeki/index.py index c5e78f6..c3d4b26 100644 --- a/titles/ongeki/index.py +++ b/titles/ongeki/index.py @@ -72,6 +72,9 @@ class OngekiServlet(): return (True, f"http://{core_cfg.title.hostname}/{game_code}/$v/", f"{core_cfg.title.hostname}/") def render_POST(self, request: Request, version: int, url_path: str) -> bytes: + if url_path == "/ping": + return zlib.compress(json.dumps({'returnCode': 1}, ensure_ascii=False).encode("utf-8")) + req_raw = request.content.getvalue() url_split = url_path.split("/") internal_ver = 0