From 580a9faae8d6408253ea87b420b6358a5235f793 Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Thu, 9 Nov 2023 11:51:50 -0500 Subject: [PATCH] sao: fix allnet --- titles/sao/config.py | 23 +++++++++++++++++++++++ titles/sao/index.py | 5 +++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/titles/sao/config.py b/titles/sao/config.py index 7b9a2d5..aa0adbd 100644 --- a/titles/sao/config.py +++ b/titles/sao/config.py @@ -41,7 +41,30 @@ class SaoServerConfig: 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): def __init__(self) -> None: self.server = SaoServerConfig(self) + self.crypt = SaoCryptConfig(self) diff --git a/titles/sao/index.py b/titles/sao/index.py index 9d38c14..177f668 100644 --- a/titles/sao/index.py +++ b/titles/sao/index.py @@ -4,6 +4,7 @@ import yaml import logging, coloredlogs from logging.handlers import TimedRotatingFileHandler from os import path +from Crypto.Cipher import Blowfish from core import CoreConfig, Utils 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]: return ( - f"http://{self.game_cfg.server.hostname}:{self.game_cfg.server.port}/SaoServlet/", - f"{self.game_cfg.server.hostname}/SaoServlet/", + f"http://{self.game_cfg.server.hostname}:{self.game_cfg.server.port}/", + f"{self.game_cfg.server.hostname}/", ) def get_mucha_info(self, core_cfg: CoreConfig, cfg_dir: str) -> Tuple[bool, str]: