Notifications and sending songs to friends

Reactions to your songs, new followers, and songs sent to you are now
notifications: a bell on the feed (app and website) with an unread
count that updates live, and a list that marks them read. "Send ✉" on
a song sends it to people who follow you, with an optional note.
Settings picks which kinds to be notified about.

Push delivery uses no third-party accounts:
- Android: UnifiedPush through a distributor app (ntfy), pointed at
  our own ntfy server (docker-compose.ntfy.yml). Works the same in
  the F-Droid build; no Firebase.
- Browsers: standard Web Push from the existing service worker.
Both use Web Push encryption with a VAPID key pair the server makes
and keeps in the database. Push addresses are checked like any other
user-supplied URL. Setup is in docs/PUSH.md; the privacy page covers
the new data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 22:14:34 -04:00
co-authored by Claude Opus 5.5
parent 3b39910f13
commit f112a3515c
55 changed files with 3783 additions and 22 deletions
+12
View File
@@ -12,6 +12,7 @@ import type {
} from './dto';
import type { DeviceDTO } from './devices';
import type { LyricsDTO } from './lyrics';
import type { NotificationListDTO } from './notifications';
import type {
ChangeEmailInput,
ChangePasswordInput,
@@ -21,6 +22,8 @@ import type {
ResetPasswordInput,
SetFeaturedInput,
UpdateMeInput,
PushSubscriptionInput,
SendSongInput,
} from './schemas';
export class ApiError extends Error {
@@ -135,6 +138,15 @@ export function createApiClient({ baseUrl, getToken, credentials }: ApiClientOpt
searchTracks: (query: string) => request<TrackSearchResultDTO[]>(`/tracks/search?q=${q(query)}`),
/** Null when no lyrics were found for the song. */
lyrics: (trackId: string) => request<LyricsDTO | null>(`/tracks/${q(trackId)}/lyrics`),
/** Send a song to people who follow you; returns who it went to. */
sendSong: (input: SendSongInput) => request<{ sentTo: string[] }>('/shares', { method: 'POST', body: input }),
notifications: (cursor?: string | null) =>
request<NotificationListDTO>(`/notifications${cursor ? `?cursor=${q(cursor)}` : ''}`),
markNotificationsRead: () => request<{ ok: true }>('/notifications/read', { method: 'POST', body: {} }),
/** The server's public key for push subscriptions (VAPID). */
pushKey: () => request<{ publicKey: string }>('/push/key'),
addPushSubscription: (input: PushSubscriptionInput) => request<{ ok: true }>('/me/push', { method: 'PUT', body: input }),
removePushSubscription: (endpoint: string) => request<{ ok: true }>('/me/push', { method: 'DELETE', body: { endpoint } }),
connections: () => request<ConnectionDTO[]>('/connections'),
authorizeUrl: (provider: 'plex' | 'lastfm', body: { client: 'web' | 'mobile'; returnTo?: string }) =>