Repository navigation
Make the feature of the day editable without a deploy - #628
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
site-configcollection (qbreaderdb,name: 'feature-of-the-day') instead of hardcoded inclient/index.html.routes/home.jsserves/, 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).marked, then DOMPurify with a small allowlist (a,b,br,code,em,i,li,ol,p,strong,ul; onlyhref), so<script>, event handlers, andjavascript:links are stripped./admin/site-config(linked from the admin portal) viaGET/PUT /api/admin/site-config/:id. Names are restricted to those inserver/site-config.js, and markdown is capped at 2000 characters.Notes
marked.dompurifyandjsdomwere already present.{ "name": "feature-of-the-day", "markdown": "You can filter your queries to only show [standard format](/about/standard-format) sets." }intosite-config. There is no fallback, so the home page returns a 500 if the document is missing.Testing
npm run lintpasses./renders the default text with an empty collection, and the admin page/API redirect when logged out.onerrorattributes, andjavascript:links.🤖 Generated with Claude Code