domma-cms 1.49.0 → 1.49.1

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.49.1] - 2026-11-09
4
+
5
+ - Plugin shortcodes are told who is viewing: the context passed to a `registerShortcode` handler now carries `user` (the signed-in viewer, or `null` for an anonymous render). Job Board's preview shortcodes use it so a super admin sees them on a page only super admins can open. Each page is rendered for the viewer's own roles and cached under those roles, so one viewer's output is never served to another.
6
+
3
7
  ## [1.49.0] - 2026-11-09
4
8
 
5
9
  - **A Domma Form can be shown in a plugin's admin panel.** `public/js/form-embed.js` `renderForm(container, slug, {token, contextToken, onSubmitted})` renders it exactly as the public site does and posts with the signed-in user's Bearer token; `onSubmitted` gets the stored entry's id. A plugin's route signs the context the form is filled in for (`server/services/formContext.js` `signFormContext` - HMAC, one form, one user, 30 minutes); the submit route keeps it as the entry's `meta.context` only from a Bearer-signed post by that user, and refuses the submission otherwise. Nothing the browser sends can set `meta.context` (`_context` is dropped). `readFormEntry`, `removeFormEntry` and `formEntriesBy` let a plugin check an entry, and delete a person's when their data is erased.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-cms",
3
- "version": "1.49.0",
3
+ "version": "1.49.1",
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",
@@ -2130,7 +2130,7 @@ function markedBody(md) {
2130
2130
  * @param {string} markdown
2131
2131
  * @returns {string}
2132
2132
  */
2133
- async function processPluginShortcodes(markdown) {
2133
+ async function processPluginShortcodes(markdown, user = null) {
2134
2134
  const processors = getShortcodeProcessors();
2135
2135
  if (!processors.length) return markdown;
2136
2136
 
@@ -2138,7 +2138,7 @@ async function processPluginShortcodes(markdown) {
2138
2138
  let result = scrubbed;
2139
2139
  // renderMap tells a plugin with its own [map] (Blog Pro: OpenStreetMap by lat/lon) that the CMS has one too, so it can
2140
2140
  // hand back the tags it cannot draw (an address, a postcode) for processMapBlocks.
2141
- const context = {parseShortcodeAttrs, scrubCodeRegions, marked, processCardBlocks, processGridBlocks, escapeAttr, renderMap};
2141
+ const context = {parseShortcodeAttrs, scrubCodeRegions, marked, processCardBlocks, processGridBlocks, escapeAttr, renderMap, user};
2142
2142
 
2143
2143
  async function replaceAsync(input, regex, mapMatch) {
2144
2144
  const matches = [];
@@ -5443,7 +5443,7 @@ export async function parseMarkdown(raw, opts = {}) {
5443
5443
  const withMenu = await processMenuBlocks(withStaticBlock, opts.user || null, menuCtx);
5444
5444
  const withDconfig = processDConfigBlocks(withMenu);
5445
5445
  const withEffects = processEffectsBlocks(withDconfig);
5446
- const withPluginShortcodes = await processPluginShortcodes(withEffects);
5446
+ const withPluginShortcodes = await processPluginShortcodes(withEffects, opts.user || null);
5447
5447
  const withTabs = processTabsBlocks(withPluginShortcodes);
5448
5448
  const withAccordion = processAccordionBlocks(withTabs);
5449
5449
  const withCarousel = processCarouselBlocks(withAccordion);