Files
eranos/src/lib/notificationTemplates.ts
T
Alex Gleason 234d3a21a3 Support NIP-84 Highlight events (kind 9802)
Render highlight excerpts as pull-quotes with source attribution across
feed cards, detail pages, and quote embeds. Without this, kind 9802
events fell through to UnknownKindContent in cards and — worse — had
their quoted prose fed through the kind-1 tokenizer in embeds,
auto-linkifying URLs and hashtags that were part of the original source,
not the highlight author's post.

Integration points:
- HighlightContent renders the excerpt with an accent blockquote, wraps
  the highlighted span in <mark> when a context tag is present, and
  attributes the source via EmbeddedNaddr (a-tag), EmbeddedNote
  (e-tag), or a sanitized URL chip (r-tag).
- EmbeddedHighlightCard gives quoted highlights a dedicated compact
  card instead of the generic-embed fallback.
- Added 9802 to NoteCard + PostDetailPage dispatch, KIND_HEADER_MAP,
  CommentContext labels/icons, NOTIFICATION_KIND_NOUNS, and the
  EmbeddedNote dispatcher.
- Registered an EXTRA_KINDS entry with feedIncludeHighlights (off by
  default) and showHighlights (on), plus a /highlights route backed by
  KindFeedPage.
- Added a highlights notification type with its own subscription
  template, preference toggle, grouped notification row, and
  author-ownership filter so users are only notified when their own
  content is highlighted.
- feedUtils hides empty highlights with no source reference.
2026-05-05 17:24:42 -05:00

74 lines
1.7 KiB
TypeScript

/**
* nostr-push notification templates.
*
* Each entry becomes a separate server-side subscription with its own filter
* and notification template. Templates use nostr-push's variable substitution:
* {{author_name}}, {{content}}, {{amount}}.
*/
export interface NotificationTemplate {
/** Suffix appended to the base subscription ID to make it unique. */
id: string;
/** Nostr event kinds this subscription watches. */
kinds: number[];
/** Notification title template. */
title: string;
/** Notification body template. */
body: string;
}
/**
* Notification subscriptions to register with nostr-push.
* Each entry becomes a separate subscription with its own filter and template.
*/
export const NOTIFICATION_TEMPLATES: NotificationTemplate[] = [
{
id: 'reactions',
kinds: [7],
title: '{{author_name}} Reacted!',
body: '{{content}}',
},
{
id: 'reposts',
kinds: [6, 16],
title: '{{author_name}} Reposted!',
body: '{{content}}',
},
{
id: 'zaps',
kinds: [9735],
title: '{{amount}} sats!',
body: '{{author_name}} zapped you',
},
{
id: 'mentions',
kinds: [1],
title: '{{author_name}} Mentioned You!',
body: '{{content}}',
},
{
id: 'comments',
kinds: [1111],
title: '{{author_name}} Commented!',
body: '{{content}}',
},
{
id: 'badges',
kinds: [8],
title: '{{author_name}} awarded you a badge!',
body: 'You received a new badge.',
},
{
id: 'letters',
kinds: [8211],
title: '{{author_name}} sent you a letter!',
body: 'You have a new letter waiting for you.',
},
{
id: 'highlights',
kinds: [9802],
title: '{{author_name}} highlighted your post!',
body: '{{content}}',
},
];