1
0
forked from Hay1tsme/artemis

sao: fix allnet

This commit is contained in:
Hay1tsme 2023-11-09 11:51:50 -05:00
parent 9537331d1c
commit 580a9faae8
2 changed files with 26 additions and 2 deletions

View File

@ -41,7 +41,30 @@ class SaoServerConfig:
self.__config, "sao", "server", "auto_register", default=True self.__config, "sao", "server", "auto_register", default=True
) )
class SaoCryptConfig:
def __init__(self, parent_config: "SaoConfig"):
self.__config = parent_config
@property
def enable(self) -> bool:
return CoreConfig.get_config_field(
self.__config, "sao", "crypt", "enable", default=False
)
@property
def key(self) -> str:
return CoreConfig.get_config_field(
self.__config, "sao", "crypt", "key", default=""
)
@property
def iv(self) -> str:
return CoreConfig.get_config_field(
self.__config, "sao", "crypt", "iv", default=""
)
class SaoConfig(dict): class SaoConfig(dict):
def __init__(self) -> None: def __init__(self) -> None:
self.server = SaoServerConfig(self) self.server = SaoServerConfig(self)
self.crypt = SaoCryptConfig(self)

View File

@ -4,6 +4,7 @@ import yaml
import logging, coloredlogs import logging, coloredlogs
from logging.handlers import TimedRotatingFileHandler from logging.handlers import TimedRotatingFileHandler
from os import path from os import path
from Crypto.Cipher import Blowfish
from core import CoreConfig, Utils from core import CoreConfig, Utils
from core.title import BaseServlet from core.title import BaseServlet
@ -70,8 +71,8 @@ class SaoServlet(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]:
return ( return (
f"http://{self.game_cfg.server.hostname}:{self.game_cfg.server.port}/SaoServlet/", f"http://{self.game_cfg.server.hostname}:{self.game_cfg.server.port}/",
f"{self.game_cfg.server.hostname}/SaoServlet/", f"{self.game_cfg.server.hostname}/",
) )
def get_mucha_info(self, core_cfg: CoreConfig, cfg_dir: str) -> Tuple[bool, str]: def get_mucha_info(self, core_cfg: CoreConfig, cfg_dir: str) -> Tuple[bool, str]: