forked from Hay1tsme/artemis
readd get_title_port_ssl
This commit is contained in:
parent
261d09aaef
commit
c680c2d4e9
@ -84,6 +84,16 @@ class ServerConfig:
|
||||
self.__config, "core", "title", "proxy_port", default=0
|
||||
)
|
||||
|
||||
@property
|
||||
def proxy_port_ssl(self) -> int:
|
||||
"""
|
||||
What port the proxy is listening for secure connections on. This will be sent
|
||||
instead of 'port' if is_using_proxy is True and this value is non-zero
|
||||
"""
|
||||
return CoreConfig.get_config_field(
|
||||
self.__config, "core", "title", "proxy_port_ssl", default=0
|
||||
)
|
||||
|
||||
@property
|
||||
def log_dir(self) -> str:
|
||||
return CoreConfig.get_config_field(
|
||||
|
@ -40,9 +40,17 @@ class Utils:
|
||||
def get_title_port(cls, cfg: CoreConfig):
|
||||
if cls.real_title_port is not None: return cls.real_title_port
|
||||
|
||||
cls.real_title_port = cfg.server.proxy_port if cfg.server.is_using_proxy else cfg.server.port
|
||||
cls.real_title_port = cfg.server.proxy_port if cfg.server.is_using_proxy and cfg.server.proxy_port else cfg.server.port
|
||||
|
||||
return cls.real_title_port
|
||||
|
||||
@classmethod
|
||||
def get_title_port_ssl(cls, cfg: CoreConfig):
|
||||
if cls.real_title_port_ssl is not None: return cls.real_title_port_ssl
|
||||
|
||||
cls.real_title_port_ssl = cfg.server.proxy_port_ssl if cfg.server.is_using_proxy and cfg.server.proxy_port_ssl else Utils.get_title_port(cfg)
|
||||
|
||||
return cls.real_title_port_ssl
|
||||
|
||||
def create_sega_auth_key(aime_id: int, game: str, place_id: int, keychip_id: str, b64_secret: str, exp_seconds: int = 86400, err_logger: str = 'aimedb') -> Optional[str]:
|
||||
logger = logging.getLogger(err_logger)
|
||||
|
@ -10,6 +10,7 @@ server:
|
||||
is_develop: True
|
||||
is_using_proxy: False
|
||||
proxy_port: 0
|
||||
proxy_port_ssl: 0
|
||||
log_dir: "logs"
|
||||
check_arcade_ip: False
|
||||
strict_ip_checking: False
|
||||
|
@ -1,3 +1,4 @@
|
||||
server:
|
||||
enable: True
|
||||
loglevel: "info"
|
||||
loglevel: "info"
|
||||
use:https: True
|
@ -6,7 +6,7 @@ server {
|
||||
location / {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass_request_headers on;
|
||||
proxy_pass http://localhost:8000/;
|
||||
proxy_pass http://localhost:8080/;
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# Billing
|
||||
# Billing, comment this out if running billing standalone
|
||||
server {
|
||||
listen 8443 ssl;
|
||||
server_name ib.naominet.jp;
|
||||
@ -58,28 +58,6 @@ server {
|
||||
ssl_prefer_server_ciphers off;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:8444/;
|
||||
}
|
||||
}
|
||||
|
||||
# Pokken, comment this out if you don't plan on serving pokken.
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name pokken.hostname.here;
|
||||
|
||||
ssl_certificate /path/to/cert/pokken.pem;
|
||||
ssl_certificate_key /path/to/cert/pokken.key;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_cache shared:MozSSL:10m;
|
||||
ssl_session_tickets off;
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers "ALL:@SECLEVEL=0";
|
||||
ssl_prefer_server_ciphers off;
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass_request_headers on;
|
||||
proxy_pass http://localhost:8080/;
|
||||
}
|
||||
}
|
||||
@ -92,7 +70,7 @@ server {
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
# If you don't want https redirection, comment the line above and uncomment the line below
|
||||
# proxy_pass http://localhost:8090/;
|
||||
# proxy_pass http://localhost:8080/;
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,6 +96,6 @@ server {
|
||||
location / {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass_request_headers on;
|
||||
proxy_pass http://localhost:8090/;
|
||||
proxy_pass http://localhost:8080/;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,12 @@ class CxbServerConfig:
|
||||
self.__config, "cxb", "server", "loglevel", default="info"
|
||||
)
|
||||
)
|
||||
|
||||
@property
|
||||
def use_https(self) -> bool:
|
||||
return CoreConfig.get_config_field(
|
||||
self.__config, "cxb", "server", "use_https", default=True
|
||||
)
|
||||
|
||||
|
||||
class CxbConfig(dict):
|
||||
|
@ -89,18 +89,19 @@ class CxbServlet(BaseServlet):
|
||||
title_port_int = Utils.get_title_port(self.core_cfg)
|
||||
title_port_ssl_int = Utils.get_title_port_ssl(self.core_cfg)
|
||||
|
||||
proto = "https" if title_port_ssl_int != 443 else "http"
|
||||
proto = "https" if self.game_cfg.server.use_https else "http"
|
||||
|
||||
if proto == "https":
|
||||
t_port = f":{title_port_ssl_int}" if title_port_ssl_int and not self.core_cfg.server.is_using_proxy else ""
|
||||
t_port = f":{title_port_ssl_int}" if title_port_ssl_int != 443 else ""
|
||||
|
||||
else:
|
||||
t_port = f":{title_port_int}" if title_port_int and not self.core_cfg.server.is_using_proxy else ""
|
||||
t_port = f":{title_port_int}" if title_port_int != 80 else ""
|
||||
|
||||
return (
|
||||
f"{proto}://{self.core_cfg.server.hostname}{t_port}",
|
||||
f"{proto}://{self.core_cfg.title.hostname}{t_port}",
|
||||
"",
|
||||
)
|
||||
|
||||
|
||||
async def preprocess(self, req: Request) -> Dict:
|
||||
req_bytes = await req.body()
|
||||
|
@ -129,14 +129,21 @@ class OngekiServlet(BaseServlet):
|
||||
|
||||
def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]:
|
||||
title_port_int = Utils.get_title_port(self.core_cfg)
|
||||
title_port_ssl_int = Utils.get_title_port_ssl(self.core_cfg)
|
||||
proto = "https" if self.game_cfg.server.use_https and game_ver >= 120 else "http"
|
||||
t_port = f":{title_port_int}" if title_port_int and not self.core_cfg.server.is_using_proxy else ""
|
||||
|
||||
if proto == "https":
|
||||
t_port = f":{title_port_ssl_int}" if title_port_ssl_int != 443 else ""
|
||||
|
||||
else:
|
||||
t_port = f":{title_port_int}" if title_port_int != 80 else ""
|
||||
|
||||
return (
|
||||
f"{proto}://{self.core_cfg.server.hostname}{t_port}/{game_code}/{game_ver}/",
|
||||
f"{self.core_cfg.server.hostname}{t_port}/",
|
||||
f"{proto}://{self.core_cfg.title.hostname}{t_port}/{game_code}/{game_ver}/",
|
||||
f"{self.core_cfg.title.hostname}{t_port}/",
|
||||
)
|
||||
|
||||
|
||||
async def render_POST(self, request: Request) -> bytes:
|
||||
endpoint: str = request.path_params.get('endpoint', '')
|
||||
version: int = request.path_params.get('version', 0)
|
||||
|
@ -78,8 +78,8 @@ class PokkenServlet(BaseServlet):
|
||||
|
||||
def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]:
|
||||
return (
|
||||
f"https://{self.game_cfg.server.hostname}:{self.game_cfg.ports.game}/pokken/",
|
||||
f"{self.game_cfg.server.hostname}:{self.game_cfg.ports.game}/pokken/",
|
||||
f"https://{self.game_cfg.server.hostname}:{Utils.get_title_port_ssl(self.core_cfg)}/pokken/",
|
||||
f"{self.game_cfg.server.hostname}:{Utils.get_title_port_ssl(self.core_cfg)}/pokken/",
|
||||
)
|
||||
|
||||
def get_mucha_info(self, core_cfg: CoreConfig, cfg_dir: str) -> Tuple[bool, str]:
|
||||
|
@ -81,13 +81,14 @@ class SaoServlet(BaseServlet):
|
||||
port_normal = Utils.get_title_port(self.core_cfg)
|
||||
|
||||
proto = "http"
|
||||
port = f":{port_normal}" if not self.core_cfg.server.is_using_proxy and port_normal != 80 else ""
|
||||
port = f":{port_normal}" if port_normal != 80 else ""
|
||||
|
||||
if self.game_cfg.server.use_https:
|
||||
proto = "https"
|
||||
port = f":{port_ssl}" if not self.core_cfg.server.is_using_proxy and port_ssl != 443 else ""
|
||||
port = f":{port_ssl}" if port_ssl != 443 else ""
|
||||
|
||||
return (f"{proto}://{self.core_cfg.title.hostname}{port}/", "")
|
||||
|
||||
return (f"{proto}://{self.core_cfg.server.hostname}{port}/", "")
|
||||
|
||||
def get_mucha_info(self, core_cfg: CoreConfig, cfg_dir: str) -> Tuple[bool, str]:
|
||||
if not self.game_cfg.server.enable:
|
||||
|
Loading…
Reference in New Issue
Block a user