add special-case ping handlers to mai2, ongeki and chuni

This commit is contained in:
Hay1tsme 2023-03-09 10:52:49 -05:00
parent 6dcd7b67ef
commit c8d4bc6109
5 changed files with 9 additions and 6 deletions

View File

@ -21,9 +21,6 @@ class ChuniBase():
self.game = ChuniConstants.GAME_CODE self.game = ChuniConstants.GAME_CODE
self.version = ChuniConstants.VER_CHUNITHM 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: 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"]}) #self.data.base.log_event("chuni", "login", logging.INFO, {"version": self.version, "user": data["userId"]})
return { "returnCode": 1 } return { "returnCode": 1 }

View File

@ -86,6 +86,9 @@ class ChuniServlet():
return (True, f"http://{core_cfg.title.hostname}/{game_code}/$v/", "") return (True, f"http://{core_cfg.title.hostname}/{game_code}/$v/", "")
def render_POST(self, request: Request, version: int, url_path: str) -> bytes: 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() req_raw = request.content.getvalue()
url_split = url_path.split("/") url_split = url_path.split("/")
encrtped = False encrtped = False

View File

@ -16,9 +16,6 @@ class Mai2Base():
self.data = Mai2Data(cfg) self.data = Mai2Data(cfg)
self.logger = logging.getLogger("mai2") 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): def handle_get_game_setting_api_request(self, data: Dict):
reboot_start = date.strftime(datetime.now() + timedelta(hours=3), Mai2Constants.DATE_TIME_FORMAT) 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) reboot_end = date.strftime(datetime.now() + timedelta(hours=4), Mai2Constants.DATE_TIME_FORMAT)

View File

@ -69,6 +69,9 @@ class Mai2Servlet():
return (True, f"http://{core_cfg.title.hostname}/{game_code}/$v/", f"{core_cfg.title.hostname}/") 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: 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() req_raw = request.content.getvalue()
url = request.uri.decode() url = request.uri.decode()
url_split = url_path.split("/") url_split = url_path.split("/")

View File

@ -72,6 +72,9 @@ class OngekiServlet():
return (True, f"http://{core_cfg.title.hostname}/{game_code}/$v/", f"{core_cfg.title.hostname}/") 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: 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() req_raw = request.content.getvalue()
url_split = url_path.split("/") url_split = url_path.split("/")
internal_ver = 0 internal_ver = 0