From a9f49e8d5dd0a304be4ab276a85b50d84a6214bd Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sat, 11 Mar 2023 20:17:05 -0500 Subject: [PATCH] pokken: remove setup(), ssl config options, change matching uri --- titles/pokken/base.py | 2 +- titles/pokken/config.py | 13 ------------- titles/pokken/index.py | 43 +++++------------------------------------ 3 files changed, 6 insertions(+), 52 deletions(-) diff --git a/titles/pokken/base.py b/titles/pokken/base.py index f1f9eb3..ca4f0b1 100644 --- a/titles/pokken/base.py +++ b/titles/pokken/base.py @@ -38,7 +38,7 @@ class PokkenBase: "MatchingServer": { "host": f"https://{self.game_cfg.server.hostname}", "port": self.game_cfg.server.port_matching, - "url": "/matching", + "url": "SDAK/100/matching", }, "StunServer": { "addr": self.game_cfg.server.hostname, diff --git a/titles/pokken/config.py b/titles/pokken/config.py index 3907838..608bbd7 100644 --- a/titles/pokken/config.py +++ b/titles/pokken/config.py @@ -55,19 +55,6 @@ class PokkenServerConfig: self.__config, "pokken", "server", "port_admission", default=9004 ) - @property - def ssl_cert(self) -> str: - return CoreConfig.get_config_field( - self.__config, "pokken", "server", "ssl_cert", default="cert/pokken.crt" - ) - - @property - def ssl_key(self) -> str: - return CoreConfig.get_config_field( - self.__config, "pokken", "server", "ssl_key", default="cert/pokken.key" - ) - - class PokkenConfig(dict): def __init__(self) -> None: self.server = PokkenServerConfig(self) diff --git a/titles/pokken/index.py b/titles/pokken/index.py index d03d619..8d8ef4c 100644 --- a/titles/pokken/index.py +++ b/titles/pokken/index.py @@ -65,16 +65,9 @@ class PokkenServlet(resource.Resource): if not game_cfg.server.enable: return (False, "", "") - # if core_cfg.server.is_develop: - # return ( - # True, - # f"https://{game_cfg.server.hostname}:{game_cfg.server.port}/{game_code}/$v/", - # f"{game_cfg.server.hostname}:{game_cfg.server.port}/", - # ) - return ( True, - f"https://{game_cfg.server.hostname}:443/{game_code}/$v/", + f"https://{game_cfg.server.hostname}:{game_cfg.server.port}/{game_code}/$v/", f"{game_cfg.server.hostname}/SDAK/$v/", ) @@ -94,42 +87,16 @@ class PokkenServlet(resource.Resource): return (True, "PKF2") - def setup(self): - """ - There's currently no point in having this server on because Twisted - won't play ball with both the fact that it's TLSv1.1, and because the - types of certs that pokken will accept are too flimsy for Twisted - so it will throw a fit. Currently leaving this here in case a bypass - is discovered in the future, but it's unlikly. For now, just use NGINX. - """ - if self.game_cfg.server.enable and self.core_cfg.server.is_develop: - key_exists = path.exists(self.game_cfg.server.ssl_key) - cert_exists = path.exists(self.game_cfg.server.ssl_cert) - - if key_exists and cert_exists: - endpoints.serverFromString( - reactor, - f"ssl:{self.game_cfg.server.port}" - f":interface={self.core_cfg.server.listen_address}:privateKey={self.game_cfg.server.ssl_key}:" - f"certKey={self.game_cfg.server.ssl_cert}", - ).listen(server.Site(self)) - - self.logger.info( - f"Pokken title server ready on port {self.game_cfg.server.port}" - ) - - else: - self.logger.error( - f"Could not find cert at {self.game_cfg.server.ssl_key} or key at {self.game_cfg.server.ssl_cert}, Pokken not running." - ) + def setup(self) -> None: + # TODO: Setup matching, stun, turn and admission servers + pass def render_POST( self, request: Request, version: int = 0, endpoints: str = "" ) -> bytes: - if endpoints == "": - endpoints = request.uri.decode() if endpoints.startswith("/matching"): self.logger.info("Matching request") + self.logger.debug(request.content) content = request.content.getvalue() if content == b"":