From 7df998a51a372f06428a3235b443e0fa497cca6d Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Thu, 23 Feb 2023 23:11:43 -0500 Subject: [PATCH] add naomitest endpoint --- core/allnet.py | 4 ++++ index.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/allnet.py b/core/allnet.py index bd2ecce..0594542 100644 --- a/core/allnet.py +++ b/core/allnet.py @@ -234,6 +234,10 @@ class AllnetServlet: self.logger.debug(f"response {vars(resp)}") return resp_str.encode("utf-8") + def handle_naomitest(self, request: Request, _: Dict) -> bytes: + self.logger.info(f"Ping from {request.getClientAddress().host}") + return b"naomi ok" + def kvp_to_dict(self, kvp: List[str]) -> List[Dict[str, Any]]: ret: List[Dict[str, Any]] = [] for x in kvp: diff --git a/index.py b/index.py index 5344ce1..7f28e82 100644 --- a/index.py +++ b/index.py @@ -22,6 +22,7 @@ class HttpDispatcher(resource.Resource): self.title = TitleServlet(cfg, config_dir) self.mucha = MuchaServlet(cfg) + self.map_post.connect('allnet_ping', '/naomitest.html', controller="allnet", action='handle_naomitest', conditions=dict(method=['GET'])) self.map_post.connect('allnet_poweron', '/sys/servlet/PowerOn', controller="allnet", action='handle_poweron', conditions=dict(method=['POST'])) self.map_post.connect('allnet_downloadorder', '/sys/servlet/DownloadOrder', controller="allnet", action='handle_dlorder', conditions=dict(method=['POST'])) self.map_post.connect('allnet_billing', '/request', controller="allnet", action='handle_billing_request', conditions=dict(method=['POST'])) @@ -29,8 +30,8 @@ class HttpDispatcher(resource.Resource): self.map_post.connect('mucha_boardauth', '/mucha/boardauth.do', controller="mucha", action='handle_boardauth', conditions=dict(method=['POST'])) self.map_post.connect('mucha_updatacheck', '/mucha/updatacheck.do', controller="mucha", action='handle_updatacheck', conditions=dict(method=['POST'])) - self.map_get.connect("title_get", "/{game}/{version}/{endpoint:.*?}", controller="title", action="render_GET", requirements=dict(game=R"S...")) - self.map_post.connect("title_post", "/{game}/{version}/{endpoint:.*?}", controller="title", action="render_POST", requirements=dict(game=R"S...")) + self.map_get.connect("title_get", "/{game}/{version}/{endpoint:.*?}", controller="title", action="render_GET", conditions=dict(method=['GET']), requirements=dict(game=R"S...")) + self.map_post.connect("title_post", "/{game}/{version}/{endpoint:.*?}", controller="title", action="render_POST", conditions=dict(method=['POST']), requirements=dict(game=R"S...")) def render_POST(self, request: Request) -> bytes: test = self.map_get.match(request.uri.decode())