173 lines
6.6 KiB
HTML
173 lines
6.6 KiB
HTML
{% extends "admin/base.html" %}
|
|
|
|
{% block title %}Webmentions - StarPunk Admin{% endblock %}
|
|
|
|
{% block admin_content %}
|
|
<div class="webmentions-admin">
|
|
<h2>Webmentions</h2>
|
|
|
|
<div class="dashboard-actions">
|
|
<a href="{{ url_for('admin.dashboard') }}" class="button">
|
|
Back to Dashboard
|
|
</a>
|
|
</div>
|
|
|
|
{# Notifications (v2.14.0, ADR-074) #}
|
|
{% if notify %}
|
|
<section class="notify-status">
|
|
<h3>Notifications</h3>
|
|
{% if notify.enabled %}
|
|
<p>Sending {{ notify.events|join(', ') }} to {{ notify.services|join(', ') }} at {{ notify.priority }} priority.</p>
|
|
{% if notify.last_error %}<p class="flash flash-error">Last send failed: {{ notify.last_error }}</p>{% endif %}
|
|
<form method="POST" action="{{ url_for('admin.notifications_test') }}"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button type="submit" class="button">Send test notification</button>
|
|
</form>
|
|
{% else %}
|
|
<p>Off. Set <code>NOTIFY_URLS</code> to one or more Apprise URLs to be notified of new responses.</p>
|
|
{% endif %}
|
|
</section>
|
|
{% endif %}
|
|
|
|
{# Backfeed (v2.13.0, ADR-073) #}
|
|
{% if backfeed and backfeed.enabled %}
|
|
<section class="backfeed-status">
|
|
<h3>Backfeed</h3>
|
|
{% for silo, message in backfeed.denied.items() %}
|
|
<p class="flash flash-error">{{ silo }}: {{ message }}</p>
|
|
{% endfor %}
|
|
{% 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 %}<p>{{ backfeed.errors }} crosspost(s) had an error at their last check (see each note's edit page).</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 %}
|