diff options
| author | Adam Soltys <[email protected]> | 2026-09-20 23:20:41 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-20 23:20:41 -0700 |
| commit | 501da85c85e014eb48e6cd7df246875fadf27cb3 (patch) | |
| tree | f24d15113f4d64f63853788b41dd6dad3531d197 /tools/feed-custom-test.js | |
| parent | 19ac1c46091e969075d998af95d304d82cbba259 (diff) | |
| download | coinosv3-501da85c85e014eb48e6cd7df246875fadf27cb3.tar.gz coinosv3-501da85c85e014eb48e6cd7df246875fadf27cb3.zip | |
Feeds: packs are found by a few letters of their title, and by following.space's real link form.
NIP-50 search only knew the packs the search relay carried — 'Niche
Accounts' lives on damus and nos.lol, not relay.nostr.band. So the editor
now indexes the wide relays' packs once per session and matches titles and
descriptions by substring. A following.space link is /d/<id>?p=<pubkey>,
not an naddr; both are accepted.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Diffstat (limited to 'tools/feed-custom-test.js')
| -rw-r--r-- | tools/feed-custom-test.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/feed-custom-test.js b/tools/feed-custom-test.js index 8062a15..0fc7ab8 100644 --- a/tools/feed-custom-test.js +++ b/tools/feed-custom-test.js @@ -23,7 +23,8 @@ const seeded = [signed('hello from the feed, about #bitcoin today', 300), signed const CURATOR_SK = generateSecretKey(); const MEMBER = getPublicKey(generateSecretKey()); const PACK = finalizeEvent({ kind: 39089, created_at: Math.floor(Date.now() / 1000) - 100, tags: [['d', 'test-pack'], ['title', 'Test pack'], ['p', MEMBER]], content: '' }, CURATOR_SK); -const PACK_LINK = 'https://following.space/d/' + naddrEncode({ kind: 39089, pubkey: PACK.pubkey, identifier: 'test-pack', relays: [] }); +const PACK_LINK = 'https://following.space/d/test-pack?p=' + PACK.pubkey; // the form following.space shares +const PACK_NADDR = naddrEncode({ kind: 39089, pubkey: PACK.pubkey, identifier: 'test-pack', relays: [] }); const html = await buildHtml({ minify: true, pwa: false }); const server = Bun.serve({ port: 5297, fetch: () => new Response(html, { headers: { 'content-type': 'text/html' } }) }); @@ -130,9 +131,16 @@ try { console.log('\n[a follow pack from following.space]'); await page.click('.feed-chip.add'); await sleep(300); await type('input[placeholder="e.g. Bitcoin builders"]', 'Pack feed'); + await type('input[placeholder="Search packs, or paste a following.space link…"]', 'tes'); + check('a few letters of the title find the pack', await waitText('test pack', 8000) && await waitText('1 members', 2000)); + await type('input[placeholder="Search packs, or paste a following.space link…"]', 'zzzz'); + await sleep(900); + check('...and letters that match nothing find nothing', !(await page.evaluate(() => document.body.innerText)).includes('Test pack')); + await type('input[placeholder="Search packs, or paste a following.space link…"]', PACK_NADDR); + check('a bare naddr finds it', await waitText('test pack', 6000)); await type('input[placeholder="Search packs, or paste a following.space link…"]', PACK_LINK); - const found = await waitText('test pack', 6000); - check('a pasted following.space link finds the pack', found && await waitText('1 members', 2000)); + await sleep(900); + check('a pasted following.space link finds it', await waitText('test pack', 6000)); await page.evaluate(() => [...document.querySelectorAll('.row')].find((r) => /Test pack/.test(r.textContent) && !r.querySelector('button')).click()); await sleep(300); check('...and adds it to the feed', await page.evaluate(() => [...document.querySelectorAll('.row')].some((r) => /Test pack/.test(r.textContent) && r.querySelector('button')))); await page.evaluate(() => { window.__reqs = []; }); |
