diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f766c4..d629aa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.13.2] - 2026-11-10 + +### Changed + +- Likes, reposts and bookmarks are no longer rows of faces under "Responses". A note shows one line of counts under the post (โ™ฅ likes, ๐Ÿ” reposts, ๐Ÿ’ฌ replies, bookmarks), and hovering or tapping a count lists who, with where each came from. Threads' anonymous counts are part of the totals ("+1 on Threads"), so the separate "On Threads" line is gone. The Responses section now holds replies, quotes and mentions +- Web actions (https://indieweb.org/webactions): each like, repost and reply count is an `` for the note, with links to do the same on the note's crossposts ("Like on Bluesky ยท GoToSocial ยท Threads"). The icons show even before anyone has responded, when the note has crossposts + +### Fixed + +- Avatars that GoToSocial hasn't cached (it redirects to the original server) are saved; the redirect is followed through the safe fetcher + ## [2.13.1] - 2026-11-10 ### Fixed diff --git a/docs/decisions/ADR-073-backfeed.md b/docs/decisions/ADR-073-backfeed.md index 8e2a9aa..193cce7 100644 --- a/docs/decisions/ADR-073-backfeed.md +++ b/docs/decisions/ADR-073-backfeed.md @@ -223,6 +223,18 @@ Threads 2 (replies, insights), plus extra pages. While at it, the Threads client moves from `graph.threads.net` to `graph.threads.com`, the host Meta's current documentation uses. +## Amendments (v2.13.2, 2026-11-10) + +- **Display.** Likes, reposts and bookmarks are a line of counts under the + note instead of facepiles in the Responses section. Hovering or focusing + a count lists the people (as `u-like` / `u-repost` / `u-bookmark` + h-cites) and the silo each came from. Threads' anonymous counts are added + to the totals ("+N on Threads") instead of a separate line (Decision 7). +- **Web actions.** Each like, repost and reply count is an + `` whose fallback is a link to + the same action on each crosspost. No web-action polyfill is loaded; + handlers such as browser extensions can use the markup. + ## Consequences - Responses on all three silos show on the note within 15 minutes for new diff --git a/docs/design/INDEX.md b/docs/design/INDEX.md index 45a2c06..d424e32 100644 --- a/docs/design/INDEX.md +++ b/docs/design/INDEX.md @@ -21,7 +21,7 @@ is in `../architecture/`; decisions are in `../decisions/` (ADRs). ## Contents -[v1.0.0](#v100) ยท [v1.1.1](#v111) ยท [v1.1.2](#v112) ยท [v1.2.0](#v120) ยท [v1.3.0](#v130) ยท [v1.3.1](#v131) ยท [v1.4.0](#v140) ยท [v1.4.1](#v141) ยท [v1.4.2](#v142) ยท [v1.5.0](#v150) ยท [v1.6.0](#v160) ยท [v2.0.0](#v200) ยท [v2.0.1](#v201) ยท [v2.0.2](#v202) ยท [v2.1.0](#v210) ยท [v2.2.0](#v220) ยท [v2.3.0](#v230) ยท [v2.3.1](#v231) ยท [v2.3.2](#v232) ยท [v2.3.3](#v233) ยท [v2.4.0](#v240) ยท [v2.5.0](#v250) ยท [v2.6.0](#v260) ยท [v2.6.1](#v261) ยท [v2.6.2](#v262) ยท [v2.6.3](#v263) ยท [v2.6.4](#v264) ยท [v2.6.5](#v265) ยท [v2.6.6](#v266) ยท [v2.6.7](#v267) ยท [v2.6.8](#v268) ยท [v2.6.9](#v269) ยท [v2.7.0](#v270) ยท [v2.7.1](#v271) ยท [v2.7.2](#v272) ยท [v2.8.0](#v280) ยท [v2.8.1](#v281) ยท [v2.9.0](#v290) ยท [v2.10.0](#v2100) ยท [v2.10.1](#v2101) ยท [v2.10.2](#v2102) ยท [v2.11.0](#v2110) ยท [v2.12.0](#v2120) ยท [v2.12.1](#v2121) ยท [v2.13.0](#v2130) ยท [v2.13.1](#v2131) ยท [hotfix](#hotfix) +[v1.0.0](#v100) ยท [v1.1.1](#v111) ยท [v1.1.2](#v112) ยท [v1.2.0](#v120) ยท [v1.3.0](#v130) ยท [v1.3.1](#v131) ยท [v1.4.0](#v140) ยท [v1.4.1](#v141) ยท [v1.4.2](#v142) ยท [v1.5.0](#v150) ยท [v1.6.0](#v160) ยท [v2.0.0](#v200) ยท [v2.0.1](#v201) ยท [v2.0.2](#v202) ยท [v2.1.0](#v210) ยท [v2.2.0](#v220) ยท [v2.3.0](#v230) ยท [v2.3.1](#v231) ยท [v2.3.2](#v232) ยท [v2.3.3](#v233) ยท [v2.4.0](#v240) ยท [v2.5.0](#v250) ยท [v2.6.0](#v260) ยท [v2.6.1](#v261) ยท [v2.6.2](#v262) ยท [v2.6.3](#v263) ยท [v2.6.4](#v264) ยท [v2.6.5](#v265) ยท [v2.6.6](#v266) ยท [v2.6.7](#v267) ยท [v2.6.8](#v268) ยท [v2.6.9](#v269) ยท [v2.7.0](#v270) ยท [v2.7.1](#v271) ยท [v2.7.2](#v272) ยท [v2.8.0](#v280) ยท [v2.8.1](#v281) ยท [v2.9.0](#v290) ยท [v2.10.0](#v2100) ยท [v2.10.1](#v2101) ยท [v2.10.2](#v2102) ยท [v2.11.0](#v2110) ยท [v2.12.0](#v2120) ยท [v2.12.1](#v2121) ยท [v2.13.0](#v2130) ยท [v2.13.1](#v2131) ยท [v2.13.2](#v2132) ยท [hotfix](#hotfix) ## v1.0.0 @@ -430,6 +430,10 @@ OIDC admin login and built-in IndieAuth server. - [2026-11-10-avatar-fetch.md](v2.13.1/2026-11-10-avatar-fetch.md) - Avatars from the own GoToSocial server and from Bluesky PDSes +## v2.13.2 + +- [2026-11-10-reaction-counts.md](v2.13.2/2026-11-10-reaction-counts.md) - Likes/reposts as a counts line with hover lists; web actions + ## hotfix Not a release folder. diff --git a/docs/design/v2.13.2/2026-11-10-reaction-counts.md b/docs/design/v2.13.2/2026-11-10-reaction-counts.md new file mode 100644 index 0000000..939a10a --- /dev/null +++ b/docs/design/v2.13.2/2026-11-10-reaction-counts.md @@ -0,0 +1,32 @@ +# v2.13.2: Reaction counts and web actions + +## Why + +With backfeed live, notes showed "5 Likes" and "1 Repost" headings over +rows of faces (blank until avatars were saved), plus a separate +"On Threads: 1 like" line. The owner asked for the usual presentation: a +flat count under the post, with who on hover. Web actions +(https://indieweb.org/webactions) fit the same line. + +## What changed + +- `templates/partials/responses.html`: `facepile` and `silo_counts` are + replaced by `reactions` / `reaction`. Each count is a focusable + `.reaction` with an SVG icon; its `.reaction-who` card lists the people + (avatar, name, silo) inside a scrollable `.reaction-people`, Threads' + anonymous counts, and an `` with links to the crossposts. + The reply count has no people list (replies are listed below). +- `templates/note.html`: the counts line follows the note's footer; the + Responses section shows only when there are replies, quotes or mentions. +- `static/css/style.css`: facepile styles replaced by `.reactions`; the card + opens on `:hover` and `:focus-within` (tap on touch screens). +- `starpunk/avatars.py`: a redirect from the own GoToSocial server (media it + hasn't cached) is followed through `safe_get`. + +## Verification + +- `tests/test_backfeed.py` (24 tests): totals include Threads' anonymous + count, `` and crosspost links present; redirected avatar + saved. Microformats, template and route tests pass. +- Rendered locally in headless Chromium in dark and light themes with the + like and reply cards open. diff --git a/docs/standards/versioning-strategy.md b/docs/standards/versioning-strategy.md index 901396d..c9d9bf1 100644 --- a/docs/standards/versioning-strategy.md +++ b/docs/standards/versioning-strategy.md @@ -4,7 +4,7 @@ **Last Updated**: 2026-11-03 (v2.10.1) StarPunk uses [Semantic Versioning 2.0.0](https://semver.org/): -`MAJOR.MINOR.PATCH`, currently **2.13.1**. Every release is a git tag +`MAJOR.MINOR.PATCH`, currently **2.13.2**. Every release is a git tag `vX.Y.Z` and a `CHANGELOG.md` entry. Where the number is stored and how to write the changelog entry is in [version-implementation-guide.md](version-implementation-guide.md); the diff --git a/starpunk/__init__.py b/starpunk/__init__.py index 39461a2..9d89d38 100644 --- a/starpunk/__init__.py +++ b/starpunk/__init__.py @@ -465,5 +465,5 @@ def create_app(config=None): # Package version (Semantic Versioning 2.0.0) # See docs/standards/versioning-strategy.md for details -__version__ = "2.13.1" -__version_info__ = (2, 13, 1) +__version__ = "2.13.2" +__version_info__ = (2, 13, 2) diff --git a/starpunk/avatars.py b/starpunk/avatars.py index 89260da..fb8861e 100644 --- a/starpunk/avatars.py +++ b/starpunk/avatars.py @@ -132,6 +132,11 @@ def _download(url: str, site_url: str) -> bytes: if own and urlparse(url).hostname == own: with httpx.Client(timeout=10.0, transport=webmention_ssrf.TRANSPORT) as http: with http.stream("GET", url, headers=headers) as response: + if response.is_redirect: + # GoToSocial sends media it hasn't cached to the original + # server: that one is fetched like any outside URL (v2.13.2) + from urllib.parse import urljoin + return _get(urljoin(url, response.headers["location"]), headers) if response.status_code >= 400: raise ValueError(f"HTTP {response.status_code}") data = b"" diff --git a/static/css/style.css b/static/css/style.css index d4baf49..2f95d5a 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -343,63 +343,38 @@ small { display: block; margin-top: var(--spacing-xs); color: var(--color-text-l color: var(--color-text-light); } -/* Backfed responses and silo counts (v2.13.0) */ -.webmention-via, -.silo-counts { +/* Backfed responses (v2.13.0) */ +.webmention-via { font-size: 0.875rem; color: var(--color-text-light); } -/* Facepile */ -.facepile { - display: flex; - align-items: center; - flex-wrap: wrap; -} - -.facepile .face { - display: block; - width: 32px; - height: 32px; - border-radius: 50%; - overflow: hidden; - border: 2px solid var(--color-bg); - margin-left: -8px; -} - -.facepile .face:first-child { - margin-left: 0; -} - -.facepile .face > .h-card, -.facepile .face > .h-card > a { - display: block; - width: 100%; - height: 100%; -} - -.facepile .face img { - width: 100%; - height: 100%; - object-fit: cover; -} - -.facepile .face-initial { - display: flex; - align-items: center; - justify-content: center; - width: 100%; - height: 100%; - font-size: 14px; - font-weight: bold; - color: white; -} - -.facepile .face-overflow { - margin-left: var(--spacing-xs); - font-size: 0.875rem; - color: var(--color-text-light); +/* Likes, reposts and bookmarks: counts with a hover list (v2.13.2) */ +.reactions { display: flex; flex-wrap: wrap; gap: var(--spacing-md); margin-top: var(--spacing-sm); color: var(--color-text-light); font-size: 0.875rem; } +.reaction { position: relative; display: inline-flex; align-items: center; gap: 0.3rem; padding-bottom: 0.4rem; cursor: default; } +.reaction > svg { width: 1rem; height: 1rem; flex: none; } +.reaction:hover, .reaction:focus-within { color: var(--color-text); } +.reaction-like:hover > svg, .reaction-like:focus-within > svg { color: #e0245e; } +.reaction-repost:hover > svg, .reaction-repost:focus-within > svg { color: #17bf63; } +.reaction-who { + display: none; position: absolute; left: 0; top: 100%; z-index: 10; + flex-direction: column; gap: 0.4rem; min-width: 13rem; max-width: 20rem; + padding: var(--spacing-sm); background: var(--color-bg-alt); border: 1px solid var(--color-border); + border-radius: var(--border-radius); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); } +.reaction:hover .reaction-who, .reaction:focus-within .reaction-who { display: flex; } +.reaction-title { font-weight: 600; color: var(--color-text); } +.reaction-people { display: flex; flex-direction: column; gap: 0.35rem; max-height: 14rem; overflow-y: auto; } +.reaction-person { display: flex; align-items: center; gap: 0.4rem; min-width: 0; line-height: 1.3; } +.reaction-person .h-card { display: flex; min-width: 0; } +.reaction-person .h-card a { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--color-text); min-width: 0; } +.reaction-person .p-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.reaction-person img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: none; } +.reaction-person .webmention-via { margin-left: auto; padding-left: 0.5rem; white-space: nowrap; } +.reaction-anon { color: var(--color-text-light); } +.reaction-elsewhere { display: block; margin-top: 0.15rem; padding-top: 0.4rem; border-top: 1px solid var(--color-border); color: var(--color-text-light); } +.reaction-elsewhere:first-child { margin-top: 0; padding-top: 0; border-top: 0; } +.reaction-elsewhere a { color: var(--color-link); } /* Generic Mentions */ .webmention-mention { diff --git a/templates/note.html b/templates/note.html index 6948345..07ba29a 100644 --- a/templates/note.html +++ b/templates/note.html @@ -78,12 +78,15 @@ {% endif %} + {{ responses.reactions(likes, reposts, replies, bookmarks, syndications, absolute_url_for('public.note', slug=note.slug)) }} + - {# Webmentions section (v1.6.0 Phase 5) - only shown if approved webmentions exist #} - {% if webmentions %} + {# Webmentions section (v1.6.0 Phase 5): replies, quotes and mentions. + Likes, reposts and bookmarks are the counts line above (v2.13.2). #} + {% if replies or quotes or mentions %}

