1
0
forked from Hay1tsme/artemis

maimai: fix net deliver paths

This commit is contained in:
Hay1tsme 2023-08-31 01:24:41 -04:00
parent 7a6272dcc5
commit 3a6cfedcca
2 changed files with 5 additions and 4 deletions

View File

@ -38,7 +38,7 @@ class Mai2DeliverConfig:
@property
def content_folder(self) -> int:
return CoreConfig.get_config_field(
self.__config, "mai2", "server", "content_folder", default=""
self.__config, "mai2", "deliver", "content_folder", default=""
)
class Mai2UploadsConfig:

View File

@ -228,7 +228,7 @@ class Mai2Servlet:
return zlib.compress(json.dumps(resp, ensure_ascii=False).encode("utf-8"))
def render_GET(self, request: Request, version: int, url_path: str) -> bytes:
self.logger.info(f"v{version} GET {url_path}")
self.logger.debug(f"v{version} GET {url_path}")
url_split = url_path.split("/")
if (url_split[0] == "api" and url_split[1] == "movie") or url_split[0] == "movie":
@ -272,9 +272,10 @@ class Mai2Servlet:
elif url_split[0] == "deliver":
file = url_split[len(url_split) - 1]
self.logger.info(f"v{version} {file} deliver inquire")
self.logger.debug(f"{self.game_cfg.deliver.content_folder}/net_deliver/{file}")
if self.game_cfg.deliver.enable and path.exists(f"{self.game_cfg.deliver.content_folder}/{file}"):
with open(f"{self.game_cfg.deliver.content_folder}/deliver/{url_split[-1]}", 'rb') as f:
if self.game_cfg.deliver.enable and path.exists(f"{self.game_cfg.deliver.content_folder}/net_deliver/{file}"):
with open(f"{self.game_cfg.deliver.content_folder}/net_deliver/{file}", 'rb') as f:
return f.read()
else: