sandcms 0.6.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/README.md +15 -11
  2. package/dist/admin/Account.svelte +2 -0
  3. package/dist/admin/Admin.svelte +21 -6
  4. package/dist/admin/AssetAttachment.svelte +9 -6
  5. package/dist/admin/AssetAttachment.svelte.d.ts +3 -1
  6. package/dist/admin/BlueprintFields.svelte +0 -3
  7. package/dist/admin/BlueprintFields.svelte.d.ts +0 -1
  8. package/dist/admin/Editor.svelte +5 -10
  9. package/dist/admin/Fields.svelte +2 -8
  10. package/dist/admin/Fields.svelte.d.ts +0 -1
  11. package/dist/admin/Gallery.svelte +221 -80
  12. package/dist/admin/Gallery.svelte.d.ts +0 -1
  13. package/dist/admin/Inbox.svelte +3 -2
  14. package/dist/admin/LinkField.svelte +0 -3
  15. package/dist/admin/LinkField.svelte.d.ts +0 -1
  16. package/dist/admin/MediaLibrary.svelte +10 -7
  17. package/dist/admin/MediaPicker.svelte +43 -35
  18. package/dist/admin/MediaPicker.svelte.d.ts +0 -1
  19. package/dist/admin/Navigation.svelte +13 -2
  20. package/dist/admin/Pages.svelte +195 -0
  21. package/dist/admin/Pages.svelte.d.ts +7 -0
  22. package/dist/admin/Shell.svelte +27 -5
  23. package/dist/admin/SortableList.svelte +82 -61
  24. package/dist/admin/SortableList.svelte.d.ts +3 -1
  25. package/dist/admin/ThemePicker.svelte +72 -0
  26. package/dist/admin/ThemePicker.svelte.d.ts +18 -0
  27. package/dist/admin/UploadButton.svelte +2 -1
  28. package/dist/admin/UploadProgress.svelte +24 -0
  29. package/dist/admin/UploadProgress.svelte.d.ts +7 -0
  30. package/dist/admin/Users.svelte +8 -3
  31. package/dist/admin/client.d.ts +3 -670
  32. package/dist/admin/client.js +2 -1
  33. package/dist/admin/components/ui/alert/alert.svelte.d.ts +3 -13
  34. package/dist/admin/components/ui/attachment/attachment-media.svelte.d.ts +3 -13
  35. package/dist/admin/components/ui/attachment/attachment.svelte.d.ts +6 -26
  36. package/dist/admin/components/ui/badge/badge.svelte.d.ts +7 -25
  37. package/dist/admin/components/ui/button/button.svelte.d.ts +15 -53
  38. package/dist/admin/components/ui/toggle/toggle.svelte.d.ts +6 -26
  39. package/dist/admin/generated/admin.css +823 -115
  40. package/dist/admin/navigation.d.ts +9 -0
  41. package/dist/admin/navigation.js +20 -1
  42. package/dist/admin/theme-context.d.ts +7 -0
  43. package/dist/admin/theme-context.js +3 -0
  44. package/dist/admin/theme.d.ts +7 -0
  45. package/dist/admin/theme.js +14 -0
  46. package/dist/admin/types.d.ts +3 -1
  47. package/dist/admin/uploads.d.ts +8 -1
  48. package/dist/admin/uploads.js +94 -16
  49. package/dist/blueprints/files.js +1 -0
  50. package/dist/blueprints/labels.d.ts +6 -0
  51. package/dist/blueprints/labels.js +14 -0
  52. package/dist/blueprints/load.js +16 -2
  53. package/dist/blueprints/types.d.ts +4 -1
  54. package/dist/cli/admin.d.ts +39 -0
  55. package/dist/cli/admin.js +95 -0
  56. package/dist/cli/backup.js +4 -4
  57. package/dist/cli/doctor.d.ts +10 -1
  58. package/dist/cli/doctor.js +98 -33
  59. package/dist/cli/email-test.d.ts +3 -0
  60. package/dist/cli/email-test.js +20 -0
  61. package/dist/cli/files.d.ts +2 -6
  62. package/dist/cli/files.js +12 -2
  63. package/dist/cli/index.js +401 -95
  64. package/dist/cli/rebaseline.d.ts +10 -0
  65. package/dist/cli/rebaseline.js +117 -0
  66. package/dist/cli/scaffold.js +8 -8
  67. package/dist/cli/setup.js +16 -26
  68. package/dist/cli/upgrade.js +34 -7
  69. package/dist/env.d.ts +26 -2
  70. package/dist/env.js +48 -6
  71. package/dist/notification-fields.js +2 -1
  72. package/dist/server/admin-load.d.ts +85 -5
  73. package/dist/server/admin-load.js +26 -1
  74. package/dist/server/api-access.d.ts +4 -0
  75. package/dist/server/api-access.js +15 -2
  76. package/dist/server/api-keys.d.ts +96 -0
  77. package/dist/server/api-keys.js +115 -0
  78. package/dist/server/api-pagination.d.ts +3 -0
  79. package/dist/server/api.js +21 -63
  80. package/dist/server/auth.d.ts +10 -9
  81. package/dist/server/cms.d.ts +63 -21
  82. package/dist/server/cms.js +64 -7
  83. package/dist/server/db/auto-migrate.d.ts +0 -4
  84. package/dist/server/db/auto-migrate.js +12 -3
  85. package/dist/server/db/legacy.d.ts +13 -0
  86. package/dist/server/db/legacy.js +60 -0
  87. package/dist/server/db/migration-data.js +2 -34
  88. package/dist/server/db/migrations/{0000_foundation.sql → 0000_baseline.sql} +120 -4
  89. package/dist/server/db/migrations/meta/0000_snapshot.json +578 -3
  90. package/dist/server/db/migrations/meta/_journal.json +2 -58
  91. package/dist/server/db/schema.d.ts +119 -2
  92. package/dist/server/db/schema.js +23 -9
  93. package/dist/server/db/store.d.ts +25 -2
  94. package/dist/server/db/store.js +90 -26
  95. package/dist/server/forms.js +2 -1
  96. package/dist/server/hooks.js +155 -81
  97. package/dist/server/media/contracts.d.ts +115 -0
  98. package/dist/server/media/contracts.js +12 -0
  99. package/dist/server/media/deletions.d.ts +2 -1
  100. package/dist/server/media/deletions.js +3 -3
  101. package/dist/server/media/delivery.js +7 -11
  102. package/dist/server/media/processor-child.d.ts +2 -0
  103. package/dist/server/media/processor-child.js +236 -0
  104. package/dist/server/media/processor.d.ts +51 -0
  105. package/dist/server/media/processor.js +135 -0
  106. package/dist/server/media/render-math.d.ts +24 -0
  107. package/dist/server/media/render-math.js +50 -0
  108. package/dist/server/media/runner.d.ts +30 -1
  109. package/dist/server/media/runner.js +418 -165
  110. package/dist/server/media/service.d.ts +53 -11
  111. package/dist/server/media/service.js +307 -98
  112. package/dist/server/media/storage.d.ts +5 -0
  113. package/dist/server/media/storage.js +279 -0
  114. package/dist/server/media/upload-ticket.d.ts +12 -0
  115. package/dist/server/media/upload-ticket.js +35 -0
  116. package/dist/server/media/verify.d.ts +64 -0
  117. package/dist/server/media/verify.js +201 -0
  118. package/dist/server/platform/http.d.ts +27 -0
  119. package/dist/server/platform/http.js +77 -0
  120. package/dist/server/platform/index.d.ts +52 -0
  121. package/dist/server/platform/index.js +98 -0
  122. package/dist/server/platform/snapshots.d.ts +18 -0
  123. package/dist/server/platform/snapshots.js +110 -0
  124. package/dist/server/platform/volume.d.ts +20 -0
  125. package/dist/server/platform/volume.js +60 -0
  126. package/docs/acceptance.md +7 -5
  127. package/docs/api.md +56 -4
  128. package/docs/cloudflare.md +26 -152
  129. package/docs/content.md +20 -5
  130. package/docs/deployment.md +222 -57
  131. package/docs/email.md +6 -0
  132. package/docs/forms.md +2 -2
  133. package/docs/media.md +94 -21
  134. package/docs/package.md +21 -18
  135. package/docs/plans/0.7-self-hosted.md +264 -0
  136. package/docs/releases.md +37 -1
  137. package/docs/upgrades.md +72 -9
  138. package/package.json +37 -44
  139. package/templates/Dockerfile +32 -0
  140. package/templates/integration.ts +26 -5
  141. package/templates/openship.json +9 -0
  142. package/templates/railpack.json +1 -1
  143. package/templates/sandcms/blueprints/files/image.yaml +1 -1
  144. package/templates/sandcms/config.yaml +1 -1
  145. package/dist/cli/cloudflare.d.ts +0 -8
  146. package/dist/cli/cloudflare.js +0 -135
  147. package/dist/server/db/migrations/0001_independent_password_resets.sql +0 -3
  148. package/dist/server/db/migrations/0002_email_failure_reason.sql +0 -1
  149. package/dist/server/db/migrations/0003_direct_r2_uploads.sql +0 -10
  150. package/dist/server/db/migrations/0004_agent_api_keys.sql +0 -38
  151. package/dist/server/db/migrations/0005_api_retention_and_pagination.sql +0 -3
  152. package/dist/server/db/migrations/0006_durable_media_deletion.sql +0 -7
  153. package/dist/server/db/migrations/0007_content_and_job_indexes.sql +0 -2
  154. package/dist/server/db/migrations/0008_search_text_cache.sql +0 -45
  155. package/dist/server/db/migrations/meta/0001_snapshot.json +0 -1197
  156. package/dist/server/db/migrations/meta/0002_snapshot.json +0 -1204
  157. package/dist/server/db/migrations/meta/0003_snapshot.json +0 -1281
  158. package/dist/server/db/migrations/meta/0004_snapshot.json +0 -1546
  159. package/dist/server/db/migrations/meta/0005_snapshot.json +0 -1572
  160. package/dist/server/db/migrations/meta/0006_snapshot.json +0 -1627
  161. package/dist/server/db/migrations/meta/0007_snapshot.json +0 -1643
  162. package/dist/server/db/migrations/meta/0008_snapshot.json +0 -1711
  163. package/dist/worker/index.d.ts +0 -10
  164. package/dist/worker/index.js +0 -460
  165. package/dist/worker/local.d.ts +0 -5
  166. package/dist/worker/local.js +0 -57
  167. package/dist/worker/source.d.ts +0 -2
  168. package/dist/worker/source.js +0 -31
  169. package/dist/worker/uploads.d.ts +0 -22
  170. package/dist/worker/uploads.js +0 -48
  171. package/templates/sandcms/worker/index.ts +0 -1
  172. package/templates/sandcms/worker/local.ts +0 -1
  173. package/templates/sandcms/worker/wrangler.jsonc +0 -6
  174. /package/dist/{worker → server/media}/svg.d.ts +0 -0
  175. /package/dist/{worker → server/media}/svg.js +0 -0
@@ -1,173 +1,47 @@
1
- # Cloudflare setup and operations
1
+ # Cloudflare: retired Worker and optional CDN
2
2
 
3
- SandCMS uses one Worker and one **private** R2 bucket per environment. The Worker signs direct browser uploads and accepts authenticated finalization and named variant requests, encodes images and inspects dimensions with remote transformations, and streams completed variants to authenticated CMS requests. It serves originals only to the processor using short-lived, signed source URLs. Keep staging and production resources separate.
3
+ From 0.7.0, SandCMS stores and processes images on the site's own volume and no longer uses a Cloudflare Worker or R2. 0.8.0 removes the remaining Worker support: `sandcms media import-r2`, the `sandcms/worker` and `sandcms/worker/local` exports, `createCMS({ workerUrl, workerToken })` and the `SANDCMS_WORKER_URL` / `SANDCMS_WORKER_TOKEN` variables. `media.workerUrl` in `sandcms/config.yaml` is still accepted and ignored.
4
4
 
5
- Website proxy caching is optional and separate from Worker deployment. Public image URLs remain on the website at `/_sandcms/media/{key}`. Enabling the website's Cloudflare proxy lets the CDN cache authorized image responses. No second bucket, object copying, public R2 access, or publication marker is needed.
5
+ ## Sites still on Cloudflare media
6
6
 
7
- ## Local development
7
+ A site whose media is still in R2 imports it with the 0.7.x package before upgrading to 0.8.0. Follow the [0.7.0 upgrade checklist](upgrades.md#070-upgrade-checklist) and the import guide that ships with that package (`docs/cloudflare.md` in `sandcms@0.7.x`), run `sandcms media import-r2` until it reports no failures, then `sandcms media verify`. Only then continue with the [0.8.0 checklist](upgrades.md#080-upgrade-checklist).
8
8
 
9
- 1. Generate a random secret of at least 32 characters.
10
- 2. Put the same value as `SANDCMS_WORKER_TOKEN` in both ignored `.env.local` and ignored `sandcms/worker/.dev.vars`.
11
- 3. Use `http://localhost:8787` as `media.workerUrl` (the starter default).
12
- 4. Run the local Worker, then restart the website:
9
+ Imported variants keep Cloudflare's encoding. To re-encode everything with sharp, run `sandcms media rebuild --force` (URLs stay the same; CDN and browser caches keep old copies until they expire).
13
10
 
14
- ```sh
15
- bun x wrangler dev sandcms/worker/local.ts --config sandcms/worker/wrangler.jsonc --local --port 8787
16
- ```
17
-
18
- The loopback-only `sandcms/worker/local` entry emulates S3 presigned PUTs with the shared CMS token, so local development needs no R2 API credentials. Never deploy this entry; the production `index.ts` remains unchanged. The local Worker uses simulated R2 and `cf.image` transformations for metadata inspection and encoding. Local processing checks format, dimensions, signed-source routing, and storage; production quality and limits require staging verification. The [offline Images implementation supports only a subset of transformations](https://developers.cloudflare.com/images/optimization/binding/). Automated tests need no production resources and do not exercise the Cloudflare CDN.
19
-
20
- For quality checks, use a deployed staging Worker or remote development with a dedicated staging Worker configuration bound to a staging R2 bucket. Before running `wrangler dev --remote`, verify that the configuration's `MEDIA` binding targets staging, including any `preview_bucket_name` override, and select that configuration explicitly with `--config`. Remote development connects to the configured real remote resources; it does not automatically isolate storage and could otherwise write test uploads and variants to production. See [Cloudflare's development modes](https://developers.cloudflare.com/workers/local-development/).
21
-
22
- ## Provisioning and deployment
23
-
24
- Setup optionally uses the existing Wrangler login, asks for an account, displays project-derived Worker/R2 names, checks collisions, creates the resources, sets Worker secrets (including bucket-scoped R2 signing credentials entered through masked prompts), and deploys. It writes non-secret names/URLs to tracked config and secrets to ignored environment files. The CLI does not store Wrangler credentials. Setup does not configure the website's DNS proxy or Cache Rules; complete those steps separately below.
25
-
26
- - Keep R2 public access disabled, including `r2.dev`. Do not attach a public custom domain to the bucket.
27
- - Set `media.workerUrl` to the deployed Worker URL, or use the server-only `SANDCMS_WORKER_URL` environment override.
28
- - Supply the same secret as `SANDCMS_WORKER_TOKEN` to both the website and the Worker.
29
- - Use project-owned resources. The repository's `sandcms-local-media` name is a local example, not a production bucket to reuse.
30
-
31
- The `IMAGES` binding is no longer required: both dimension inspection (`format=json`) and encoding use remote transformations. Existing project-owned configurations may retain the unused binding. Ensure image transformations are enabled for the Worker’s account and that its own hostname is an allowed source. Cloudflare supports `cf.image` on Worker zones, including `workers.dev`. The Worker constructs source URLs from its request origin; use the deployed hostname for `media.workerUrl` and avoid redirects or rewrites on `/internal/source/*`.
32
-
33
- Signed source URLs are processor credentials, scoped to one asset and valid at the source for five minutes. Do not log or expose them, and bypass CDN cache rules on `/internal/*`. Source responses use `private, no-store`; Cloudflare maintains its own transformation cache keyed by the signed URL, which is not purged by token expiry. No `origin-auth: share-publicly` setting or public R2 bucket is needed. See [media privacy](media.md#privacy-and-publication). Never forward the CMS bearer token to a source URL.
34
-
35
- ### Direct upload configuration
36
-
37
- The browser uploads to the R2 S3 API endpoint using a 15-minute presigned PUT URL. The bucket remains private. The CMS receives JSON metadata only; `BODY_SIZE_LIMIT=1M` is sufficient for its default JSON request limit. Existing customized host limits are preserved.
38
-
39
- Set these **Worker** secrets with `bun x wrangler secret put NAME --config sandcms/worker/wrangler.jsonc`:
40
-
41
- - `SANDCMS_CF_ACCOUNT_ID`: the Cloudflare account containing the bucket.
42
- - `SANDCMS_R2_BUCKET_NAME`: exactly the bucket bound as `MEDIA`.
43
- - `SANDCMS_R2_ACCESS_KEY_ID` and `SANDCMS_R2_SECRET_ACCESS_KEY`: an R2 S3 API token with Object Read & Write access restricted to that bucket. These are separate from Wrangler credentials and `SANDCMS_WORKER_TOKEN`; never put them in browser or website configuration.
44
-
45
- For a jurisdiction-specific endpoint, set optional Worker `SANDCMS_R2_ENDPOINT` to its HTTPS S3 endpoint. The endpoint and bucket must address the same bucket as `MEDIA`.
11
+ ## Remove the Worker and bucket
46
12
 
47
- Configure bucket CORS in R2 Settings for every authorized admin origin (merge with existing project-owned rules):
13
+ Once the import is verified:
48
14
 
49
- ```json
50
- [
51
- {
52
- "AllowedOrigins": ["https://www.example.com"],
53
- "AllowedMethods": ["PUT"],
54
- "AllowedHeaders": ["Content-Type"],
55
- "MaxAgeSeconds": 3600
56
- }
57
- ]
58
- ```
59
-
60
- Add an R2 object lifecycle rule expiring objects under **only** `incoming/` after one day. This bounds cleanup of abandoned transfers and objects recreated by replaying an unexpired PUT URL. Do not apply this rule to originals or variants. Finalization retries must complete before lifecycle expiration; otherwise the editor must upload again.
61
-
62
- The signature binds the object key, method, content type and expiry. It is not a byte-range upload policy: declared size is checked by the CMS before signing and actual size is checked by the Worker before acceptance. A client can write an oversized staging object, but it cannot be accepted as an original. Treat upload URLs as temporary write credentials and keep them out of logs. See [R2 presigned URLs](https://developers.cloudflare.com/r2/api/s3/presigned-urls/) and [bucket CORS](https://developers.cloudflare.com/r2/buckets/cors/).
63
-
64
- Later deploys are explicit:
65
-
66
- ```sh
67
- bun x --no-install sandcms worker update
68
- bun x --no-install sandcms doctor
69
- ```
70
-
71
- Worker updates verify recorded resource ownership. The current CMS/Worker protocol is **6**. The Worker also accepts protocols 3, 4 and 5 for existing website processes and legacy BLOB transfers, allowing the Worker to be deployed first. Direct uploads require protocol 4 or later. Focal-point crops require protocol 5 or later, and batched variant processing requires the protocol-6 Worker. Configure signing credentials, CORS and lifecycle cleanup, deploy the Worker, then migrate the database and deploy the website. The retained incremental migration adds `upload_sessions` without changing old media or pending BLOBs; follow the [upgrade workflow](upgrades.md).
15
+ 1. Remove `SANDCMS_WORKER_URL` and `SANDCMS_WORKER_TOKEN` from the site's environment and redeploy. Nothing reads them from 0.8.0. `media.workerUrl` in `sandcms/config.yaml` is ignored and can be removed.
16
+ 2. Delete the project-owned `sandcms/worker/` directory and the `worker:dev` script, if present. They import the removed `sandcms/worker` exports, so they no longer type-check or deploy with 0.8.0. `sandcms setup` and `sandcms upgrade` leave these files alone and report them as removable.
17
+ 3. Wait for a volume backup, restore it somewhere and confirm it contains the originals (`media/originals/`) and a database snapshot.
18
+ 4. Delete the Worker (`bun x wrangler delete --config sandcms/worker/wrangler.jsonc`, before removing that file, or from the Cloudflare dashboard), the R2 bucket, its bucket-scoped R2 API token and its CORS and lifecycle rules.
72
19
 
73
- For deployments still using legacy public Worker `/media/*` URLs, deploy a protocol-3 Worker to close that route, update manually constructed URLs to the CMS routes, and purge old Worker URL caches. Legacy browser copies may have a one-year immutable lifetime and cannot be recalled. Confirm bucket public access is disabled before relying on draft privacy.
20
+ Do not delete the bucket before step 3: until then it is the only off-server copy of the originals.
74
21
 
75
- ## Website proxy and public image caching
22
+ ## Optional CDN caching
76
23
 
77
- The origin authorizes an image using current published references and active variants, then marks its successful response cacheable:
24
+ A CDN in front of the site is optional. Public variants are served with:
78
25
 
79
26
  ```http
80
27
  Cache-Control: public, max-age=86400, s-maxage=2592000
81
- ETag: "object-validator"
28
+ ETag: "…"
82
29
  ```
83
30
 
84
- This gives browsers one day of freshness and shared caches 30 days. A browser hit needs no network request; a CDN hit avoids the CMS, SQLite, Worker, and R2 entirely. A cache miss still uses the CMS → Worker → R2 path. The Worker and R2 remain private. TTL specifies freshness, not guaranteed cache retention.
85
-
86
- Draft-only images return an uncached 404. Authenticated previews at `/api/cms/media/` and delivery errors retain `private, no-store`. Public responses do not vary by cookie. Conditional requests reaching the origin still check publication before returning `304`.
87
-
88
- ### Enable the website proxy
89
-
90
- 1. Deploy the updated website and Worker. The former `no-store` public policy cannot be fixed by simply enabling the proxy.
91
- 2. In the website's Cloudflare zone, change the website hostname's DNS record to **Proxied** (orange cloud).
92
- 3. Use **Full (strict)** SSL/TLS with a valid origin certificate. Keep website `SANDCMS_ORIGIN` and SvelteKit `paths.origin` configured to the public HTTPS origin; see [host configuration](deployment.md#host-configuration).
93
- 4. In **Rules → Cache Rules**, add the two rules below, replacing `www.example.com` with the actual website hostname. Repeat for any other hostname that serves the website.
94
-
95
- Do not change trusted-client-IP settings just to enable caching. Trust a proxy header only after configuring the origin so clients cannot spoof it; see [deployment guidance](deployment.md#host-configuration).
96
-
97
- ### Rule 1: SandCMS public images
98
-
99
- Paste this into the expression editor:
100
-
101
- ```text
102
- (http.host eq "www.example.com" and starts_with(http.request.uri.path, "/_sandcms/media/") and http.request.uri.query eq "")
103
- ```
104
-
105
- Set:
106
-
107
- | Setting | Value |
108
- | ------------------------- | -------------------------------------------------------- |
109
- | Cache eligibility | Eligible for cache |
110
- | Edge TTL | Use cache-control header if present, bypass cache if not |
111
- | Browser TTL | Respect origin |
112
- | Status code TTL overrides | None |
113
- | Cache key | Default; retain query strings, do not add cookies |
114
-
115
- Do not select **Ignore cache-control header and use this TTL**: errors must remain uncached. Do not apply the public-image policy to the whole website. GET/HEAD handling is left to Cloudflare and the origin; the expression intentionally has no method restriction so URL purging can match it.
116
-
117
- ### Rule 2: SandCMS private routes and query requests
118
-
119
- Place this bypass rule after any broader cache rules that might otherwise match it:
120
-
121
- ```text
122
- (http.host eq "www.example.com" and (http.request.uri.path eq "/admin" or starts_with(http.request.uri.path, "/admin/") or http.request.uri.path eq "/api/cms" or starts_with(http.request.uri.path, "/api/cms/") or http.request.uri.query ne ""))
123
- ```
124
-
125
- Set **Cache eligibility → Bypass cache**. This deliberately bypasses all query-bearing URLs, including content previews and rejected image transformation queries. It avoids sharing a cached ordinary page with a preview request. Other application caching needs can be configured separately with equally explicit rules.
126
-
127
- Audit existing rules for conflicts: a later whole-site override can defeat these settings; a blanket bypass-on-cookie rule can prevent public image cache hits for signed-in visitors. Never bypass origin privacy directives to work around a cache miss. These rules govern image delivery; they do not enable public HTML caching.
128
-
129
- Cloudflare documents the [proxied DNS requirement](https://developers.cloudflare.com/cache/how-to/cache-rules/), [Cache Rule settings and TTL overrides](https://developers.cloudflare.com/cache/how-to/cache-rules/settings/), [rule ordering](https://developers.cloudflare.com/cache/how-to/cache-rules/order/), and [origin cache-control behavior](https://developers.cloudflare.com/cache/concepts/cache-control/).
130
-
131
- ### Verify delivery
132
-
133
- Use a real published image URL, with no query string. Run the GET twice (rather than relying only on HEAD):
134
-
135
- ```sh
136
- MEDIA_URL='https://www.example.com/_sandcms/media/REPLACE_WITH_ACTUAL_VARIANT_KEY'
137
- curl -sS -D - -o /dev/null "$MEDIA_URL"
138
- curl -sS -D - -o /dev/null "$MEDIA_URL"
139
- ```
140
-
141
- Expect HTTP 200, the public cache policy, an ETag, no `Set-Cookie` or `Vary: Cookie`, and eventually `CF-Cache-Status: HIT` (often `MISS` on the first request). `Age` indicates time in the shared cache. Requests may reach different cache locations, so an immediate HIT is not guaranteed. For conditional delivery, copy the actual ETag:
142
-
143
- ```sh
144
- curl -sS -D - -o /dev/null -H 'If-None-Match: "REPLACE_WITH_ACTUAL_ETAG"' "$MEDIA_URL"
145
- ```
146
-
147
- Expect 304 when the representation is unchanged. The CDN may answer this itself. To verify origin revocation after unpublishing, purge the exact image URL first or use a controlled direct-origin request; a CDN hit is allowed to keep serving the previously public image.
148
-
149
- Also check:
150
-
151
- - A never-published image returns 404 and `private, no-store` on repeated public requests, including with `If-None-Match: *`.
152
- - A signed-out preview request returns 401 and `private, no-store`.
153
- - A signed-in preview succeeds but remains `private, no-store`, without an ETag or CDN HIT. Inspect it in browser developer tools without sharing session cookies.
154
- - An image URL with `?width=100` returns an uncached 404, even after warming the ordinary URL.
155
- - Publishing that previously private image immediately makes the origin return 200; a cached negative response must not delay publication.
156
-
157
- If a public image remains `BYPASS` or `DYNAMIC`, inspect response headers, proxy status, Development Mode, and matching Cache Rules using Cloudflare Trace. Check for upstream `Set-Cookie`, old `no-store` responses, and conflicting cookie bypass rules. See [uncached-response troubleshooting](https://developers.cloudflare.com/cache/troubleshooting/investigating-uncached-responses/).
158
-
159
- ### Unpublishing, deletion, and purging
160
-
161
- Unpublishing or removing the last published reference immediately denies new origin requests. It does not recall cached images. Cloudflare may keep serving a fresh copy for the remaining shared-cache lifetime; browsers may keep using their cached copy. A cold cache can return 404 while another location still serves 200. This is the intended tradeoff for fast public delivery.
31
+ Browsers keep them for a day and shared caches for 30 days. Editor previews at `/api/cms/media/` and all errors use `private, no-store`. With Cloudflare proxying the site's hostname (DNS record **Proxied**, SSL/TLS **Full (strict)**), add two Cache Rules, replacing `www.example.com`:
162
32
 
163
- SandCMS does **not** automatically purge Cloudflare. For deliberate removal, unpublish/remove the reference (or delete the asset) first, then use **Caching → Configuration → Purge Cache → Custom Purge** to purge every affected full public variant URL. Purging before revoking origin access allows the cache to refill. There can be several formats and sizes per image. See [purge by URL](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/).
33
+ 1. **Public images** — _Eligible for cache_, Edge TTL _Use cache-control header if present, bypass cache if not_, Browser TTL _Respect origin_:
164
34
 
165
- A CDN purge cannot clear visitor browser caches or downloaded files. Changed image bytes must get a new URL; never overwrite an existing variant to try to force an update. Ordinary text edits and publication require no purge or file movement.
35
+ ```text
36
+ (http.host eq "www.example.com" and starts_with(http.request.uri.path, "/_sandcms/media/") and http.request.uri.query eq "")
37
+ ```
166
38
 
167
- For rollback, bypass the public-media path and purge its cached URLs. Disabling the proxy also bypasses CDN delivery but does not clear existing browser copies. The application still serves images with the public browser-cache policy unless that policy is changed in code.
39
+ 2. **Private routes and query requests** — _Bypass cache_, ordered after broader rules:
168
40
 
169
- ## Staging verification
41
+ ```text
42
+ (http.host eq "www.example.com" and (http.request.uri.path eq "/admin" or starts_with(http.request.uri.path, "/admin/") or http.request.uri.path eq "/api/cms" or starts_with(http.request.uri.path, "/api/cms/") or http.request.uri.query ne ""))
43
+ ```
170
44
 
171
- Before production, run setup with a staging project name and authorized Wrangler login. Confirm account selection, collision handling, Worker/bucket ownership, secrets, deployed URL, and `worker update`. Exercise remote transformations with the chosen format/quality/size matrix, large and transparent images, SVG sanitization, retries, restart recovery, and rebuilds while published images stay live. Verify a real image larger than 20 MB and a 100 MB upload produce ready variants; check the 100 MP boundary and rejection above it. Confirm unsigned, expired, tampered, and wrong-asset source URLs fail, source responses are uncached, and failed transformations never expose originals as variants. Verify the remote path works on the actual deployed hostname; local tests cannot establish that Cloudflare’s production fetch and caching configuration is correct.
45
+ Do not use _Ignore cache-control header_: errors must stay uncached. Upload chunks go to `/api/cms/media/upload/…` and must not be cached or buffered; the second rule covers them. Behind Cloudflare, set the client IP header to `cf-connecting-ip`; see [client IP](deployment.md#client-ip-behind-a-reverse-proxy).
172
46
 
173
- Then enable proxy caching on a staging website hostname and complete the checks above. Local automated tests cover access checks, conditional requests, and headers; actual edge HIT behavior, rule precedence, purging, image quality, and production limits require this deployed verification. Record that evidence separately from local test results.
47
+ Unpublishing or deleting an image immediately denies new origin requests but does not recall cached copies. SandCMS does not purge the CDN. For deliberate removal, unpublish or delete first, then purge every affected variant URL (several sizes and formats per image). Never overwrite bytes under an existing URL to force an update; preset changes produce new URLs.
package/docs/content.md CHANGED
@@ -129,21 +129,25 @@ Local settings override inherited settings. Nested mappings merge by key, retain
129
129
 
130
130
  The starter and demo project blueprint use `fields/seo`. Existing inline YAML continues to work. Reusing a definition keeps the field key and stored payload shape unchanged; restart the application after YAML edits. Upgrades preserve project-owned YAML, so adopting shared definitions in an existing site is an explicit configuration edit.
131
131
 
132
+ ## Pages screen
133
+
134
+ The sidebar shows one **Pages** link instead of a link for every page. It opens `/admin/pages`, a table of every page blueprint, including pages with their own sidebar group or link. Each row shows the page's label and icon, the public path from its `preview` template, its status (Draft, Published or Changes not live) and when it was last updated. Search filters by label, ID, path or description, and the column headings sort the table. The row menu edits, previews or views the page and publishes or unpublishes it. Listing pages does not create drafts; a page's draft is created when it is first opened. While editing a page from the Pages screen, the breadcrumb leads back to it.
135
+
132
136
  ## Sidebar groups
133
137
 
134
- Pages appear under a collapsible **Pages** group by default. Other blueprint kinds stay at the top level. Set `navigation.group` on a content blueprint to choose a group:
138
+ Pages in the default **Pages** group (no `navigation`, or `navigation: { group: Pages }`) are listed on the [Pages screen](#pages-screen) instead of the sidebar. Other blueprint kinds stay at the top level. Set `navigation.group` on a content blueprint to choose a group:
135
139
 
136
140
  ```yaml
137
141
  id: about
138
142
  label: About
139
143
  kind: page
140
144
  navigation:
141
- group: Pages
145
+ group: Company
142
146
  fields:
143
147
  title: { type: text }
144
148
  ```
145
149
 
146
- Use the same group label on several blueprints to group them together, or `navigation: { group: false }` to keep an item at the top level. Labels must be nonempty strings. Groups remain within the Content (pages/collections) or Workspace (forms/site settings) section. Groups follow the existing kind and blueprint order, appearing at their first member's position. File blueprints do not participate in navigation.
150
+ Use the same group label on several blueprints to group them together, or `navigation: { group: false }` to keep an item at the top level. Labels must be nonempty strings. Groups remain within the Content (pages/collections) or Workspace (forms/site settings) section. Groups follow the existing kind and blueprint order, appearing at their first member's position. A collection placed in a group named **Pages** stays in a collapsible group; only pages move to the Pages screen. File blueprints do not participate in navigation.
147
151
 
148
152
  Groups start collapsed and automatically open when navigating to a member, including a direct link to an editor. You can toggle them with the mouse or keyboard; choices last while the admin shell remains mounted. This only changes the admin sidebar: public URLs, content relationships, blueprint IDs, and stored data stay the same. Restart the application after editing YAML.
149
153
 
@@ -153,6 +157,17 @@ Every content blueprint kind accepts an optional `icon` using a lowercase, hyphe
153
157
 
154
158
  Omitting `icon` keeps the defaults: `file-text` for pages, `folder` for collections, `inbox` for forms, and `settings` for site settings. Restart the application after changing a blueprint. Icons are resolved on the server, and only the selected icon data is included in admin pages.
155
159
 
160
+ ## Site logo
161
+
162
+ The admin sidebar shows the site's favicon next to the project `name` by default, read from the page's `<link rel="icon">`. Set `logo` in `sandcms/config.yaml` to use another image:
163
+
164
+ ```yaml
165
+ name: Sandquist Produktion
166
+ logo: /logo.svg # A file in static/, or an http(s) URL
167
+ ```
168
+
169
+ Paths must start with `/`; `logo: false` shows the first letter of `name` instead. The initial is also shown when the site has no favicon or the image fails to load. Restart the application after changing `config.yaml`.
170
+
156
171
  ## Public routes
157
172
 
158
173
  Routes and components remain developer-owned. Use the installed site's `getCMS` wrapper:
@@ -169,7 +184,7 @@ export const load = async (event) => {
169
184
  };
170
185
  ```
171
186
 
172
- `cms.read` returns `{ id, data }` or null. Without an authenticated `cmsPreview` request it reads only published data. Preview uses an entry ID and the existing session; it is not an anonymous token. The loader and hook set `private, no-store` and noindex. A draft can preview at a developer-defined path before publication. Do not prerender preview-aware routes or independently cache their draft data. Each route must opt in by calling the preview-aware loader.
187
+ `cms.read` returns `{ id, data }` or null. Without an authenticated `cmsPreview` request it reads only published data. Preview uses an entry ID and the existing session; it is not an anonymous token. The loader and hook set `private, no-store` and noindex; a route can call `cms.read` several times during one preview, and `cmsHandle` overrides any application `cache-control` on preview responses. A draft can preview at a developer-defined path before publication. Do not prerender preview-aware routes or independently cache their draft data. Each route must opt in by calling the preview-aware loader.
173
188
 
174
189
  Other server APIs:
175
190
 
@@ -233,7 +248,7 @@ File blueprints live alongside content blueprints, conventionally in `sandcms/bl
233
248
  id: image
234
249
  kind: file
235
250
  label: Image
236
- accept: [image/jpeg, image/png, image/webp, image/avif, image/gif, image/svg+xml]
251
+ accept: [image/jpeg, image/png, image/webp, image/avif, image/gif, image/tiff, image/svg+xml]
237
252
  fields:
238
253
  alt: { type: text, label: Alternative text }
239
254
  ```