aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-12-05 06:19:34 -0700
committerAdam Soltys <[email protected]>2026-12-05 06:19:34 -0700
commit1e5c781b85d7cf9922914c57ddbaf9acfd075042 (patch)
treec005225f6248c54d4dad94410e8de711a57facda
parent8249966d6f55b06c6f7a6340693b068a89058327 (diff)
downloadcoinosv3-1e5c781b85d7cf9922914c57ddbaf9acfd075042.tar.gz
coinosv3-1e5c781b85d7cf9922914c57ddbaf9acfd075042.zip
A bio's links stay plain links: no page cards or PAFF players in a profile header. "let's not render site previews in bios" (Adam, 2026-12-05, PAFF's profile showed two big paff.club cards). The bio renders through noteBody with bare links (bareLinkBody); notes are untouched. link-preview-test gains a bio check (fails without the fix); profile-open-test and features-smoke-test pass.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6UBzkUjWrGu31fqD5d
-rw-r--r--src/features/messages.js11
-rw-r--r--tools/link-preview-test.js11
2 files changed, 17 insertions, 5 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 952350f..dbbe05e 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -11047,6 +11047,9 @@ export function messagesFeature(ctx) {
const x = e.clientX - (r.left + (r.width - w) / 2), y = e.clientY - (r.top + (r.height - hh) / 2);
return x >= 0 && x <= w && y >= 0 && y <= hh;
}
+ // A bio's links stay links: no page cards or PAFF players in a profile header.
+ let bareLinks = false;
+ const bareLinkBody = (text) => { bareLinks = true; try { return noteBody(text); } finally { bareLinks = false; } };
function urlNode(url, { label = null, isImage = false, shown: written = null } = {}) {
if (isVideoUrl(url)) {
return videoNode(url, { stable: !!feedPaint });
@@ -11081,7 +11084,7 @@ export function messagesFeature(ctx) {
});
}
if (youtubeId(url)) return youtubeEmbed(url, youtubeId(url));
- if (!label && paffMusicUrl(url)) {
+ if (!label && !bareLinks && paffMusicUrl(url)) {
let pv = previews.get(url) || null;
if (feedPaint) {
if (!feedPaint.media.has('pv:' + url)) feedPaint.media.set('pv:' + url, pv);
@@ -11089,7 +11092,7 @@ export function messagesFeature(ctx) {
}
return paffSongCard(url, pv);
}
- if (!label && paffEmbedUrl(url)) {
+ if (!label && !bareLinks && paffEmbedUrl(url)) {
let pv = previews.get(url) || null;
if (feedPaint) {
if (!feedPaint.media.has('pv:' + url)) feedPaint.media.set('pv:' + url, pv);
@@ -11097,7 +11100,7 @@ export function messagesFeature(ctx) {
}
return paffEmbed(url, pv);
}
- if (!label && previewable(url)) {
+ if (!label && !bareLinks && previewable(url)) {
// a frozen feed row keeps the card (or the bare link) it first painted
let pv = previews.get(url) || null;
if (feedPaint) {
@@ -14228,7 +14231,7 @@ export function messagesFeature(ctx) {
// in a bio was punching clean through the card).
showAbout && !ui.profEdit
? h('p', { class: 'small', style: 'margin:0;white-space:pre-wrap;overflow-wrap:anywhere' },
- ...noteBody(about.slice(0, 1000)))
+ ...bareLinkBody(about.slice(0, 1000)))
: null,
ui.profEdit ? null : socialLine(pk),
ui.profEdit ? null : socialList(pk),
diff --git a/tools/link-preview-test.js b/tools/link-preview-test.js
index 3b2aad3..2eeac7d 100644
--- a/tools/link-preview-test.js
+++ b/tools/link-preview-test.js
@@ -22,7 +22,7 @@ const POSTS = [
finalizeEvent({ kind: 1, created_at: now - 120, tags: [], content: 'film night https://paff.club/movie/1382-hackers-1995/play?q=1080p&t=4910' }, AUTHOR),
finalizeEvent({ kind: 1, created_at: now - 150, tags: [], content: 'on repeat https://paff.club/song/abc123' }, AUTHOR),
];
-const PROFILE = finalizeEvent({ kind: 0, created_at: now - 100, tags: [], content: JSON.stringify({ name: 'Linker', picture: 'http://localhost:5311/face.png' }) }, AUTHOR);
+const PROFILE = finalizeEvent({ kind: 0, created_at: now - 100, tags: [], content: JSON.stringify({ name: 'Linker', picture: 'http://localhost:5311/face.png', about: 'Read me at https://news.example/story/1 or https://paff.club/movie/1382-hackers-1995/play?q=1080p&t=4910' }) }, AUTHOR);
const html = await buildHtml({ minify: true, pwa: false });
const previewHits = [];
@@ -201,6 +201,15 @@ try {
for (let i = 0; i < 20; i++) { draft = await page.evaluate(() => { const p = document.querySelector('.draft-preview'); return p && { card: !!p.querySelector('.link-card'), title: p.querySelector('.link-title')?.textContent }; }); if (draft?.card) break; await sleep(250); }
check('a draft\'s preview shows the link as its card', opened && draft?.card && /Hackers/.test(draft.title || ''), JSON.stringify(draft));
check('...asked for once the typing settled, not per keystroke', previewHits.filter((u) => u.startsWith('https://movies.example')).length === 1, JSON.stringify(previewHits));
+ // a bio's links stay links (Adam, 2026-12-05: PAFF's bio painted two big cards)
+ await page.evaluate(() => document.querySelector('.draft-preview')?.closest('dialog, .modal')?.remove());
+ await page.evaluate(() => { const a = document.querySelector('.notes-feed > .row .note-avatar'); a.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true })); a.click(); });
+ await waitText('read me at', 10000);
+ const bio = await page.evaluate(() => {
+ const p = [...document.querySelectorAll('p')].find((n) => /read me at/i.test(n.textContent));
+ return p && { links: [...p.querySelectorAll('a')].map((a) => a.getAttribute('href')), card: !!p.querySelector('.link-card, .paff-embed, .paff-song') };
+ });
+ check('a bio shows its links as plain links, no cards', !!bio && !bio.card && bio.links.length === 2, JSON.stringify(bio));
check('no page errors', errs.length === 0, errs.slice(0, 2).join(' | '));
} finally { await browser.close(); server.stop(true); paffServer.stop(true); }
console.log(ok ? '\nāœ… links show as the cards their pages describe' : '\nāŒ failed');