sao: add endpoint matcher

This commit is contained in:
Hay1tsme 2023-10-20 01:18:38 -04:00
parent d7f323f2e2
commit deccaf593a

View File

@ -1,12 +1,8 @@
from typing import Tuple, Dict
from typing import Tuple, Dict, List
from twisted.web.http import Request
from twisted.web import resource
import json, ast
from datetime import datetime
import yaml
import logging, coloredlogs
from logging.handlers import TimedRotatingFileHandler
import inflection
from os import path
from core import CoreConfig, Utils
@ -52,6 +48,12 @@ class SaoServlet(BaseServlet):
self.base = SaoBase(core_cfg, self.game_cfg)
def get_endpoint_matchers(self) -> Tuple[List[Tuple[str, str, Dict]], List[Tuple[str, str, Dict]]]:
return (
[],
[("render_POST", "/SaoServlet/{datecode}/proto/if/{endpoint}", {})]
)
@classmethod
def is_game_enabled(cls, game_code: str, core_cfg: CoreConfig, cfg_dir: str) -> bool:
game_cfg = SaoConfig()
@ -68,8 +70,8 @@ class SaoServlet(BaseServlet):
def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]:
return (
f"http://{self.game_cfg.server.hostname}:{self.game_cfg.server.port}/{game_code}/$v/",
f"{self.game_cfg.server.hostname}/SDEW/$v/",
f"http://{self.game_cfg.server.hostname}:{self.game_cfg.server.port}/SaoServlet/",
f"{self.game_cfg.server.hostname}/SaoServlet/",
)
def get_mucha_info(self, core_cfg: CoreConfig, cfg_dir: str) -> Tuple[bool, str]: