Commit graph

8 commits

Author SHA1 Message Date
773fecc090 Shop: move commerce logic into PocketBase hooks; public app unprivileged
The public (internet-facing) app logged in as the PocketBase superuser and
held the Stripe secret key, so any bug in it could become full control of
the database. Baskets, slot holds, Stripe PaymentIntents, the webhook that
creates orders, and the payment-result lookup now run in PocketBase JS
hooks (pocketbase/pb_hooks/shop, routes under /api/shop/*, plus a cron
that releases expired holds every minute).

The public app's routes keep their URLs but only proxy to those routes and
manage the basket cookie; it has no PocketBase or Stripe secret. Booking
emails are still rendered and sent by the public app (same renderer as the
admin preview) from order data the webhook hook returns; it records the
outcome via a narrow endpoint guarded by INTERNAL_API_SECRET.

Also: slot add and order creation are now transactional; shop listings
load anonymously (already public via API rules); shop API errors always
reach the browser as JSON; the superuser client and stripe package are
removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 12:34:58 +00:00
3308f2f85f Public site: readable text on brand-coloured buttons
Hero, Shop, Checkout, checkout-return and the header logo fallback used
white text on the site Primary; on a light Primary that was unreadable.
They now use primary-content (auto-contrast, see $shared/theme).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 12:06:05 +00:00
cd66d61f6f Public pages: build slug filters with pb.filter
The URL slug was interpolated into the filter string, so a crafted URL
could rewrite the query (e.g. make any path serve a page). API rules
still limited it to published pages, so no drafts leaked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 12:06:05 +00:00
91e3e916d8 Shop block: share item loading with the admin preview, never render blank
The admin preview never received items/slots/events, so Shop and Upcoming
calendar blocks were empty there. loadShopData() (shared) now feeds both
the public layout and a new /preview loader.

A Shop block with nothing to show (no active items, a filter matching
none, or commerce data unavailable because POCKETBASE_ADMIN_* is unset)
now says so instead of rendering an empty section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 12:06:05 +00:00
3399daf951 Theme: admin and site colours follow Site design, rendered server-side
- Admin primary/secondary now follow the site's Primary/Accent colours
  (owner's request), replacing the fixed admin sage. Text on them is picked
  automatically (white or dark, whichever contrasts more), which keeps the
  earlier low-contrast problem from coming back with light brand colours;
  brand colour is no longer used as text (active nav item, placeholders).
- New $shared/theme renders the colours as a <style> in <head> during
  SSR. The public site used to apply them in onMount, so every page load
  flashed the default colours first.
- DaisyUI `secondary` now maps to the site Accent everywhere — the
  button block's "Secondary" variant was DaisyUI's default pink.
- Colours are admin-entered text placed inside <style>, so only plain
  colour values are accepted (hex, named, rgb()/hsl()/oklch()…); anything
  else falls back to the default.
- Saving colours in Site design refreshes the admin theme immediately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 11:32:21 +00:00
Jakub Dorfman
96828994e1 added mailing through Brevo and node mailer, also a email editor, with
their custom blocks and renderers
2026-09-28 19:25:19 +02:00
Jakub Dorfman
478a5fd466 moved shared code to the shared package 2026-08-19 19:18:10 +02:00
Jakub Dorfman
1027da989e moved page rendering to a different service and access is now behind
admin.DOMAIN
www.DOMAIN
db.DOMAIN
2026-08-19 17:58:19 +02:00