]> git.ipfire.org Git - people/shoehn/ipfire.org.git/blobdiff - webapp/__init__.py
planet: Add a view counter for the posts
[people/shoehn/ipfire.org.git] / webapp / __init__.py
index 3dfdbecf35a13a3f6479755ecf8531ec1f06474b..6cab6c0d7ab31054e8ddbfeaf72b8eabcd298257 100644 (file)
@@ -36,7 +36,9 @@ class Application(tornado.web.Application):
                        ui_modules = {
                                "Advertisement"        : AdvertisementModule,
                                "DonationBox"          : DonationBoxModule,
+                               "DonationButton"       : DonationButtonModule,
                                "DownloadButton"       : DownloadButtonModule,
+                               "LanguageName"         : LanguageNameModule,
                                "Map"                  : MapModule,
                                "Menu"                 : MenuModule,
                                "MirrorItem"           : MirrorItemModule,
@@ -50,16 +52,19 @@ class Application(tornado.web.Application):
                                "NewsYearNavigation"   : NewsYearNavigationModule,
                                "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,
+                               "TalkOngoingCalls"     : TalkOngoingCallsModule,
                                "TrackerPeerList"      : TrackerPeerListModule,
                                "Wish"                 : WishModule,
                                "Wishlist"             : WishlistModule,
+                               "WishlistItems"        : WishlistItemsModule,
                        },
                        xsrf_cookies = True,
                )
@@ -74,6 +79,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,11 +93,10 @@ 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),
-                       (r"/downloads", tornado.web.RedirectHandler, { "url" : "/download" }),
+                       (r"/download", tornado.web.RedirectHandler, { "url" : "http://downloads.ipfire.org/latest" }),
+                       (r"/downloads", tornado.web.RedirectHandler, { "url" : "http://downloads.ipfire.org/latest" }),
 
                        # Handle old pages that have moved elsewhere
                        (r"/screenshots", tornado.web.RedirectHandler, { "url" : "/about" }),
@@ -95,7 +104,9 @@ class Application(tornado.web.Application):
                        (r"/support", tornado.web.RedirectHandler, { "url" : "/getinvolved" }),
                        (r"/features/.*", tornado.web.RedirectHandler, { "url" : "/features" }),
 
-                       (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 +120,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 +136,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),
@@ -145,34 +156,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,7 +210,7 @@ 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
@@ -196,13 +223,14 @@ class Application(tornado.web.Application):
                ])
 
                # 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 +239,31 @@ 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),
+                       (r"/trunks", TalkTrunksHandler),
+               ] + 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 +281,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 +308,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