]> git.ipfire.org Git - ipfire.org.git/commitdiff
dnsbl: Move the list sources to an extra page
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Dec 2025 16:29:50 +0000 (16:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Dec 2025 16:29:50 +0000 (16:29 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/dnsbl/lists/show.html
src/templates/dnsbl/lists/sources.html [new file with mode: 0644]
src/web/__init__.py
src/web/dnsbl.py

index 8118bdc88da9e14c6eccebfe510016b68a900fcc..cde06b0074e0b7e303afc0eac3b7c6d06a320510 100644 (file)
@@ -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
index 551e0f6bf950101cd3293a582947071293a3b737..3156849102535596afe92bfbb39732edf902ed05 100644 (file)
@@ -193,66 +193,4 @@ rpz:
                        </div>
                </div>
        </section>
-
-       {# Sources #}
-       {% if sources %}
-               <section class="section">
-                       <div class="container">
-                               <h5 class="title is-5">{{ _("Sources") }}</h5>
-
-                               <table class="table is-fullwidth is-striped is-hoverable is-narrow">
-                                       <thead>
-                                               <tr>
-                                                       <th>
-                                                               {{ _("Name") }}
-                                                       </th>
-
-                                                       <th class="has-text-right">
-                                                               {{ _("Last Update") }}
-                                                       </th>
-
-                                                       <th class="has-text-right">
-                                                               {{ _("Listed Domains") }}
-                                                       </th>
-                                               </tr>
-                                       </thead>
-
-                                       <tbody>
-                                               {% for source in sorted(sources) %}
-                                                       <tr>
-                                                               <td>
-                                                                       <a href="{{ source.url }}" target="_blank">
-                                                                               {{ source.name }}
-                                                                       </a>
-
-                                                                       <br>
-
-                                                                       <small class="has-text-grey">
-                                                                               {{ source.license }}
-                                                                       </small>
-                                                               </td>
-
-                                                               <td class="has-text-right">
-                                                                       {{ locale.format_date(source.updated_at, shorter=True) }}
-                                                               </td>
-
-                                                               <td class="has-text-right">
-                                                                       {{ format_number(source.total_domains) }}
-
-                                                                       <br>
-
-                                                                       {# Dead Domains #}
-                                                                       {% if source.total_domains and source.dead_domains %}
-                                                                               <small>
-                                                                                       {{ _("Dead Domains: %s") % format_percent(source.dead_domains / source.total_domains) }}
-                                                                               </small>
-                                                                       {% end %}
-                                                               </td>
-                                                       </tr>
-                                               {% end %}
-                                       </tbody>
-                               </table>
-                       </div>
-               </section>
-       {% end %}
 {% end block %}
diff --git a/src/templates/dnsbl/lists/sources.html b/src/templates/dnsbl/lists/sources.html
new file mode 100644 (file)
index 0000000..1ccf3e9
--- /dev/null
@@ -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 %}
+       <section class="hero is-dark">
+               <div class="hero-body">
+                       <div class="container">
+                               <nav class="breadcrumb" aria-label="breadcrumbs">
+                                       <ul>
+                                               <li>
+                                                       <a href="/dnsbl">
+                                                               {{ _("IPFire DNSBL") }}
+                                                       </a>
+                                               </li>
+
+                                               <li>
+                                                       <a href="/dnsbl/lists">
+                                                               {{ _("Lists") }}
+                                                       </a>
+                                               </li>
+
+                                               <li>
+                                                       <a href="/dnsbl/lists/{{ list.slug }}">
+                                                               {{ list }}
+                                                       </a>
+                                               </li>
+
+                                               <li class="is-active">
+                                                       <a href="#" aria-current="page">{{ _("Sources") }}</a>
+                                               </li>
+                                       </ul>
+                               </nav>
+
+                               <h1 class="title">
+                                       {{ _("Sources: %s") % list }}
+                               </h1>
+                       </div>
+               </div>
+       </section>
+
+       <section class="section">
+               <div class="container">
+                       <h5 class="title is-5">{{ _("Sources") }}</h5>
+
+                       <table class="table is-fullwidth is-striped is-hoverable is-narrow">
+                               <thead>
+                                       <tr>
+                                               <th>
+                                                       {{ _("Name") }}
+                                               </th>
+
+                                               <th class="has-text-right">
+                                                       {{ _("Last Update") }}
+                                               </th>
+
+                                               <th class="has-text-right">
+                                                       {{ _("Listed Domains") }}
+                                               </th>
+                                       </tr>
+                               </thead>
+
+                               <tbody>
+                                       {% for source in sorted(sources) %}
+                                               <tr>
+                                                       <td>
+                                                               <a href="{{ source.url }}" target="_blank">
+                                                                       {{ source.name }}
+                                                               </a>
+
+                                                               <br>
+
+                                                               <small class="has-text-grey">
+                                                                       {{ source.license }}
+                                                               </small>
+                                                       </td>
+
+                                                       <td class="has-text-right">
+                                                               {{ locale.format_date(source.updated_at, shorter=True) }}
+                                                       </td>
+
+                                                       <td class="has-text-right">
+                                                               {{ format_number(source.total_domains) }}
+
+                                                               <br>
+
+                                                               {# Dead Domains #}
+                                                               {% if source.total_domains and source.dead_domains %}
+                                                                       <small>
+                                                                               {{ _("Dead Domains: %s") % format_percent(source.dead_domains / source.total_domains) }}
+                                                                       </small>
+                                                               {% end %}
+                                                       </td>
+                                               </tr>
+                                       {% end %}
+                               </tbody>
+                       </table>
+               </div>
+       </section>
+{% end block %}
index 8778e5214eb096ac40cbe83e4c2e15351144ef6f..1e1e440fb9fbcbcdbf8241b2bad5847ac8239664 100644 (file)
@@ -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),
index 3abee1c8e57c533b220df9a45d60688330361dfe..22a2249001305172ce129dcefceb0fba81db628a 100644 (file)
@@ -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