]> git.ipfire.org Git - ipfire.org.git/blobdiff - src/web/__init__.py
backend: show checksum on thank-you page
[ipfire.org.git] / src / web / __init__.py
index cdb534c1b5f0e6c31406a19093c88898984dd89c..dfc72eaa1212e30f246913f2dc7d6bc99ebb17d1 100644 (file)
@@ -14,6 +14,7 @@ from .. import util
 
 from .handlers import *
 
+from . import analytics
 from . import auth
 from . import blog
 from . import boot
@@ -40,6 +41,9 @@ class Application(tornado.web.Application):
 
                        # Enable XSRF cookies
                        "xsrf_cookies" : True,
+                       "xsrf_cookie_kwargs" : {
+                               "secure" : True,
+                       },
 
                        # Login
                        "login_url" : "/login",
@@ -60,6 +64,9 @@ class Application(tornado.web.Application):
 
                        # UI Modules
                        "ui_modules" : {
+                               # Analytics
+                               "AnalyticsSummary"     : analytics.SummaryModule,
+
                                # Auth
                                "Password"             : auth.PasswordModule,
 
@@ -114,10 +121,14 @@ class Application(tornado.web.Application):
                        (r"/logout", auth.LogoutHandler),
                ]
 
-               self.add_handlers(r"(www\.)?([a-z]+\.dev\.)?ipfire\.org", [
+               self.add_handlers(r"www\.([a-z]+\.dev\.)?ipfire\.org", [
                        # Entry site that lead the user to index
                        (r"/", IndexHandler),
 
+                       # Analytics
+                       (r"/analytics", analytics.IndexHandler),
+                       (r"/analytics/docs", analytics.DocsHandler),
+
                        # Authentication
                        (r"/join", auth.JoinHandler),
                        (r"/login", auth.LoginHandler),
@@ -149,7 +160,7 @@ class Application(tornado.web.Application):
                        (r"/docs(/[A-Za-z0-9\-_\/]+)?/_files", docs.FilesHandler),
                        (r"/docs(/[A-Za-z0-9\-_\/]+(?:.*)\.(?:\w+))/_delete", docs.DeleteFileHandler),
                        (r"/docs(/[A-Za-z0-9\-_\/]+(?:.*)\.(?:\w+))$", docs.FileHandler),
-                       (r"/docs(/[A-Za-z0-9\-_\/]+)?", docs.PageHandler),
+                       (r"/docs(/[A-Za-z0-9\-_\/]*)?", docs.PageHandler),
 
                        # Downloads
                        (r"/downloads", downloads.IndexHandler),
@@ -162,6 +173,18 @@ class Application(tornado.web.Application):
                        (r"/donate", donate.DonateHandler),
                        (r"/donate/thank-you", donate.ThankYouHandler),
                        (r"/donate/error", donate.ErrorHandler),
+                       (r"/donate/check-vat-number", donate.CheckVATNumberHandler),
+
+                       # Fireinfo
+                       (r"/fireinfo/?", fireinfo.IndexHandler),
+                       (r"/fireinfo/admin", fireinfo.AdminIndexHandler),
+                       (r"/fireinfo/vendors", fireinfo.VendorsHandler),
+                       (r"/fireinfo/vendors/(pci|usb)/([0-9a-f]{4})", fireinfo.VendorHandler),
+                       (r"/fireinfo/drivers/(.*)", fireinfo.DriverDetail),
+                       (r"/fireinfo/profile/random", fireinfo.RandomProfileHandler),
+                       (r"/fireinfo/profile/([a-z0-9]{40})", fireinfo.ProfileHandler),
+                       (r"/fireinfo/processors", fireinfo.ProcessorsHandler),
+                       (r"/fireinfo/releases", fireinfo.ReleasesHandler),
 
                        # Lists
                        (r"/lists", lists.IndexHandler),
@@ -171,11 +194,16 @@ class Application(tornado.web.Application):
                        (r"/password\-reset/([a-z_][a-z0-9_-]{0,31})/(\w+)", auth.PasswordResetHandler),
                        (r"/.well-known/change-password", auth.WellKnownChangePasswordHandler),
 
-                       # Projects
-                       (r"/projects/location", location.IndexHandler),
-                       (r"/projects/location/download", StaticHandler, { "template" : "location/download.html" }),
-                       (r"/projects/location/how\-to\-use", StaticHandler, { "template" : "location/how-to-use.html" }),
-                       (r"/projects/location/lookup/(.+)", location.LookupHandler),
+                       # Location
+                       (r"/location/?", StaticHandler, { "template" : "location/index.html" }),
+                       (r"/location/download", tornado.web.RedirectHandler, { "url" : "/location/install" }),
+                       (r"/location/how\-to\-use", StaticHandler, { "template" : "location/how-to-use/index.html" }),
+                       (r"/location/how\-to\-use/cli", StaticHandler, { "template" : "location/how-to-use/cli.html" }),
+                       (r"/location/how\-to\-use/dns", StaticHandler, { "template" : "location/how-to-use/dns.html" }),
+                       (r"/location/how\-to\-use/python", StaticHandler, { "template" : "location/how-to-use/python.html" }),
+                       (r"/location/install", StaticHandler, { "template" : "location/install.html" }),
+                       (r"/location/report\-a\-problem", StaticHandler, { "template" : "location/report-a-problem.html" }),
+                       (r"/location/lookup/(.+)", location.LookupHandler),
 
                        # Single-Sign-On for Discourse
                        (r"/sso/discourse", auth.SSODiscourse),
@@ -203,6 +231,7 @@ class Application(tornado.web.Application):
                        (r"/about",  StaticHandler, { "template" : "static/about.html" }),
                        (r"/legal", StaticHandler, { "template" : "static/legal.html" }),
                        (r"/help", StaticHandler, { "template" : "static/help.html" }),
+                       (r"/partners", StaticHandler, { "template" : "static/partners.html" }),
                        (r"/sitemap",  StaticHandler, { "template" : "static/sitemap.html" }),
 
                        # API
@@ -218,6 +247,7 @@ class Application(tornado.web.Application):
                        (r"/imprint", tornado.web.RedirectHandler, { "url" : "/legal" }),
                        (r"/news.rss", tornado.web.RedirectHandler, { "url" : "/blog/feed.xml" }),
                        (r"/news/(.*)", tornado.web.RedirectHandler, { "url" : "/blog/{0}" }),
+                       (r"/projects(/.*)", tornado.web.RedirectHandler, { "url" : "{0}" }),
                        (r"/support", tornado.web.RedirectHandler, { "url" : "/help"}),
                        (r"/(de|en)/(.*)", tornado.web.RedirectHandler, { "url" : "/{0}"}),
 
@@ -266,32 +296,12 @@ class Application(tornado.web.Application):
 
                # fireinfo.ipfire.org
                self.add_handlers(r"fireinfo\.([a-z]+\.dev\.)?ipfire\.org", [
-                       (r"/", fireinfo.IndexHandler),
-
-                       # Admin
-                       (r"/admin", fireinfo.AdminIndexHandler),
-
-                       # Vendors
-                       (r"/vendors", fireinfo.VendorsHandler),
-                       (r"/vendors/(pci|usb)/([0-9a-f]{4})", fireinfo.VendorHandler),
-
-                       # Driver
-                       (r"/drivers/(.*)", fireinfo.DriverDetail),
-
-                       # Show profiles
-                       (r"/profile/random", fireinfo.RandomProfileHandler),
-                       (r"/profile/([a-z0-9]{40})", fireinfo.ProfileHandler),
-
-                       # Stats
-                       (r"/processors", fireinfo.ProcessorsHandler),
-                       (r"/releases", fireinfo.ReleasesHandler),
-
-                       # Send profiles
+                       # Handle profiles
                        (r"/send/([a-z0-9]+)", fireinfo.ProfileSendHandler),
 
-                       # Serve any static files
-                       (r"/static/(.*)", tornado.web.StaticFileHandler, { "path" : self.settings.get("static_path") }),
-               ] + 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", [
@@ -317,6 +327,9 @@ class Application(tornado.web.Application):
                # nopaste.ipfire.org
                self.add_handlers(r"nopaste\.([a-z]+\.dev\.)?ipfire\.org", [
                        (r"/", nopaste.CreateHandler),
+                       (r"/upload", nopaste.UploadHandler),
+
+                       # View
                        (r"/raw/(.*)", nopaste.RawHandler),
                        (r"/view/(.*)", nopaste.ViewHandler),
 
@@ -326,7 +339,7 @@ class Application(tornado.web.Application):
 
                # location.ipfire.org
                self.add_handlers(r"location\.([a-z]+\.dev\.)?ipfire\.org", [
-                       (r"/(.*)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/projects/location/{0}" }),
+                       (r"(.*)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/location{0}" }),
                ])
 
                # geoip.ipfire.org
@@ -350,12 +363,12 @@ class Application(tornado.web.Application):
 
                # wiki.ipfire.org
                self.add_handlers(r"wiki\.([a-z]+\.dev\.)?ipfire\.org", [
-                       (r"/(.*)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/docs/{0}" }),
+                       (r"(.*)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/docs{0}" }),
                ])
 
                # ipfire.org
-               self.add_handlers(r"(.*)ipfire\.org", [
-                       (r".*", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org" })
+               self.add_handlers(r"([a-z]+\.dev\.)?ipfire\.org", [
+                       (r".*", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/" })
                ])
 
                logging.info("Successfully initialied application")