]> git.ipfire.org Git - people/shoehn/ipfire.org.git/blobdiff - webapp/__init__.py
netboot: Allow booting multiple architectures
[people/shoehn/ipfire.org.git] / webapp / __init__.py
index 3dfdbecf35a13a3f6479755ecf8531ec1f06474b..a6d380baf082e8a06ef7d216b8c527acc8b74ade 100644 (file)
@@ -36,7 +36,10 @@ class Application(tornado.web.Application):
                        ui_modules = {
                                "Advertisement"        : AdvertisementModule,
                                "DonationBox"          : DonationBoxModule,
+                               "DonationButton"       : DonationButtonModule,
+                               "DonationInputBox"     : DonationInputBoxModule,
                                "DownloadButton"       : DownloadButtonModule,
+                               "LanguageName"         : LanguageNameModule,
                                "Map"                  : MapModule,
                                "Menu"                 : MenuModule,
                                "MirrorItem"           : MirrorItemModule,
@@ -48,18 +51,23 @@ class Application(tornado.web.Application):
                                "NewsLine"             : NewsLineModule,
                                "NewsTable"            : NewsTableModule,
                                "NewsYearNavigation"   : NewsYearNavigationModule,
+                               "PlanetAuthorBox"      : PlanetAuthorBoxModule,
                                "PlanetEntry"          : PlanetEntryModule,
                                "PlanetSearchBox"      : PlanetSearchBoxModule,
+                               "ProgressBar"          : ProgressBarModule,
                                "ReleaseItem"          : ReleaseItemModule,
                                "SidebarBanner"        : SidebarBannerModule,
                                "SidebarRelease"       : SidebarReleaseModule,
-                               "StasyTable"           : StasyTableModule,
-                               "StasyCPUCoreTable"    : StasyCPUCoreTableModule,
-                               "StasyDeviceTable"     : StasyDeviceTableModule,
-                               "StasyGeoTable"        : StasyGeoTableModule,
+                               "FireinfoDeviceTable"     : FireinfoDeviceTableModule,
+                               "FireinfoDeviceAndGroupsTable" : FireinfoDeviceAndGroupsTableModule,
+                               "FireinfoGeoTable"        : FireinfoGeoTableModule,
+                               "TalkCallLog"          : TalkCallLogModule,
+                               "TalkLines"            : TalkLinesModule,
+                               "TalkOngoingCalls"     : TalkOngoingCallsModule,
                                "TrackerPeerList"      : TrackerPeerListModule,
                                "Wish"                 : WishModule,
                                "Wishlist"             : WishlistModule,
+                               "WishlistItems"        : WishlistItemsModule,
                        },
                        xsrf_cookies = True,
                )
@@ -74,6 +82,11 @@ class Application(tornado.web.Application):
                        (r"/(robots\.txt)", tornado.web.StaticFileHandler, dict(path = static_path)),
                ]
 
+               authentication_handlers = [
+                       (r"/login", LoginHandler),
+                       (r"/logout", LogoutHandler),
+               ]
+
                self.add_handlers(r"(dev|www)\.ipfire\.(at|org)", [
                        # Entry site that lead the user to index
                        (r"/", IndexHandler),
@@ -83,7 +96,6 @@ class Application(tornado.web.Application):
                        (r"/news", NewsIndexHandler),
                        (r"/news/year/([0-9]*)", NewsYearHandler),
                        (r"/news/(.*)", NewsItemHandler),
-                       (r"/author/(.*)", NewsAuthorHandler),
 
                        # Download sites
                        (r"/download", DownloadHandler),
@@ -92,10 +104,12 @@ class Application(tornado.web.Application):
                        # 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"/features/.*", tornado.web.RedirectHandler, { "url" : "/features" }),
+                       (r"/getinvolved", tornado.web.RedirectHandler, { "url" : "/get-involved" }),
 
-                       (r"/donate", tornado.web.RedirectHandler, { "url" : "/donation" }),
+                       # Donate
+                       (r"/donate", DonateHandler),
+                       (r"/donation", tornado.web.RedirectHandler, { "url" : "/donate" }),
 
                        # RSS feed
                        (r"/news.rss", RSSNewsHandler),
@@ -109,7 +123,7 @@ class Application(tornado.web.Application):
                ])
 
                # downloads.ipfire.org
