From: Michael Tremer Date: Thu, 29 Mar 2018 19:13:51 +0000 (+0100) Subject: Remove mirror list generation from webapp X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c07a6551f0eef625ffbcaf081eaef44ffe783d04;p=ipfire.org.git Remove mirror list generation from webapp Signed-off-by: Michael Tremer --- diff --git a/webapp/__init__.py b/webapp/__init__.py index 30c94d14..6dafc3e6 100644 --- a/webapp/__init__.py +++ b/webapp/__init__.py @@ -142,7 +142,6 @@ class Application(tornado.web.Application): self.add_handlers(r"mirrors(\.dev)?\.ipfire\.org", [ (r"/", MirrorIndexHandler), (r"/mirror/(.*)", MirrorItemHandler), - (r"/lists/pakfire2", MirrorListPakfire2Handler), ] + static_handlers) # planet.ipfire.org diff --git a/webapp/backend/mirrors.py b/webapp/backend/mirrors.py index 042c0b61..60bd7793 100644 --- a/webapp/backend/mirrors.py +++ b/webapp/backend/mirrors.py @@ -99,17 +99,6 @@ class Mirrors(Object): return MirrorSet(self.backend, sorted(mirrors)) - def get_all_up(self): - res = self.db.query("SELECT * FROM mirrors WHERE enabled = %s AND state = %s \ - ORDER BY hostname", True, "UP") - - mirrors = [] - for row in res: - m = Mirror(self.backend, row.id, row) - mirrors.append(m) - - return MirrorSet(self.backend, mirrors) - def get_by_hostname(self, hostname): ret = self.db.get("SELECT * FROM mirrors WHERE hostname = %s", hostname) diff --git a/webapp/handlers_mirrors.py b/webapp/handlers_mirrors.py index 75a251ac..6ccaf6a5 100644 --- a/webapp/handlers_mirrors.py +++ b/webapp/handlers_mirrors.py @@ -55,47 +55,3 @@ class MirrorAllHandler(BaseHandler): class MirrorDetailHandler(BaseHandler): def get(self, id): self.render("download-mirror-detail.html", mirror=self.mirrors.get(id)) - - -class MirrorListPakfire2Handler(BaseHandler): - def get(self): - suffix = self.get_argument("suffix", "") - development = self.get_argument("development", None) - - self.set_header("Content-Type", "text/plain") - - # Get all mirror servers that are currently up. - mirrors = self.mirrors.get_all_up() - - lines = [] - for m in mirrors: - if not m.mirrorlist: - continue - - # Skip all non-development mirrors - # if we run in development mode. - if development and not m.development: - continue - - path = [m.path, "pakfire2"] - - if suffix: - path.append(suffix) - - path = "/".join(path) - - # Remove double slashes. - path = path.replace("//", "/") - - # Remove leading slash. - if path.startswith("/"): - path = path[1:] - - # Remove trailing slash. - if path.endswith("/"): - path = path[:-1] - - line = ("HTTP", m.hostname, path, "") - lines.append(";".join(line)) - - self.finish("\r\n".join(lines))