2023-05-26 17:45:20 +00:00
|
|
|
from core.config import CoreConfig
|
|
|
|
|
|
|
|
|
|
|
|
class SaoServerConfig:
|
|
|
|
def __init__(self, parent_config: "SaoConfig"):
|
|
|
|
self.__config = parent_config
|
|
|
|
|
|
|
|
@property
|
|
|
|
def enable(self) -> bool:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "sao", "server", "enable", default=True
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def loglevel(self) -> int:
|
|
|
|
return CoreConfig.str_to_loglevel(
|
|
|
|
CoreConfig.get_config_field(
|
|
|
|
self.__config, "sao", "server", "loglevel", default="info"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def auto_register(self) -> bool:
|
|
|
|
"""
|
|
|
|
Automatically register users in `aime_user` on first carding in with sao
|
|
|
|
if they don't exist already. Set to false to display an error instead.
|
|
|
|
"""
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "sao", "server", "auto_register", default=True
|
|
|
|
)
|
|
|
|
|
2023-12-10 23:35:59 +00:00
|
|
|
@property
|
2024-06-25 18:02:53 +00:00
|
|
|
def photon_app_id(self) -> str:
|
2023-12-10 23:35:59 +00:00
|
|
|
return CoreConfig.get_config_field(
|
2024-06-25 18:02:53 +00:00
|
|
|
self.__config, "sao", "server", "photon_app_id", default="7df3a2f6-d69d-4073-aafe-810ee61e1cea"
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def data_version(self) -> int:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "sao", "server", "data_version", default=1
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def game_version(self) -> int:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "sao", "server", "game_version", default=33
|
2023-12-10 23:35:59 +00:00
|
|
|
)
|
|
|
|
|
2023-11-09 16:51:50 +00:00
|
|
|
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=""
|
|
|
|
)
|
|
|
|
|
2023-11-09 23:11:58 +00:00
|
|
|
class SaoHashConfig:
|
|
|
|
def __init__(self, parent_config: "SaoConfig"):
|
|
|
|
self.__config = parent_config
|
|
|
|
|
|
|
|
@property
|
|
|
|
def verify_hash(self) -> bool:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "sao", "hash", "verify_hash", default=False
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def hash_base(self) -> str:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "sao", "hash", "hash_base", default=""
|
|
|
|
)
|
|
|
|
|
2024-06-25 18:02:53 +00:00
|
|
|
class SaoCardConfig:
|
|
|
|
def __init__(self, parent_config: "SaoConfig"):
|
|
|
|
self.__config = parent_config
|
|
|
|
|
|
|
|
@property
|
|
|
|
def enable(self) -> bool:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "sao", "card", "enable", default=True
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def crypt_password(self) -> str:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "sao", "card", "crypt_password", default=""
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def crypt_salt(self) -> str:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "sao", "card", "crypt_salt", default=""
|
|
|
|
)
|
2023-05-26 17:45:20 +00:00
|
|
|
|
|
|
|
class SaoConfig(dict):
|
|
|
|
def __init__(self) -> None:
|
|
|
|
self.server = SaoServerConfig(self)
|
2023-11-09 16:51:50 +00:00
|
|
|
self.crypt = SaoCryptConfig(self)
|
2023-11-09 23:11:58 +00:00
|
|
|
self.hash = SaoHashConfig(self)
|
2024-06-25 18:02:53 +00:00
|
|
|
self.card = SaoCardConfig(self)
|