1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
<!--
SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me>
SPDX-License-Identifier: BSD-3-Clause
-->
{% extends "base.html" %}
{% from "bootstrap5/pagination.html" import render_pagination %}
{% macro sortable_header(label, column, responsive_class="") %}
{% set active = sort_key == column %}
<th scope="col"
class="{{ responsive_class }}"
aria-sort="{{ ('ascending' if sort_order == 'asc' else 'descending') if active else 'none' }}">
<a href="{{ sort_urls[column] }}"
class="link-body-emphasis text-decoration-none">
{{ label }}
{% if active %}<span aria-hidden="true">{{ "↑" if sort_order == "asc" else "↓" }}</span>{% endif %}
</a>
</th>
{% endmacro %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-3">
<h1 class="mb-0">Sources</h1>
<div class="d-flex flex-column justify-content-between">
<span class="text-body-secondary mb-1">{{ sources.total }} sources</span>
<button type="button"
class="btn btn-sm btn-primary"
data-bs-toggle="modal"
data-bs-target="#confirmation-modal"
data-action="{{ url_for('webmentions.rescan_sources', page=sources.page, **filters) }}"
data-title="Rescan sources?"
data-message="All sources will be scanned again for changes and webmentions."
data-confirm-label="Rescan"
data-confirm-class="btn-primary">Rescan</button>
</div>
</div>
<form action="{{ url_for('webmentions.source_list') }}"
method="get"
class="row g-2 align-items-end mb-4"
role="search">
{{ filter_form.sort }}
{{ filter_form.order }}
<div class="col-sm-6 col-lg">
{{ filter_form.status.label(class_="form-label") }}
{{ filter_form.status(class_="form-select") }}
</div>
<div class="col-sm-6 col-lg">
{{ filter_form.q.label(class_="form-label") }}
{{ filter_form.q(class_="form-control", placeholder="Search paths and URLs") }}
</div>
<div class="col-sm-6 col-lg">
{{ filter_form.date_from.label(class_="form-label") }}
{{ filter_form.date_from(class_="form-control") }}
</div>
<div class="col-sm-6 col-lg">
{{ filter_form.date_to.label(class_="form-label") }}
{{ filter_form.date_to(class_="form-control") }}
</div>
<div class="col-sm-6 col-lg-auto">
{{ filter_form.per_page.label(class_="form-label") }}
{{ filter_form.per_page(class_="form-control", min=1, max=max_source_page_size, step=1) }}
</div>
<div class="col-auto d-flex gap-2 ms-auto">
<button type="submit" class="btn btn-primary">Filter</button>
<a href="{{ url_for('webmentions.source_list') }}"
class="btn btn-outline-secondary">Clear</a>
</div>
</form>
{% if sources.items %}
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover align-middle">
<thead>
<tr>
{{ sortable_header('Status', 'status') }}
{{ sortable_header('Path', 'path') }}
{{ sortable_header('URL', 'url', 'd-none d-md-table-cell') }}
{{ sortable_header('Webmentions', 'webmentions') }}
{{ sortable_header('Revision', 'revision', 'd-none d-md-table-cell') }}
{{ sortable_header('Created', 'created', 'd-none d-md-table-cell') }}
{{ sortable_header('Last seen', 'last_seen', 'd-none d-md-table-cell') }}
</tr>
</thead>
<tbody>
{% for source in sources %}
{% set counts = statistics[source.uuid] %}
{% if source.deleted_at is none %}
{% set row_class = "table-success" %}
{% set badge_class = "text-bg-success" %}
{% set status_text = "Active" %}
{% else %}
{% set row_class = "table-danger" %}
{% set badge_class = "text-bg-danger" %}
{% set status_text = "Deleted" %}
{% endif %}
<tr class="{{ row_class }}">
<td>
<span class="badge {{ badge_class }}">{{ status_text }}</span>
</td>
<td class="text-break">
<a href="{{ url_for('webmentions.source_detail', source_uuid=source.uuid, source_page=sources.page, **filters) }}">{{ source.path }}</a>
</td>
<td class="text-break d-none d-md-table-cell">
<a href="{{ source.url }}">{{ source.url }}</a>
</td>
<td>
<span class="badge text-bg-info">{{ counts.total }} Total</span>
{% if counts.sent %}
<span class="badge text-bg-success">{{ counts.sent }} sent</span>
{% endif %}
{% if counts.no_endpoint %}
<span class="badge text-bg-secondary">{{ counts.no_endpoint }} no endpoint</span>
{% endif %}
{% if counts.failed %}
<span class="badge text-bg-danger">{{ counts.failed }} failed</span>
{% endif %}
{% if counts.retrying %}
<span class="badge text-bg-warning">{{ counts.retrying }} awaiting retry</span>
{% endif %}
</td>
<td class="d-none d-md-table-cell">{{ source.revision }}</td>
<td class="text-nowrap d-none d-md-table-cell">
<time datetime="{{ source.created_at | utc_isoformat }}"
title="{{ source.created_at | utc_timestamp }}">
{{ source.created_at | relative_time }}
</time>
</td>
<td class="text-nowrap d-none d-md-table-cell">
<time datetime="{{ source.last_seen_at | utc_isoformat }}"
title="{{ source.last_seen_at | utc_timestamp }}">
{{ source.last_seen_at | relative_time }}
</time>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if sources.pages > 1 %}
<div class="mt-3">{{ render_pagination(sources, args=filters) }}</div>
{% endif %}
{% else %}
{% if filters %}
<p class="text-body-secondary">No sources match these filters.</p>
{% else %}
<p class="text-body-secondary">No Webmention sources have been discovered yet.</p>
{% endif %}
{% endif %}
{% include "includes/confirmation_modal.html" %}
{% endblock %}
{% block scripts %}
{{ super() }}
<script src="{{ url_for('static', filename='js/confirmation-modal.js') }}"></script>
{% endblock %}
|