1
0
forked from Hay1tsme/artemis

ongeki: add get_allnet_info,

This commit is contained in:
Hay1tsme 2023-03-04 21:39:38 -05:00
parent e0fdd937e6
commit b2b28850dd
2 changed files with 17 additions and 9 deletions

View File

@ -6,13 +6,5 @@ from titles.ongeki.read import OngekiReader
index = OngekiServlet
database = OngekiData
reader = OngekiReader
use_default_title = True
include_protocol = True
title_secure = False
game_codes = [OngekiConstants.GAME_CODE]
trailing_slash = True
use_default_host = False
host = ""
current_schema_version = 2

View File

@ -6,6 +6,8 @@ import string
import logging, coloredlogs
import zlib
from logging.handlers import TimedRotatingFileHandler
from os import path
from typing import Tuple
from core.config import CoreConfig
from titles.ongeki.config import OngekiConfig
@ -23,7 +25,8 @@ class OngekiServlet():
def __init__(self, core_cfg: CoreConfig, cfg_dir: str) -> None:
self.core_cfg = core_cfg
self.game_cfg = OngekiConfig()
self.game_cfg.update(yaml.safe_load(open(f"{cfg_dir}/ongeki.yaml")))
if path.exists(f"{cfg_dir}/ongeki.yaml"):
self.game_cfg.update(yaml.safe_load(open(f"{cfg_dir}/ongeki.yaml")))
self.versions = [
OngekiBase(core_cfg, self.game_cfg),
@ -52,6 +55,19 @@ class OngekiServlet():
self.logger.setLevel(self.game_cfg.server.loglevel)
coloredlogs.install(level=self.game_cfg.server.loglevel, logger=self.logger, fmt=log_fmt_str)
@classmethod
def get_allnet_info(cls, game_code: str, core_cfg: CoreConfig, cfg_dir: str) -> Tuple[bool, str, str]:
game_cfg = OngekiConfig()
game_cfg.update(yaml.safe_load(open(f"{cfg_dir}/ongeki.yaml")))
if not game_cfg.server.enable:
return (False, "", "")
if core_cfg.server.is_develop:
return (True, f"http://{core_cfg.title.hostname}:{core_cfg.title.port}/{game_code}/$v/", f"{core_cfg.title.hostname}:{core_cfg.title.port}/")
return (True, f"http://{core_cfg.title.hostname}/{game_code}/$v/", f"{core_cfg.title.hostname}/")
def render_POST(self, request: Request, version: int, url_path: str) -> bytes:
req_raw = request.content.getvalue()