domma-cms 1.47.1 → 1.47.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.47.3] - 2026-11-08
4
+
5
+ - **Security: `{{field}}` in a block template escapes `'` as well**, so a value printed inside a single-quoted attribute cannot end it (`escapeHtmlText()` in markdown.js escaped `"` only).
6
+
7
+ ## [1.47.2] - 2026-11-08
8
+
9
+ - **Security: a shortcode parameter can no longer close the attribute it is written into.** `[card class=…]` (and `[box]`, which builds on it) was pushed into `class="…"` unescaped, and `[animate]`, `[ambient]`, `[grid]`/`[col]` and the hero's blobs built class names from parameters as written (`animate-${type}`, `gap-${gap}`, `grid-cols-${cols}`, `col-span-${span}`). A quote in one added attributes of its own - a `data-config` that site.js acts on, for one. The class is now escaped and class-building parameters keep to letters, digits, `_` and `-` (`classToken()` in markdown.js).
10
+
3
11
  ## [1.47.1] - 2026-11-08
4
12
 
5
13
  - Chat: a request naming an unknown chat launcher (`/api/chat/config`, `/state`, `/send` and the rest) is answered once. The 404 was sent and then Fastify tried to answer again, which logged "Reply was already sent" and "Cannot write headers after they are sent" each time. The visitor already got the 404 - only the log changes.
@@ -30,6 +30,8 @@ Code was treated as the truth. Where docs disagree with it, the disagreement is
30
30
  | Plugin | Tier | Version | In one line |
31
31
  |---|---|---|---|
32
32
  | `advent-calendar` | paid (giftable) | 1.0.0 | A calendar of 1 to 31 doors, one opening each day: an advent calendar or a countdown to a launch or event. Behind each door a message, picture, link and a code (shared, unique from a list, or a single-use Shop code), never sent before its day; codes limited per visitor and per connection. |
33
+ | `ai-site-builder` | paid (hosted sites only, in the Pro plan) | 0.6.2 | Site Builder - "Dot": build and change a site by asking in plain words, with the site's own pages, blocks, menus, forms, collections and theme; every change a draft to preview, publish or undo. Never on self-hosted sites. |
34
+ | `ai-tool-builder` | paid (hosted sites only, £59 a month) | 0.1.4 | Tool Builder - "Daisy": describe a Tool and it is written, checked on a test copy of a site, shown as a picture, then reviewed by a person at Domma before it reaches the site. Never a copy of a Tool Domma has. Never on self-hosted sites. |
33
35
  | `anagram` | paid (giftable) | 1.0.0 | Word puzzles against the clock: unscramble the letters (any other real word of the same letters counts too) or climb a word ladder one letter at a time. Random rounds each go, or a daily set everyone shares. Skip and hints for a time penalty, leaderboards, personal best, Share, export and import. |
34
36
  | `analytics-pro` | paid | 2.3.4 | Visitors, visits and page views: where visitors came from (sources, campaigns, channels, country and city by GeoIP), IP addresses, each visit's pages in order, devices and browsers, busiest times and a live view. Cookieless. Several display styles, CSV/JSON export and a printable report. |
35
37
  | `backup-pro` | paid | 0.1.4 | A site's own view of the backups Domma keeps of it: how they stand, every backup, Back up now, restore of the whole site or chosen collections, pages or media after a safety backup, downloads without secrets, and Activity - every backup, restore and change, including Domma's own, named and never hidden. Needs a site run by Domma. |
