feat: backfeed of responses to crossposts (v2.13.0)

Likes, reposts, quotes and replies to a note's GoToSocial, Bluesky and
Threads copies are read back from the silos and stored as webmentions
(ADR-073): age-based schedule to 90 days, pruning of withdrawn responses,
#nobridge/#nobot opt-outs, admin backfill and Check now, Threads counts,
a Quotes group, local avatar copies, and delete tombstones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-10 12:19:57 -07:00
1 parent 6aaac982d5
commit 55ce6a1fdd
27 files changed
+1763 -40

No files matched your search

+6
View File
@@ -102,6 +102,12 @@
<button type="submit" class="button button-secondary">Retry now</button>
</form>
{% endif %}
{% if backfeed_enabled and s.state == 'synced' and s.remote_id %}
<br><small>Responses {% if s.backfeed_checked_at %}checked {{ s.backfeed_checked_at }} UTC{% else %}not checked yet{% endif %}{% if s.backfeed_error %}: {{ s.backfeed_error }}{% endif %}</small>
<form action="{{ url_for('admin.check_syndication_responses', syndication_id=s.id) }}" method="POST" style="display: inline;"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="button button-secondary">Check now</button>
</form>
{% endif %}
</li>
{% endfor %}
</ul>
+4 -1
View File
@@ -16,6 +16,7 @@
<div class="detail-row">
<strong>Source:</strong>
<a href="{{ webmention.source_url }}" target="_blank">{{ webmention.source_url }}</a>
{% if webmention.origin and webmention.origin != 'webmention' %}<small>(backfed from {{ webmention.origin }})</small>{% endif %}
</div>
<div class="detail-row">
@@ -43,7 +44,9 @@
{% if webmention.author_photo %}
<div class="detail-row">
<strong>Author Photo:</strong>
<img src="{{ webmention.author_photo }}" alt="{{ webmention.author_name or 'Author' }}" width="48" height="48" loading="lazy">
{% set photo = webmention.author_photo|local_avatar %}
{% if photo %}<img src="{{ photo }}" alt="{{ webmention.author_name or 'Author' }}" width="48" height="48" loading="lazy">{% endif %}
<a href="{{ webmention.author_photo }}" rel="noopener" target="_blank">{{ webmention.author_photo|truncate(60) }}</a>
</div>
{% endif %}
+31 -2
View File
@@ -12,6 +12,27 @@
</a>
</div>
{# 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 %}">
@@ -26,6 +47,14 @@
<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 %}
@@ -93,11 +122,11 @@
{% if total_pages > 1 %}
<nav class="pagination">
{% if page > 1 %}
<a href="?page={{ page - 1 }}{% if status_filter %}&status={{ status_filter }}{% endif %}" class="button">Previous</a>
<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 %}" class="button">Next</a>
<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 %}
+8
View File
@@ -115,6 +115,13 @@
</div>
{% endif %}
{% if quotes %}
<div class="webmention-group webmention-quotes">
<h3>{{ quotes|length }} {{ 'Quote' if quotes|length == 1 else 'Quotes' }}</h3>
{% for wm in quotes %}{{ responses.mention(wm) }}{% endfor %}
</div>
{% endif %}
{% if mentions %}
<div class="webmention-group webmention-mentions">
<h3>{{ mentions|length }} {{ 'Mention' if mentions|length == 1 else 'Mentions' }}</h3>
@@ -123,5 +130,6 @@
{% endif %}
</section>
{% endif %}
{{ responses.silo_counts(syndications) }}
</article>
{% endblock %}
+23 -6
View File
@@ -12,11 +12,18 @@
{# The response's own URL: the source's u-url if it gave one #}
{% macro response_url(wm) %}{{ wm.source_post_url or wm.source_url }}{% endmacro %}
{# Where a backfed response came from, e.g. "via Bluesky" (v2.13.0) #}
{% macro via(wm) %}{% if wm.via %}<span class="webmention-via">via {{ wm.via }}</span>{% endif %}{% endmacro %}
{# Author h-card: name, URL and photo. u-url is on an inner link: on the
h-card element itself it would belong to the enclosing h-cite #}
h-card element itself it would belong to the enclosing h-cite.
The photo is this site's saved copy (v2.13.0); until there is one, the
initial is shown instead of loading it from the other site. #}
{% macro author_card(wm, class='', photo_size=48, show_name=True) %}
<span class="p-author h-card {{ class }}"><a class="u-url" href="{{ wm.author_url or wm.source_url }}" title="{{ wm.author_name or 'Anonymous' }}">
{%- if wm.author_photo %}<img class="u-photo" src="{{ wm.author_photo }}" alt="" width="{{ photo_size }}" height="{{ photo_size }}" loading="lazy">
{% set photo = wm.author_photo|local_avatar %}
<span class="p-author h-card {{ class }}"><a class="u-url" href="{{ wm.author_url or wm.source_url }}" title="{{ wm.author_name or 'Anonymous' }}{% if wm.via %} via {{ wm.via }}{% endif %}">
{%- if photo %}<img class="u-photo" src="{{ photo }}" alt="" width="{{ photo_size }}" height="{{ photo_size }}" loading="lazy">
{%- elif wm.author_photo %}<data class="u-photo" value="{{ wm.author_photo }}"></data>{% if not show_name %}<span class="face-initial" style="background-color: {{ wm.author_url|url_to_color }}" aria-hidden="true">{{ (wm.author_name or '?')[0]|upper }}</span>{% endif %}
{%- elif not show_name %}<span class="face-initial" style="background-color: {{ wm.author_url|url_to_color }}" aria-hidden="true">{{ (wm.author_name or '?')[0]|upper }}</span>
{%- endif %}
<span class="p-name{{ '' if show_name else ' visually-hidden' }}">{{ wm.author_name or 'Anonymous' }}</span>
@@ -30,7 +37,7 @@
{% if wm.content_snippet %}
<div class="e-content">{{ wm.content_snippet|safe }}</div>
{% endif %}
<a class="u-url webmention-date" href="{{ response_url(wm) }}">{{ response_time(wm) }}</a>
<a class="u-url webmention-date" href="{{ response_url(wm) }}">{{ response_time(wm) }}</a> {{ via(wm) }}
</article>
{%- endmacro %}
@@ -50,13 +57,23 @@
</div>
{%- endmacro %}
{# A post that mentions this note without replying #}
{# A post that mentions this note without replying; also quote posts (v2.13.0) #}
{% macro mention(wm) %}
<div class="webmention webmention-mention u-mention h-cite">
{{ author_card(wm, photo_size=24) }}
{% if wm.content_snippet %}
<p class="p-content">{{ wm.content_snippet|striptags|truncate(200) }}</p>
{% endif %}
<a class="u-url webmention-date" href="{{ response_url(wm) }}">{{ response_time(wm) }}</a>
<a class="u-url webmention-date" href="{{ response_url(wm) }}">{{ response_time(wm) }}</a> {{ via(wm) }}
</div>
{%- endmacro %}
{# Like, repost and quote counts a silo reports without saying who (Threads,
v2.13.0). Plain text: these aren't people, so no u-like / h-cite. #}
{% macro silo_counts(syndications) %}
{% for s in syndications or [] if s.likes_count or s.reposts_count or s.quotes_count %}
{% set parts = [] %}
{% for n, one, many in [(s.likes_count, 'like', 'likes'), (s.reposts_count, 'repost', 'reposts'), (s.quotes_count, 'quote', 'quotes')] if n %}{% set _ = parts.append(n ~ ' ' ~ (one if n == 1 else many)) %}{% endfor %}
<p class="silo-counts">On {{ s.name }}: {{ parts|join(' · ') }}</p>
{% endfor %}
{%- endmacro %}