diff options
Diffstat (limited to 'webmentions_ssg/templates')
| -rw-r--r-- | webmentions_ssg/templates/base.html | 2 | ||||
| -rw-r--r-- | webmentions_ssg/templates/received.html | 132 | ||||
| -rw-r--r-- | webmentions_ssg/templates/received_detail.html | 148 |
3 files changed, 204 insertions, 78 deletions
diff --git a/webmentions_ssg/templates/base.html b/webmentions_ssg/templates/base.html index 3395dd5..c7af077 100644 --- a/webmentions_ssg/templates/base.html +++ b/webmentions_ssg/templates/base.html @@ -43,7 +43,7 @@ SPDX-License-Identifier: BSD-3-Clause </a> {% if current_user.is_authenticated %} <div class="navbar-nav flex-row gap-3"> - <a class="nav-link{% if request.endpoint == 'webmentions.received_list' %} active{% endif %}" + <a class="nav-link{% if request.endpoint in ('webmentions.received_list', 'webmentions.received_detail') %} active{% endif %}" href='{{ url_for("webmentions.received_list") }}'>Received</a> <a class="nav-link{% if request.endpoint and request.endpoint.startswith('webmentions.moderation') %} active{% endif %}" href="{{ url_for('webmentions.moderation') }}">Source rules</a> diff --git a/webmentions_ssg/templates/received.html b/webmentions_ssg/templates/received.html index 5fd9866..b8099aa 100644 --- a/webmentions_ssg/templates/received.html +++ b/webmentions_ssg/templates/received.html @@ -160,85 +160,63 @@ SPDX-License-Identifier: BSD-3-Clause data-confirm-class="btn-danger">Delete all declined</button> </div> {% if webmentions.items %} - <table class="table table-bordered table-striped table-hover align-middle"> - <thead> - <tr> - <th scope="col"> - <input type="checkbox" - class="form-check-input" - id="received-select-all" - aria-label="Select all Webmentions on this page"> - </th> - {{ sortable_header('Status', 'status') }} - {{ sortable_header('Source', 'source') }} - {{ sortable_header('Target', 'target') }} - {{ sortable_header('Received', 'received') }} - {{ sortable_header('Updated', 'updated') }} - <th scope="col">Reason</th> - <th scope="col">Actions</th> - </tr> - </thead> - <tbody> - {% for webmention in webmentions %} - {% set style = received_status_presentation.get(webmention.status, {"row_class": "table-danger", "badge_class": "text-bg-danger", "label": "Declined"}) %} - <tr class="{{ style.row_class }}"> - <td> + <div class="table-responsive"> + <table class="table table-bordered table-striped table-hover align-middle"> + <thead> + <tr> + <th scope="col"> <input type="checkbox" - class="form-check-input received-select" - value="{{ webmention.uuid }}" - aria-label="Select webmention {{ webmention.uuid }}"> - </td> - <td><span class="badge {{ style.badge_class }}">{{ style.label }}</span></td> - <td class="text-break"> - <a href="{{ webmention.source }}">{{ webmention.source }}</a> - </td> - <td class="text-break"> - <a href="{{ webmention.target }}">{{ webmention.target }}</a> - </td> - <td class="text-nowrap"> - <time datetime="{{ webmention.created_at.isoformat() }}"> - {{ webmention.created_at.strftime("%Y-%m-%d %H:%M:%S") }} - </time> - </td> - <td class="text-nowrap"> - <time datetime="{{ webmention.updated_at.isoformat() }}"> - {{ webmention.updated_at.strftime("%Y-%m-%d %H:%M:%S") }} - </time> - </td> - <td>{{ webmention.failure_reason or "—" }}</td> - <td class="text-nowrap"> - <button type="button" - class="btn btn-sm btn-primary" - data-bs-toggle="modal" - data-bs-target="#confirmation-modal" - data-action="{{ url_for('webmentions.reverify_received_webmention', webmention_uuid=webmention.uuid, page=webmentions.page, **filters) }}" - data-title="Reverify webmention?" - data-message="The webmention will be fetched and verified again." - data-confirm-label="Reverify" - data-confirm-class="btn-primary">Reverify</button> - <button type="button" - class="btn btn-sm btn-warning" - data-bs-toggle="modal" - data-bs-target="#confirmation-modal" - data-action="{{ url_for('webmentions.block_received_source', webmention_uuid=webmention.uuid, page=webmentions.page, **filters) }}" - data-title="Block this source domain?" - data-message="Future Webmentions from this source hostname and its subdomains will be rejected." - data-confirm-label="Block domain" - data-confirm-class="btn-warning">Block this domain</button> - <button type="button" - class="btn btn-sm btn-danger" - data-bs-toggle="modal" - data-bs-target="#confirmation-modal" - data-action="{{ url_for('webmentions.delete_received_webmention', webmention_uuid=webmention.uuid, page=webmentions.page, **filters) }}" - data-title="Delete webmention?" - data-message="This permanently deletes the webmention and cannot be undone." - data-confirm-label="Delete" - data-confirm-class="btn-danger">Delete</button> - </td> + class="form-check-input" + id="received-select-all" + aria-label="Select all Webmentions on this page"> + </th> + {{ sortable_header('Status', 'status') }} + {{ sortable_header('Source', 'source') }} + {{ sortable_header('Target', 'target') }} + {{ sortable_header('Received', 'received') }} + {{ sortable_header('Updated', 'updated') }} + <th scope="col">Details</th> </tr> - {% endfor %} - </tbody> - </table> + </thead> + <tbody> + {% for webmention in webmentions %} + {% set style = received_status_presentation.get(webmention.status, {"row_class": "table-danger", "badge_class": "text-bg-danger", "label": "Declined"}) %} + <tr class="{{ style.row_class }}"> + <td> + <input type="checkbox" + class="form-check-input received-select" + value="{{ webmention.uuid }}" + aria-label="Select webmention {{ webmention.uuid }}"> + </td> + <td><span class="badge {{ style.badge_class }}">{{ style.label }}</span></td> + <td> + <a href="{{ webmention.source }}">{{ webmention.source }}</a> + </td> + <td> + <a href="{{ webmention.target }}">{{ webmention.target }}</a> + </td> + <td class="text-nowrap"> + <time datetime="{{ webmention.created_at.isoformat() }}" + title="{{ webmention.created_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC"> + {{ webmention.created_at.strftime("%Y-%m-%d %H:%M:%S") }} + </time> + </td> + <td class="text-nowrap"> + <time datetime="{{ webmention.updated_at.isoformat() }}" + title="{{ webmention.updated_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC"> + {{ webmention.updated_at.strftime("%Y-%m-%d %H:%M:%S") }} + </time> + </td> + <td> + <a class="btn btn-sm btn-primary" + href="{{ url_for('webmentions.received_detail', webmention_uuid=webmention.uuid, page=webmentions.page, **filters) }}" + aria-label="Details for Webmention {{ webmention.uuid }}">Details</a> + </td> + </tr> + {% endfor %} + </tbody> + </table> + </div> {% if webmentions.pages > 1 %} <div class="mt-3">{{ render_pagination(webmentions, args=filters) }}</div> {% endif %} diff --git a/webmentions_ssg/templates/received_detail.html b/webmentions_ssg/templates/received_detail.html new file mode 100644 index 0000000..091e2e4 --- /dev/null +++ b/webmentions_ssg/templates/received_detail.html @@ -0,0 +1,148 @@ +<!-- +SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me> + +SPDX-License-Identifier: BSD-3-Clause +--> +{% extends "base.html" %} + +{% set status_presentation = { + "received": { + "badge": "text-bg-info", + "label": "Pending" + }, + "verifying": { + "badge": "text-bg-warning", + "label": "Verifying" + }, + "verified": { + "badge": "text-bg-success", + "label": "Verified" + }, + "failed": { + "badge": "text-bg-danger", + "label": "Declined (failed)" + }, + "source_removed": { + "badge": "text-bg-danger", + "label": "Declined (source removed)" + } +} %} + +{% block styles %} + {{ super() }} + <link rel="stylesheet" + href="{{ url_for('static', filename='styles/style.css') }}"> +{% endblock %} + +{% block content %} + <div class="mb-3"> + <a href="{{ url_for('webmentions.received_list', page=page, **filters) }}">← Back to received Webmentions</a> + </div> + <div class="d-flex flex-wrap justify-content-between align-items-center gap-2 mb-4"> + <h1 class="mb-0">Received Webmention</h1> + {% set style = status_presentation.get(webmention.status, {"badge": "text-bg-secondary", "label": "Unknown"}) %} + <span class="badge fs-6 {{ style.badge }}">{{ style.label }}</span> + </div> + <section aria-labelledby="mention-details-heading" class="card mb-4"> + <div class="card-body"> + <h2 id="mention-details-heading" class="h4 card-title mb-3">Details</h2> + <dl class="row mb-0"> + <dt class="col-md-3">Source</dt> + <dd class="col-md-9 text-break"> + <a href="{{ webmention.source }}">{{ webmention.source }}</a> + </dd> + <dt class="col-md-3">Target</dt> + <dd class="col-md-9 text-break"> + <a href="{{ webmention.target }}">{{ webmention.target }}</a> + </dd> + <dt class="col-md-3">Received</dt> + <dd class="col-md-9"> + <time datetime="{{ webmention.created_at.isoformat() }}">{{ webmention.created_at.strftime("%Y-%m-%d %H:%M:%S") }} UTC</time> + </dd> + <dt class="col-md-3">Last updated</dt> + <dd class="col-md-9"> + <time datetime="{{ webmention.updated_at.isoformat() }}">{{ webmention.updated_at.strftime("%Y-%m-%d %H:%M:%S") }} UTC</time> + </dd> + <dt class="col-md-3">Recovery attempts</dt> + <dd class="col-md-9"> + {{ webmention.recovery_attempts }} <span class="text-body-secondary small">(automatic stale-verification recoveries; resets when verification is explicitly reopened)</span> + </dd> + <dt class="col-md-3">Webmention ID</dt> + <dd class="col-md-9"> + <code class="text-break">{{ webmention.uuid }}</code> + </dd> + <dt class="col-md-3">Public status</dt> + <dd class="col-md-9"> + <a href="{{ url_for('webmentions.webmention_status', identifier=webmention.uuid, _external=True) }}">View public status page</a> + </dd> + <dt class="col-md-3">Failure reason</dt> + <dd class="col-md-9"> + {% if webmention.failure_reason %} + <div class="text-break text-pre-formatted">{{ webmention.failure_reason }}</div> + {% else %} + <span class="text-body-secondary">None</span> + {% endif %} + </dd> + </dl> + </div> + </section> + <div class="d-flex flex-wrap gap-2 mb-4" aria-label="Webmention actions"> + <button type="button" + class="btn btn-sm btn-primary" + data-bs-toggle="modal" + data-bs-target="#confirmation-modal" + data-action="{{ url_for('webmentions.reverify_received_webmention', webmention_uuid=webmention.uuid, return_to='detail', page=page, **filters) }}" + data-title="Reverify webmention?" + data-message="The webmention will be fetched and verified again." + data-confirm-label="Reverify" + data-confirm-class="btn-primary">Reverify</button> + <button type="button" + class="btn btn-sm btn-warning" + data-bs-toggle="modal" + data-bs-target="#confirmation-modal" + data-action="{{ url_for('webmentions.block_received_source', webmention_uuid=webmention.uuid, return_to='detail', page=page, **filters) }}" + data-title="Block this source domain?" + data-message="Future Webmentions from this source hostname and its subdomains will be rejected." + data-confirm-label="Block domain" + data-confirm-class="btn-warning">Block this domain</button> + <button type="button" + class="btn btn-sm btn-danger" + data-bs-toggle="modal" + data-bs-target="#confirmation-modal" + data-action="{{ url_for('webmentions.delete_received_webmention', webmention_uuid=webmention.uuid, page=page, **filters) }}" + data-title="Delete webmention?" + data-message="This permanently deletes the webmention and cannot be undone." + data-confirm-label="Delete" + data-confirm-class="btn-danger">Delete</button> + </div> + <section aria-labelledby="status-history-heading"> + <h2 class="h4 mb-3" id="status-history-heading">Status history</h2> + {% if history %} + <ol class="list-group list-group-numbered mb-3"> + {% for event in history %} + {% set event_style = status_presentation.get(event.status, {"badge": "text-bg-secondary", "label": "Unknown"}) %} + <li class="list-group-item"> + <div class="d-flex flex-wrap align-items-center gap-2 mb-1"> + <span class="badge {{ event_style.badge }}">{{ event_style.label }}</span> + <strong>{{ event.action }}</strong> + <time class="ms-auto text-body-secondary small" + datetime="{{ event.occurred_at.isoformat() }}">{{ event.occurred_at.strftime("%Y-%m-%d %H:%M:%S") }} UTC</time> + </div> + <div class="small text-body-secondary">Recovery attempts: {{ event.recovery_attempts }}</div> + {% if event.failure_reason %} + <div class="mt-2 text-break text-pre-formatted">{{ event.failure_reason }}</div> + {% endif %} + </li> + {% endfor %} + </ol> + {% else %} + <p class="text-body-secondary">No historical transitions were recorded for this Webmention. Its current status appears above.</p> + {% endif %} + </section> + {% include "includes/confirmation_modal.html" %} +{% endblock %} + +{% block scripts %} + {{ super() }} + <script src="{{ url_for('static', filename='js/confirmation-modal.js') }}"></script> +{% endblock %} |