@@ -1724,6 +1726,37 @@ From `dcms-marketplace/docs/security-plan.md` (2026-09-26; all phases built and
1724
1726
 
1725
1727
  ## Marketplace Plugins
1726
1728
 
1729
+ ### Site Builder (`ai-site-builder`) - "Dot"
1730
+
1731
+ Tier: paid (closed source), **hosted sites only** (`hostedOnly: true`; a self-hosted site refuses to install or load it) · Included in the **Pro** plan, not sold alone · Version: 0.6.2 · Permission: `ai-builder`
1732
+
1733
+ The AI in Site Builder is called **Dot** ("Dot, your Site Builder"). A site owner asks for changes in plain words and Dot makes them with the site's own content types. Dot says plainly that it is AI, never claims to be a person, and only works on the website: general questions, emails and other writing are politely turned down, and nothing in the conversation can change those rules.
1734
+
1735
+ **Features**
1736
+ - Plain-word requests: new pages, rewrites, a warmer look, menu changes, forms, collections, blocks, blog posts and products (where the site has them). One short question when something that matters is unclear.
1737
+ - Drafts first: every change waits under **Changes** to preview, publish or undo; Dot never claims something is live.
1738
+ - Build a whole site: a few questions (business, audience, feel) and a plan shown before anything is built.
1739
+ - Conversations with their own changes, saved prompts, site memory and references; a monthly allowance of words (25,000 on Pro), shown on the screen.
1740
+ - Missing Tools: Dot says which Tool would do it rather than faking it with pages, and points to Tool Builder for Tools Domma does not have.
1741
+ - Works through the person's own permissions: what they may not edit, Dot may not edit for them.
1742
+
1743
+ **Where:** Admin sidebar **Site Builder** (`#/plugins/ai-site-builder`); the model runs on the Manager (`site-manager/services/aiBuilder.js`, system prompt in `aiBuilderTools.js`). Guide: Documentation > Tools > Site Builder; manual chapter `/spaces/domma-cms-user-manual/site-builder`; tutorial `/tutorials/build-a-page-by-asking-dot`.
1744
+
1745
+ ### Tool Builder (`ai-tool-builder`) - "Daisy"
1746
+
1747
+ Tier: paid (closed source), **hosted sites only** (`hostedOnly: true`) · **£59 a month**, a separate Tool (not in a plan) · Version: 0.1.4 · Permission: `tool-builder`
1748
+
1749
+ The AI in Tool Builder is called **Daisy** ("Daisy, your Tool Builder"). A site owner describes a Tool and Daisy writes it as a walled-off plugin (`tb-<site>-<name>`), checks it and sends it to Domma for review. Daisy says plainly that it is AI, only builds Tools, and never builds a Tool Domma already has: it names the Tool that does the job instead.
1750
+
1751
+ **Features**
1752
+ - New Tool: a name and a description in plain words; one short question when something that matters is unclear. Two new Tools a month; changes to a site's Tools are included.
1753
+ - Checks on every change: code rules, a real boot of a test copy of a site, its screen opened in a browser and its tests run; a picture of how it looks.
1754
+ - Review by a person at Domma (by the next working day) before release; approved versions are kept and an earlier one can be put back.
1755
+ - Never a copy: a name matching a Tool Domma has (or one the site already built) is refused before any build is counted, with the reason in the New Tool form ("Domma already has Invoices…", 0.1.4); the model is given the list of every Tool Domma has, rescanned every 10 minutes.
1756
+ - Ownership: the idea and the Tool's data are the client's; Domma writes, holds and licenses the code.
1757
+
1758
+ **Where:** Admin sidebar **Tool Builder** (`#/plugins/ai-tool-builder`); the build loop, checks and release run on the Manager (`tools/ai-tool-builder/`, `site-manager/services/toolBuilder.js`); staff review at Site Manager > Tool reviews. Guide: Documentation > Tools > Tool Builder; manual chapter `/spaces/domma-cms-user-manual/tool-builder`; tutorial `/tutorials/make-a-tool-of-your-own-with-daisy`.
1759
+
1727
1760
  ### Analytics Pro (`analytics-pro`)
1728
1761
 
1729
1762
  Tier: paid (closed source) · Version: 2.3.2 · Requires: no MongoDB (hits kept in `data/hits.jsonl`); no `minCmsVersion` declared; no `requires` · Uses: none declared · Permission: `analytics-pro` (View), granted to `admin` (2.3.0)
@@ -1840,6 +1873,8 @@ Everything in the free Blog, plus several separate blogs on one site - each with
1840
1873
  - `align`: wide, full, center, left, right. Admin "Insert media" slideover builds these.
1841
1874
  - Post editor **Insert shortcode** (0.7.0): a searchable picker over the admin's own shortcode registry (`insertMenuGroups()` / `insertShortcodeByName()` from `admin/js/lib/shortcode-insert.js`), so posts get the page editor's forms and builders (card, timeline, scribe, image); Blog Pro's media group leads and opens Insert media. The content box also gets the page editor's right-click menu (edit the shortcode under the cursor, Insert…).
1842
1875
  - Featured media on posts: a video/audio link leads the post in place of its picture; cards borrow the provider thumbnail.
1876
+ - **Pin to the top** (Blog Pro 0.8.0): a post editor box puts a post first on a blog's front page and makes it the Featured header's post (and `[blog-featured]` with no slug); archives stay in date order; publishers only.
1877
+ - **After every post** (Blog Pro 0.8.1): a per-blog or default setting (`postFooter`, Markdown and shortcodes, up to 8,000 characters) shown under every post in every layout; admin-only.
1843
1878
  - Link metadata and thumbnails fetched once server-side (SSRF-guarded), cached in `data/media/` (30 days; failures retried after 6 hours).
1844
1879
  - Per-blog settings: posts per page, RSS length, comments, hold for approval, post layout, listing display, readers can switch display, in-page search/filter, related posts, author pages, authors index, index header, author page header, authors index style, transition, reveal, hover.
1845
1880
  - Sitemap source `blog-pro` (every blog's index and public posts).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-cms",
3
- "version": "1.47.1",
3
+ "version": "1.47.3",
4
4
  "description": "File-based CMS powered by Domma and Fastify. Run npx domma-cms my-site to create a new project.",
5
5
  "type": "module",
6
6
  "main": "server/server.js",
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.10.3] - 2026-11-08
4
+ - **Security: the post preview runs no scripts.** The editor's preview iframe is sandboxed (`allow-same-origin`, no `allow-scripts`). It showed the rendered post same-origin with the admin and ran the site's scripts, so markup in a post someone else wrote - another author, or an API token - could run as the admin previewing it. The preview lifts the page cloak itself, so it still shows; interactive bits (tabs, carousels) are static in the preview.
5
+
3
6
  ## [1.10.2] - 2026-11-08
4
7
  - A post created as published gets a published date (only Publish stamped one).
5
8
 
@@ -41,7 +41,7 @@ const PREVIEW_PANEL = `
41
41
  <button type="button" class="btn btn-sm btn-primary" data-on-click="use" data-bind-disabled="!changed.value">Use this layout</button>
42
42
  </div>
43
43
  <div class="blog-preview-stage" data-bind-class="'is-' + width.value">
44
- <iframe title="Post preview"></iframe>
44
+ <iframe sandbox="allow-same-origin" title="Post preview"></iframe>
45
45
  </div>
46
46
  </div>`;
47
47
 
@@ -148,7 +148,10 @@ function mountLayoutCard(card, {current, collect, catalogue, kit, add}) {
148
148
  if (mine !== seq || !alive) return;
149
149
  if (res?.error) throw new Error(res.error);
150
150
  // The page's own addresses (/dist/…, /plugins/…) resolve against the site.
151
- frame.srcdoc = String(res.html).replace(/<head>/i, `<head><base href="${location.origin}/">`);
151
+ // Sandboxed with no scripts (the iframe's sandbox="allow-same-origin"): a post is written by
152
+ // other people too - authors, API tokens - and must never run as the admin previewing it.
153
+ // With no scripts Domma never lifts the body's cloak, so the preview lifts it itself.
154
+ frame.srcdoc = String(res.html).replace(/<head>/i, `<head><base href="${location.origin}/"><style>body.dm-cloaked{opacity:1 !important;transition:none !important}</style>`);
152
155
  state.value = '';
153
156
  } catch (err) {
154
157
  if (mine === seq && alive) state.value = err?.message ?? 'Preview failed.';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "blog",
3
3
  "displayName": "Blog",
4
- "version": "1.10.2",
4
+ "version": "1.10.3",
5
5
  "tier": "free",
6
6
  "description": "Public-facing blog with posts, categories and comments - layouts and listings built from editable blocks.",
7
7
  "author": "Domma CMS",
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The post preview is sandboxed with NO scripts: a post's body is written by
3
+ * other people (authors, API tokens), and the preview frame is same-origin with
4
+ * the admin - running the site's scripts there ran the post's markup as them.
5
+ * Blog Pro's two previews (its post editor, Appearance) hold to the same.
6
+ */
7
+ import {test} from 'node:test';
8
+ import assert from 'node:assert/strict';
9
+ import fs from 'node:fs';
10
+ import path from 'node:path';
11
+ import {fileURLToPath} from 'node:url';
12
+
13
+ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
14
+ const FRAMES = [
15
+ 'blog/admin/views/post-editor.js',
16
+ 'blog-pro/admin/views/post-editor.js',
17
+ 'blog-pro/admin/templates/appearance.html'
18
+ ];
19
+
20
+ test('every Blog preview iframe is sandboxed without allow-scripts', () => {
21
+ for (const rel of FRAMES) {
22
+ const file = path.join(ROOT, rel);
23
+ if (!fs.existsSync(file)) continue; // Blog Pro is not on every checkout
24
+ const src = fs.readFileSync(file, 'utf8');
25
+ const frames = [...src.matchAll(/<iframe\b[^>]*>/g)].map(m => m[0]);
26
+ assert.ok(frames.length, `${rel} has its preview iframe`);
27
+ for (const f of frames) {
28
+ const sandbox = f.match(/sandbox="([^"]*)"/);
29
+ assert.ok(sandbox, `${rel}: ${f} is sandboxed`);
30
+ assert.doesNotMatch(sandbox[1], /allow-scripts/, `${rel}: no scripts in the preview`);
31
+ }
32
+ }
33
+ });
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "note": "Written by `make sync-free-tier` in dcms-marketplace. Do not edit these plugins here - edit them there and sync.",
3
- "source": "dcms-marketplace@32f9cef",
3
+ "source": "dcms-marketplace@2611cf2",
4
4
  "plugins": {
5
5
  "blog": {
6
- "version": "1.10.2",
6
+ "version": "1.10.3",
7
7
  "files": {
8
- "CHANGELOG.md": "4760a7c18332f7d9fcbd34ddd339876eeecc0fd601518e4ce50e208a055d481e",
8
+ "CHANGELOG.md": "af44457efba1401fa781d40c691f301946bdc1567ab9aa00e2479d3fc3817359",
9
9
  "CLAUDE.md": "357072eb15b3c2b04b25a18ed44b3d569e1bbdf927118d5b472a9b952c3778d0",
10
10
  "admin/css/index.css": "8d6dfd2bfadf0bbe8efbd52ef9b397ca9d36ca699c80e260aec11f677c77a248",
11
11
  "admin/lib/drafts.js": "60446f6bf93b790f07041fbb95dac30b12cd0ebc3caa71d15f2a7dc16c661b0d",
@@ -19,7 +19,7 @@
19
19
  "admin/views/categories.js": "92946bba9740e5f3ce6770bf283d5db5f061353cf7afa10ecf1dac38ead7d837",
20
20
  "admin/views/comments.js": "ead4477f75c751cc1940ce2e5d272f6498c4940a34f69b3e896c47c7c9c4e263",
21
21
  "admin/views/kit.js": "a7d705de235bd7f125e5ff0607134863c1e67112f3b5876ed97dbbdded202dbc",
22
- "admin/views/post-editor.js": "a522f6f9692180e207b64b932d1ed999578dc6b14a2011dc9a74c4ab7f489d12",
22
+ "admin/views/post-editor.js": "8bc81317decd579be5f110a3f21a44ecb9ee66c5f6b110f7900f4462da3a1959",
23
23
  "admin/views/settings-cog.js": "307efc93835863dd8511f8fb17a224cf45a77532c90b854a86d2cd1d4e5f9f18",
24
24
  "admin/views/settings.js": "256729c7fc2c7cc30541b19afd2efb335a8ac2cc8bdf15202a360c9b7c07c1e4",
25
25
  "blocks/blog-card-compact.css": "eb8e8ae9a6461c362bc021ea0396c6b4481047b6b36a50eeb59e47375e49be75",
@@ -54,7 +54,7 @@
54
54
  "lib/render.js": "0e97c6a950bc962c8d8ea4b2f21d06cb73fbcdc738d8942d6935d01309a29b1d",
55
55
  "lib/samples.js": "e8cdb77ce22e43937707f6854d3a5cb722437dc584e22ac7b24480bef686cf85",
56
56
  "plugin.js": "689bd734b0aa9c2b9a780a6c2274a91492a55471a2397376111c84a28e7c35df",
57
- "plugin.json": "9aca17f3e5c6595721be73840dce5493c8e4bfdd59e344b319c426fc9e64fdd7",
57
+ "plugin.json": "d58c3da0d9fbb0784251caff12125cd26630a8427c46def195b5015f5bc0307e",
58
58
  "plugin.public.js": "0718b1610cebbdcca43012c9c4b67774c1baca2d4ccdcec4ddbd991458951cd8",
59
59
  "public/blog.css": "fd733e6b624190da1e70dc1b6613e2376efd7f7570a28fab311d81006d03d960",
60
60
  "public/blog.js": "d01c72a9834dcc7c5241923371f2b164ac30d20ac9f1a5c5dc5b71fa3cb09f08",
@@ -76,6 +76,7 @@
76
76
  "tests/layouts.test.js": "554cff8194bd650cfb5f2a83c1f51c25f427c07f7dbfdc2ad9ad69bb38fca6a0",
77
77
  "tests/nav-link.test.js": "d36e33ad7483abca27ae6e2098ad2f75bafa18d91f3beba70372ebe6b9b88994",
78
78
  "tests/notices.test.js": "2b02aa84e780dc4c82e6c503fc8fe17c64a63bee0709627866ef97c99cb4e131",
79
+ "tests/preview-sandbox.test.js": "fba7f5a640832a8b3f1fe8aa05b8dcb7349134f93dc6b385e33af2939bbb8919",
79
80
  "tests/public.test.js": "cd4cc53da9709d400d082ef6df01b3f49e6fc419e4b020b588464306a5d907e9"
80
81
  }
81
82
  },
@@ -233,10 +234,10 @@
233
234
  }
234
235
  },
