Commit graph

17 commits

Author SHA1 Message Date
King Omar
046937dc37 Add Worker routes for sitemap.xml and robots.txt
Pages was serving index.html (SPA fallback) for these paths because no Worker
route existed to intercept them. Worker already has serveSitemap() and the
robots.txt inline response — they just weren't being reached.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-12 13:55:42 +10:00
King Omar
39e36dfe76 fix: use SUN in cron expression for Cloudflare compatibility
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 01:17:33 +10:00
King Omar
5c291d29ea feat: leaderboard, milestones, email capture, postcode, flag, stats bar
- Vote state now persists on page load (user_vote in proposals query)
- Stats bar: live votes-today / citizens / proposals counts
- Leaderboard section: top 10 proposals with milestone progress bars
- Milestone system: 100→viral, 500→community, 1k→publish, 5k→minister, 10k→media
- Email capture modal after 3rd vote (postcode optional)
- Milestone email notifications via Resend (requires RESEND_API_KEY secret)
- Weekly digest cron (Monday 9am AEST) to all subscribers
- Share-as-image button opens dynamic SVG in new tab
- Flag/report button hides proposals after 5 flags
- Proposals with hidden=1 excluded from all feeds
- DB: users.email, users.postcode, proposals.flag_count, proposals.hidden,
       proposal_flags, milestone_notifications tables

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 01:07:30 +10:00
King Omar
876d0c438c fix: votes, comments and feed refresh all broken due to safeFetch misuse
safeFetch already returns parsed JSON and throws on non-2xx — callers were
treating the result as a Response object and checking .ok / .json(), which
made votes, comment votes, and comment posts silently fail every time.

Also: fetchProposals was missing cache:'no-store' so newly posted proposals
were invisible until the 24hr browser cache expired; getProposals was sending
24hr Cache-Control so Cloudflare CDN served stale data; getShareableImageUrl
had a double slash (/api//petition-svg); wrangler.toml had an invalid [pages]
stanza that caused a warning on every deploy.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 00:35:31 +10:00
Omar Najjar
c00120a85c Revert "x"
This reverts commit 58f39fb352.
2025-04-30 19:45:50 +10:00
Omar Najjar
58f39fb352 x 2025-04-30 19:23:25 +10:00
Omar Najjar
d58ba122c0 x 2025-04-13 03:10:56 +10:00
Omar Najjar
e35571fd3b x 2025-04-13 02:55:28 +10:00
Omar Najjar
e1e5fb8e92 x 2025-04-13 01:24:01 +10:00
Omar Najjar
906c5ffe2c X 2025-04-13 01:00:45 +10:00
Omar Najjar
0bed3f7b27 x 2025-04-02 21:27:40 +11:00
Omar Najjar
2ebdde777a x 2025-04-02 21:08:18 +11:00
Omar Najjar
3cb78a90d8 x 2025-04-02 20:37:49 +11:00
Omar Najjar
3ceccb0392 x 2025-03-31 18:27:41 +11:00
Omar Najjar
4a4731e0af x 2025-03-31 18:24:54 +11:00
Omar Najjar
896e636e6a x 2025-03-31 18:22:01 +11:00
Omar Najjar
b088ea7170 Create wrangler.toml 2025-03-31 18:19:40 +11:00