From 104a483f4c001891e996c8e864d4969cae0e6798 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sat, 2 Dec 2023 22:30:55 -0500 Subject: [PATCH] maimai: fixes for finale --- titles/mai2/dx.py | 8 +------- titles/mai2/finale.py | 6 ------ titles/mai2/index.py | 41 +++++++++++++++++++---------------------- 3 files changed, 20 insertions(+), 35 deletions(-) diff --git a/titles/mai2/dx.py b/titles/mai2/dx.py index 3feccc5..a0a7d6f 100644 --- a/titles/mai2/dx.py +++ b/titles/mai2/dx.py @@ -14,13 +14,7 @@ class Mai2DX(Mai2Base): def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None: super().__init__(cfg, game_cfg) self.version = Mai2Constants.VER_MAIMAI_DX - - if self.core_config.server.is_develop and self.core_config.title.port > 0: - self.old_server = f"http://{self.core_config.title.hostname}:{self.core_config.title.port}/SDEZ/100/" - - else: - self.old_server = f"http://{self.core_config.title.hostname}/SDEZ/100/" - + def handle_get_game_setting_api_request(self, data: Dict): return { "gameSetting": { diff --git a/titles/mai2/finale.py b/titles/mai2/finale.py index e29196f..f9f1d88 100644 --- a/titles/mai2/finale.py +++ b/titles/mai2/finale.py @@ -15,9 +15,3 @@ class Mai2Finale(Mai2Base): self.version = Mai2Constants.VER_MAIMAI_FINALE self.can_deliver = True self.can_usbdl = True - - if self.core_config.server.is_develop and self.core_config.title.port > 0: - self.old_server = f"http://{self.core_config.title.hostname}:{self.core_config.title.port}/SDEY/197/" - - else: - self.old_server = f"http://{self.core_config.title.hostname}/SDEY/197/" diff --git a/titles/mai2/index.py b/titles/mai2/index.py index c09d9e3..793aaef 100644 --- a/titles/mai2/index.py +++ b/titles/mai2/index.py @@ -104,13 +104,15 @@ class Mai2Servlet(BaseServlet): def get_endpoint_matchers(self) -> Tuple[List[Tuple[str, str, Dict]], List[Tuple[str, str, Dict]]]: return ( [ - ("handle_movie", "/{version}/MaimaiServlet/api/movie/{endpoint:..?}", {}), - ("handle_old_srv", "/{version}/MaimaiServlet/old/{endpoint:..?}", {}), - ("handle_usbdl", "/{version}/MaimaiServlet/usbdl/{endpoint:..?}", {}), - ("handle_deliver", "/{version}/MaimaiServlet/deliver/{endpoint:..?}", {}), + ("handle_movie", "/{version}/MaimaiServlet/api/movie/{endpoint}", {}), + ("handle_old_srv", "/{version}/MaimaiServlet/old/{endpoint}", {}), + ("handle_old_srv_userdata", "/{version}/MaimaiServlet/old/{endpoint}/{placeid}/{keychip}/{userid}", {}), + ("handle_old_srv_userdata", "/{version}/MaimaiServlet/old/{endpoint}/{userid}", {}), + ("handle_usbdl", "/{version}/MaimaiServlet/usbdl/{endpoint}", {}), + ("handle_deliver", "/{version}/MaimaiServlet/deliver/{endpoint}", {}), ], [ - ("handle_movie", "/{version}/MaimaiServlet/api/movie/{endpoint:..?}", {}), + ("handle_movie", "/{version}/MaimaiServlet/api/movie/{endpoint}", {}), ("handle_mai", "/{version}/MaimaiServlet/{endpoint}", {}), ("handle_mai2", "/{version}/Maimai2Servlet/{endpoint}", {}), ] @@ -304,6 +306,18 @@ class Mai2Servlet(BaseServlet): return zlib.compress(json.dumps(resp, ensure_ascii=False).encode("utf-8")) + def handle_old_srv(self, request: Request, game_code: str, matchers: Dict) -> bytes: + endpoint = matchers['endpoint'] + version = matchers['version'] + self.logger.info(f"v{version} old server {endpoint}") + return zlib.compress(b"ok") + + def handle_old_srv_userdata(self, request: Request, game_code: str, matchers: Dict) -> bytes: + endpoint = matchers['endpoint'] + version = matchers['version'] + self.logger.info(f"v{version} old server {endpoint}") + return zlib.compress(b"{}") + def render_GET(self, request: Request, version: int, url_path: str) -> bytes: self.logger.debug(f"v{version} GET {url_path}") url_split = url_path.split("/") @@ -318,23 +332,6 @@ class Mai2Servlet(BaseServlet): request.setResponseCode(404) return b"" - if url_split[0] == "old": - if url_split[1] == "ping": - self.logger.info(f"v{version} old server ping") - return zlib.compress(b"ok") - - elif url_split[1].startswith("userdata"): - self.logger.info(f"v{version} old server userdata inquire") - return zlib.compress(b"{}") - - elif url_split[1].startswith("friend"): - self.logger.info(f"v{version} old server friend inquire") - return zlib.compress(b"{}") - - else: - request.setResponseCode(404) - return b"" - elif url_split[0] == "usbdl": if url_split[1] == "CONNECTIONTEST": self.logger.info(f"v{version} usbdl server test")