Merge pull request 'chu&mai2: add option to use https' (#217) from zaphkito/artemis:chumai_https into develop

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/217
This commit is contained in:
Hay1tsme
2025-07-13 05:22:18 +00:00
6 changed files with 54 additions and 9 deletions

View File

@@ -177,14 +177,29 @@ class Mai2Servlet(BaseServlet):
]
def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]:
if not self.core_cfg.server.is_using_proxy and Utils.get_title_port(self.core_cfg) != 80:
return (
f"http://{self.core_cfg.server.hostname}:{Utils.get_title_port(self.core_cfg)}/{game_code}/{game_ver}/",
f"{self.core_cfg.server.hostname}",
)
title_port_int = Utils.get_title_port(self.core_cfg)
title_port_ssl_int = Utils.get_title_port_ssl(self.core_cfg)
if self.game_cfg.server.use_https:
if (game_code == "SDEZ" and game_ver >= 114) or (game_code == "SDGA" and game_ver >= 110): # SDEZ and SDGA use tls from Splash version
proto = "" # game will auto add https:// in uri with original code
elif game_code == "SDGB" and game_ver >= 130: # SDGB use tls from 1.30
# game will check if uri start with "http:", if yes, set IsHttpConnection = true
# so we can return https://example.com or http://example.com, all will work
proto = "https://"
else:
# "maimai", SDEZ 1.00 ~ 1.13, SDGA 1.00 ~ 1.06 and SDGB 1.01, 1.20 use http://
proto = "http://"
else:
proto = "http://"
if proto == "" or proto == "https://":
t_port = f":{title_port_ssl_int}" if title_port_ssl_int != 443 else ""
else:
t_port = f":{title_port_int}" if title_port_int != 80 else ""
return (
f"http://{self.core_cfg.server.hostname}/{game_code}/{game_ver}/",
f"{proto}{self.core_cfg.server.hostname}{t_port}/{game_code}/{game_ver}/",
f"{self.core_cfg.server.hostname}",
)