diff options
| author | Adam Soltys <[email protected]> | 2026-10-05 00:49:03 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-05 00:49:03 -0700 |
| commit | 05da05590bf8f8e8d54a0eee27d27fce3e85354d (patch) | |
| tree | 298523858f172ab228fdd4db69e129f63f98e0c8 /src/media-cache.js | |
| parent | c2a4e13e5ce6b5df522d23bf94bde01f1a9bcbf5 (diff) | |
| download | coinosv3-05da05590bf8f8e8d54a0eee27d27fce3e85354d.tar.gz coinosv3-05da05590bf8f8e8d54a0eee27d27fce3e85354d.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YRC6aKhwAud231ot9FPmhi
Diffstat (limited to 'src/media-cache.js')
| -rw-r--r-- | src/media-cache.js | 6 |
1 files changed, 5 insertions, 1 deletions
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 {} } |