Responses

@@ -94,27 +97,6 @@ {% endif %} - {% if likes %} -
-

{{ likes|length }} {{ 'Like' if likes|length == 1 else 'Likes' }}

- {{ responses.facepile(likes, 'u-like') }} -
- {% endif %} - - {% if reposts %} -
-

{{ reposts|length }} {{ 'Repost' if reposts|length == 1 else 'Reposts' }}

- {{ responses.facepile(reposts, 'u-repost') }} -
- {% endif %} - - {% if bookmarks %} -
-

{{ bookmarks|length }} {{ 'Bookmark' if bookmarks|length == 1 else 'Bookmarks' }}

- {{ responses.facepile(bookmarks, 'u-bookmark') }} -
- {% endif %} - {% if quotes %}

{{ quotes|length }} {{ 'Quote' if quotes|length == 1 else 'Quotes' }}

@@ -130,6 +112,5 @@ {% endif %}
{% endif %} - {{ responses.silo_counts(syndications) }} {% endblock %} diff --git a/templates/partials/responses.html b/templates/partials/responses.html index b7e9db6..8d898d5 100644 --- a/templates/partials/responses.html +++ b/templates/partials/responses.html @@ -41,22 +41,6 @@ {%- endmacro %} -{# Likes, reposts or bookmarks as a facepile; prop is u-like / u-repost / u-bookmark. - Faces past `shown` are hidden on screen but kept for parsers. #} -{% macro facepile(items, prop, shown=8) %} -
- {% for wm in items %} - shown %} hidden{% endif %}> - {{ author_card(wm, photo_size=32, show_name=False) }} - - - {% endfor %} - {% if items|length > shown %} - +{{ items|length - shown }} others - {% endif %} -
-{%- endmacro %} - {# A post that mentions this note without replying; also quote posts (v2.13.0) #} {% macro mention(wm) %}
@@ -68,12 +52,62 @@
{%- 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 %} -

On {{ s.name }}: {{ parts|join(' ยท ') }}

+{# Likes, reposts, replies and bookmarks: one line of counts under the note, + like other sites (v2.13.2). Hovering or focusing a count lists who, and + offers the same action on the note's crossposts. Each action is an + (https://indieweb.org/webactions) with those silo links as + its fallback, so web action handlers can take over. Counts a silo gives + without names (Threads) are added to the total. The people stay in the + markup as u-like / u-repost / u-bookmark h-cites. #} +{% set ICONS = { + 'like': '', + 'repost': '', + 'reply': '', + 'bookmark': '', +} %} +{% set VERBS = {'like': 'Like', 'repost': 'Repost', 'reply': 'Reply'} %} + +{% macro reaction(kind, items, prop, anon, one, many, copies=[], permalink='', people=True) %} +{% set ns = namespace(total=items|length) %} +{% for name, n in anon %}{% set ns.total = ns.total + n %}{% endfor %} +{% set verb = VERBS.get(kind) %} +{% if ns.total or (verb and copies) %} + + {{ ICONS[kind]|safe }}{% if ns.total %}{{ ns.total }}{% endif %} {{ ns.total }} {{ one if ns.total == 1 else many }} + + {% if ns.total %}{{ ns.total }} {{ one if ns.total == 1 else many }}{% endif %} + {% if (people and items) or anon %} + + {% if people %} + {% for wm in items %} + {{ author_card(wm, photo_size=20) }}{% if wm.via %}{{ wm.via }}{% endif %} + {% endfor %} + {% endif %} + {% for name, n in anon %}{{ '+' if items and people else '' }}{{ n }} on {{ name }}{% endfor %} + + {% endif %} + {% if verb and copies %} + {{ verb }} on {% for s in copies %}{{ s.name }}{% if not loop.last %} ยท {% endif %}{% endfor %} + {% endif %} + + +{% endif %} +{%- endmacro %} + +{% macro reactions(likes, reposts, replies, bookmarks, syndications, permalink) %} +{% set anon_likes, anon_reposts = [], [] %} +{% for s in syndications or [] %} + {% if s.likes_count %}{% set _ = anon_likes.append((s.name, s.likes_count)) %}{% endif %} + {% if s.reposts_count %}{% set _ = anon_reposts.append((s.name, s.reposts_count)) %}{% endif %} {% endfor %} +{% set copies = (syndications or [])|selectattr('remote_url')|list %} +{% if copies or likes or reposts or replies or bookmarks or anon_likes or anon_reposts %} +
+ {{ reaction('like', likes or [], 'u-like', anon_likes, 'like', 'likes', copies, permalink) }} + {{ reaction('repost', reposts or [], 'u-repost', anon_reposts, 'repost', 'reposts', copies, permalink) }} + {# Replies are listed in full below; here just the count and where to reply #} + {{ reaction('reply', replies or [], '', [], 'reply', 'replies', copies, permalink, people=False) }} + {{ reaction('bookmark', bookmarks or [], 'u-bookmark', [], 'bookmark', 'bookmarks') }} +
+{% endif %} {%- endmacro %} diff --git a/tests/test_backfeed.py b/tests/test_backfeed.py index cefce9f..9b47392 100644 --- a/tests/test_backfeed.py +++ b/tests/test_backfeed.py @@ -334,7 +334,11 @@ def test_note_page_shows_backfed_responses_quotes_and_counts(app, client, web): page = app.test_client().get(f"/note/{note.slug}").get_data(as_text=True) assert "via GoToSocial" in page assert "1 Quote" in page and "Look at this" in page - assert 'class="silo-counts">On GoToSocial: 12 likes ยท 1 repost<' in page + # Likes and reposts are a counts line (v2.13.2): named likes plus the silo's anonymous count + assert '13' in page and "+12 on GoToSocial" in page + assert '1' in page + assert f'' in page + assert f'Like on