]> git.ipfire.org Git - ipfire.org.git/blobdiff - src/web/__init__.py
location: Add new location subdomain
[ipfire.org.git] / src / web / __init__.py
index 1c619adfbea7bae991901409d1cf987c3ddce0b6..686bbd21da62bd2d80d244a41e755a977e6dcda5 100644 (file)
@@ -12,6 +12,7 @@ from handlers import *
 from ui_modules import *
 
 from . import blog
+from . import location
 
 BASEDIR = os.path.join(os.path.dirname(__file__), "..")
 
@@ -39,11 +40,15 @@ class Application(tornado.web.Application):
                                "format_month_name" : self.format_month_name,
                        },
                        "ui_modules" : {
+                               # Blog
                                "BlogHistoryNavigation": blog.HistoryNavigationModule,
                                "BlogList"             : blog.ListModule,
                                "BlogPost"             : blog.PostModule,
                                "BlogPosts"            : blog.PostsModule,
 
+                               # Location
+                               "Map"                  : MapModule,
+
                                # Old modules
                                "Advertisement"        : AdvertisementModule,
                                "DonationBox"          : DonationBoxModule,
@@ -51,7 +56,6 @@ class Application(tornado.web.Application):
                                "DonationInputBox"     : DonationInputBoxModule,
                                "DownloadButton"       : DownloadButtonModule,
                                "LanguageName"         : LanguageNameModule,
-                               "Map"                  : MapModule,
                                "Menu"                 : MenuModule,
                                "MirrorItem"           : MirrorItemModule,
                                "MirrorsTable"         : MirrorsTableModule,
@@ -226,9 +230,15 @@ class Application(tornado.web.Application):
                        (r"/view/(.*)", NopasteViewHandler),
                ] + authentication_handlers)
 
+               # location.ipfire.org
+               self.add_handlers(r"location(\.dev)?\.ipfire\.org", [
+                       (r"/", location.IndexHandler),
+                       (r"/lookup/(.+)", location.LookupHandler),
+               ])
+
                # geoip.ipfire.org
                self.add_handlers(r"geoip(\.dev)?\.ipfire\.org", [
-                       (r"/", GeoIPHandler),
+                       (r"/", tornado.web.RedirectHandler, { "url" : "https://location.ipfire.org/" }),
                ])
 
                # talk.ipfire.org