Commit graph

15 commits

Author SHA1 Message Date
d62799f263 PocketBase: switch image to elestio/pocketbase v0.23.12
spectado/pocketbase has been removed from Docker Hub. elestio publishes
the same PocketBase version (0.23.12), so schema, migrations and hooks
are unchanged. The image differs in packaging:

- listens on 8090 instead of 80 (Caddyfile, POCKETBASE_INTERNAL_URL)
- runs as non-root user `pocketbase` (uid 100), so pb_data written by
  the old root-run image needs a one-off chown; README documents it
- pinned by digest as well as tag

Tested: copy of an existing pb_data volume, README chown command via
podman-compose, then the full stack (public page renders, admin and db
routes via Caddy, shop hooks respond). A fresh volume also works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HA82gX7xH4zwYTr5vE7mf8
2026-11-03 09:10:16 +00:00
7b6c8c2511 Compose: configurable public URL scheme/port (fixes login behind HTTPS)
ORIGIN, PUBLIC_POCKETBASE_URL and PUBLIC_SITE_URL were hard-coded to
http://<sub>.${DOMAIN}:8080. Behind a TLS reverse proxy the browser's
origin is https://<sub>.<domain>, so SvelteKit rejected the admin login
form ("Cross-site POST form submissions are forbidden") and image URLs
pointed at an unreachable port. URL_SCHEME / URL_PORT now build them
(defaults unchanged). Two flat variables because podman-compose 1.5 does
not support nested ${A:-${B}} defaults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-07 14:37:28 +00:00
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
c54da8728e Pin PocketBase server to 0.23.12
`spectado/pocketbase:latest` meant any rebuild could silently jump
versions, while pb_schema.json and the JS migrations target 0.23's format
and API. 0.23.12 is the image `latest` currently resolves to (same image
id), so this changes nothing at runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 11:21:36 +00:00
9264289813 PocketBase: close public sign-up, lock commerce writes, add dates/unique keys
Security:
- PocketBase's default `users` collection allows anonymous sign-up, and
  every CMS rule only checks "signed in" (the admin login also accepts
  `users`). Anyone could register via the public API and edit the site,
  read orders/customer details, or log into the admin. Sign-up is now
  superuser-only.
- orders.create, baskets.create/update and basket_lines.create/update/
  delete were open to anonymous requests, allowing forged "paid" orders in
  the admin and basket tampering. The public app performs all of these
  server-side with the admin client, so they are now superuser-only
  (basket add-item/add-slot verified still working).

Data:
- created/updated autodate fields on all app collections; orders are now
  listed newest-first by date (ids are random, '-id' was not chronological).
- Unique indexes on pages.slug and globals.key (skipped with a log line if
  existing data has duplicates, so PocketBase still starts).

Delivered as a JS migration in pocketbase/pb_migrations, mounted into the
container (the image already passes --migrationsDir=/pb_migrations), so it
applies once on the next start. pb_schema.json carries the same changes for
fresh installs, where the migration runs before the schema is imported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 10:55:12 +00:00
1518f1bbbe Fix admin login/logout over HTTP and stale sessions
- Auth cookie was always exported with the SDK default `Secure` flag, so
  browsers dropped it over plain HTTP (CADDY_SCHEME=http) and login
  looped back to /login. Set `secure` from the real request scheme.
- Logout never ran: the hook redirected every authenticated request to
  /login (including POST /login?/logout) back to /pages. Only redirect GET.
- Refresh the token per request so revoked tokens log the user out instead
  of surfacing as 500s, and sessions slide instead of expiring mid-edit.
- Use `_superusers` instead of the deprecated `pb.admins` alias; keep the
  entered email on a failed login.
- docker-compose: fully-qualified image names (podman rejects short names).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 10:35:15 +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
43db707e34 added configurable modes to caddy http/https 2026-08-19 21:16:12 +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
Jakub Dorfman
702d99b9ed Added shop and checkout to the CMS
Checkout is done with stripe
Added reservation system
2026-07-29 18:18:23 +02:00
Jakub Dorfman
3e7a4f8983 fixed pocketbase volume
visual updates to Testimonials and UpcomingCalendar
2026-06-05 15:59:15 +02:00
Jakub Dorfman
246b1990ca added reverse proxy 2026-06-05 15:32:23 +02:00
Jakub Dorfman
ad34d78d40 Add home page selection to header and increase body size limit in Docker config 2026-06-01 13:34:31 +02:00
Jakub Dorfman
fe5d77443d fix image upload
visual improvements
2026-05-19 17:11:52 +02:00
Jakub Dorfman
b4fbf3e411 initial 2026-05-18 17:18:09 +02:00