]> git.ipfire.org Git - people/shoehn/ipfire.org.git/blobdiff - www/webapp/__init__.py
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire.org
[people/shoehn/ipfire.org.git] / www / webapp / __init__.py
index 06a49214d5f81c061b79a79ea3d5d874be1e7f2f..69e03e3051883c611509603b6aded9399e62d2ab 100644 (file)
@@ -5,9 +5,10 @@ import os.path
 import simplejson
 import tornado.httpserver
 import tornado.locale
-import tornado.options
 import tornado.web
 
+from tornado.options import options
+
 import backend
 
 from handlers import *
@@ -15,19 +16,22 @@ from ui_modules import *
 
 BASEDIR = os.path.join(os.path.dirname(__file__), "..")
 
-tornado.locale.load_translations(os.path.join(BASEDIR, "translations"))
+# Load translations.
+tornado.locale.load_gettext_translations(os.path.join(BASEDIR, "translations"), "webapp")
 
 class Application(tornado.web.Application):
        def __init__(self):
                settings = dict(
                        cookie_secret = "aXBmaXJlY29va2llc2VjcmV0Cg==",
-                       debug = True,
+                       debug = options.debug,
                        gzip = True,
                        login_url = "/login",
                        template_path = os.path.join(BASEDIR, "templates"),
                        ui_modules = {
+                               "DownloadButton" : DownloadButtonModule,
                                "Menu"           : MenuModule,
                                "MirrorItem"     : MirrorItemModule,
+                               "MirrorsTable"   : MirrorsTableModule,
                                "NewsItem"       : NewsItemModule,
                                "NewsLine"       : NewsLineModule,
                                "PlanetEntry"    : PlanetEntryModule,
@@ -35,7 +39,9 @@ class Application(tornado.web.Application):
                                "SidebarBanner"  : SidebarBannerModule,
                                "SidebarRelease" : SidebarReleaseModule,
                                "StasyTable"     : StasyTableModule,
+                               "StasyCPUCoreTable" : StasyCPUCoreTableModule,
                                "StasyDeviceTable" : StasyDeviceTableModule,
+                               "StasyGeoTable"  : StasyGeoTableModule,
                                "TrackerPeerList": TrackerPeerListModule,
                        },
                        xsrf_cookies = True,
@@ -61,7 +67,15 @@ class Application(tornado.web.Application):
                        (r"/author/(.*)", NewsAuthorHandler),
 
                        # Download sites
-                       (r"/downloads?", DownloadHandler),
+                       (r"/download", DownloadHandler),
+                       (r"/downloads", tornado.web.RedirectHandler, { "url" : "/download" }),
+
+                       # Handle old pages that have moved elsewhere
+                       (r"/screenshots", tornado.web.RedirectHandler, { "url" : "/about" }),
+                       (r"/about", tornado.web.RedirectHandler, { "url" : "/features" }),
+                       (r"/support", tornado.web.RedirectHandler, { "url" : "/getinvolved" }),
+
+                       (r"/donate", tornado.web.RedirectHandler, { "url" : "/donation" }),
 
                        # RSS feed
                        (r"/news.rss", RSSNewsHandler),
@@ -83,7 +97,9 @@ class Application(tornado.web.Application):
                        (r"/development", DownloadsDevelopmentHandler),
                        (r"/mirrors", tornado.web.RedirectHandler, { "url" : "http://mirrors.ipfire.org/" }),
                        (r"/source", tornado.web.RedirectHandler, { "url" : "http://source.ipfire.org/" }),
+                       (r"/download-splash", DownloadSplashHandler),
                ] + static_handlers + [
+                       (r"/(iso|torrent)/(.*)", DownloadCompatHandler),
                        (r"/(.*)", DownloadFileHandler),
                ])
 
@@ -105,7 +121,7 @@ class Application(tornado.web.Application):
                ] + static_handlers)
 
                # stasy.ipfire.org
-               self.add_handlers(r"(fireinfo|stasy)\.ipfire\.org", [
+               self.add_handlers(r"fireinfo\.ipfire\.org", [
                        (r"/", StasyIndexHandler),
                        (r"/profile/([a-z0-9]{40})", StasyProfileDetailHandler),
                        (r"/vendor/(pci|usb)/([0-9a-f]{4})", StasyStatsVendorDetail),
@@ -135,6 +151,27 @@ class Application(tornado.web.Application):
                        (r"/torrent/([0-9a-f]+)", TrackerDetailHandler),
                ] + static_handlers)
 
+               # boot.ipfire.org
+               BOOT_STATIC_PATH = os.path.join(self.settings["static_path"], "netboot")
+               self.add_handlers(r"boot\.ipfire\.org", [
+                       (r"/", tornado.web.RedirectHandler, { "url" : "http://www.ipfire.org/download" }),
+
+                       # Configurations
+                       (r"/menu.gpxe", MenuGPXEHandler),
+                       (r"/menu.cfg", MenuCfgHandler),
+                       (r"/config/([0-9]+)/boot.gpxe", BootGPXEHandler),
+
+                       # Static files
+                       (r"/(boot.png|custom.gpxe|premenu.cfg|vesamenu.c32|menu.c32)",
+                               tornado.web.StaticFileHandler, { "path" : BOOT_STATIC_PATH }),
+               ])
+
+               # nopaste.ipfire.org
+               self.add_handlers(r"nopaste\.ipfire\.org", [
+                       (r"/", NopasteIndexHandler),
+                       (r"/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})", NopasteEntryHandler),
+               ] + static_handlers)
+
                # admin.ipfire.org
                self.add_handlers(r"admin\.ipfire\.org", [
                        (r"/", AdminIndexHandler),
@@ -155,6 +192,12 @@ class Application(tornado.web.Application):
                        (r"/mirrors/edit/([0-9]+)", AdminMirrorsEditHandler),
                        (r"/mirrors/details/([0-9]+)", AdminMirrorsDetailsHandler),
                        (r"/mirrors/update", AdminMirrorsUpdateHandler),
+                       # Fireinfo
+                       (r"/fireinfo/stats", AdminFireinfoStatsHandler),
+                       # Downloads
+                       (r"/downloads", AdminDownloadsHandler),
+                       (r"/downloads/mirrors", AdminDownloadsMirrorsHandler),
+                       (r"/downloads/test", AdminDownloadsGraphHandler),
                        # API
                        (r"/api/planet/render", AdminApiPlanetRenderMarkupHandler)
                ] + static_handlers)