maimai: fixes for finale

This commit is contained in:
Hay1tsme 2023-12-02 22:30:55 -05:00
parent 29a1dac983
commit 104a483f4c
3 changed files with 20 additions and 35 deletions

View File

@ -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": {

View File

@ -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/"

View File

@ -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")