| … | … | @@ -981,6 +981,14 @@ function outsideActor (uri) { |
| 981 | 981 | return '<a class="who" href="' + esc(url.href) + '" rel="nofollow noopener" target="_blank">' + esc(label) + '</a> <span class="who">(fediverse)</span>' |
| 982 | 982 | } |
| 983 | 983 | |
| 984 | // A bsky actor is a DID (hyper-social #82, I2). Linked to its bsky.app profile — only a well-formed did: becomes a link. |
| 985 | function bskyActor (did) { |
| 986 | const d = String(did || '') |
| 987 | if (!/^did:[a-z]+:[A-Za-z0-9._:%-]+$/.test(d)) return '<span class="who">' + esc(d || 'someone') + '</span> <span class="who">(bluesky)</span>' |
| 988 | const short = d.length > 24 ? d.slice(0, 20) + '…' : d |
| 989 | return '<a class="who" href="https://bsky.app/profile/' + esc(d) + '" rel="nofollow noopener" target="_blank">' + esc(short) + '</a> <span class="who">(bluesky)</span>' |
| 990 | } |
| 991 | |
| 984 | 992 | export function notifications (rows, profiles = null) { |
| 985 | 993 | const VERB = { |
| 986 | 994 | reaction: (n) => (n.value === 'like' ? 'liked' : 'reacted ' + esc(n.value || '')) + ' your post', |
| … | … | @@ -997,7 +1005,7 @@ export function notifications (rows, profiles = null) { |
| 997 | 1005 | ? ' <a href="/t/' + encodeURIComponent(n.target.feed + '/' + n.target.collection + '/' + n.target.name) + '">→</a>' |
| 998 | 1006 | : '' |
| 999 | 1007 | const snippet = n.body ? '<div class="who bio">' + esc(n.body.replace(/\s+/g, ' ').trim().slice(0, 120)) + '</div>' : '' |
| 1000 | | const by = n.source === 'fediverse' ? outsideActor(n.author) : who(n.author, profiles) |
| 1008 | const by = n.source === 'fediverse' ? outsideActor(n.author) : n.source === 'bsky' ? bskyActor(n.author) : who(n.author, profiles) |
| 1001 | 1009 | return '<li>' + by + ' ' + verb + link + snippet + '</li>' |
| 1002 | 1010 | }).join('') + '</ul>' |
| 1003 | 1011 | : empty('No notifications.', |