forked from Hay1tsme/artemis
ongeki: add get_allnet_info,
This commit is contained in:
parent
e0fdd937e6
commit
b2b28850dd
@ -6,13 +6,5 @@ from titles.ongeki.read import OngekiReader
|
|||||||
index = OngekiServlet
|
index = OngekiServlet
|
||||||
database = OngekiData
|
database = OngekiData
|
||||||
reader = OngekiReader
|
reader = OngekiReader
|
||||||
|
|
||||||
use_default_title = True
|
|
||||||
include_protocol = True
|
|
||||||
title_secure = False
|
|
||||||
game_codes = [OngekiConstants.GAME_CODE]
|
game_codes = [OngekiConstants.GAME_CODE]
|
||||||
trailing_slash = True
|
|
||||||
use_default_host = False
|
|
||||||
host = ""
|
|
||||||
|
|
||||||
current_schema_version = 2
|
current_schema_version = 2
|
@ -6,6 +6,8 @@ import string
|
|||||||
import logging, coloredlogs
|
import logging, coloredlogs
|
||||||
import zlib
|
import zlib
|
||||||
from logging.handlers import TimedRotatingFileHandler
|
from logging.handlers import TimedRotatingFileHandler
|
||||||
|
from os import path
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
from core.config import CoreConfig
|
from core.config import CoreConfig
|
||||||
from titles.ongeki.config import OngekiConfig
|
from titles.ongeki.config import OngekiConfig
|
||||||
@ -23,6 +25,7 @@ class OngekiServlet():
|
|||||||
def __init__(self, core_cfg: CoreConfig, cfg_dir: str) -> None:
|
def __init__(self, core_cfg: CoreConfig, cfg_dir: str) -> None:
|
||||||
self.core_cfg = core_cfg
|
self.core_cfg = core_cfg
|
||||||
self.game_cfg = OngekiConfig()
|
self.game_cfg = OngekiConfig()
|
||||||
|
if path.exists(f"{cfg_dir}/ongeki.yaml"):
|
||||||
self.game_cfg.update(yaml.safe_load(open(f"{cfg_dir}/ongeki.yaml")))
|
self.game_cfg.update(yaml.safe_load(open(f"{cfg_dir}/ongeki.yaml")))
|
||||||
|
|
||||||
self.versions = [
|
self.versions = [
|
||||||
@ -53,6 +56,19 @@ class OngekiServlet():
|
|||||||
self.logger.setLevel(self.game_cfg.server.loglevel)
|
self.logger.setLevel(self.game_cfg.server.loglevel)
|
||||||
coloredlogs.install(level=self.game_cfg.server.loglevel, logger=self.logger, fmt=log_fmt_str)
|
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:
|
def render_POST(self, request: Request, version: int, url_path: str) -> bytes:
|
||||||
req_raw = request.content.getvalue()
|
req_raw = request.content.getvalue()
|
||||||
url_split = url_path.split("/")
|
url_split = url_path.split("/")
|
||||||
|
Loading…
Reference in New Issue
Block a user