-               self.add_handlers(r"downloads?\.ipfire\.org", [
+               self.add_handlers(r"downloads?(\.dev)?\.ipfire\.org", [
                        (r"/", DownloadsIndexHandler),
                        (r"/latest", DownloadsLatestHandler),
                        (r"/release/(\d)", DownloadsReleaseHandler),
@@ -125,7 +139,7 @@ class Application(tornado.web.Application):
                ])
 
                # mirrors.ipfire.org
-               self.add_handlers(r"mirrors\.ipfire\.org", [
+               self.add_handlers(r"mirrors(\.dev)?\.ipfire\.org", [
                        (r"/", MirrorIndexHandler),
                        (r"/mirror/(.*)", MirrorItemHandler),
                        (r"/lists/pakfire2", MirrorListPakfire2Handler),
@@ -134,6 +148,7 @@ class Application(tornado.web.Application):
                # planet.ipfire.org
                self.add_handlers(r"planet(\.dev)?\.ipfire\.org", [
                        (r"/", PlanetMainHandler),
+                       (r"/hottest", PlanetHotEntriesHandler),
                        (r"/post/([A-Za-z0-9_-]+)", PlanetPostingHandler),
                        (r"/user/([a-z0-9_-]+)", PlanetUserHandler),
                        (r"/search", PlanetSearchHandler),
@@ -145,34 +160,50 @@ class Application(tornado.web.Application):
                        (r"/news.rss", tornado.web.RedirectHandler, { "url" : "/rss" }),
                ] + static_handlers)
 
-               # 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),
-                       (r"/model/(pci|usb)/([0-9a-f]{4})/([0-9a-f]{4})", StasyStatsModelDetail),
+               # fireinfo.ipfire.org
+               self.add_handlers(r"fireinfo(\.dev)?\.ipfire\.org", [
+                       (r"/", FireinfoIndexHandler),
+                       (r"/device/driver/(.*)", FireinfoDeviceDriverDetail),
+                       (r"/device/vendors", FireinfoDeviceVendorsHandler),
+                       (r"/device/(pci|usb)/([0-9a-f]{4})", FireinfoDeviceVendorHandler),
+                       (r"/device/(pci|usb)/([0-9a-f]{4})/([0-9a-f]{4})", FireinfoDeviceModelHandler),
+
+                       # Show profiles
+                       (r"/profile/random", FireinfoRandomProfileHandler),
+                       (r"/profile/([a-z0-9]{40})", FireinfoProfileDetailHandler),
 
                        # Send profiles.
-                       (r"/send/([a-z0-9]+)", StasyProfileSendHandler),
-
-                       # Stats handlers                        
-                       (r"/stats", StasyStatsHandler),
-                       (r"/stats/cpus", StasyStatsCPUHandler),
-                       (r"/stats/cpuflags", StasyStatsCPUFlagsHandler),
-                       (r"/stats/geo", StasyStatsGeoHandler),
-                       (r"/stats/memory", StasyStatsMemoryHandler),
-                       (r"/stats/network", StasyStatsNetworkHandler),
-                       (r"/stats/oses", StasyStatsOSesHandler),
-                       (r"/stats/virtual", StasyStatsVirtualHandler),
+                       (r"/send/([a-z0-9]+)", FireinfoProfileSendHandler),
+
+                       # Stats handlers
+                       (r"/statistics", FireinfoStatsHandler),
+                       (r"/statistics/processors", FireinfoStatsProcessorsHandler),
+                       (r"/statistics/processors/(arm|x86)", FireinfoStatsProcessorDetailHandler),
+                       (r"/statistics/geo-locations", FireinfoStatsGeoHandler),
+                       (r"/statistics/languages", FireinfoStatsLanguagesHandler),
+                       (r"/statistics/memory", FireinfoStatsMemoryHandler),
+                       (r"/statistics/networking", FireinfoStatsNetworkingHandler),
+                       (r"/statistics/releases", FireinfoStatsReleasesHandler),
+                       (r"/statistics/virtualization", FireinfoStatsVirtualHandler),
+
+                       # Compat handlers
+                       (r"/stats", tornado.web.RedirectHandler, { "url" : "/statistics" }),
+                       (r"/stats/cpus", tornado.web.RedirectHandler, { "url" : "/statistics/processors" }),
+                       (r"/stats/geo", tornado.web.RedirectHandler, { "url" : "/statistics/geo-locations" }),
+                       (r"/stats/network", tornado.web.RedirectHandler, { "url" : "/statistics/networking" }),
+                       (r"/stats/oses", tornado.web.RedirectHandler, { "url" : "/statistics/releases" }),
+                       (r"/stats/virtual", tornado.web.RedirectHandler, { "url" : "/statistics/virtualization" }),
+                       (r"/vendor/(pci|usb)/([0-9a-f]{4})", FireinfoDeviceVendorCompatHandler),
+                       (r"/model/(pci|usb)/([0-9a-f]{4})/([0-9a-f]{4})", FireinfoDeviceModelCompatHandler),
                ] + static_handlers)
 
                # i-use.ipfire.org
-               self.add_handlers(r"i-use\.ipfire\.org", [
+               self.add_handlers(r"i-use(\.dev)?\.ipfire\.org", [
                        (r"/profile/([a-f0-9]{40})/([0-9]+).png", IUseImage),
                ])
 
                # tracker.ipfire.org
-               self.add_handlers(r"(torrent|tracker)\.ipfire\.org", [
+               self.add_handlers(r"(torrent|tracker)(\.dev)?\.ipfire\.org", [
                        (r"/", TrackerIndexHandler),
                        (r"/announce.*", TrackerAnnounceHandler),
                        (r"/scrape", TrackerScrapeHandler),
@@ -183,26 +214,28 @@ class Application(tornado.web.Application):
 
                # boot.ipfire.org
                BOOT_STATIC_PATH = os.path.join(self.settings["static_path"], "netboot")
-               self.add_handlers(r"boot\.ipfire\.org", [
+               self.add_handlers(r"boot(\.dev)?\.ipfire\.org", [
                        (r"/", tornado.web.RedirectHandler, { "url" : "http://www.ipfire.org/download" }),
 
                        # Configurations
+                       (r"/premenu.cfg", PremenuCfgHandler),
                        (r"/menu.gpxe", MenuGPXEHandler),
                        (r"/menu.cfg", MenuCfgHandler),
 
                        # Static files
-                       (r"/(boot\.png|premenu\.cfg|pxelinux\.0|menu\.c32|vesamenu\.c32)",
+                       (r"/(boot\.png|pxelinux\.0|menu\.c32|vesamenu\.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)
+               self.add_handlers(r"nopaste(\.dev)?\.ipfire\.org", [
+                       (r"/", NopasteCreateHandler),
+                       (r"/raw/(.*)", NopasteRawHandler),
+                       (r"/view/(.*)", NopasteViewHandler),
+               ] + authentication_handlers + static_handlers)
 
                # wishlist.ipfire.org
-               self.add_handlers(r"wishlist\.ipfire\.org", [
+               self.add_handlers(r"wishlist(\.dev)?\.ipfire\.org", [
                        (r"/", WishlistIndexHandler),
                        (r"/closed", WishlistClosedHandler),
                        (r"/wish/(.*)/donate", WishDonateHandler),
@@ -211,15 +244,30 @@ class Application(tornado.web.Application):
                ] + static_handlers)
 
                # geoip.ipfire.org
-               self.add_handlers(r"geoip\.ipfire\.org", [
+               self.add_handlers(r"geoip(\.dev)?\.ipfire\.org", [
                        (r"/", GeoIPHandler),
                ] + static_handlers)
 
+               # talk.ipfire.org
+               self.add_handlers(r"talk(\.dev)?\.ipfire\.org", [
+                       (r"/", TalkIndexHandler),
+                       (r"/call/(\d+)", TalkInitiateCallHandler),
+                       (r"/conferences", TalkConferencesHandler),
+                       (r"/conferences/(\d+)/invite/(\d+)", TalkConferencesInviteHandler),
+                       (r"/diagnosis", TalkDiagnosisHandler),
+                       (r"/phonebook/(\w+)", TalkPhonebookAccountHandler),
+                       (r"/phonebook", TalkPhonebookHandler),
+                       (r"/profile", TalkProfileHandler),
+               ] + authentication_handlers + static_handlers)
+
+               # accounts.ipfire.org
+               self.add_handlers(r"accounts(\.dev)?\.ipfire\.org", [
+                       (r"/avatar/(\w+)\.jpg", AccountsAvatarHandler),
+               ] + static_handlers)
+
                # admin.ipfire.org
                self.add_handlers(r"admin(\.dev)?\.ipfire\.org", [
                        (r"/", AdminIndexHandler),
-                       (r"/login", AdminLoginHandler),
-                       (r"/logout", AdminLogoutHandler),
                        # Accounts
                        (r"/accounts", AdminAccountsHandler),
                        #(r"/accounts/delete/([0-9]+)", AdminAccountsDeleteHandler),
@@ -237,13 +285,13 @@ class Application(tornado.web.Application):
                        (r"/mirrors/details/([0-9]+)", AdminMirrorsDetailsHandler),
                        (r"/mirrors/update", AdminMirrorsUpdateHandler),
                        # Fireinfo
-                       (r"/fireinfo/stats", AdminFireinfoStatsHandler),
+                       (r"/fireinfo", AdminFireinfoHandler),
                        # Downloads
                        (r"/downloads", AdminDownloadsHandler),
                        (r"/downloads/mirrors", AdminDownloadsMirrorsHandler),
                        # API
                        (r"/api/planet/render", AdminApiPlanetRenderMarkupHandler)
-               ] + static_handlers)
+               ] + authentication_handlers + static_handlers)
 
                # ipfire.org
                self.add_handlers(r".*", [
@@ -264,7 +312,8 @@ class Application(tornado.web.Application):
                        if not configfile:
                                raise RuntimeException("Could not find configuration file")
 
-                       self.__backend = backend.Backend(configfile=configfile)
+                       self.__backend = backend.Backend(configfile=configfile,
+                               debug=self.settings.get("debug", False))
 
                return self.__backend