From 5ab04c910ac16afd4296ab875d443672adf51671 Mon Sep 17 00:00:00 2001 From: cynic Date: Wed, 16 Nov 2022 10:03:14 -0500 Subject: [PATCH] port-independent host sub --- cathedral.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cathedral.py b/cathedral.py index 1462eea..a3541b1 100644 --- a/cathedral.py +++ b/cathedral.py @@ -12,9 +12,10 @@ class cathedral(): async def handle_http(self, r): for t in self.towers: for h in t.hooks: - if compile(h.replace("$HOST", self.cfg.get("host") if self.cfg.get("port") == 80 else self.cfg.get("host")+":"+str(self.cfg.get("port")))).match(str(r.url)): + print(str(r.host)[str(r.host).find(self.cfg.get("host")):]) + if compile(h.replace("$HOST", str(r.host)[str(r.host).find(self.cfg.get("host")):])).match(str(r.url)): return web.Response(**t.run(self, r)) - return web.Response(body=f"lol dongs {r.url}") + return web.Response(body=f"usergroup homepage") async def start_http(self): srv = web.Server(self.handle_http) runner = web.ServerRunner(srv)