]> git.ipfire.org Git - ipfire.org.git/commitdiff
wiki: Redirect to the new docs section
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 1 Jul 2023 10:05:02 +0000 (10:05 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 1 Jul 2023 10:05:02 +0000 (10:05 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/__init__.py
src/web/wiki.py

index 7865964454493f3038b09411c27719a3f04fb163..144787afd5ebf4f2b1b7cff7fd62f6f9fbdc9a9d 100644 (file)
@@ -362,7 +362,7 @@ class Application(tornado.web.Application):
                        (r"/static/(.*)", tornado.web.StaticFileHandler, { "path" : self.settings.get("static_path") }),
 
                        # Render pages
-                       (r"([A-Za-z0-9\-_\/]+)?", wiki.PageHandler),
+                       (r"([A-Za-z0-9\-_\/]+)?", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/docs{0}" }),
                ])
 
                # ipfire.org
index d9ba122abd7d7919ce6a016abacfb995f03051a9..d90fcacb7558b6315f1df3ece442639abc385f30 100644 (file)
@@ -211,89 +211,6 @@ class FilesHandler(base.BaseHandler):
                self.render("wiki/files/index.html", path=path, files=files)
 
 
-class PageHandler(base.BaseHandler):
-       @property
-       def action(self):
-               return self.get_argument("action", None)
-
-       def write_error(self, status_code, **kwargs):
-               # Render a custom page for 404
-               if status_code == 404:
-                       self.render("wiki/404.html", **kwargs)
-                       return
-
-               # Otherwise raise this to one layer above
-               super().write_error(status_code, **kwargs)
-
-       @tornado.web.removeslash
-       def get(self, path):
-               if path is None:
-                       path = "/"
-
-               # Check permissions
-               if not self.backend.wiki.check_acl(path, self.current_user):
-                       raise tornado.web.HTTPError(403, "Access to %s not allowed for %s" % (path, self.current_user))
-
-               # Check if we are asked to render a certain revision
-               revision = self.get_argument("revision", None)
-
-               # Fetch the wiki page
-               page = self.backend.wiki.get_page(path, revision=revision)
-
-               # Diff
-               if self.action == "diff":
-                       # Get both revisions
-                       a = self.get_argument("a")
-                       b = self.get_argument("b")
-
-                       # Fetch both versions of the page
-                       a = self.backend.wiki.get_page(path, revision=a)
-                       b = self.backend.wiki.get_page(path, revision=b)
-                       if not a or not b:
-                               raise tornado.web.HTTPError(404)
-
-                       # Cannot render a diff for the identical page
-                       if a == b:
-                               raise tornado.web.HTTPError(400)
-
-                       # Make sure that b is newer than a
-                       if a > b:
-                               a, b = b, a
-
-                       self.render("wiki/diff.html", page=page, a=a, b=b)
-                       return
-
-               # Restore
-               elif self.action == "restore":
-                       self.render("wiki/confirm-restore.html", page=page)
-                       return
-
-               # Revisions
-               elif self.action == "revisions":
-                       self.render("wiki/revisions.html", page=page)
-                       return
-
-               # If the page does not exist, we send 404
-               if not page or page.was_deleted():
-                       # Handle /start links which were in the format of DokuWiki
-                       if path.endswith("/start"):
-                               # Strip /start from path
-                               path = path[:-6] or "/"
-
-                               # Redirect user to page if it exists
-                               page = self.backend.wiki.page_exists(path)
-                               if page:
-                                       self.redirect(path)
-
-                       raise tornado.web.HTTPError(404)
-
-               # Fetch the latest revision
-               latest_revision = page.get_latest_revision()
-
-               # Render page
-               self.render("wiki/page.html", page=page, latest_revision=latest_revision)
-
-
 class SearchHandler(base.BaseHandler):
        @base.ratelimit(minutes=5, requests=25)
        def get(self):