235
236
  "shopping-cart": {
236
- "version": "1.7.3",
237
+ "version": "1.7.4",
237
238
  "files": {
238
- "CHANGELOG.md": "9eb6067eff204d178cb58f4acb22191fce03ec84440fddf0515fa595a00fe19e",
239
- "CLAUDE.md": "8c6678338cbfaddff1a0d2a70dcc8f59518b4a6a3d2d10ca4e190b9d892f857a",
239
+ "CHANGELOG.md": "0dd30ec7fde5f4b1c5a5743852d925eb849f764e7de8971b3fc2e2e34b948983",
240
+ "CLAUDE.md": "9e62730419a01b05e70559fea238b8334a6f46ebed27a5943d7b477abfcce9a1",
240
241
  "admin/css/index.css": "cdd7790511deef162ad30e299b4512d289583e978ba3b87d65945cdf1da3cdda",
241
242
  "admin/lib/chart.js": "b01ce5cfac773c8df8efccab50b67d3dfa99fbead0037d817553db4a6688d4d6",
242
243
  "admin/lib/drafts.js": "9e71b939f6c98d5c25875f35b02c367a5e89e0d2c6d084d6a4de0c71128930a2",
@@ -245,7 +246,7 @@
245
246
  "admin/templates/shop.html": "c5bb03f1f7cbabfbd8202f3533783eb1848103755b1ba25fdcf1fd8e9478cb8e",
246
247
  "admin/views/orders.js": "11a4f9d1db5b6c849b136d97b97e44821bcac21b617281dda58809b442c8645e",
247
248
  "admin/views/overview.js": "02241e75976cfa759d6ba738dd13ca0bd2bcb760d66a5f184becc2e472807efc",
248
- "admin/views/products.js": "b35893d85b92db0048459431258f2a235b1f0824b3601bebc5e5d94fdcc0d10f",
249
+ "admin/views/products.js": "8944645e5e264b0bce5fbd483fbc694ba9df0999db288f2ee202b513ba619c99",
249
250
  "admin/views/sales.js": "001c08963e26df72f43d2357bbcc5a0f54f74f9d22bca319c23a28a50f40c124",
250
251
  "admin/views/settings.js": "5bec0fc307abe935858e24697acb5cfae7f4dcac945afc1f6185da982c121e22",
251
252
  "admin/views/shop.js": "b28390b8aacde1c2d395cdf92902ec655075061bbd8dd5ca0df53db851f5051c",
@@ -266,13 +267,13 @@
266
267
  "lib/shop.js": "baa5dfc4e410210e8ba13678997ee5752eb2ebe72fc4d3e449465d29b60b458d",
267
268
  "lib/summary.js": "ff947ccf0f63cc3095946612460f3ea7ff742803395802179b3ccd66fe961dfa",
268
269
  "plugin.js": "650025fefd7426ffc8334807c3e88c6496067350479e2551efcf61d53c74b630",
269
- "plugin.json": "d057fe23713c879e1f4172261244b2d2311e89754685a73de5ab9870643af3ec",
270
+ "plugin.json": "ed9dd04c57e12d722fe6ea0d8642c9ea2c07b785b0ac6a18ca64f6408893fbcb",
270
271
  "plugin.public.js": "d4304e85895f7e8e2397e64cc7a8e118e94b65c2f271369f880d92e7d32f83f8",
271
272
  "public/account.js": "5f644016c098c7879c59948d662f5997cb61680996204ecb7897baab8945d434",
272
273
  "public/cart.js": "7338141392ec653ff616eb75688d2a2ad08cff8427d7020d381f540be0037b73",
273
274
  "public/lib/money.js": "d22b2b6f80dde6f7887b69e24188c05ea93c02217aba639b5331aa3bd616f4fc",
274
275
  "public/lib/orders.js": "e18d054bf385e9c15544628c81ad7746179eea74c33dbcce42dd2525f3fa210e",
275
- "public/lib/products.js": "65a033b4b03c1b6d9cd7035e6be4c3fe47c7ad309dc14c4d417b6ac0fc10e2f4",
276
+ "public/lib/products.js": "ace3b66b3a5033c061c01bef86c8529ba91449bcb47f7be4fbada072a9c63e1e",
276
277
  "public/lib/session.js": "4f71e98818a52cf2321c8dc57e33e5591deb04ebb2c0bea19dd6758827719a08",
277
278
  "public/samples/candle-2.svg": "aca5691b9168467caf6feb7622ab154ee92504be8b887ac6c818db22476e7bed",
278
279
  "public/samples/candle.svg": "ef75e95a53ce13e88928004c6f1290c45a1094765e2ba741ae1fc55d404b881f",
@@ -286,7 +287,7 @@
286
287
  "public/samples/tee.svg": "287a82d7fc00acb1543b3209927ae20dcbe3d4b2a2b3de03574ab0c463385f3c",
287
288
  "public/samples/tote-2.svg": "9c7f41cc57866e71973e413a6c87f46be48f7488d3490ceea58e24559c334813",
288
289
  "public/samples/tote.svg": "01de817a32c8d3d8ea47ff491049f439ca3e4d4fce943dbdc62a4187139e016c",
289
- "public/shop.css": "173ad430069f64581aaf3520b8f4273ec87e30e81cb4db454987226fdd097ded",
290
+ "public/shop.css": "ac42d386b014556e175b12164cf4ff2fbdcf7b273c32ed7f55da7cc1f43c103b",
290
291
  "roles/shop-customer.json": "3f3366c536c9fbf2b2ce146bb3090b008d5fbfe22752e764eb8e5a1de9cd611c",
291
292
  "templates/shop.html": "4649e57d23458833a157799dc80141824eb0f658d96734bd1859c68e0ba9a8b9",
292
293
  "tests/accounts.test.js": "79b0e91e4310d076960b2a768ada02185b6cf05cab83052ee825b13978e0a9dc",
@@ -294,7 +295,7 @@
294
295
  "tests/commission.test.js": "fbc4cf83e0ed6446a09e57e4ff37a9608c81947c633c78ac6049eb0aedf6cb58",
295
296
  "tests/drafts.test.js": "2dec0cfeadd6df1d3b90f3fd8bce1f33762811eb6e94cd7325bcb8ec31edac42",
296
297
  "tests/email.test.js": "2190b6dd7cc9afad99d2170f002343fe3dad306aa14ac718428e5df0be54ded1",
297
- "tests/pure.test.js": "7fd8db1d18fbd2dcac899eaff5ee19d30f8b806bd6f342b89259413d5f205c18",
298
+ "tests/pure.test.js": "d124ed192b0148965558c563dce87acfd84d6c63fc475bc1e4ff2313dab62db8",
298
299
  "tests/refunds.test.js": "0ae06afca3cf9fd1fe89f1fbc63b3676216c79e174dbcb83788180c01d078366",
299
300
  "tests/sales.test.js": "9025bc608b04bcc14f5bb2c98b4f7c35de99f3ddab4ffa59772d045795bf2cb7",
300
301
  "tests/seo.test.js": "1d0b77409bd65faf803af303531c7653a151b4ffd615bab4fb1708efabd670de"
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.7.4] - 2026-11-08
4
+ - The product list counts options without pluralising their name: "Units: 2 options", not "2 unitss" (`optionsText` in public/lib/products.js).
5
+ - The receipt's Download buttons (and [buy-button] links) are readable on every theme: their text is the theme's own on-primary colour (`--dm-primary-text`), and the site's content-link colour no longer paints over it (it made them primary text on a primary button).
6
+
3
7
  ## [1.7.3] - 2026-11-08
4
8
  - An order's extension facts show only words and numbers, with readable names ("keys short: 2"): Shop Pro's bookkeeping (counted, granted) showed raw.
5
9
  - Needs you says an option is sold out ("Imperial sold out") rather than ": 0".
@@ -93,6 +93,9 @@ A cached page can show a stale stock flag until it is re-rendered; checkout re-p
93
93
 
94
94
  - Storefront CSS tokens are defined on `body`, not `:root`: themes set --dm-* on body's dm-theme-* class.
95
95
  - The site's own input/link styles reach the storefront: see the "reach in here" block at the end of shop.css.
96
+ - Text on the accent is `--shop-accent-ink` = the theme's `--dm-primary-text` (never a fixed #fff). A link drawn as a button
97
+ needs its colour in the `@layer shop-ink` block: core site.css colours content links with an !important rule of
98
+ specificity 0,8,5, and only a layered !important beats it without a selector arms race.
96
99
  - `siteBase()` uses `request.host` (with the port); `request.hostname` drops it under Fastify 5.
97
100
  - A test site on a non-standard port needs `site.baseUrl` for Stripe/PayPal return addresses behind a proxy, and
98
101
  emails have no links to the order until it (or a real sign-in) gives the site a trusted address (1.6.1).
@@ -20,7 +20,7 @@
20
20
  import {api, ask, claims, entriesOf, soon, esc, getCurrency, money, moneyIn, moneyOut, mountPanels, openPanel, refreshBadge, store, wireRows} from '../lib/kit.js';
21
21
  import {NEW_KEY, PRODUCT_DRAFTS_KEY, adoptAsNew, draftDiffers, draftKey, draftValues, productDraftQuestion, readMap, replaceNewDraftQuestion,
22
22
  stableJson, withDraft} from '../lib/drafts.js';
23
- import {STATUS_LABEL, cleanProduct, priceRange, slugify, totalStock} from '/plugins/shopping-cart/public/lib/products.js';
23
+ import {STATUS_LABEL, cleanProduct, optionsText, priceRange, slugify, totalStock} from '/plugins/shopping-cart/public/lib/products.js';
24
24
 
25
25
  const FILTERS = [
26
26
  {key: 'all', label: 'All', match: (p) => p.status !== 'archived'},
@@ -90,7 +90,7 @@ export async function mount(root, ctx) {
90
90
  img: p.images?.[0] || '',
91
91
  featured: Boolean(p.featured),
92
92
  unsaved: kept.has(e.id),
93
- meta: [p.category, p.variants?.length ? `${p.variants.length} ${(p.optionName || 'option').toLowerCase()}s` : '', p.sku].filter(Boolean).join(' · ') || ' ',
93
+ meta: [p.category, optionsText(p), p.sku].filter(Boolean).join(' · ') || ' ',
94
94
  stockText: stock === null ? '∞' : `${stock} in stock`,
95
95
  stockTone: stock === null ? 'is-muted' : stock === 0 ? 'is-danger' : stock <= low ? 'is-warning' : '',
96
96
  statusLabel: STATUS_LABEL[p.status],
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shopping-cart",
3
3
  "displayName": "Shopping Cart",
4
- "version": "1.7.3",
4
+ "version": "1.7.4",
5
5
  "tier": "free",
6
6
  "description": "Sell from your site: products with options, stock and pictures, a storefront and a cart that follows shoppers from page to page, and checkout with Stripe, PayPal or payment offline. Orders to fulfil in the sidebar, refunds from the order.",
7
7
  "author": "Domma CMS",
@@ -194,6 +194,20 @@ export function priceRange(product) {
194
194
  return {min: Math.min(...prices), max: Math.max(...prices)};
195
195
  }
196
196
 
197
+ /**
198
+ * How many options a product has, for the admin's product list: "Size: 2
199
+ * options", or "2 options" when the option has no name of its own. The name is
200
+ * shown as typed and never pluralised - owners write "Size" as often as "Sizes"
201
+ * or "Units", and adding an "s" gave "2 unitss". '' when there are none.
202
+ */
203
+ export function optionsText(product) {
204
+ const count = product?.variants?.length || 0;
205
+ if (!count) return '';
206
+ const counted = `${count} ${count === 1 ? 'option' : 'options'}`;
207
+ const name = String(product.optionName || '').trim();
208
+ return !name || /^options?$/i.test(name) ? counted : `${name}: ${counted}`;
209
+ }
210
+
197
211
  /**
198
212
  * The fields a shopper may see. Never the cost of anything internal: no
199
213
  * position, no SKU-level stock numbers beyond "how many can I buy".
@@ -14,7 +14,11 @@
14
14
 
15
15
  body {
16
16
  --shop-accent: var(--dm-primary, #4f46e5);
17
- --shop-accent-ink: #fff;
17
+ /* Text on the accent: the theme's own on-primary colour (every Domma theme
18
+ sets --dm-primary-text - dark on a pale primary, white on a deep one).
19
+ A theme without it gets the browser's contrast pick where it has
20
+ contrast-color() (the @supports below), else white. */
21
+ --shop-accent-ink: var(--dm-primary-text, #fff);
18
22
  --shop-bg: var(--dm-surface, #fff);
19
23
  --shop-page: var(--dm-background, var(--shop-bg));
20
24
  --shop-text: var(--dm-text, #16181d);
@@ -31,6 +35,9 @@ body {
31
35
  --shop-shadow-lift: 0 2px 4px rgba(0, 0, 0, .06), 0 18px 40px -16px rgba(0, 0, 0, .35);
32
36
  --shop-ease: cubic-bezier(.2, .8, .2, 1);
33
37
  }
38
+ @supports (color: contrast-color(red)) {
39
+ body { --shop-accent-ink: var(--dm-primary-text, contrast-color(var(--shop-accent))); }
40
+ }
34
41
 
35
42
  .shop-page { padding-top: 1.5rem; padding-bottom: 4rem; color: var(--shop-text); }
36
43
  .shop-page h1, .shop-page h2, .shop-page h3 { color: var(--shop-text); }
@@ -411,7 +418,19 @@ html.shop-locked { overflow: hidden; }
411
418
  .shop-page .shop-qty input, .shop-drawer .shop-qty input, .shop-search input {
412
419
  background: transparent !important; border: 0 !important; box-shadow: none !important; outline: 0; padding-left: 0; padding-right: 0; margin: 0; min-height: 0; }
413
420
  .shop-card-title a, .shop-card-title a:hover, .shop-line-name, .shop-crumbs a, .shop-quick { text-decoration: none !important; }
414
- .shop-r-get, .shop-r-get:hover, .shop-r-get:visited { color: var(--shop-accent-ink) !important; text-decoration: none !important; }
421
+ .shop-r-get, .shop-r-get:hover, .shop-r-get:visited { text-decoration: none !important; }
422
+ /* Links drawn as buttons keep the ink. The CMS's site.css colours every content
423
+ link with `html body .page-body a[href]:not(...)` + !important (specificity
424
+ 0,8,5), which turned these into primary text on a primary button - the
425
+ receipt's washed-out Download. An !important declaration in a cascade layer
426
+ beats every unlayered !important one whatever its specificity, so this is
427
+ the one place that wins without a selector arms race. */
428
+ @layer shop-ink {
429
+ .shop-r-get, .shop-r-get:hover, .shop-r-get:visited,
430
+ .shop-buy-button, .shop-buy-button:hover, .shop-buy-button:visited,
431
+ .shop-quick.is-link:hover, .shop-quick.is-link:focus-visible { color: var(--shop-accent-ink) !important; }
432
+ .shop-quick.is-link { color: var(--shop-text) !important; }
433
+ }
415
434
  .shop-card-title a:hover { color: var(--shop-accent); }
416
435
 
417
436
  @media (max-width: 640px) {
@@ -2,7 +2,7 @@ import {test} from 'node:test';
2
2
  import assert from 'node:assert/strict';
3
3
  import {createHmac} from 'node:crypto';
4
4
  import {formatMoney, fromMinor, includedTax, percentOf, toMinor} from '../public/lib/money.js';
5
- import {available, cleanProduct, priceRange, publicProduct, slugify, unitPrice} from '../public/lib/products.js';
5
+ import {available, cleanProduct, optionsText, priceRange, publicProduct, slugify, unitPrice} from '../public/lib/products.js';
6
6
  import {canMove, cleanCheckout} from '../public/lib/orders.js';
7
7
  import {cleanCharges, cleanCustomLines, cleanLines, priceBasket} from '../lib/pricing.js';
8
8
  import {paypalPaid, stripeCreateSession, stripeForm, stripeLineItems, stripeRefund, stripeSessionPaid, stripeVerify} from '../lib/payments.js';
@@ -48,6 +48,17 @@ test('products: cleaned, slugged, variants and stock', () => {
48
48
  assert.deepEqual(cleanProduct({name: 'A', price: 1, images: ['javascript:alert(1)', '/media/a.jpg']}).data.images, ['/media/a.jpg']);
49
49
  });
50
50
 
51
+ test('products: the admin list counts options without pluralising their name', () => {
52
+ const two = [{id: 'a'}, {id: 'b'}];
53
+ assert.equal(optionsText({optionName: 'Units', variants: two}), 'Units: 2 options', 'not "2 unitss"');
54
+ assert.equal(optionsText({optionName: 'Sizes', variants: two}), 'Sizes: 2 options', 'not "2 sizess"');
55
+ assert.equal(optionsText({optionName: 'Size', variants: [{id: 'a'}]}), 'Size: 1 option');
56
+ assert.equal(optionsText({optionName: '', variants: two}), '2 options');
57
+ assert.equal(optionsText({optionName: 'Option', variants: two}), '2 options', 'no "Option: 2 options"');
58
+ assert.equal(optionsText({optionName: 'Size', variants: []}), '');
59
+ assert.equal(optionsText({}), '');
60
+ });
61
+
51
62
  test('orders: moves, checkout cleaning', () => {
52
63
  assert.ok(canMove('paid', 'fulfilled'));
53
64
  assert.ok(!canMove('cancelled', 'paid'));
@@ -93,11 +93,13 @@ export function inertShortcodes(html) {
93
93
  }
94
94
 
95
95
  function escapeHtmlText(str) {
96
+ // ' too: a block template may print {{field}} inside a single-quoted attribute.
96
97
  return String(str ?? '')
97
98
  .replace(/&/g, '&amp;')
98
99
  .replace(/</g, '&lt;')
99
100
  .replace(/>/g, '&gt;')
100
- .replace(/"/g, '&quot;');
101
+ .replace(/"/g, '&quot;')
102
+ .replace(/'/g, '&#39;');
101
103
  }
102
104
 
103
105
  /**
@@ -2360,10 +2362,10 @@ function processEffectsBlocks(markdown) {
2360
2362
  if (body === null) return '';
2361
2363
  const attrs = parseShortcodeAttrs(attrStr);
2362
2364
  const classes = [];
2363
- if (attrs.type) classes.push(`animate-${attrs.type}`);
2364
- if (attrs.duration) classes.push(`animate-duration-${attrs.duration}`);
2365
- if (attrs.delay) classes.push(`animate-delay-${attrs.delay}`);
2366
- if (attrs.repeat) classes.push(`animate-${attrs.repeat}`);
2365
+ if (attrs.type) classes.push(`animate-${classToken(attrs.type)}`);
2366
+ if (attrs.duration) classes.push(`animate-duration-${classToken(attrs.duration)}`);
2367
+ if (attrs.delay) classes.push(`animate-delay-${classToken(attrs.delay)}`);
2368
+ if (attrs.repeat) classes.push(`animate-${classToken(attrs.repeat)}`);
2367
2369
  return `<div class="${classes.join(' ')}">${markedBody(processCardBlocks(processGridBlocks(processInlineShortcodes(restore(body.trim())))))}</div>\n`;
2368
2370
  });
2369
2371
 
@@ -2371,9 +2373,9 @@ function processEffectsBlocks(markdown) {
2371
2373
  if (body === null) return '';
2372
2374
  const attrs = parseShortcodeAttrs(attrStr);
2373
2375
  const classes = [];
2374
- if (attrs.type) classes.push(`bg-ambient-${attrs.type}`);
2375
- if (attrs.speed) classes.push(`bg-ambient-${attrs.speed}`);
2376
- if (attrs.intensity) classes.push(`bg-ambient-${attrs.intensity}`);
2376
+ if (attrs.type) classes.push(`bg-ambient-${classToken(attrs.type)}`);
2377
+ if (attrs.speed) classes.push(`bg-ambient-${classToken(attrs.speed)}`);
2378
+ if (attrs.intensity) classes.push(`bg-ambient-${classToken(attrs.intensity)}`);
2377
2379
  return `<div class="${classes.join(' ')}">${markedBody(processCardBlocks(processGridBlocks(processInlineShortcodes(restore(body.trim())))))}</div>\n`;
2378
2380
  });
2379
2381
 
@@ -2418,7 +2420,7 @@ function responsiveGridCols(cols) {
2418
2420
  '5': ['grid-cols-1', 'grid-cols-md-2', 'grid-cols-lg-5'],
2419
2421
  '6': ['grid-cols-1', 'grid-cols-md-3', 'grid-cols-lg-6'],
2420
2422
  };
2421
- return map[String(cols)] ?? [`grid-cols-${cols}`];
2423
+ return map[String(cols)] ?? [`grid-cols-${classToken(cols)}`];
2422
2424
  }
2423
2425
 
2424
2426
  function processGridBlocks(markdown) {
@@ -2431,7 +2433,7 @@ function processGridBlocks(markdown) {
2431
2433
  const attrs = parseShortcodeAttrs(attrStr);
2432
2434
  const COL_INJECTABLE = ['reveal', 'breathe', 'animate', 'ripple'];
2433
2435
  const injected = extractInjectedEffects(attrs, COL_INJECTABLE);
2434
- const baseCls = attrs.span ? `col-span-${attrs.span}` : 'col';
2436
+ const baseCls = attrs.span ? `col-span-${classToken(attrs.span)}` : 'col';
2435
2437
  // Explicit alignment takes precedence over the shorthand flags.
2436
2438
  const alignment = typeof attrs.align === 'string'
2437
2439
  ? attrs.align.trim().toLowerCase()
@@ -2456,7 +2458,7 @@ function processGridBlocks(markdown) {
2456
2458
  (_, attrStr, inner) => {
2457
2459
  const attrs = parseShortcodeAttrs(attrStr);
2458
2460
  const classes = ['row'];
2459
- if (attrs.gap) classes.push(`gap-${attrs.gap}`);
2461
+ if (attrs.gap) classes.push(`gap-${classToken(attrs.gap)}`);
2460
2462
  if (attrs.class) classes.push(escapeAttr(attrs.class));
2461
2463
  const id = attrs.id ? ` id="${escapeAttr(attrs.id)}"` : '';
2462
2464
  const reveal = attrs.reveal !== undefined ? ' data-reveal="true"' : '';
@@ -2482,12 +2484,12 @@ function processGridBlocks(markdown) {
2482
2484
  const classes = ['grid'];
2483
2485
  if (attrs.cols) {
2484
2486
  if (attrs.responsive === 'false') {
2485
- classes.push(`grid-cols-${attrs.cols}`);
2487
+ classes.push(`grid-cols-${classToken(attrs.cols)}`);
2486
2488
  } else {
2487
2489
  classes.push(...responsiveGridCols(attrs.cols));
2488
2490
  }
2489
2491
  }
2490
- if (attrs.gap) classes.push(`gap-${attrs.gap}`);
2492
+ if (attrs.gap) classes.push(`gap-${classToken(attrs.gap)}`);
2491
2493
  if (attrs.class) classes.push(escapeAttr(attrs.class));
2492
2494
  if (attrs.fullwidth === 'true') classes.push('grid-breakout');
2493
2495
  const id = attrs.id ? ` id="${escapeAttr(attrs.id)}"` : '';
@@ -2567,6 +2569,17 @@ export function collectAndRewriteComponents(source) {
2567
2569
  return {output: restore(rewritten), used};
2568
2570
  }
2569
2571
 
2572
+ /**
2573
+ * A shortcode parameter used as part of a class name (`animate-${type}`, `gap-${gap}`):
2574
+ * letters, digits, `_` and `-` only, so it can never close the attribute or add another.
2575
+ *
2576
+ * @param {unknown} value
2577
+ * @returns {string}
2578
+ */
2579
+ export function classToken(value) {
2580
+ return String(value ?? '').replace(/[^\w-]/g, '');
2581
+ }
2582
+
2570
2583
  export function escapeAttr(str) {
2571
2584
  return String(str)
2572
2585
  .replace(/&/g, '&amp;')
@@ -2646,7 +2659,8 @@ function cardVariantClasses(attrs) {
2646
2659
  // A bare `hover` or any other value retains the explicit hover class.
2647
2660
  if ('hover' in attrs) classes.push(isHoverOff(attrs.hover) ? 'card-no-hover' : 'card-hover');
2648
2661
  if (attrs.collapsible === 'true') classes.push('card-collapsible');
2649
- if (typeof attrs.class === 'string') classes.push(attrs.class.trim());
2662
+ // Escaped: the class is written into class="…" as it stands, and a quote in it closed the attribute.
2663
+ if (typeof attrs.class === 'string') classes.push(escapeAttr(attrs.class.trim()));
2650
2664
  const font = typeof attrs.font === 'string' ? attrs.font.trim() : '';
2651
2665
  if (['serif', 'mono'].includes(font)) classes.push(`card-font-${font}`);
2652
2666
  const fontSize = typeof attrs['font-size'] === 'string' ? attrs['font-size'].trim() : '';
@@ -4937,7 +4951,7 @@ function processHeroBlocks(markdown) {
4937
4951
  // Legacy ad-hoc 'blobs' flag - keep for backward compat. Different keyspace
4938
4952
  // (bg-ambient-* CSS class), not folded into the generic helper.
4939
4953
  const blobs = 'blobs' in attrs;
4940
- const blobsType = attrs['blobs-type'] || 'float-blobs';
4954
+ const blobsType = classToken(attrs['blobs-type']) || 'float-blobs';
4941
4955
 
4942
4956
  const classes = ['hero', 'hero-responsive'];
4943
4957
  if (size) classes.push(`hero-${size}`);