1
0
forked from Hay1tsme/artemis

maimai: fix usbdl endpoints

This commit is contained in:
Hay1tsme 2023-08-27 11:53:29 -04:00
parent d4ea3bc12a
commit 37e2da2051

View File

@ -234,6 +234,10 @@ class Mai2Servlet:
if (url_split[0] == "api" and url_split[1] == "movie") or url_split[0] == "movie": if (url_split[0] == "api" and url_split[1] == "movie") or url_split[0] == "movie":
if url_split[2] == "moviestart": if url_split[2] == "moviestart":
return json.dumps({"moviestart":{"status":"OK"}}).encode() return json.dumps({"moviestart":{"status":"OK"}}).encode()
else:
request.setResponseCode(404)
return b""
if url_split[0] == "old": if url_split[0] == "old":
if url_split[1] == "ping": if url_split[1] == "ping":
@ -247,18 +251,35 @@ class Mai2Servlet:
elif url_split[1].startswith("friend"): elif url_split[1].startswith("friend"):
self.logger.info(f"v{version} old server friend inquire") self.logger.info(f"v{version} old server friend inquire")
return zlib.compress(b"{}") return zlib.compress(b"{}")
else:
request.setResponseCode(404)
return b""
elif url_split[0] == "usbdl": elif url_split[0] == "usbdl":
if url_split[1] == "CONNECTIONTEST": if url_split[1] == "CONNECTIONTEST":
self.logger.info(f"v{version} usbdl server test") self.logger.info(f"v{version} usbdl server test")
return zlib.compress(b"ok") return b""
elif self.game_cfg.deliver.udbdl_enable and path.exists(f"{self.game_cfg.deliver.content_folder}/usb/{url_split[-1]}"):
with open(f"{self.game_cfg.deliver.content_folder}/usb/{url_split[-1]}", 'rb') as f:
return f.read()
else:
request.setResponseCode(404)
return b""
elif url_split[0] == "deliver": elif url_split[0] == "deliver":
file = url_split[len(url_split) - 1] file = url_split[len(url_split) - 1]
self.logger.info(f"v{version} {file} deliver inquire") self.logger.info(f"v{version} {file} deliver inquire")
if not self.game_cfg.deliver.enable or not path.exists(f"{self.game_cfg.deliver.content_folder}/{file}"): if self.game_cfg.deliver.enable and path.exists(f"{self.game_cfg.deliver.content_folder}/{file}"):
return zlib.compress(b"") with open(f"{self.game_cfg.deliver.content_folder}/deliver/{url_split[-1]}", 'rb') as f:
return f.read()
else:
request.setResponseCode(404)
return b""
else: else:
return zlib.compress(b"{}") return zlib.compress(b"{}")