Skip to content

feat(reads): block NSFW/spam articles with updatable lists - #740

Merged
spe1020 merged 4 commits into
mainfrom
feat/reads-nsfw-blocklist
Sep 19, 2026
Merged

spe1020 merged 4 commits into
mainfrom
feat/reads-nsfw-blocklist

Conversation

@spe1020

@spe1020 spe1020 commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Seed-block known NSFW/spam Reads authors and events (pubkey 16c0ebba…79992 plus the Mila / dasha naddrs) and overlay updates from Cloudflare KV so lists can change without a redeploy
  • Keyword denylist excludes matching articles from feed, search, explore, profile Reads, and direct /r / /reads naddr routes; hits are logged and the author pubkey is auto-blocked
  • Report from the article ⋯ menu logs to the same review queue; /admin/reads-moderation (NIP-98) edits lists and reviews reports
  • Direct links to blocked content show “Content unavailable” instead of rendering; OG injection falls back to generic tags

Test plan

  • Open the Mila naddr (/reads/naddr1qvzqq… / /r/…) and confirm “Content unavailable”, no article body
  • Confirm that pubkey’s articles are absent from Reads feed, explore, search recipes, and the author profile Reads tab
  • Confirm a keyword-matching article (title/summary/hashtag) is filtered and the author appears in the admin blocklist after a hit
  • Report an article from the ⋯ menu and confirm it shows in /admin/reads-moderation
  • Add/remove a pubkey or denylist term in admin and confirm feeds pick it up without a redeploy
  • pnpm exec vitest run src/lib/reads/moderation.test.ts src/lib/recipeOgHtml.server.test.ts

Made with Cursor

Seed-block known spam pubkeys and naddrs, filter keyword matches from
feeds and direct links, and let admins update KV lists without a redeploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 19, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
zapcooking-frontend d10f4e4 Sep 19 2026, 04:20 PM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical authorization and concurrent-write issues, plus moderation reset and UI accessibility/loading defects, remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity · 3 Medium severity

Open (5)
What changed in this PR

Adds configurable Reads moderation with blocklists, keyword filtering, reporting, admin controls, and blocked-content fallbacks.

Changes:

  • Filters moderated content across feeds, search, profiles, and direct routes.
  • Adds Cloudflare KV list management, reports, hit logging, and admin tooling.
  • Provides unavailable states and generic OG metadata for blocked content.
File Summary
src/​routes/​user/​[slug]/​+page.svelte Filters profile Reads; refreshes needed when moderation data changes.
src/​routes/​search/​+page.svelte Filters search results.
src/​routes/​recipes/​+page.svelte Filters recipe feeds.
src/​routes/​reads/​[naddr]/​+page.svelte Handles blocked Reads routes.
src/​routes/​r/​[naddr]/​+page.svelte Handles blocked article routes.
src/​routes/​api/​reads/​moderation/​report/​+server.ts Accepts moderation reports.
src/​routes/​api/​reads/​moderation/​hit/​+server.ts Records keyword hits; unauthenticated auto-blocking requires verification.
src/​routes/​api/​reads/​moderation/​+server.ts Serves moderation lists.
src/​routes/​api/​admin/​reads-moderation/​+server.ts Provides authenticated list management.
src/​routes/​admin/​reads-moderation/​+page.svelte Provides moderation administration; initial loading can remain stuck.
src/​routes/​admin/​+page.svelte Adds moderation navigation.
src/​lib/​recipeOgHtml.server.ts Provides generic OG metadata for blocked content.
src/​lib/​reads/​moderationConfig.ts Defines seed moderation lists.
src/​lib/​reads/​moderationClient.ts Implements client filtering and reporting.
src/​lib/​reads/​moderation.ts Implements moderation logic; empty denylist overlays must override seeds.
src/​lib/​reads/​moderation.test.ts Tests moderation behavior.
src/​lib/​reads/​moderation.server.ts Persists lists and logs; concurrent auto-block updates need merge-safe writes.
src/​lib/​articleUtils.ts Applies moderation to article filtering.
src/​lib/​articleStore.ts Reacts to moderation updates.
src/​hooks.server.ts Loads moderation lists for server rendering.
src/​components/​TagsSearchAutocomplete.svelte Filters autocomplete results.
src/​components/​table/​FeedSection.svelte Filters feed sections.
src/​components/​Recipe/​Recipe.svelte Adds report actions.
src/​components/​reads/​ReportArticleModal.svelte Adds report dialog; heading needs an accessible label ID.
src/​components/​reads/​ContentUnavailable.svelte Displays blocked-content fallback.
src/​components/​LongformFoodFeed.svelte Filters explore content.
package.json Bumps application version.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/lib/reads/moderation.server.ts Outdated
Comment thread src/routes/api/reads/moderation/hit/+server.ts
Comment thread src/components/reads/ReportArticleModal.svelte Outdated
Comment thread src/lib/reads/moderation.ts Outdated
Comment thread src/routes/admin/reads-moderation/+page.svelte Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 19, 2026

Copy link
Copy Markdown

Deploying frontend with  Cloudflare Pages  Cloudflare Pages

Latest commit: d10f4e4
Status: ✅  Deploy successful!
Preview URL: https://202a3792.frontend-hvd.pages.dev
Branch Preview URL: https://feat-reads-nsfw-blocklist.frontend-hvd.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 19, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
frontend d10f4e4 Sep 19 2026, 04:23 PM

spe1020 and others added 3 commits September 19, 2026 12:09
Co-authored-by: Cursor <cursoragent@cursor.com>
Verify signed events before auto-blocking, persist each auto-block as its
own KV key, and treat an empty denylist overlay as a deliberate clear.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@spe1020
spe1020 merged commit dba3caf into main Sep 19, 2026
6 of 7 checks passed
@spe1020
spe1020 deleted the feat/reads-nsfw-blocklist branch September 19, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants