Small fixes: optional R2_PUBLIC_URL, seo.uploadsCollection, staff features without roles

- ipalEnvRules({ storage: true }): R2_PUBLIC_URL optional (media served by
  the app); storage: { requirePublicUrl: true } requires it again.
- seo.uploadsCollection: upload collection of the meta image (default media).
- userMeetsRole(req, minimum): the plugin's admin/editor features (Site
  Integrations, settings globals, test e-mail, stats, consent records, form
  submissions) stay reachable when `access` is omitted — without a roles
  field every logged-in account passes, as in Payload's default.
- IndexNow skip for seed writes is covered by test/seed.test.ts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-22 18:33:35 +02:00
co-authored by Claude Opus 5.5
parent cff76c2a69
commit 4911da7112
24 changed files with 167 additions and 68 deletions
+4 -4
View File
@@ -61,7 +61,7 @@ URLs point at that domain. Outside production, `R2_PUBLIC_URL` alone → read-on
| `DATABASE_URI` | ✅ | infra | database connection (read by the project config, not the plugin) |
| `PAYLOAD_SECRET` | ✅ | infra | Payload secret (as above) |
| `NEXT_PUBLIC_SERVER_URL` | ✅ | infra | public URL (canonical, OG, sitemap, IndexNow) |
| `NODE_ENV` | ⬜ | infra | `production` tightens `ipalEnvRules` (R2, `IPAL_IP_HEADER`) and turns off read-only media mode |
| `NODE_ENV` | ⬜ | infra | `production` tightens `ipalEnvRules` (R2 keys, `IPAL_IP_HEADER`) and turns off read-only media mode |
| `GRAPH_TENANT_ID` | ⬜ | email | Azure tenant (Graph) |
| `GRAPH_CLIENT_ID` | ⬜ | email | Azure app id |
| `GRAPH_CLIENT_SECRET` | ⬜ | email | Azure secret |
@@ -70,7 +70,7 @@ URLs point at that domain. Outside production, `R2_PUBLIC_URL` alone → read-on
| `R2_ENDPOINT` | ⬜ (✅ prod) | storage | R2 S3 endpoint |
| `R2_ACCESS_KEY_ID` | ⬜ (✅ prod) | storage | R2 key |
| `R2_SECRET_ACCESS_KEY` | ⬜ (✅ prod) | storage | R2 secret |
| `R2_PUBLIC_URL` | ⬜ (✅ prod in `ipalEnvRules`) | storage | media domain attached to the bucket; empty = media through the app (§6 — then relax the rule, env.md); dev: also the `/media` path |
| `R2_PUBLIC_URL` | ⬜ (✅ prod only with `storage: { requirePublicUrl: true }`) | storage | media domain attached to the bucket; empty = media through the app (§6); dev: also the `/media` path |
| `IPAL_IP_HEADER` | ⬜ (✅ prod) | forms | header with the real IP for the rate limit (`cf-connecting-ip`, `x-forwarded-for`); without it, a warning in the log |
| `NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | ⬜ | forms | fallback when the Turnstile keys are not in Site Integrations |
| `INDEXNOW_KEY` | ⬜ | SEO | IndexNow key (takes precedence over the key from the panel) |
@@ -438,8 +438,8 @@ be attached. Options, in order of preference:
1. **Serve media through the app (default)** — leave `R2_PUBLIC_URL` empty. Files are stored in R2, Payload serves
them at `/api/media/file/<name>` on the site's own domain: no DNS record, works on any zone. Cost: media traffic
passes through the app (next/image caches optimized variants); relax the `R2_PUBLIC_URL` rule in
`ipalEnvRules` (env.md). Details: storage.md.
passes through the app (next/image caches optimized variants); `ipalEnvRules({ storage: true })` accepts an
empty `R2_PUBLIC_URL` (env.md). Details: storage.md.
2. **A dedicated media domain on Cloudflare** — a separate domain whose zone is in our Cloudflare account (e.g.
`klient-media.com`), attached as the bucket's Custom Domain → `R2_PUBLIC_URL=https://<that domain>`. CDN and
cache rules included; for media-heavy sites.