src/templates/dbl/lists/domain.html \
src/templates/dbl/lists/history.html \
src/templates/dbl/lists/reports.html \
- src/templates/dbl/lists/sources.html \
src/templates/dbl/lists/show.html
templates_dbl_listsdir = $(templates_dbldir)/lists
templates_dbl_modules_DATA = \
src/templates/dbl/modules/lists.html \
+ src/templates/dbl/modules/sources.html \
src/templates/dbl/modules/submit-report.html
templates_dbl_modulesdir = $(templates_dbldir)/modules
</span>
</a>
- <a class="button" href="/dbl/lists/{{ list.slug }}/sources">
- <span class="icon is-small">
- <i class="fas fa-code-pull-request" aria-hidden="true"></i>
- </span>
-
- <span>{{ _("Sources") }}</span>
- </a>
-
<a class="button" href="/dbl/lists/{{ list.slug }}/history">
<span class="icon is-small">
<i class="fas fa-list-check" aria-hidden="true"></i>
</div>
</div>
</section>
+
+ {# Sources #}
+ {% if sources %}
+ <section class="section" id="sources">
+ <div class="container">
+ <h4 class="title is-4">
+ {{ _("Sources") }}
+ </h4>
+
+ {% module DBLSources(sources) %}
+ </div>
+ </section>
+ {% end %}
{% end block %}
+++ /dev/null
-{% extends "../../base.html" %}
-
-{% block head %}
- {% module OpenGraph(
- title=_("IPFire DBL - %s - Sources") % list,
- description=list.description,
- ) %}
-{% end block %}
-
-{% block title %}{{ _("IPFire DBL") }} - {{ 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="/dbl">
- {{ _("IPFire DBL") }}
- </a>
- </li>
-
- <li>
- <a href="/dbl/lists">
- {{ _("Lists") }}
- </a>
- </li>
-
- <li>
- <a href="/dbl/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>
-
- <th class="has-text-right">
- {{ _("False Positives") }}
- </th>
-
- <th class="has-text-right">
- {{ _("Dead 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>
-
- {# Total Domains #}
- <td class="has-text-right">
- {{ format_number(source.total_domains) }}
- </td>
-
- {# False Positives #}
- <td class="has-text-right">
- {{ format_number(source.false_positives) }}
- </td>
-
- {# Dead Domains #}
- <td class="has-text-right">
- {% if source.total_domains and source.dead_domains %}
- {{ format_percent(source.dead_domains / source.total_domains) }}
- {% else %}
- <span class="has-text-grey">
- {{ _("N/A") }}
- </span>
- {% end %}
- </td>
- </tr>
- {% end %}
- </tbody>
- </table>
- </div>
- </section>
-{% end block %}
--- /dev/null
+<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>
+
+ <th class="has-text-right">
+ {{ _("False Positives") }}
+ </th>
+
+ <th class="has-text-right">
+ {{ _("Dead 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>
+
+ {# Total Domains #}
+ <td class="has-text-right">
+ {{ format_number(source.total_domains) }}
+ </td>
+
+ {# False Positives #}
+ <td class="has-text-right">
+ {{ format_number(source.false_positives) }}
+ </td>
+
+ {# Dead Domains #}
+ <td class="has-text-right">
+ {% if source.total_domains and source.dead_domains %}
+ {{ format_percent(source.dead_domains / source.total_domains) }}
+ {% else %}
+ <span class="has-text-grey">
+ {{ _("N/A") }}
+ </span>
+ {% end %}
+ </td>
+ </tr>
+ {% end %}
+ </tbody>
+</table>
# DBL
"DBLLists" : dbl.ListsModule,
+ "DBLSources" : dbl.SourcesModule,
"DBLSubmitReport" : dbl.SubmitReportModule,
# Docs
(r"/dbl/lists/([\w\-]+)/domains/(.*)", dbl.ListDomainHandler),
(r"/dbl/lists/([\w\-]+)/history", dbl.ListHistoryHandler),
(r"/dbl/lists/([\w\-]+)/reports", dbl.ListReportsHandler),
- (r"/dbl/lists/([\w\-]+)/sources", dbl.ListSourcesHandler),
(r"/dbl/report", dbl.SubmitReportHandler),
(r"/dbl/reports/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})", dbl.ReportHandler),
(r"/dbl/search", dbl.SearchHandler),
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("dbl/lists/show.html", list=list)
+ self.render("dbl/lists/show.html", list=list, sources=sources)
class ListHistoryHandler(base.AnalyticsMixin, BaseHandler):
self.render("dbl/lists/reports.html", list=list, reports=reports)
-class ListSourcesHandler(base.AnalyticsMixin, BaseHandler):
- async def get(self, slug):
- # Fetch the list
- list = await self.backend.dbl.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("dbl/lists/sources.html", list=list, sources=sources)
-
-
class ListDomainHandler(base.AnalyticsMixin, BaseHandler):
async def get(self, slug, name):
# Fetch the list
return self.render_string("dbl/modules/lists.html", lists=lists)
+class SourcesModule(ui_modules.UIModule):
+ def render(self, sources):
+ return self.render_string("dbl/modules/sources.html", sources=sources)
+
+
class SubmitReportModule(ui_modules.UIModule):
def render(self, name, blocked=False, list=None):
args = {