Skip to content

Make the feature of the day editable without a deploy - #628

Merged
geoffrey-wu merged 4 commits into
mainfrom
feature-of-the-day-config
Oct 21, 2026
Merged

geoffrey-wu merged 4 commits into
mainfrom
feature-of-the-day-config

Conversation

@geoffrey-wu

@geoffrey-wu geoffrey-wu commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Feature of the Day text is now stored as markdown in the site-config collection (qbreader db, name: 'feature-of-the-day') instead of hardcoded in client/index.html.
  • routes/home.js serves /, rendering the markdown into the page. Result is cached for 60s, so edits show up within a minute with no deploy or restart. The document must exist (see below).
  • Markdown goes through marked, then DOMPurify with a small allowlist (a, b, br, code, em, i, li, ol, p, strong, ul; only href), so <script>, event handlers, and javascript: links are stripped.
  • Admins edit it at /admin/site-config (linked from the admin portal) via GET/PUT /api/admin/site-config/:id. Names are restricted to those in server/site-config.js, and markdown is capped at 2000 characters.

Notes

  • Adds one dependency, marked. dompurify and jsdom were already present.
  • Before deploying, insert { "name": "feature-of-the-day", "markdown": "You can filter your queries to only show [standard format](/about/standard-format) sets." } into site-config. There is no fallback, so the home page returns a 500 if the document is missing.

Testing

  • npm run lint passes.
  • Booted the server: / renders the default text with an empty collection, and the admin page/API redirect when logged out.
  • Sanitizer checked directly against script tags, onerror attributes, and javascript: links.
  • Not tested: saving from the admin page while logged in as an admin.

🤖 Generated with Claude Code

geoffrey-wu and others added 4 commits October 21, 2026 14:05
Store markdown in a new site-config collection, render it with marked and
sanitize it with DOMPurify (strict tag allowlist), and edit it from
/admin/site-config without a deploy or restart.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@geoffrey-wu geoffrey-wu left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

.

@geoffrey-wu
geoffrey-wu merged commit 279a502 into main Oct 21, 2026
2 checks passed
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.

1 participant