From 05da05590bf8f8e8d54a0eee27d27fce3e85354d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 5 Oct 2026 00:49:03 -0700 Subject: Feed Articles view: long-form posts (NIP-23) from the feed's people/topics/relays as cards, own cursor + index; Popular keeps articles two others engaged with Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YRC6aKhwAud231ot9FPmhi --- src/media-cache.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/media-cache.js') diff --git a/src/media-cache.js b/src/media-cache.js index ee9e118..74c574a 100644 --- a/src/media-cache.js +++ b/src/media-cache.js @@ -41,6 +41,8 @@ async function tx(mode, fn) { }); } +export const ARTICLES_KEEP = 150; // articles per feed — whole, so a tap reads offline + // what a grid needs of a post: who, when, the words, and its imeta export const compactMediaEvent = (e) => ({ id: e.id, pubkey: e.pubkey, created_at: e.created_at, kind: e.kind, content: String(e.content || '').slice(0, 2000), @@ -55,7 +57,9 @@ export async function saveMediaIndex(key, rec) { try { await tx('readwrite', (s) => { s.put({ ...rec, images: (rec.images || []).slice(0, MEDIA_KEEP).map(compactMediaEvent), - videos: (rec.videos || []).slice(0, MEDIA_KEEP).map(compactMediaEvent), at: Date.now() }, key); + videos: (rec.videos || []).slice(0, MEDIA_KEEP).map(compactMediaEvent), + articles: (rec.articles || []).slice(0, ARTICLES_KEEP) + .map((e) => ({ ...e, content: String(e.content || '').slice(0, 100_000) })), at: Date.now() }, key); }); } catch {} } -- cgit v1.2.3