Files
StarPunk/templates/admin/webmentions.html
T
PhilandClaude Opus 5.5 aa88db50b2 feat: admin Log and Settings pages, decluttered Webmentions page (v2.18.0)
Notifications move to /admin/settings. /admin/log lists everything failing
now (crossposts, response checks, outgoing webmentions, reply contexts,
WebSub, notifications, refused silo credentials) with the affected post,
the error and Retry/Check now. Back to Dashboard button removed; nav gains
Webmentions, Log (with error count) and Settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 13:05:26 -07:00

148 lines
5.6 KiB
HTML

{% extends "admin/base.html" %}
{% block title %}Webmentions - StarPunk Admin{% endblock %}
{% block admin_content %}
<div class="webmentions-admin">
<h2>Webmentions</h2>
{# Backfeed (v2.13.0, ADR-073) #}
{% if backfeed and backfeed.enabled %}
<section class="backfeed-status">
<h3>Backfeed</h3>
{% if backfeed.remaining %}
<p>Backfill started {{ backfeed.started }} UTC: {{ backfeed.remaining }} crosspost(s) left to check.</p>
{% elif backfeed.finished %}
<p>Last backfill: started {{ backfeed.started }}, finished {{ backfeed.finished }} UTC.</p>
{% else %}
<p>No backfill has been run. It checks every crosspost once for responses, however old the note.</p>
{% endif %}
{% if backfeed.errors or backfeed.denied %}<p><a href="{{ url_for('admin.error_log') }}">Response checks have errors: see the Log.</a></p>{% endif %}
<form method="POST" action="{{ url_for('admin.backfeed_backfill') }}"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="button"{% if backfeed.remaining %} disabled{% endif %}>Backfill responses</button>
</form>
</section>
{% endif %}
{# Filter tabs #}
<div class="filter-tabs">
<a href="{{ url_for('admin.webmentions') }}" class="{% if not status_filter %}active{% endif %}">
All
</a>
<a href="{{ url_for('admin.webmentions', status='pending') }}" class="{% if status_filter == 'pending' %}active{% endif %}">
Pending
</a>
<a href="{{ url_for('admin.webmentions', status='approved') }}" class="{% if status_filter == 'approved' %}active{% endif %}">
Approved
</a>
<a href="{{ url_for('admin.webmentions', status='hidden') }}" class="{% if status_filter == 'hidden' %}active{% endif %}">
Hidden
</a>
<a href="{{ url_for('admin.webmentions', status='deleted') }}" class="{% if status_filter == 'deleted' %}active{% endif %}">
Deleted
</a>
</div>
<div class="filter-tabs">
{% for value, label in [(None, 'Any source'), ('webmention', 'Webmentions'), ('gotosocial', 'GoToSocial'), ('bluesky', 'Bluesky'), ('threads', 'Threads')] %}
<a href="{{ url_for('admin.webmentions', status=status_filter, origin=value) }}" class="{% if origin_filter == value %}active{% endif %}">{{ label }}</a>
{% endfor %}
</div>
{% if webmentions %}
<form method="POST" action="{{ url_for('admin.webmention_bulk_action') }}"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="bulk-actions">
<button type="submit" name="action" value="approve" class="button">
Approve Selected
</button>
<button type="submit" name="action" value="hide" class="button">
Hide Selected
</button>
<button type="submit" name="action" value="delete" class="button button-danger"
onclick="return confirm('Delete selected webmentions permanently?')">
Delete Selected
</button>
</div>
<div class="table-scroll">
<table class="webmention-table">
<thead>
<tr>
<th><input type="checkbox" id="select-all"></th>
<th>Source</th>
<th>Target</th>
<th>Type</th>
<th>Author</th>
<th>Status</th>
<th>Received</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for wm in webmentions %}
<tr>
<td><input type="checkbox" name="ids" value="{{ wm.id }}"></td>
<td><a href="{{ wm.source_url }}" target="_blank">{{ wm.source_url|truncate(40) }}</a></td>
<td>
{% if wm.target_note_id %}
<a href="{{ url_for('public.note', slug=wm.target_slug) }}">{{ wm.target_slug }}</a>
{% else %}
Homepage
{% endif %}
</td>
<td><span class="badge badge-{{ wm.mention_type }}">{{ wm.mention_type }}</span></td>
<td>{{ wm.author_name or 'Anonymous' }}</td>
<td>
<span class="status-badge status-{{ wm.moderation_status }}">
{{ wm.moderation_status }}
</span>
</td>
<td>{{ wm.received_at.strftime('%b %d, %Y %H:%M') }}</td>
<td>
<a href="{{ url_for('admin.webmention_detail', id=wm.id) }}" class="button button-small">
View
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</form>
{# Pagination #}
{% if total_pages > 1 %}
<nav class="pagination">
{% if page > 1 %}
<a href="?page={{ page - 1 }}{% if status_filter %}&status={{ status_filter }}{% endif %}{% if origin_filter %}&origin={{ origin_filter }}{% endif %}" class="button">Previous</a>
{% endif %}
<span>Page {{ page }} of {{ total_pages }}</span>
{% if page < total_pages %}
<a href="?page={{ page + 1 }}{% if status_filter %}&status={{ status_filter }}{% endif %}{% if origin_filter %}&origin={{ origin_filter }}{% endif %}" class="button">Next</a>
{% endif %}
</nav>
{% endif %}
{% else %}
{# Empty states #}
{% if status_filter %}
<div class="empty-state">
<p>No webmentions match the current filters.</p>
<a href="{{ url_for('admin.webmentions') }}" class="button">Clear Filters</a>
</div>
{% else %}
<div class="empty-state">
<p>No webmentions received yet.</p>
<p class="text-muted">They will appear here when other sites mention your content.</p>
</div>
{% endif %}
{% endif %}
</div>
<script>
// Select All functionality
document.getElementById('select-all')?.addEventListener('change', function() {
document.querySelectorAll('input[name="ids"]').forEach(cb => cb.checked = this.checked);
});
</script>
{% endblock %}