Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228<!doctype html><!-- aligned.click — the feed builder's front door. Copyright (C) 2026 Johan Lagerlöf. Licensed under the GNU AGPL v3 or later. See LICENSE. --><html lang="en"><head><meta charset="utf-8"><title>aligned.click — feeds</title><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"><meta name="theme-color" content="#2f6f5e"><!-- Served by feeds/web.py, which sends the CSP as a header. `connect-src 'self' https:` stays open because atproto-post draws each pick live from whichever PDS hosts its author — nothing here stores post text (see reader/chat.html for the same reason). script-src allows 'unsafe-inline' for the one setup script below; every library is from /shared/. --><script type="module" src="/shared/atproto-wc.js"></script><link rel="stylesheet" href="/shared/theme.css"><style> :root { color-scheme: light dark; --accent: #2f6f5e; --accent-fill: #2f6f5e; --bg: #ffffff; --fg: #1a1a1a; --muted: #6b7280; --border: #e5e7eb; --panel: #f7f8f8; --atproto-accent: var(--accent); } @media (prefers-color-scheme: dark) { :root { --accent: #4e9d85; --accent-fill: #2a6353; --bg: #17181c; --fg: #e8e8e8; --muted: #9aa0a6; --border: #2c2d33; --panel: #1f2025; } } * { box-sizing: border-box; } html, body { margin: 0; background: var(--bg); color: var(--fg); } body { font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; } #app { max-width: 760px; margin: 0 auto; padding: 20px 16px 64px; } header { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 16px; } header h1 { font-size: 17px; margin: 0; letter-spacing: -0.01em; } header h1 .dot { color: var(--accent); } header .tagline { font-size: 13px; color: var(--muted); margin: 2px 0 0; } .ask { margin-bottom: 18px; } .ask label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 6px; } .row { display: flex; gap: 8px; } .row input { flex: 1; font: inherit; font-size: 16px; padding: 12px; min-height: 44px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: inherit; } .row button { font: inherit; font-size: 16px; padding: 0 16px; min-height: 44px; border: 0; border-radius: 8px; background: var(--accent-fill); color: #fff; cursor: pointer; white-space: nowrap; } .row button:disabled { opacity: 0.6; cursor: wait; } .hint { font-size: 12px; color: var(--muted); margin-top: 6px; } .result { margin-top: 18px; } .feed { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; background: var(--panel); } .feed h2 { font-size: 15px; margin: 0 0 2px; } .feed .meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; } .feed h3 { font-size: 13px; margin: 12px 0 6px; } .kw { margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; } .kw .chip { font-size: 12px; color: var(--muted); list-style: none; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; } .batch { display: grid; gap: 10px; } .pick { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--bg); } .pick atproto-post { display: block; } .pick .why { font-size: 12px; color: var(--muted); margin-top: 8px; } .pick .why b { color: var(--fg); font-weight: 600; } .empty { font-size: 13px; color: var(--muted); } .criteria { font-size: 12px; color: var(--muted); margin: 0 0 10px; } .criteria b { color: var(--fg); font-weight: 600; } .settings { border: 1px dashed var(--border); border-radius: 8px; padding: 8px 10px; margin: 0 0 12px; background: transparent; } .settings .criteria { font-size: 13px; color: var(--fg); margin: 0 0 6px; line-height: 1.4; } .settings .criteria span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; display: block; } .settings .kw { margin: 0; } .error { color: #c0392b; font-size: 13px; margin-top: 8px; white-space: pre-wrap; } footer { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); } footer code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }</style></head><body><div id="app"> <header> <h1>aligned<span class="dot">.</span>click <span style="font-weight:400">— feeds</span></h1> <p class="tagline">Tell me what you want to see; one round searches and picks a diverse batch.</p> </header>
<section class="ask"> <label for="q">What types of posts do you want to see?</label> <div class="row"> <input id="q" type="text" placeholder="posts about sharing food" autocomplete="off" maxlength="300"> <button id="run">Run round</button> </div> <p class="hint">One shot: your words become the criteria, the pool is seeded from them, the pool is searched, and the whole result goes into one call.</p> </section>
<main id="result" class="result"></main> <div class="error" id="error" hidden></div>
<footer> State lives in <code>feeds/feeds.json</code>. Each round searches the pool, loads everything found plus the reader's history into one model context, and returns 8 diverse picks. </footer></div>
<script> // The one script that talks to the server; every post card is drawn by // atproto-post directly from the network, and none of its text is stored here. const RESULT = document.getElementById("result"); const ERROR = document.getElementById("error"); const RUN = document.getElementById("run"); const Q = document.getElementById("q");
function esc(s) { return String(s ?? "").replace(/[&<>"']/g, c => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'", }[c])); }
function showError(msg) { ERROR.textContent = msg; ERROR.hidden = !msg; }
function render(feed) { if (!feed) { RESULT.innerHTML = '<div class="feed"><p class="empty">No feed yet — run a round above.</p></div>'; return; } const chips = (feed.keywords || []) .map(k => `<li class="chip">${esc(k)}</li>`).join("\n"); const settings = ` <div class="settings"> <p class="criteria"><span>refined criteria</span>${esc(feed.criteria || feed.text)}</p> <p class="criteria"><span>seed keywords</span></p> <ul class="kw">${chips || '<li class="chip">(no keywords)</li>'}</ul> </div>`; const posts = Object.values(feed.posts || {}); const picks = feed.suggested || []; let feedCards = '<div class="batch">'; if (posts.length === 0) { feedCards += '<div class="empty">No posts on the feed yet.</div>'; } for (const p of posts) { feedCards += '<div class="pick">' + `<atproto-post src="${esc(p.uri)}"></atproto-post>` + `<div class="why"><b>via “${esc(p.found_by)}”</b>` + (p.grade != null ? ` · <b>grade ${esc(p.grade)}/10</b>` : "") + (p.why ? ` — ${esc(p.why)}` : "") + "</div></div>"; } feedCards += "</div>"; let cards = '<div class="batch">'; if (picks.length === 0) { cards += '<div class="empty">Nothing suggested — the search came back empty.</div>'; } for (const p of picks) { const meta = `@${esc(p.handle)} · via “${esc(p.found_by)}”`; cards += '<div class="pick">' + `<atproto-post src="${esc(p.uri)}"></atproto-post>` + `<div class="why"><b>${meta}</b>` + (p.grade != null ? ` · <b>grade ${esc(p.grade)}/10</b>` : "") + (p.why ? ` — ${esc(p.why)}` : "") + "</div></div>"; } cards += "</div>"; RESULT.innerHTML = ` <div class="feed"> <h2>${esc(feed.text)}</h2> <div class="meta">round ${esc(feed.round)} · generated ${posts.length} post(s) · searched: ${esc((feed.keywords || []).length)} keyword(s)</div> ${settings} <h3>the feed</h3> ${feedCards} <h3 style="margin-top:16px">this round's picks</h3> ${cards} </div>`; }
async function run() { const text = Q.value.trim(); if (!text) return; showError(""); RUN.disabled = true; RUN.textContent = "Searching…"; try { const r = await fetch("/api/add", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ text }), }); const data = await r.json(); if (!r.ok) throw new Error(data.error || `HTTP ${r.status}`); render(data); Q.value = ""; } catch (e) { showError(`could not run the round: ${e}`); } finally { RUN.disabled = false; RUN.textContent = "Run round"; } }
RUN.addEventListener("click", run); Q.addEventListener("keydown", e => { if (e.key === "Enter") run(); }); fetch("/api/feeds", { headers: { Accept: "application/json" } }) .then(r => r.json()) .then(d => { const ids = Object.keys(d.feeds || {}).sort().reverse(); render(ids.length ? d.feeds[ids[0]] : null); }) .catch(() => render(null));</script></body></html>