From 945aff38e90c22b53ccf45689e334a9a35ec4999 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 4 Mar 2024 12:46:04 +0000 Subject: [PATCH] fireinfo: Simplify redirection The redirections didn't work as they incorrectly used the regular expressions. Since there are so many, it probably is best to simply redirect everything as is prefixed with /fireinfo and let the service decide later whether some resource exists. Signed-off-by: Michael Tremer --- src/web/__init__.py | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/src/web/__init__.py b/src/web/__init__.py index 47806f03..b4249fac 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -288,36 +288,14 @@ class Application(tornado.web.Application): (r"/news.rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/feed.xml" }), ]) - # fireinfo.ipfire.org - LEGACY REDIRECTION + # fireinfo.ipfire.org self.add_handlers(r"fireinfo\.([a-z]+\.dev\.)?ipfire\.org", [ + # Handle profiles (r"/fireinfo/send/([a-z0-9]+)", fireinfo.ProfileSendHandler), - (r"/", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo/" }), - - # Admin - (r"/admin", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo/admin" }), - - # Vendors - (r"/vendors", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo/vendors" }), - (r"/vendors/(pci|usb)/([0-9a-f]{4})", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo/vendors/(pci|usb)/([0-9a-f]{4})" }), - - # Driver - (r"/drivers/(.*)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo/drivers/(.*)" }), - - # Show profiles - (r"/profile/random", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo/profile/random" }), - (r"/profile/([a-z0-9]{40})", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo/profile/([a-z0-9]{40})" }), - - # Stats - (r"/processors", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo/processors" }), - (r"/releases", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo/releases" }), - - # Send profiles - (r"/send/([a-z0-9]+)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo/send/([a-z0-9]+)" }), - - # Serve any static files - (r"/static/(.*)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo/static/(.*)" }), - ] + authentication_handlers) + # Redirect anything else + (r"(.*)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/fireinfo{0}" }), + ]) # i-use.ipfire.org self.add_handlers(r"i-use\.([a-z]+\.dev\.)?ipfire\.org", [ -- 2.47.2