mai2: add movie server endpoints

This commit is contained in:
Hay1tsme 2023-06-25 18:43:00 -04:00
parent b1968fe320
commit 0c6d9a36ce
2 changed files with 9 additions and 1 deletions

View File

@ -36,7 +36,7 @@ class Mai2Base:
"rebootEndTime": "2020-01-01 07:59:59.0", "rebootEndTime": "2020-01-01 07:59:59.0",
"movieUploadLimit": 100, "movieUploadLimit": 100,
"movieStatus": 1, "movieStatus": 1,
"movieServerUri": self.old_server + "movie/", "movieServerUri": self.old_server + "movie",
"deliverServerUri": self.old_server + "deliver/" if self.can_deliver and self.game_config.deliver.enable else "", "deliverServerUri": self.old_server + "deliver/" if self.can_deliver and self.game_config.deliver.enable else "",
"oldServerUri": self.old_server + "old", "oldServerUri": self.old_server + "old",
"usbDlServerUri": self.old_server + "usbdl/" if self.can_deliver and self.game_config.deliver.udbdl_enable else "", "usbDlServerUri": self.old_server + "usbdl/" if self.can_deliver and self.game_config.deliver.udbdl_enable else "",

View File

@ -112,6 +112,10 @@ class Mai2Servlet:
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.lower() == "ping": if url_path.lower() == "ping":
return zlib.compress(b'{"returnCode": "1"}') return zlib.compress(b'{"returnCode": "1"}')
elif url_path.startswith("movie/"):
self.logger.info(f"Movie data: {url_path} - {request.content.getvalue()}")
return b""
req_raw = request.content.getvalue() req_raw = request.content.getvalue()
url = request.uri.decode() url = request.uri.decode()
@ -211,6 +215,10 @@ class Mai2Servlet:
self.logger.info(f"v{version} GET {url_path}") self.logger.info(f"v{version} GET {url_path}")
url_split = url_path.split("/") url_split = url_path.split("/")
if url_split[0] == "movie":
if url_split[1] == "moviestart":
return json.dumps({"moviestart":{"status":"OK"}}).encode()
if url_split[0] == "old": if url_split[0] == "old":
if url_split[1] == "ping": if url_split[1] == "ping":
self.logger.info(f"v{version} old server ping") self.logger.info(f"v{version} old server ping")