1
0
forked from Hay1tsme/artemis

ongeki: add option to use https for red and beyond

This commit is contained in:
Hay1tsme 2023-11-08 21:42:53 -05:00
parent cb8eaae2c0
commit 94c326a27d
3 changed files with 17 additions and 7 deletions

View File

@ -1,6 +1,7 @@
server: server:
enable: True enable: True
loglevel: "info" loglevel: "info"
use_https: False
gachas: gachas:
enabled_gachas: enabled_gachas:

View File

@ -21,6 +21,12 @@ class OngekiServerConfig:
self.__config, "ongeki", "server", "loglevel", default="info" self.__config, "ongeki", "server", "loglevel", default="info"
) )
) )
@property
def use_https(self) -> bool:
return CoreConfig.get_config_field(
self.__config, "ongeki", "server", "use_https", default=False
)
class OngekiGachaConfig: class OngekiGachaConfig:

View File

@ -127,15 +127,18 @@ class OngekiServlet(BaseServlet):
) )
def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]: 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: title_port_int = Utils.get_title_port(self.core_cfg)
return ( proto = "https" if self.game_cfg.server.use_https and game_ver >= 120 else "http"
f"http://{self.core_cfg.title.hostname}:{Utils.get_title_port(self.core_cfg)}/{game_code}/{game_ver}/",
f"{self.core_cfg.title.hostname}:{Utils.get_title_port(self.core_cfg)}/", if proto == "https":
) t_port = f":{title_port_int}" if title_port_int != 443 and not self.core_cfg.server.is_using_proxy else ""
else:
t_port = f":{title_port_int}" if title_port_int != 80 and not self.core_cfg.server.is_using_proxy else ""
return ( return (
f"http://{self.core_cfg.title.hostname}/{game_code}/{game_ver}/", f"{proto}://{self.core_cfg.title.hostname}{t_port}/{game_code}/{game_ver}/",
f"{self.core_cfg.title.hostname}/", f"{self.core_cfg.title.hostname}{t_port}/",
) )
def render_POST(self, request: Request, game_code: str, matchers: Dict) -> bytes: def render_POST(self, request: Request, game_code: str, matchers: Dict) -> bytes: