feat(dashboard): public shareable stats page - #19
Merged
Conversation
Adds /public — a read-only, no-auth stats page that anyone can view. Renders the /public-stats API endpoint (pageviews, visitors, bots blocked, daily chart, top pages, referrers, countries, devices) in a clean layout matching the design system. Share URL format: /public?worker=https://your-worker.workers.dev&site=yoursite.com Workers must opt in by setting PUBLIC_STATS_SITES=yoursite.com in wrangler.toml. When no params are present, the page shows setup instructions instead of an error. Includes "Powered by Flarelytics" footer for organic reach. Also adds 7 worker tests covering the /public-stats endpoint: missing site param, invalid characters, forbidden site, empty allowlist, happy-path stats shape, CF failure → 502, and CORS reflection.
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
/public— a read-only, no-auth Astro page that renders a site's analytics publicly/public-statsworker endpoint (opt-in viaPUBLIC_STATS_SITES)Share URL format
Users opt in by setting
PUBLIC_STATS_SITES=yoursite.cominwrangler.toml.Test plan
/public-statsworker tests: missing site, invalid chars, forbidden site, empty allowlist, happy-path stats shape, CF failure → 502, CORS reflection3 page(s) built)