From: Michael Tremer Date: Tue, 30 Dec 2025 16:29:50 +0000 (+0000) Subject: dnsbl: Move the list sources to an extra page X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3f2697217d449dee1804806116daf9a14fa32b4;p=ipfire.org.git dnsbl: Move the list sources to an extra page Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 8118bdc8..cde06b00 100644 --- a/Makefile.am +++ b/Makefile.am @@ -192,6 +192,7 @@ templates_dnsbldir = $(templatesdir)/dnsbl templates_dnsbl_lists_DATA = \ src/templates/dnsbl/lists/index.html \ src/templates/dnsbl/lists/reports.html \ + src/templates/dnsbl/lists/sources.html \ src/templates/dnsbl/lists/show.html templates_dnsbl_listsdir = $(templates_dnsbldir)/lists diff --git a/src/templates/dnsbl/lists/show.html b/src/templates/dnsbl/lists/show.html index 551e0f6b..31568491 100644 --- a/src/templates/dnsbl/lists/show.html +++ b/src/templates/dnsbl/lists/show.html @@ -193,66 +193,4 @@ rpz: - - {# Sources #} - {% if sources %} -
-
-
{{ _("Sources") }}
- - - - - - - - - - - - - - {% for source in sorted(sources) %} - - - - - - - - {% end %} - -
- {{ _("Name") }} - - {{ _("Last Update") }} - - {{ _("Listed Domains") }} -
- - {{ source.name }} - - -
- - - {{ source.license }} - -
- {{ locale.format_date(source.updated_at, shorter=True) }} - - {{ format_number(source.total_domains) }} - -
- - {# Dead Domains #} - {% if source.total_domains and source.dead_domains %} - - {{ _("Dead Domains: %s") % format_percent(source.dead_domains / source.total_domains) }} - - {% end %} -
-
-
- {% end %} {% end block %} diff --git a/src/templates/dnsbl/lists/sources.html b/src/templates/dnsbl/lists/sources.html new file mode 100644 index 00000000..1ccf3e91 --- /dev/null +++ b/src/templates/dnsbl/lists/sources.html @@ -0,0 +1,107 @@ +{% extends "../../base.html" %} + +{% block head %} + {% module OpenGraph( + title=_("IPFire DNSBL - %s - Sources") % list, + description=list.description, + ) %} +{% end block %} + +{% block title %}{{ _("IPFire DNSBL") }} - {{ list }} - {{ _("Sources") }}{% end block %} + +{% block container %} +
+
+
+ + +

+ {{ _("Sources: %s") % list }} +

+
+
+
+ +
+
+
{{ _("Sources") }}
+ + + + + + + + + + + + + + {% for source in sorted(sources) %} + + + + + + + + {% end %} + +
+ {{ _("Name") }} + + {{ _("Last Update") }} + + {{ _("Listed Domains") }} +
+ + {{ source.name }} + + +
+ + + {{ source.license }} + +
+ {{ locale.format_date(source.updated_at, shorter=True) }} + + {{ format_number(source.total_domains) }} + +
+ + {# Dead Domains #} + {% if source.total_domains and source.dead_domains %} + + {{ _("Dead Domains: %s") % format_percent(source.dead_domains / source.total_domains) }} + + {% end %} +
+
+
+{% end block %} diff --git a/src/web/__init__.py b/src/web/__init__.py index 8778e521..1e1e440f 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -218,6 +218,7 @@ class Application(tornado.web.Application): (r"/dnsbl/lists", dnsbl.ListsHandler), (r"/dnsbl/lists/(\w+)", dnsbl.ListHandler), (r"/dnsbl/lists/(\w+)/reports", dnsbl.ListReportsHandler), + (r"/dnsbl/lists/(\w+)/sources", dnsbl.ListSourcesHandler), (r"/dnsbl/report", dnsbl.SubmitReportHandler), (r"/dnsbl/reports/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})", dnsbl.ReportHandler), (r"/dnsbl/search", dnsbl.SearchHandler), diff --git a/src/web/dnsbl.py b/src/web/dnsbl.py index 3abee1c8..22a22490 100644 --- a/src/web/dnsbl.py +++ b/src/web/dnsbl.py @@ -28,14 +28,8 @@ class ListHandler(base.AnalyticsMixin, BaseHandler): if not list: raise tornado.web.HTTPError(404, "Could not find list '%s'" % slug) - # Fetch the sources - sources = await list.get_sources() - - # Fetch some recent reports - reports = await list.get_reports(limit=25) - # Render the page - self.render("dnsbl/lists/show.html", list=list, sources=sources, reports=reports) + self.render("dnsbl/lists/show.html", list=list) class ListReportsHandler(base.AnalyticsMixin, BaseHandler): @@ -52,6 +46,20 @@ class ListReportsHandler(base.AnalyticsMixin, BaseHandler): self.render("dnsbl/lists/reports.html", list=list, reports=reports) +class ListSourcesHandler(base.AnalyticsMixin, BaseHandler): + async def get(self, slug): + # Fetch the list + list = await self.backend.dnsbl.get_list(slug) + if not list: + raise tornado.web.HTTPError(404, "Could not find list '%s'" % slug) + + # Fetch the sources + sources = await list.get_sources() + + # Render the page + self.render("dnsbl/lists/sources.html", list=list, sources=sources) + + class SubmitReportHandler(base.AnalyticsMixin, BaseHandler): async def get(self): # Fetch all lists