inlaycms 0.4.1 → 0.6.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 (151) hide show
  1. package/README.md +18 -709
  2. package/assets/admin/admin.css +1 -1
  3. package/assets/admin/admin.js +1 -1
  4. package/assets/admin/editor.js +63 -46
  5. package/assets/site/consent.js +1 -0
  6. package/dist/adapters/admin/context.d.ts +1 -1
  7. package/dist/adapters/admin/context.js +1 -0
  8. package/dist/adapters/admin/publish.js +2 -2
  9. package/dist/adapters/admin/routes.d.ts +2 -0
  10. package/dist/adapters/admin/routes.js +2 -0
  11. package/dist/adapters/admin/screens/backups.js +2 -2
  12. package/dist/adapters/admin/screens/editor.js +5 -2
  13. package/dist/adapters/admin/screens/integrations.d.ts +4 -0
  14. package/dist/adapters/admin/screens/integrations.js +140 -0
  15. package/dist/adapters/admin/screens/lists.js +2 -1
  16. package/dist/adapters/admin/screens/releases.js +9 -4
  17. package/dist/adapters/admin/views/data-table.js +1 -1
  18. package/dist/adapters/admin/views/layout.d.ts +1 -1
  19. package/dist/adapters/admin/views/layout.js +15 -2
  20. package/dist/adapters/cli/bin.js +8 -3
  21. package/dist/adapters/cli/main.js +12 -2
  22. package/dist/adapters/mcp/agent-refs.d.ts +2 -1
  23. package/dist/adapters/mcp/agent-refs.js +4 -4
  24. package/dist/adapters/mcp/tools/publish.js +1 -1
  25. package/dist/adapters/mcp/tools/read.js +19 -4
  26. package/dist/adapters/mcp/tools/write.js +5 -1
  27. package/dist/adapters/site/cache.d.ts +8 -2
  28. package/dist/adapters/site/cache.js +13 -4
  29. package/dist/adapters/site/code-files.d.ts +44 -0
  30. package/dist/adapters/site/code-files.js +212 -0
  31. package/dist/adapters/site/consent.d.ts +9 -0
  32. package/dist/adapters/site/consent.js +26 -0
  33. package/dist/adapters/site/context.d.ts +9 -1
  34. package/dist/adapters/site/context.js +106 -27
  35. package/dist/adapters/site/csp.d.ts +11 -0
  36. package/dist/adapters/site/csp.js +36 -0
  37. package/dist/adapters/site/head.d.ts +2 -0
  38. package/dist/adapters/site/head.js +7 -20
  39. package/dist/adapters/site/headers.d.ts +5 -2
  40. package/dist/adapters/site/headers.js +13 -6
  41. package/dist/adapters/site/integrations.d.ts +48 -0
  42. package/dist/adapters/site/integrations.js +118 -0
  43. package/dist/adapters/site/media-routes.d.ts +2 -0
  44. package/dist/adapters/site/media-routes.js +2 -1
  45. package/dist/adapters/site/plugin.d.ts +2 -0
  46. package/dist/adapters/site/plugin.js +78 -40
  47. package/dist/adapters/site/preview.d.ts +2 -0
  48. package/dist/adapters/site/preview.js +10 -5
  49. package/dist/adapters/site/render.d.ts +31 -14
  50. package/dist/adapters/site/render.js +33 -7
  51. package/dist/adapters/site/routes.d.ts +3 -0
  52. package/dist/adapters/site/routes.js +11 -6
  53. package/dist/adapters/site/scripts.d.ts +6 -0
  54. package/dist/adapters/site/scripts.js +27 -0
  55. package/dist/adapters/site/sitemap.d.ts +2 -1
  56. package/dist/adapters/site/sitemap.js +3 -3
  57. package/dist/core/auth/roles.d.ts +1 -1
  58. package/dist/core/auth/roles.js +1 -0
  59. package/dist/core/boot.d.ts +2 -0
  60. package/dist/core/boot.js +3 -0
  61. package/dist/core/content/shipped-input.js +1 -2
  62. package/dist/core/content/validate.d.ts +7 -0
  63. package/dist/core/content/validate.js +24 -1
  64. package/dist/core/core.d.ts +29 -0
  65. package/dist/core/core.js +10 -2
  66. package/dist/core/db/migrate.js +2 -0
  67. package/dist/core/db/migrations/0008_integrations.d.ts +3 -0
  68. package/dist/core/db/migrations/0008_integrations.js +11 -0
  69. package/dist/core/db/schema.d.ts +11 -0
  70. package/dist/core/export/export.js +4 -0
  71. package/dist/core/export/format.d.ts +11 -0
  72. package/dist/core/export/format.js +4 -0
  73. package/dist/core/export/import.js +2 -1
  74. package/dist/core/export/replace.d.ts +6 -1
  75. package/dist/core/export/replace.js +4 -1
  76. package/dist/core/export/report.d.ts +6 -0
  77. package/dist/core/export/report.js +7 -0
  78. package/dist/core/fields/builtins.d.ts +4 -0
  79. package/dist/core/fields/builtins.js +11 -1
  80. package/dist/core/fields/widgets.js +5 -1
  81. package/dist/core/integrations/integrations.d.ts +32 -0
  82. package/dist/core/integrations/integrations.js +80 -0
  83. package/dist/core/integrations/warnings.d.ts +4 -0
  84. package/dist/core/integrations/warnings.js +29 -0
  85. package/dist/core/media/store.d.ts +2 -0
  86. package/dist/core/media/store.js +17 -1
  87. package/dist/core/media/variants.d.ts +14 -0
  88. package/dist/core/media/variants.js +54 -0
  89. package/dist/core/messages/en.d.ts +83 -2
  90. package/dist/core/messages/en.js +83 -2
  91. package/dist/core/registry/code-image.d.ts +16 -0
  92. package/dist/core/registry/code-image.js +13 -0
  93. package/dist/core/registry/define.d.ts +12 -0
  94. package/dist/core/registry/define.js +3 -0
  95. package/dist/core/registry/designed.d.ts +6 -0
  96. package/dist/core/registry/designed.js +8 -0
  97. package/dist/core/registry/integration.d.ts +48 -0
  98. package/dist/core/registry/integration.js +29 -0
  99. package/dist/core/registry/js.d.ts +9 -0
  100. package/dist/core/registry/js.js +39 -0
  101. package/dist/core/registry/registry.js +46 -0
  102. package/dist/core/registry/render.d.ts +45 -5
  103. package/dist/core/release/bundle.d.ts +3 -1
  104. package/dist/core/release/bundle.js +169 -11
  105. package/dist/core/release/manifest.d.ts +29 -6
  106. package/dist/core/release/manifest.js +26 -25
  107. package/dist/core/release/pack.js +13 -2
  108. package/dist/core/release/pointer.js +14 -3
  109. package/dist/core/release/read.d.ts +4 -2
  110. package/dist/core/release/read.js +12 -12
  111. package/dist/core/release/window.d.ts +11 -0
  112. package/dist/core/release/window.js +34 -0
  113. package/dist/core/report.d.ts +3 -0
  114. package/dist/core/richtext/headings.d.ts +10 -0
  115. package/dist/core/richtext/headings.js +37 -0
  116. package/dist/core/richtext/html.d.ts +10 -1
  117. package/dist/core/richtext/html.js +17 -6
  118. package/dist/core/richtext/markdown-text.d.ts +24 -0
  119. package/dist/core/richtext/markdown-text.js +38 -0
  120. package/dist/core/richtext/markdown.js +44 -3
  121. package/dist/core/richtext/schema.d.ts +12 -3
  122. package/dist/core/richtext/schema.js +34 -0
  123. package/dist/core/site/live.d.ts +6 -0
  124. package/dist/core/site/live.js +25 -0
  125. package/dist/core/site/paths.d.ts +5 -0
  126. package/dist/core/site/paths.js +32 -0
  127. package/dist/core/site/resolve.js +17 -6
  128. package/dist/core/version.d.ts +4 -0
  129. package/dist/core/version.js +4 -0
  130. package/dist/host/activate.js +2 -1
  131. package/dist/host/app.d.ts +2 -0
  132. package/dist/host/app.js +1 -0
  133. package/dist/host/diff.d.ts +11 -0
  134. package/dist/host/diff.js +40 -0
  135. package/dist/host/ipc.d.ts +2 -0
  136. package/dist/host/ipc.js +5 -1
  137. package/dist/host/preview-worker.js +2 -2
  138. package/dist/host/primary.js +15 -4
  139. package/dist/host/push.d.ts +5 -1
  140. package/dist/host/push.js +18 -6
  141. package/dist/host/serve.js +1 -1
  142. package/dist/host/store.d.ts +1 -2
  143. package/dist/host/store.js +32 -6
  144. package/dist/host/worker.js +9 -3
  145. package/dist/image-modules.d.ts +29 -0
  146. package/dist/image-modules.js +1 -0
  147. package/dist/index.d.ts +7 -1
  148. package/dist/index.js +4 -0
  149. package/dist/site.d.ts +9 -2
  150. package/dist/site.js +5 -0
  151. package/package.json +5 -1
@@ -0,0 +1 @@
1
+ (()=>{var C="inlay-consent";var A=["analytics","marketing","functional"],h=a=>A.includes(a);function v(a){let r=a.document,l=null;function S(){let t=l;try{let e=a.localStorage.getItem(C);if(e!==null){let n=JSON.parse(e);n&&typeof n.at=="number"&&(t={at:n.at,analytics:n.analytics===!0,marketing:n.marketing===!0,functional:n.functional===!0})}}catch{}return!t||Date.now()-t.at>31536e6||Date.now()<t.at-6e4?null:t}function c(){let t=S();return{decided:t!==null,analytics:t?.analytics??!1,marketing:t?.marketing??!1,functional:t?.functional??!1}}function s(t){let e=r.createElement("script");for(let n of Array.from(t.attributes))e.setAttribute(n.name,n.value);return e.text=t.text,e}let u=t=>t.nodeName==="SCRIPT",d=t=>{if(!u(t)||!t.hasAttribute("src")||t.hasAttribute("async")||t.hasAttribute("nomodule"))return!1;let e=(t.getAttribute("type")??"").trim().toLowerCase();return e===""||e==="module"||/^(text|application)\/(x-)?(javascript|ecmascript)$/.test(e)},T=t=>new Promise(e=>{t.addEventListener("load",()=>e(),{once:!0}),t.addEventListener("error",()=>e(),{once:!0})});async function L(t){let e=r.createComment("");t.replaceWith(e);let n=r.importNode(t.content,!0);for(let o of Array.from(n.childNodes)){if(o.nodeType===1)for(let E of Array.from(o.querySelectorAll("script")))E.replaceWith(s(E));let i=u(o)?s(o):o;d(i)&&(i.async=!1);let b=d(i)?T(i):null;e.before(i),b&&await b}e.remove()}function m(){let t=c();for(let e of Array.from(r.querySelectorAll("template[data-inlay-consent]"))){let n=e.getAttribute("data-inlay-consent")??"";!h(n)||!t[n]||!e.parentNode||L(e)}}function f(t,e){let n=t==="all"?[...A]:t.filter(h),o={at:Date.now(),...c()};delete o.decided;for(let i of n)o[i]=e;l=o;try{a.localStorage.setItem(C,JSON.stringify(o))}catch{}m(),y()}function y(){r.dispatchEvent(new a.CustomEvent("inlay:consent",{detail:c()}))}let p=a;p.inlay={...p.inlay,consent:{grant:t=>f(t,!0),revoke:t=>f(t,!1),get:c}};let g=()=>{m(),y()};r.readyState==="loading"?r.addEventListener("DOMContentLoaded",g,{once:!0}):g()}v(window);})();
@@ -8,7 +8,7 @@ export declare const SETUP_PATH = "/admin/setup";
8
8
  /** Everything admin screens receive. */
9
9
  export type AdminContext = AdminRouteOptions;
10
10
  /** The part of the admin a page belongs to, for the navigation. */
11
- export type Section = 'dashboard' | 'pages' | 'globals' | `collection:${string}` | 'media' | 'redirects' | 'users' | 'backups' | 'releases' | 'security' | 'account';
11
+ export type Section = 'dashboard' | 'pages' | 'globals' | `collection:${string}` | 'media' | 'redirects' | 'users' | 'backups' | 'releases' | 'integrations' | 'security' | 'account';
12
12
  export type { FormValues };
13
13
  /** The notices a redirect may ask for with `?notice=<key>`, and the counts each may carry in the query. */
14
14
  export declare const NOTICES: Record<string, {
@@ -21,6 +21,7 @@ export const NOTICES = {
21
21
  siteLocked: { id: 'admin.notice.siteLocked' },
22
22
  siteUnlocked: { id: 'admin.notice.siteUnlocked' },
23
23
  sitePasswordSaved: { id: 'admin.notice.sitePasswordSaved' },
24
+ integrationSaved: { id: 'admin.notice.integrationSaved' },
24
25
  passwordChanged: { id: 'admin.notice.passwordChanged' },
25
26
  userAdded: { id: 'admin.notice.userAdded' },
26
27
  userUpdated: { id: 'admin.notice.userUpdated' },
@@ -1,5 +1,5 @@
1
1
  import { InlayError } from '../../core/errors.js';
2
- import { encodePath } from '../../core/site/paths.js';
2
+ import { encodePath, presentHref } from '../../core/site/paths.js';
3
3
  import { t } from '../../core/messages/index.js';
4
4
  import { html } from '../../jsx/html.js';
5
5
  import { adminActor, formOf, HTML } from './context.js';
@@ -187,7 +187,7 @@ export function registerPublishRoutes(scope, opts) {
187
187
  ? (await core.liveDocuments([doc.groupId], doc.locale, { state: 'published' })).get(doc.groupId)
188
188
  : undefined;
189
189
  const path = live && live.documentId === id ? live.path : null;
190
- items.push(html `<li>${path === null ? itemTitle(doc) : html `<a href="${encodePath(path)}" class="link">${itemTitle(doc)}</a>`}</li>`);
190
+ items.push(html `<li>${path === null ? itemTitle(doc) : html `<a href="${presentHref(encodePath(path), core.registry.site.trailingSlash)}" class="link">${itemTitle(doc)}</a>`}</li>`);
191
191
  }
192
192
  const body = html `<p>${t(COPY[action].done)}</p><ul class="list-disc pl-6">${items}</ul>${backLink(back)}`;
193
193
  return page(reply, 200, await sectionPage(opts, actor, t(COPY[action].doneTitle), 'done', body));
@@ -36,6 +36,8 @@ export interface AdminRouteOptions {
36
36
  /** The site's database and the folder releases are kept in: with both, owners get the Releases screen. */
37
37
  db?: Kysely<Database>;
38
38
  releasesDir?: string;
39
+ /** The media folder, so deleting a release can sweep the variants of code images no release names any more. */
40
+ mediaDir?: string;
39
41
  /** The public keys an uploaded release must be signed with, when there is no `host` to check it. */
40
42
  trustedKeys?: readonly string[];
41
43
  }
@@ -8,6 +8,7 @@ import { adminActor, formOf, hostOf, HTML, notFound, registerScreens, SETUP_PATH
8
8
  import { badOriginPage, consentPage, loginPage, messagePage, setupPage } from './pages.js';
9
9
  import { registerPublishRoutes } from './publish.js';
10
10
  import { registerBackups } from './screens/backups.js';
11
+ import { registerIntegrations } from './screens/integrations.js';
11
12
  import { registerSecurity } from './screens/security.js';
12
13
  import { registerDashboard } from './screens/dashboard.js';
13
14
  import { registerEditor } from './screens/editor.js';
@@ -244,6 +245,7 @@ export function registerAdminRoutes(app, opts) {
244
245
  registerUsers(authed, opts);
245
246
  registerBackups(authed, opts);
246
247
  registerReleases(authed, opts);
248
+ registerIntegrations(authed, opts);
247
249
  registerSecurity(authed, opts);
248
250
  registerPublishRoutes(authed, opts);
249
251
  registerSearch(authed, opts);
@@ -7,7 +7,7 @@ import { basename, join } from 'node:path';
7
7
  import { pipeline } from 'node:stream/promises';
8
8
  import { InlayError } from '../../../core/errors.js';
9
9
  import { exportFileName } from '../../../core/export/format.js';
10
- import { siteLockLines } from '../../../core/export/report.js';
10
+ import { integrationLines, siteLockLines } from '../../../core/export/report.js';
11
11
  import { formatSize } from '../../../core/media/labels.js';
12
12
  import { t } from '../../../core/messages/index.js';
13
13
  import { adminActor, forbidden, HTML, noticeOf, notFound } from '../context.js';
@@ -98,7 +98,7 @@ export function registerBackups(scope, ctx) {
98
98
  },
99
99
  { key: 'documents', label: t('admin.import.documents'), cell: (row) => row.documents },
100
100
  { key: 'status', label: t('admin.import.status'), cell: (row) => t(`import.status.${row.status}`) },
101
- ] })] }), hiddenLocales.length > 0 && (_jsxs("section", { class: "flex flex-col gap-2", "aria-labelledby": "locales-heading", children: [_jsx("h2", { id: "locales-heading", class: "text-lg font-semibold", children: t('admin.import.locales') }), _jsx("ul", { class: "flex flex-col gap-2", children: hiddenLocales.map((row) => (_jsx("li", { children: t('import.localeLine', { locale: row.locale, status: t(`import.status.${row.status}`), documents: row.documents }) }))) })] })), report.general.length > 0 && (_jsxs("section", { class: "flex flex-col gap-2", "aria-labelledby": "general-heading", children: [_jsx("h2", { id: "general-heading", class: "text-lg font-semibold", children: t('admin.import.general') }), _jsx(Problems, { problems: report.general })] })), report.media.damaged.length > 0 && (_jsxs("section", { class: "flex flex-col gap-2", "aria-labelledby": "damaged-heading", children: [_jsx("h2", { id: "damaged-heading", class: "text-lg font-semibold", children: t('admin.import.damaged') }), _jsx("p", { children: t('import.damagedMedia', { count: report.media.damaged.length, names: report.media.damaged.join(', ') }) })] })), report.shipped.length > 0 && (_jsxs("section", { class: "flex flex-col gap-2", "aria-labelledby": "shipped-heading", children: [_jsx("h2", { id: "shipped-heading", class: "text-lg font-semibold", children: t('admin.import.shippedTitle') }), _jsx("ul", { class: "list-disc pl-6", children: report.shipped.map((title) => (_jsx("li", { children: title }))) })] })), siteLockLines(report.siteLock).length > 0 && (_jsxs("section", { class: "flex flex-col gap-2", "aria-labelledby": "site-lock-heading", children: [_jsx("h2", { id: "site-lock-heading", class: "text-lg font-semibold", children: t('admin.import.siteLockTitle') }), _jsx("ul", { class: "list-disc pl-6", children: siteLockLines(report.siteLock).map((line) => (_jsx("li", { children: line }))) })] })), report.ok ? (_jsxs("form", { method: "post", action: `/admin/backups/import/${token}`, class: "flex flex-col gap-4", children: [_jsx(Alert, { kind: "warning", id: "replace-warning", children: t('admin.import.replaceWarning') }), _jsxs("div", { class: "flex gap-4", children: [_jsx("button", { type: "submit", class: "btn btn-primary", children: t('admin.import.restore') }), _jsx("a", { href: "/admin/backups", class: "btn", children: t('admin.import.back') })] })] })) : (_jsxs("div", { class: "flex flex-col gap-4", children: [_jsx(Alert, { kind: "error", id: "cannot-restore", children: t('admin.import.cannotRestore') }), _jsx("div", { children: _jsx("a", { href: "/admin/backups", class: "btn", children: t('admin.import.back') }) })] }))] }));
101
+ ] })] }), hiddenLocales.length > 0 && (_jsxs("section", { class: "flex flex-col gap-2", "aria-labelledby": "locales-heading", children: [_jsx("h2", { id: "locales-heading", class: "text-lg font-semibold", children: t('admin.import.locales') }), _jsx("ul", { class: "flex flex-col gap-2", children: hiddenLocales.map((row) => (_jsx("li", { children: t('import.localeLine', { locale: row.locale, status: t(`import.status.${row.status}`), documents: row.documents }) }))) })] })), report.general.length > 0 && (_jsxs("section", { class: "flex flex-col gap-2", "aria-labelledby": "general-heading", children: [_jsx("h2", { id: "general-heading", class: "text-lg font-semibold", children: t('admin.import.general') }), _jsx(Problems, { problems: report.general })] })), report.media.damaged.length > 0 && (_jsxs("section", { class: "flex flex-col gap-2", "aria-labelledby": "damaged-heading", children: [_jsx("h2", { id: "damaged-heading", class: "text-lg font-semibold", children: t('admin.import.damaged') }), _jsx("p", { children: t('import.damagedMedia', { count: report.media.damaged.length, names: report.media.damaged.join(', ') }) })] })), report.shipped.length > 0 && (_jsxs("section", { class: "flex flex-col gap-2", "aria-labelledby": "shipped-heading", children: [_jsx("h2", { id: "shipped-heading", class: "text-lg font-semibold", children: t('admin.import.shippedTitle') }), _jsx("ul", { class: "list-disc pl-6", children: report.shipped.map((title) => (_jsx("li", { children: title }))) })] })), siteLockLines(report.siteLock).length > 0 && (_jsxs("section", { class: "flex flex-col gap-2", "aria-labelledby": "site-lock-heading", children: [_jsx("h2", { id: "site-lock-heading", class: "text-lg font-semibold", children: t('admin.import.siteLockTitle') }), _jsx("ul", { class: "list-disc pl-6", children: siteLockLines(report.siteLock).map((line) => (_jsx("li", { children: line }))) })] })), integrationLines(report).length > 0 && (_jsxs("section", { class: "flex flex-col gap-2", "aria-labelledby": "integrations-heading", children: [_jsx("h2", { id: "integrations-heading", class: "text-lg font-semibold", children: t('admin.import.integrationsTitle') }), _jsx("ul", { class: "list-disc pl-6", children: integrationLines(report).map((line) => (_jsx("li", { children: line }))) })] })), report.ok ? (_jsxs("form", { method: "post", action: `/admin/backups/import/${token}`, class: "flex flex-col gap-4", children: [_jsx(Alert, { kind: "warning", id: "replace-warning", children: t('admin.import.replaceWarning') }), _jsxs("div", { class: "flex gap-4", children: [_jsx("button", { type: "submit", class: "btn btn-primary", children: t('admin.import.restore') }), _jsx("a", { href: "/admin/backups", class: "btn", children: t('admin.import.back') })] })] })) : (_jsxs("div", { class: "flex flex-col gap-4", children: [_jsx(Alert, { kind: "error", id: "cannot-restore", children: t('admin.import.cannotRestore') }), _jsx("div", { children: _jsx("a", { href: "/admin/backups", class: "btn", children: t('admin.import.back') }) })] }))] }));
102
102
  const page = await adminPage(ctx, {
103
103
  title: t('admin.import.reportTitle'),
104
104
  actor,
@@ -3,6 +3,8 @@ import { normalizeContent } from '../../../core/content/schema.js';
3
3
  import { validateContent } from '../../../core/content/validate.js';
4
4
  import { InlayError } from '../../../core/errors.js';
5
5
  import { t } from '../../../core/messages/index.js';
6
+ import { designedInCode } from '../../../core/registry/designed.js';
7
+ import { presentPath } from '../../../core/site/paths.js';
6
8
  import { loadAgentRefs } from '../../mcp/agent-refs.js';
7
9
  import { previewLink } from '../../site/preview.js';
8
10
  import { adminActor, forbidden, formValues, HTML, noticeOf, notFound } from '../context.js';
@@ -80,6 +82,7 @@ function DeviceButton({ device, icon, pressed }) {
80
82
  return (_jsx("button", { type: "button", "data-device": device, "aria-pressed": pressed ? 'true' : 'false', "aria-label": label, title: label, class: pressed ? 'btn btn-xs join-item btn-active' : 'btn btn-xs join-item', children: _jsx(Icon, { name: icon }) }));
81
83
  }
82
84
  /** The live preview: a toolbar over the page itself, which loads the saved draft and is then rewritten as the form changes. */
85
+ /** `live.path` is the presented path. */
83
86
  function PreviewPane({ id, live }) {
84
87
  const src = panePath(id);
85
88
  return (_jsxs("div", { id: "preview-pane", class: "flex min-h-0 flex-col overflow-y-auto border-l border-base-300 bg-base-100", children: [_jsxs("div", { class: "flex h-11 shrink-0 items-center gap-2 border-b border-base-300 px-3", children: [_jsxs("div", { role: "group", "aria-label": t('admin.preview.size'), class: "join", children: [_jsx(DeviceButton, { device: "desktop", icon: "monitor", pressed: true }), _jsx(DeviceButton, { device: "tablet", icon: "tablet", pressed: false }), _jsx(DeviceButton, { device: "phone", icon: "smartphone", pressed: false })] }), _jsx("span", { id: "preview-scale", class: "text-xs tabular-nums text-base-content/70" }), _jsxs("div", { class: "mx-auto flex min-w-0 items-center gap-1.5 rounded-field bg-base-200 px-2.5 py-1 text-xs text-base-content/70", children: [_jsx(Icon, { name: "globe", class: "opacity-60" }), _jsx("span", { class: "truncate", children: live.path })] }), _jsx("span", { id: "preview-status", "data-text-updating": t('admin.preview.updating'), "data-text-ready": t('admin.preview.ready'), "data-text-signed-out": t('admin.preview.signedOut'), "data-text-failed": t('admin.preview.failed'), class: "flex min-w-0 items-center gap-1.5 truncate text-xs text-base-content/70" }), _jsx("span", { id: "preview-announce", role: "status", class: "sr-only" }), _jsx("button", { type: "button", id: "preview-hide", "aria-label": t('admin.preview.hide'), title: t('admin.preview.hide'), class: "btn btn-ghost btn-xs btn-square hidden lg:inline-flex", children: _jsx(Icon, { name: "panel-right" }) })] }), _jsx("div", { id: "preview-stage", class: "relative flex min-h-0 flex-1 justify-center overflow-hidden bg-base-200 p-3", children: _jsx("div", { id: "preview-device", class: "relative w-full overflow-hidden rounded-lg bg-white shadow-sm ring-1 ring-base-300", children: _jsx("iframe", { id: "preview-frame", title: t('admin.preview.title'), src: src, "data-preview-url": src, "data-blank-url": blankPath(id), "data-page-path": live.path, class: "absolute left-0 top-0 h-full w-full origin-top-left border-0 bg-white" }) }) })] }));
@@ -96,7 +99,7 @@ export async function editorPage(ctx, actor, doc, state) {
96
99
  paneDocument(ctx, doc),
97
100
  doc.publishedRev === null ? undefined : core.listGaps({ ids: [doc.id] }).then((gaps) => gaps[0]),
98
101
  ]);
99
- const pane = live !== null && live.path !== null ? { ...live, path: live.path } : null;
102
+ const pane = live !== null && live.path !== null ? { ...live, path: presentPath(live.path, registry.site.trailingSlash) } : null;
100
103
  const hints = publishHints(ctx, doc.type, state.data);
101
104
  const formCtx = {
102
105
  registry,
@@ -112,7 +115,7 @@ export async function editorPage(ctx, actor, doc, state) {
112
115
  };
113
116
  const unplaced = state.unplaced ?? [];
114
117
  const actions = (_jsxs(_Fragment, { children: [_jsx("span", { id: "editor-status", "data-refresh": true, children: _jsx(StatusBadge, { doc: doc }) }), _jsx(LocaleSwitcher, { doc: doc, translations: translations, missing: (locale) => _jsx(TranslateButton, { id: doc.id, locale: locale }) }), _jsx(HeaderActions, { doc: doc, pane: pane !== null, ...(state.conflict && { conflictHead: state.conflict.head }) })] }));
115
- const body = (_jsxs(_Fragment, { children: [_jsxs("div", { id: "workspace", "data-view": "edit", class: pane ? 'grid min-h-0 flex-1 grid-cols-1 lg:grid-cols-[minmax(24rem,5fr)_7fr]' : 'grid min-h-0 flex-1 grid-cols-1', children: [_jsx("div", { id: "form-pane", class: "min-h-0 overflow-y-auto", children: _jsxs("form", { id: "editor-form", method: "post", action: action, "data-save-errors": (state.status ?? 200) >= 400, class: "mx-auto flex max-w-3xl flex-col gap-4 p-4 pb-24", children: [_jsx("button", { type: "submit", name: "_action", value: "save", class: "hidden", tabindex: "-1", "aria-hidden": "true" }), _jsx("input", { type: "hidden", name: "base", value: state.base }), state.review !== undefined && _jsx("div", { hidden: true, "data-publish-open": state.review }), state.unsaved === true && (_jsx("div", { role: "status", class: "alert alert-info", children: t('admin.editor.unsaved') })), state.conflict && (_jsx(Alert, { kind: "error", children: t('admin.editor.conflict', { name: state.conflict.name, source: sourceLabel(state.conflict.source) }) })), (state.error !== undefined || unplaced.length > 0) && (_jsx(Alert, { kind: "error", children: _jsxs("div", { children: [state.error !== undefined && _jsx("p", { children: state.error }), unplaced.length > 0 && (_jsx("ul", { class: "list-disc pl-6", children: unplaced.map((issue) => (_jsx("li", { children: issue.message }))) }))] }) })), gap && (_jsx(Alert, { kind: "warning", children: t('admin.gaps.editor', { count: gap.issues.length, labels: gap.issues.map((issue) => issue.labels.join(' → ')).join(', ') }) })), hints.unplaced.length > 0 && (_jsx(Alert, { kind: "warning", children: _jsxs("div", { children: [_jsx("p", { children: t('admin.editor.neededIntro') }), _jsx("ul", { class: "list-disc pl-6", children: hints.unplaced.map((issue) => (_jsx("li", { children: issue.message }))) })] }) })), _jsx(DocumentFields, { ctx: formCtx, data: state.data, ...(def.kind === 'collection' && { entry: { customPaths: def.customPaths } }) })] }) }), pane && _jsx(PreviewPane, { id: doc.id, live: pane })] }), pane && (_jsxs("button", { type: "button", id: "preview-show", hidden: true, class: "btn btn-sm fixed bottom-4 right-4 z-30 shadow-lg", children: [_jsx(Icon, { name: "eye" }), t('admin.preview.show')] }))] }));
118
+ const body = (_jsxs(_Fragment, { children: [_jsxs("div", { id: "workspace", "data-view": "edit", class: pane ? 'grid min-h-0 flex-1 grid-cols-1 lg:grid-cols-[minmax(24rem,5fr)_7fr]' : 'grid min-h-0 flex-1 grid-cols-1', children: [_jsx("div", { id: "form-pane", "data-keep-scroll": true, class: "min-h-0 overflow-y-auto", children: _jsxs("form", { id: "editor-form", method: "post", action: action, "data-save-errors": (state.status ?? 200) >= 400, class: "mx-auto flex max-w-3xl flex-col gap-4 p-4 pb-24", children: [_jsx("button", { type: "submit", name: "_action", value: "save", class: "hidden", tabindex: "-1", "aria-hidden": "true" }), _jsx("input", { type: "hidden", name: "base", value: state.base }), state.review !== undefined && _jsx("div", { hidden: true, "data-publish-open": state.review }), state.unsaved === true && (_jsx("div", { role: "status", class: "alert alert-info", children: t('admin.editor.unsaved') })), state.conflict && (_jsx(Alert, { kind: "error", children: t('admin.editor.conflict', { name: state.conflict.name, source: sourceLabel(state.conflict.source) }) })), (state.error !== undefined || unplaced.length > 0) && (_jsx(Alert, { kind: "error", children: _jsxs("div", { children: [state.error !== undefined && _jsx("p", { children: state.error }), unplaced.length > 0 && (_jsx("ul", { class: "list-disc pl-6", children: unplaced.map((issue) => (_jsx("li", { children: issue.message }))) }))] }) })), gap && (_jsx(Alert, { kind: "warning", children: t('admin.gaps.editor', { count: gap.issues.length, labels: gap.issues.map((issue) => issue.labels.join(' → ')).join(', ') }) })), hints.unplaced.length > 0 && (_jsx(Alert, { kind: "warning", children: _jsxs("div", { children: [_jsx("p", { children: t('admin.editor.neededIntro') }), _jsx("ul", { class: "list-disc pl-6", children: hints.unplaced.map((issue) => (_jsx("li", { children: issue.message }))) })] }) })), def.kind !== 'collection' && designedInCode(def.template) ? (_jsx("div", { role: "note", class: "alert alert-info", children: t('admin.editor.designedInCode') })) : (_jsx(DocumentFields, { ctx: formCtx, data: state.data, ...(def.kind === 'collection' && { entry: { customPaths: def.customPaths } }) }))] }) }), pane && _jsx(PreviewPane, { id: doc.id, live: pane })] }), pane && (_jsxs("button", { type: "button", id: "preview-show", hidden: true, class: "btn btn-sm fixed bottom-4 right-4 z-30 shadow-lg", children: [_jsx(Icon, { name: "eye" }), t('admin.preview.show')] }))] }));
116
119
  const { section, breadcrumbs } = placement(ctx, doc);
117
120
  return adminPage(ctx, {
118
121
  title: doc.title,
@@ -0,0 +1,4 @@
1
+ import type { FastifyInstance } from 'fastify';
2
+ import { type AdminContext } from '../context.js';
3
+ /** The owner's Integrations screen: switch on the scripts the site's code defines and fill in their details. */
4
+ export declare function registerIntegrations(scope: FastifyInstance, ctx: AdminContext): void;
@@ -0,0 +1,140 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "inlaycms/jsx-runtime";
2
+ import { InlayError } from '../../../core/errors.js';
3
+ import { fieldMeta } from '../../../core/fields/define.js';
4
+ import { t } from '../../../core/messages/index.js';
5
+ import { adminActor, forbidden, formValues, HTML, noticeOf, notFound } from '../context.js';
6
+ import { Alert, adminPage } from '../views/layout.js';
7
+ const NO_REFS = {
8
+ document: () => null,
9
+ media: () => ({ status: 'unknown' }),
10
+ mediaUrl: () => '',
11
+ };
12
+ const CATEGORY = {
13
+ analytics: 'admin.integrations.category.analytics',
14
+ marketing: 'admin.integrations.category.marketing',
15
+ functional: 'admin.integrations.category.functional',
16
+ };
17
+ const isOptional = (schema) => schema._zod.optin === 'optional';
18
+ const fieldsOf = (shape) => Object.entries(shape).flatMap(([key, schema]) => {
19
+ const meta = fieldMeta(schema);
20
+ return meta?.admin === undefined ? [] : [{ key, meta, widget: meta.admin, optional: isOptional(schema) }];
21
+ });
22
+ /** The validation issues of `e` by field key; anything else goes under `''`. */
23
+ function errorsOf(e, keys) {
24
+ const errors = {};
25
+ const issues = e.details.issues ?? [];
26
+ if (issues.length === 0)
27
+ (errors[''] ??= []).push(e.message);
28
+ for (const issue of issues) {
29
+ const at = issue.path[0];
30
+ const key = typeof at === 'string' && keys.includes(at) ? at : '';
31
+ (errors[key] ??= []).push(issue.message);
32
+ }
33
+ return errors;
34
+ }
35
+ function FieldRow(props) {
36
+ const { prefix, name, meta, widget, optional, value, errors } = props;
37
+ const id = `${prefix}-${name}`;
38
+ const ids = [];
39
+ if (meta.help !== undefined)
40
+ ids.push(`${id}-help`);
41
+ if (errors.length > 0)
42
+ ids.push(`${id}-problem`);
43
+ const control = widget.render({
44
+ name,
45
+ id,
46
+ value,
47
+ meta,
48
+ optional,
49
+ readOnly: false,
50
+ describedBy: ids.length > 0 ? ids.join(' ') : undefined,
51
+ invalid: errors.length > 0,
52
+ refs: NO_REFS,
53
+ locale: '',
54
+ });
55
+ const notes = (_jsxs(_Fragment, { children: [meta.help !== undefined && (_jsx("p", { id: `${id}-help`, class: "text-sm text-base-content/70", children: meta.help })), errors.length > 0 && (_jsx("ul", { id: `${id}-problem`, class: "text-sm text-error", children: errors.map((e) => (_jsx("li", { children: e }))) }))] }));
56
+ const mark = optional ? _jsx("span", { class: "ms-2 text-sm font-normal text-base-content/60", children: t('admin.form.optional') }) : null;
57
+ if (widget.fieldset === true) {
58
+ return (_jsxs("fieldset", { class: "fieldset", "aria-describedby": ids.length > 0 ? ids.join(' ') : undefined, children: [_jsxs("legend", { class: "fieldset-legend", children: [meta.label, mark] }), notes, control] }));
59
+ }
60
+ if (meta.kind === 'boolean') {
61
+ return (_jsxs("div", { class: "flex flex-col gap-1", children: [_jsxs("div", { class: "flex items-center gap-2", children: [control, _jsxs("label", { for: id, children: [meta.label, mark] })] }), notes] }));
62
+ }
63
+ return (_jsxs("div", { class: "flex flex-col gap-1", children: [_jsxs("label", { for: id, class: "text-sm font-medium", children: [meta.label, mark] }), control, notes] }));
64
+ }
65
+ function IntegrationForm({ state, posted }) {
66
+ const { def } = state;
67
+ const name = def.name;
68
+ const enabled = posted?.enabled ?? state.enabled;
69
+ const values = posted?.values ?? state.values;
70
+ const errors = posted?.errors ?? {};
71
+ const general = errors[''] ?? [];
72
+ const prefix = `integration-${name}`;
73
+ const unsafe = def.csp['script-src']?.includes("'unsafe-inline'") === true;
74
+ return (_jsx("form", { method: "post", action: `/admin/integrations/${name}`, class: "card bg-base-100 shadow-sm", "aria-labelledby": `${prefix}-title`, children: _jsxs("div", { class: "card-body flex flex-col gap-4", children: [_jsx("h2", { id: `${prefix}-title`, class: "card-title", children: def.label }), def.description !== undefined && _jsx("p", { children: def.description }), _jsxs("ul", { class: "list-none text-sm", children: [_jsx("li", { children: def.consent !== undefined ? t('admin.integrations.consent', { category: t(CATEGORY[def.consent]) }) : t('admin.integrations.always') }), def.preview && _jsx("li", { children: t('admin.integrations.preview') }), unsafe && _jsx("li", { children: t('admin.integrations.unsafeInline') })] }), posted === undefined && state.enabled && !state.active && (_jsx(Alert, { kind: "warning", id: `${prefix}-not-running`, children: t('admin.integrations.notRunning') })), general.length > 0 && (_jsx(Alert, { kind: "error", id: `${prefix}-error`, children: general.join(' ') })), _jsxs("div", { class: "flex items-center gap-3", children: [_jsx("input", { id: `${prefix}-enabled`, type: "checkbox", name: "enabled", value: "true", class: "toggle", checked: enabled }), _jsx("label", { for: `${prefix}-enabled`, children: t('admin.integrations.on') })] }), fieldsOf(def.fields.shape).map(({ key, meta, widget, optional }) => (_jsx(FieldRow, { prefix: prefix, name: key, meta: meta, widget: widget, optional: optional, value: values[key], errors: errors[key] ?? [] }))), _jsx("div", { class: "card-actions", children: _jsx("button", { type: "submit", class: "btn btn-primary", children: t('admin.integrations.save') }) })] }) }));
75
+ }
76
+ /** The owner's Integrations screen: switch on the scripts the site's code defines and fill in their details. */
77
+ export function registerIntegrations(scope, ctx) {
78
+ const { core } = ctx;
79
+ const asCtx = (request) => ({ actor: adminActor(request), source: 'admin' });
80
+ const defined = () => core.registry.site.integrations;
81
+ async function integrationsPage(request, reply, status = 200, posted) {
82
+ const actor = adminActor(request);
83
+ const states = await core.integrations(asCtx(request));
84
+ const notice = noticeOf(request.query);
85
+ const body = (_jsxs("div", { class: "flex flex-col gap-6", children: [_jsx(Alert, { kind: "info", children: t('admin.integrations.public') }), states.map((state) => (_jsx(IntegrationForm, { state: state, posted: posted?.name === state.def.name ? posted : undefined })))] }));
86
+ const page = await adminPage(ctx, {
87
+ title: t('admin.integrations.title'),
88
+ actor,
89
+ section: 'integrations',
90
+ status,
91
+ description: t('admin.integrations.description'),
92
+ ...(notice !== undefined && { notice }),
93
+ }, body);
94
+ return reply.code(status).type(HTML).send(page);
95
+ }
96
+ scope.get('/admin/integrations', async (request, reply) => {
97
+ const actor = adminActor(request);
98
+ if (actor.role !== 'owner')
99
+ return forbidden(reply, ctx, actor);
100
+ if (defined().length === 0)
101
+ return notFound(reply, ctx, actor);
102
+ return integrationsPage(request, reply);
103
+ });
104
+ scope.post('/admin/integrations/:name', async (request, reply) => {
105
+ const actor = adminActor(request);
106
+ if (actor.role !== 'owner')
107
+ return forbidden(reply, ctx, actor);
108
+ const { name } = request.params;
109
+ const def = defined().find((d) => d.name === name);
110
+ if (def === undefined)
111
+ return notFound(reply, ctx, actor);
112
+ const form = formValues(request);
113
+ const enabled = form.get('enabled') === 'true';
114
+ const fields = fieldsOf(def.fields.shape);
115
+ const values = {};
116
+ for (const { key, meta, widget, optional } of fields) {
117
+ const value = widget.parse(form, key, meta, optional);
118
+ if (value !== undefined)
119
+ values[key] = value;
120
+ }
121
+ try {
122
+ await core.saveIntegration(name, { enabled, values }, asCtx(request));
123
+ }
124
+ catch (e) {
125
+ if (!(e instanceof InlayError))
126
+ throw e;
127
+ if (e.code === 'not_found')
128
+ return notFound(reply, ctx, actor);
129
+ if (e.code !== 'validation')
130
+ throw e;
131
+ return integrationsPage(request, reply, 400, {
132
+ name,
133
+ enabled,
134
+ values,
135
+ errors: errorsOf(e, fields.map((x) => x.key)),
136
+ });
137
+ }
138
+ return reply.redirect('/admin/integrations?notice=integrationSaved', 303);
139
+ });
140
+ }
@@ -1,6 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "inlaycms/jsx-runtime";
2
2
  import { InlayError } from '../../../core/errors.js';
3
3
  import { t } from '../../../core/messages/index.js';
4
+ import { designedInCode } from '../../../core/registry/designed.js';
4
5
  import { singletonPath, withLocale } from '../../../core/site/paths.js';
5
6
  import { adminActor, forbidden, formValues, HTML, noticeOf, notFound } from '../context.js';
6
7
  import { backOf, idsOf } from '../publish.js';
@@ -82,7 +83,7 @@ export function registerLists(scope, ctx) {
82
83
  class: 'max-w-md',
83
84
  cell: (row) => {
84
85
  const doc = defaultDoc(row);
85
- return (_jsxs(_Fragment, { children: [doc ? (_jsx("a", { href: editorLink(doc), class: "link link-hover", children: row.def.label })) : (row.def.label), hasGap(row) && _jsx(GapBadge, {}), row.def.help !== undefined && (_jsx("div", { class: "truncate text-xs font-normal text-base-content/60", title: row.def.help, children: row.def.help }))] }));
86
+ return (_jsxs(_Fragment, { children: [doc ? (_jsx("a", { href: editorLink(doc), class: "link link-hover", children: row.def.label })) : (row.def.label), hasGap(row) && _jsx(GapBadge, {}), designedInCode(row.def.template) && (_jsx(Badge, { tone: "neutral", class: "ml-2", children: t('admin.list.designedInCode') })), row.def.help !== undefined && (_jsx("div", { class: "truncate text-xs font-normal text-base-content/60", title: row.def.help, children: row.def.help }))] }));
86
87
  },
87
88
  },
88
89
  ];
@@ -7,7 +7,7 @@ import { InlayError } from '../../../core/errors.js';
7
7
  import { t } from '../../../core/messages/index.js';
8
8
  import { manifestSchema } from '../../../core/release/manifest.js';
9
9
  import { formatDiff, structuralDiff } from '../../../host/diff.js';
10
- import { currentManifest, pendingMigrations, PUSH_MAX_BYTES, RELEASE_NAME_MAX } from '../../../host/push.js';
10
+ import { currentManifest, packAgainWarning, pendingMigrations, PUSH_MAX_BYTES, RELEASE_NAME_MAX } from '../../../host/push.js';
11
11
  import { deleteRelease, getRelease, listReleases, releaseDir, storeRelease } from '../../../host/store.js';
12
12
  import { previewLink } from '../../site/preview.js';
13
13
  import { adminActor, forbidden, HTML, noticeOf, notFound } from '../context.js';
@@ -81,7 +81,11 @@ function releaseRoutes(scope, ctx, db, releasesDir) {
81
81
  label: t('admin.releases.name'),
82
82
  cell: (r) => (_jsx("a", { href: `/admin/releases/${encodeURIComponent(r.id)}`, class: "link font-medium", children: r.name })),
83
83
  },
84
- { key: 'state', label: t('admin.releases.state'), cell: (r) => _jsx(StateBadge, { state: r.state }) },
84
+ {
85
+ key: 'state',
86
+ label: t('admin.releases.state'),
87
+ cell: (r) => (_jsxs(_Fragment, { children: [_jsx(StateBadge, { state: r.state }), packAgainWarning(r) !== null && (_jsx(Badge, { tone: "warning", class: "ml-2", children: t('admin.releases.packAgainBadge') }))] })),
88
+ },
85
89
  { key: 'pushedBy', label: t('admin.releases.pushedBy'), cell: (r) => pushedBy(r, names) },
86
90
  { key: 'pushedAt', label: t('admin.releases.pushedAt'), cell: (r) => _jsx(Time, { iso: r.pushed_at, relative: true }) },
87
91
  { key: 'activatedAt', label: t('admin.releases.activatedAt'), cell: activated },
@@ -146,7 +150,8 @@ function releaseRoutes(scope, ctx, db, releasesDir) {
146
150
  // A release whose files are missing can't be activated: its page says so instead.
147
151
  const activatable = (row.state === 'staged' || row.state === 'previous') && manifest !== null;
148
152
  const fact = (label, value) => (_jsxs("div", { class: "flex flex-col gap-0.5 sm:flex-row sm:gap-4", children: [_jsx("dt", { class: "text-sm text-base-content/70 sm:w-56 sm:shrink-0", children: label }), _jsx("dd", { children: value })] }));
149
- const body = (_jsxs("div", { class: "flex flex-col gap-8", children: [error !== undefined && (_jsx(Alert, { kind: "error", id: "release-error", children: error })), _jsx(Section, { id: "facts", title: t('admin.releases.facts'), children: _jsxs("dl", { class: "flex flex-col gap-2", children: [fact(t('admin.releases.state'), _jsx(StateBadge, { state: row.state })), fact(t('admin.releases.pushedBy'), pushedBy(row, names)), fact(t('admin.releases.pushedAt'), _jsx(Time, { iso: row.pushed_at })), fact(t('admin.releases.activatedAt'), row.activated_at === null ? t('admin.releases.never') : _jsx(Time, { iso: row.activated_at })), fact(t('admin.releases.signedBy'), _jsx("code", { class: "font-mono text-sm break-all", children: row.signed_by })), fact(t('admin.releases.secrets'), row.secrets.length === 0 ? t('admin.releases.secretsNone') : _jsx("code", { class: "font-mono text-sm", children: row.secrets.join(', ') }))] }) }), row.state === 'deleted' && _jsx("p", { children: t('admin.releases.deletedNote') }), row.state !== 'deleted' && manifest === null && (_jsx(Alert, { kind: "warning", id: "files-missing", children: t('admin.releases.filesMissing') })), activatable && host === undefined && (_jsx(Alert, { kind: "info", id: "no-host", children: t('admin.releases.noHost') })), activatable && host !== undefined && (_jsxs(Section, { id: "activate", title: t('admin.releases.activate'), children: [_jsx("p", { id: "activate-hint", children: t('admin.releases.activateHint') }), _jsxs("div", { class: "flex flex-wrap gap-2", children: [_jsx("form", { method: "post", action: `/admin/releases/${encodeURIComponent(row.id)}/activate`, children: _jsx("button", { type: "submit", class: "btn btn-primary", "aria-describedby": "activate-hint", children: t('admin.releases.activate') }) }), row.state === 'staged' && (_jsxs("a", { href: previewLink(ctx, '/', { release: row.id }), target: "_blank", rel: "noopener", class: "btn", "data-release-preview": true, "aria-describedby": "preview-hint", children: [_jsx(Icon, { name: "eye" }), t('admin.releases.preview')] }))] }), row.state === 'staged' && (_jsx("p", { id: "preview-hint", class: "text-sm text-base-content/70", children: t('admin.releases.previewHint') }))] })), manifest !== null && row.state !== 'current' && (_jsx(Section, { id: "changes", title: t('admin.releases.changes'), children: await changes(row, manifest, status === 200) })), manifest !== null && (_jsx(Section, { id: "migrations", title: t('admin.releases.migrations'), children: manifest.migrations.length === 0 ? (_jsx("p", { children: t('admin.releases.migrationsNone') })) : (_jsx("ul", { class: "list-disc pl-6", children: manifest.migrations.map((name) => (_jsx("li", { children: _jsx("code", { class: "font-mono text-sm", children: name }) }))) })) })), row.state === 'current' && (_jsx(Section, { id: "hidden", title: t('admin.releases.hidden'), children: await hidden() })), row.state !== 'current' && row.state !== 'deleted' && (_jsxs(Section, { id: "delete", title: t('admin.releases.delete'), children: [_jsx("p", { id: "delete-hint", children: t('admin.releases.deleteHint') }), _jsx("form", { method: "post", action: `/admin/releases/${encodeURIComponent(row.id)}/delete`, children: _jsxs("button", { type: "submit", class: "btn btn-error btn-outline", "aria-describedby": "delete-hint", children: [_jsx(Icon, { name: "trash" }), t('admin.releases.delete')] }) })] }))] }));
153
+ const packAgain = packAgainWarning(row);
154
+ const body = (_jsxs("div", { class: "flex flex-col gap-8", children: [error !== undefined && (_jsx(Alert, { kind: "error", id: "release-error", children: error })), _jsx(Section, { id: "facts", title: t('admin.releases.facts'), children: _jsxs("dl", { class: "flex flex-col gap-2", children: [fact(t('admin.releases.state'), _jsx(StateBadge, { state: row.state })), fact(t('admin.releases.pushedBy'), pushedBy(row, names)), fact(t('admin.releases.pushedAt'), _jsx(Time, { iso: row.pushed_at })), fact(t('admin.releases.activatedAt'), row.activated_at === null ? t('admin.releases.never') : _jsx(Time, { iso: row.activated_at })), fact(t('admin.releases.signedBy'), _jsx("code", { class: "font-mono text-sm break-all", children: row.signed_by })), fact(t('admin.releases.secrets'), row.secrets.length === 0 ? t('admin.releases.secretsNone') : _jsx("code", { class: "font-mono text-sm", children: row.secrets.join(', ') }))] }) }), packAgain !== null && (_jsx(Alert, { kind: "warning", id: "pack-again", children: packAgain })), row.state === 'deleted' && _jsx("p", { children: t('admin.releases.deletedNote') }), row.state !== 'deleted' && manifest === null && (_jsx(Alert, { kind: "warning", id: "files-missing", children: t('admin.releases.filesMissing') })), activatable && host === undefined && (_jsx(Alert, { kind: "info", id: "no-host", children: t('admin.releases.noHost') })), activatable && host !== undefined && (_jsxs(Section, { id: "activate", title: t('admin.releases.activate'), children: [_jsx("p", { id: "activate-hint", children: t('admin.releases.activateHint') }), _jsxs("div", { class: "flex flex-wrap gap-2", children: [_jsx("form", { method: "post", action: `/admin/releases/${encodeURIComponent(row.id)}/activate`, children: _jsx("button", { type: "submit", class: "btn btn-primary", "aria-describedby": "activate-hint", children: t('admin.releases.activate') }) }), row.state === 'staged' && (_jsxs("a", { href: previewLink(ctx, '/', { release: row.id }), target: "_blank", rel: "noopener", class: "btn", "data-release-preview": true, "aria-describedby": "preview-hint", children: [_jsx(Icon, { name: "eye" }), t('admin.releases.preview')] }))] }), row.state === 'staged' && (_jsx("p", { id: "preview-hint", class: "text-sm text-base-content/70", children: t('admin.releases.previewHint') }))] })), manifest !== null && row.state !== 'current' && (_jsx(Section, { id: "changes", title: t('admin.releases.changes'), children: await changes(row, manifest, status === 200) })), manifest !== null && (_jsx(Section, { id: "migrations", title: t('admin.releases.migrations'), children: manifest.migrations.length === 0 ? (_jsx("p", { children: t('admin.releases.migrationsNone') })) : (_jsx("ul", { class: "list-disc pl-6", children: manifest.migrations.map((name) => (_jsx("li", { children: _jsx("code", { class: "font-mono text-sm", children: name }) }))) })) })), row.state === 'current' && (_jsx(Section, { id: "hidden", title: t('admin.releases.hidden'), children: await hidden() })), row.state !== 'current' && row.state !== 'deleted' && (_jsxs(Section, { id: "delete", title: t('admin.releases.delete'), children: [_jsx("p", { id: "delete-hint", children: t('admin.releases.deleteHint') }), _jsx("form", { method: "post", action: `/admin/releases/${encodeURIComponent(row.id)}/delete`, children: _jsxs("button", { type: "submit", class: "btn btn-error btn-outline", "aria-describedby": "delete-hint", children: [_jsx(Icon, { name: "trash" }), t('admin.releases.delete')] }) })] }))] }));
150
155
  const page = await adminPage(ctx, {
151
156
  title: row.name,
152
157
  actor,
@@ -273,7 +278,7 @@ function releaseRoutes(scope, ctx, db, releasesDir) {
273
278
  if (row.state === 'deleted')
274
279
  return releasePage(request, reply, row, 409, t('admin.releases.alreadyDeleted', { name: row.name }));
275
280
  try {
276
- await deleteRelease({ db, releasesDir }, row.id);
281
+ await deleteRelease({ db, releasesDir, ...(ctx.mediaDir !== undefined && { mediaDir: ctx.mediaDir }) }, row.id);
277
282
  }
278
283
  catch (e) {
279
284
  if (e instanceof InlayError && e.messageId === 'error.releaseCurrent')
@@ -81,7 +81,7 @@ export function DataTable(props) {
81
81
  const filters = (query !== undefined || hasToolbar) && (_jsxs("form", { id: filtersId, method: "get", action: base, ...swapTo(id, base), "hx-trigger": "submit, input changed delay:300ms from:find input[name=q], change from:find select", class: hasToolbar ? 'flex min-h-12 flex-wrap items-center gap-2 border-b border-base-300 px-3 py-2' : 'contents', children: [hidden.map(([name, value]) => (_jsx("input", { type: "hidden", name: name, value: value }))), search !== undefined && (_jsxs(_Fragment, { children: [_jsx("label", { for: `${id}-q`, class: "sr-only", children: search.label }), _jsxs("div", { class: "input input-sm w-full sm:w-64", children: [_jsx(Icon, { name: "search", class: "opacity-50" }), _jsx("input", { id: `${id}-q`, name: "q", type: "search", value: query?.q ?? '', placeholder: search.label, autocomplete: "off" })] })] })), tabs !== undefined && query !== undefined && (_jsx("div", { class: "tabs tabs-box tabs-sm", role: "group", "aria-label": t('admin.table.status'), children: tabs.map((tab) => {
82
82
  const link = href({ status: tab.key });
83
83
  const active = tab.key === query.status;
84
- return (_jsxs("a", { href: link, ...swapTo(id, link), class: active ? 'tab tab-active gap-1.5' : 'tab gap-1.5', "aria-current": active ? 'true' : undefined, children: [tab.label, _jsx("span", { class: "text-xs text-base-content/60 tabular-nums", children: tab.count })] }));
84
+ return (_jsx("a", { href: link, ...swapTo(id, link), class: active ? 'tab tab-active' : 'tab', "aria-current": active ? 'true' : undefined, children: _jsxs("span", { children: [tab.label, _jsx("span", { class: "ml-1.5 text-xs text-base-content/60 tabular-nums", children: tab.count })] }) }));
85
85
  }) })), toolbarEnd !== undefined && _jsx("div", { class: "ml-auto flex flex-wrap items-center gap-2", children: toolbarEnd }), _jsx("button", { type: "submit", class: "btn btn-sm sr-only focus:not-sr-only", children: t('admin.table.apply') })] }));
86
86
  const bulkBar = bulk !== undefined && (_jsx("div", { "data-bulk-bar": true, "data-selected-template": t('admin.table.selected', { count: '{count}' }), class: "flex min-h-12 items-center border-b border-base-300 bg-primary/5 px-3 py-2", children: _jsxs("form", { id: bulkId, method: "get", class: "flex w-full flex-wrap items-center gap-2", children: [_jsx("span", { "data-selected-count": true, class: "text-sm font-medium tabular-nums" }), bulk.actions, _jsxs("button", { type: "button", "data-clear-selection": true, class: "btn btn-ghost btn-xs ml-auto", children: [_jsx(Icon, { name: "x" }), t('admin.table.clear')] })] }) }));
87
87
  const head = (_jsxs("tr", { children: [bulk !== undefined && (_jsx("th", { scope: "col", class: "w-10", children: _jsx("input", { type: "checkbox", class: "checkbox checkbox-xs", "data-select-all": true, form: bulkId, "aria-label": t('admin.table.selectAll') }) })), columns.map((col) => {
@@ -1,6 +1,6 @@
1
1
  import type { Actor } from '../../../core/types.js';
2
2
  import { type Renderable } from '../../../jsx/html.js';
3
- import type { AdminContext, Section } from '../context.js';
3
+ import { type AdminContext, type Section } from '../context.js';
4
4
  /** Up to two initials from `name` (its first and last words), for the small circle next to a person. */
5
5
  export declare function initials(name: string): string;
6
6
  /**
@@ -1,6 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "inlaycms/jsx-runtime";
2
2
  import { t } from '../../../core/messages/index.js';
3
3
  import { raw, renderToString } from '../../../jsx/html.js';
4
+ import { NOTICES } from '../context.js';
4
5
  import { Icon } from './icons.js';
5
6
  import { Badge, badgeClass } from './status.js';
6
7
  const HTMX_CONFIG = JSON.stringify({
@@ -16,6 +17,15 @@ function Head({ ctx, title, scripts }) {
16
17
  const { theme, name } = ctx.branding;
17
18
  return (_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("meta", { name: "robots", content: "noindex" }), _jsx("meta", { name: "htmx-config", content: HTMX_CONFIG }), _jsx("title", { children: t('admin.pageTitle', { title, name }) }), _jsx("link", { rel: "stylesheet", href: ctx.assets.url('admin.css') }), theme.css !== '' && _jsx("style", { children: raw(theme.css) }), scripts.map((script) => (_jsx("script", { type: "module", src: ctx.assets.url(script) })))] }));
18
19
  }
20
+ /**
21
+ * What a redirect asked to say (`?notice=`), as a toast over the page rather than a bar in it, so the page doesn't
22
+ * move. `client/admin/notice.ts` hides it after a while, puts the scroll back where the form was sent from and takes
23
+ * `data-notice-query` out of the address, so reloading doesn't show it again.
24
+ */
25
+ function Notice({ text }) {
26
+ const query = ['notice', ...new Set(Object.values(NOTICES).flatMap((n) => n.params ?? []))];
27
+ return (_jsxs("div", { id: "admin-notice", "data-notice-query": query.join(' '), class: "alert alert-success fixed left-4 right-4 top-18 z-50 shadow-lg transition-opacity duration-300 motion-reduce:transition-none sm:left-auto sm:max-w-sm", children: [_jsx(Icon, { name: "check-circle" }), _jsx("span", { role: "status", children: text }), _jsxs("button", { type: "button", class: "btn btn-ghost btn-xs btn-square", "data-notice-dismiss": true, children: [_jsx(Icon, { name: "x" }), _jsx("span", { class: "sr-only", children: t('admin.notice.dismiss') })] })] }));
28
+ }
19
29
  function SkipLink() {
20
30
  return (_jsx("a", { href: "#main", class: "sr-only focus:not-sr-only focus:absolute focus:left-4 focus:top-4 focus:z-50 btn btn-primary", children: t('admin.skipLink') }));
21
31
  }
@@ -62,6 +72,9 @@ function navItems(ctx, actor, counts) {
62
72
  if (ctx.db !== undefined && ctx.releasesDir !== undefined) {
63
73
  siteItems.push({ section: 'releases', href: '/admin/releases', label: t('admin.nav.releases'), icon: 'rocket' });
64
74
  }
75
+ if (site.integrations.length > 0) {
76
+ siteItems.push({ section: 'integrations', href: '/admin/integrations', label: t('admin.nav.integrations'), icon: 'external' });
77
+ }
65
78
  siteItems.push({ section: 'security', href: '/admin/security', label: t('admin.nav.security'), icon: 'lock' });
66
79
  }
67
80
  const sections = [
@@ -105,7 +118,7 @@ function PrivateBadge({ owner }) {
105
118
  }
106
119
  /** The bar along the top: the menu button on small screens, the search box, the private-site badge, View site and Publish. */
107
120
  function TopBar({ pending, locked, owner }) {
108
- return (_jsxs("div", { class: "sticky top-0 z-30 flex h-14 items-center gap-3 border-b border-base-300 bg-base-100 px-4 lg:px-6", children: [_jsxs("label", { for: "admin-nav-toggle", class: "btn btn-ghost btn-sm btn-square lg:hidden", children: [_jsx(Icon, { name: "menu" }), _jsx("span", { class: "sr-only", children: t('admin.nav.open') })] }), _jsxs("form", { role: "search", action: "/admin/search", method: "get", class: "relative w-full max-w-lg", children: [_jsxs("label", { for: "global-search", class: "input input-sm w-full border-transparent bg-base-200 focus-within:border-base-300 focus-within:bg-base-100", children: [_jsx(Icon, { name: "search", class: "opacity-60" }), _jsx("span", { class: "sr-only", children: t('admin.search.label') }), _jsx("input", { id: "global-search", name: "q", type: "search", class: "grow", placeholder: t('admin.search.placeholder'), autocomplete: "off", role: "combobox", "aria-expanded": "false", "aria-controls": "global-search-results", "aria-autocomplete": "list", "hx-get": "/admin/search", "hx-trigger": "input changed delay:250ms, focus", "hx-target": "#global-search-results", "hx-select": "#global-search-results", "hx-swap": "outerHTML" }), _jsx("kbd", { "aria-hidden": "true", class: "kbd kbd-sm", children: "/" })] }), _jsx("button", { type: "submit", class: "btn btn-sm sr-only focus:not-sr-only focus:absolute focus:right-0 focus:top-0", children: t('admin.search.submit') }), _jsx("div", { id: "global-search-results" })] }), _jsxs("div", { class: "ml-auto flex items-center gap-2", children: [locked && _jsx(PrivateBadge, { owner: owner }), _jsxs("a", { href: "/", class: "btn btn-ghost btn-sm hidden sm:inline-flex", children: [_jsx(Icon, { name: "external" }), t('admin.topbar.viewSite')] }), _jsxs("a", { id: "topbar-publish", href: "/admin/publish", "data-publish-dialog": true, "data-refresh": true, class: "btn btn-primary btn-sm", children: [_jsx(Icon, { name: "send" }), t('admin.topbar.publish'), pending > 0 && (_jsx("span", { "aria-hidden": "true", class: "badge badge-sm border-0 bg-primary-content/20 text-primary-content tabular-nums", children: pending })), pending > 0 && _jsx("span", { class: "sr-only", children: t('admin.topbar.pending', { count: pending }) })] })] })] }));
121
+ return (_jsxs("div", { id: "admin-top", class: "sticky top-0 z-30 flex h-14 items-center gap-3 border-b border-base-300 bg-base-100 px-4 lg:px-6", children: [_jsxs("label", { for: "admin-nav-toggle", class: "btn btn-ghost btn-sm btn-square lg:hidden", children: [_jsx(Icon, { name: "menu" }), _jsx("span", { class: "sr-only", children: t('admin.nav.open') })] }), _jsxs("form", { role: "search", action: "/admin/search", method: "get", class: "relative w-full max-w-lg", children: [_jsxs("label", { for: "global-search", class: "input input-sm w-full border-transparent bg-base-200 focus-within:border-base-300 focus-within:bg-base-100", children: [_jsx(Icon, { name: "search", class: "opacity-60" }), _jsx("span", { class: "sr-only", children: t('admin.search.label') }), _jsx("input", { id: "global-search", name: "q", type: "search", class: "grow", placeholder: t('admin.search.placeholder'), autocomplete: "off", role: "combobox", "aria-expanded": "false", "aria-controls": "global-search-results", "aria-autocomplete": "list", "hx-get": "/admin/search", "hx-trigger": "input changed delay:250ms, focus", "hx-target": "#global-search-results", "hx-select": "#global-search-results", "hx-swap": "outerHTML" }), _jsx("kbd", { "aria-hidden": "true", class: "kbd kbd-sm", children: "/" })] }), _jsx("button", { type: "submit", class: "btn btn-sm sr-only focus:not-sr-only focus:absolute focus:right-0 focus:top-0", children: t('admin.search.submit') }), _jsx("div", { id: "global-search-results" })] }), _jsxs("div", { class: "ml-auto flex items-center gap-2", children: [locked && _jsx(PrivateBadge, { owner: owner }), _jsxs("a", { href: "/", class: "btn btn-ghost btn-sm hidden sm:inline-flex", children: [_jsx(Icon, { name: "external" }), t('admin.topbar.viewSite')] }), _jsxs("a", { id: "topbar-publish", href: "/admin/publish", "data-publish-dialog": true, "data-refresh": true, class: "btn btn-primary btn-sm", children: [_jsx(Icon, { name: "send" }), t('admin.topbar.publish'), pending > 0 && (_jsx("span", { "aria-hidden": "true", class: "badge badge-sm border-0 bg-primary-content/20 text-primary-content tabular-nums", children: pending })), pending > 0 && _jsx("span", { class: "sr-only", children: t('admin.topbar.pending', { count: pending }) })] })] })] }));
109
122
  }
110
123
  function Breadcrumbs({ items, compact }) {
111
124
  if (items.length === 0)
@@ -142,7 +155,7 @@ export async function adminPage(ctx, opts, body) {
142
155
  const workspace = opts.layout === 'workspace';
143
156
  const page = (_jsxs("html", { lang: "en", "data-theme": ctx.branding.theme.name, children: [_jsx(Head, { ctx: ctx, title: opts.title, scripts: scripts }), _jsxs("body", { class: "min-h-screen bg-base-200 text-base-content", children: [_jsx(SkipLink, {}), _jsxs("div", { class: "drawer lg:drawer-open", children: [_jsx("input", { id: "admin-nav-toggle", type: "checkbox", class: "drawer-toggle lg:hidden", "aria-label": t('admin.nav.open') }), _jsxs("div", { class: workspace ? 'drawer-content flex h-screen flex-col' : 'drawer-content flex min-h-screen flex-col', children: [_jsx(TopBar, { pending: pending.length, locked: lock.enabled, owner: opts.actor.role === 'owner' }), _jsxs("main", { id: "main", tabindex: "-1", class: workspace ? 'flex min-h-0 w-full flex-1 flex-col focus:outline-none' : 'w-full flex-1 px-4 py-4 focus:outline-none lg:px-6 lg:py-5', children: [_jsxs("div", { class: workspace
144
157
  ? 'flex shrink-0 flex-wrap items-center gap-x-4 gap-y-2 border-b border-base-300 bg-base-100 px-4 py-2.5'
145
- : 'mb-5 flex flex-wrap items-end justify-between gap-4', children: [_jsxs("div", { class: "min-w-0", children: [_jsx(Breadcrumbs, { items: opts.breadcrumbs ?? [], compact: workspace }), _jsx("h1", { class: workspace ? 'truncate text-lg font-semibold tracking-tight' : 'text-2xl font-semibold tracking-tight', children: opts.title }), opts.description !== undefined && _jsx("p", { class: "text-sm text-base-content/70", children: opts.description })] }), opts.actions !== undefined && (_jsx("div", { class: workspace ? 'flex min-w-0 flex-1 flex-wrap items-center gap-2' : 'flex flex-wrap items-center gap-2', children: opts.actions }))] }), ctx.readOnly && (_jsx("div", { role: "status", class: workspace ? `alert alert-info ${BAR}` : 'alert alert-info mb-4', children: ctx.release ? t('admin.readOnly', { name: ctx.release.name }) : t('admin.readOnly.unnamed') })), _jsx("noscript", { children: _jsx("p", { class: workspace ? `alert alert-warning ${BAR}` : 'alert alert-warning mb-4', children: t('admin.noscript') }) }), notice !== undefined && (_jsx("div", { role: "status", class: workspace ? `alert alert-success ${BAR}` : 'alert alert-success mb-4', children: notice })), workspace ? _jsx("div", { class: "flex min-h-0 flex-1 flex-col", children: body }) : body] })] }), _jsxs("div", { class: "drawer-side z-40", children: [_jsx("label", { for: "admin-nav-toggle", "aria-label": t('admin.nav.close'), class: "drawer-overlay", children: _jsx("span", { class: "sr-only", children: t('admin.nav.close') }) }), _jsxs("aside", { class: "flex min-h-full w-64 flex-col border-r border-base-300 bg-base-100", children: [_jsx("header", { class: "flex h-14 shrink-0 items-center border-b border-base-300 px-4", children: _jsx("a", { href: "/admin", class: "inline-flex min-w-0 items-center", children: _jsx(Brand, { ctx: ctx, size: "h-7 max-w-40" }) }) }), _jsx(Nav, { ctx: ctx, actor: opts.actor, section: opts.section, counts: counts })] })] })] }), _jsx(PickerDialog, {}), _jsx(PublishDialog, {})] })] }));
158
+ : 'mb-5 flex flex-wrap items-end justify-between gap-4', children: [_jsxs("div", { class: "min-w-0", children: [_jsx(Breadcrumbs, { items: opts.breadcrumbs ?? [], compact: workspace }), _jsx("h1", { class: workspace ? 'truncate text-lg font-semibold tracking-tight' : 'text-2xl font-semibold tracking-tight', children: opts.title }), opts.description !== undefined && _jsx("p", { class: "text-sm text-base-content/70", children: opts.description })] }), opts.actions !== undefined && (_jsx("div", { class: workspace ? 'flex min-w-0 flex-1 flex-wrap items-center gap-2' : 'flex flex-wrap items-center gap-2', children: opts.actions }))] }), ctx.readOnly && (_jsx("div", { role: "status", class: workspace ? `alert alert-info ${BAR}` : 'alert alert-info mb-4', children: ctx.release ? t('admin.readOnly', { name: ctx.release.name }) : t('admin.readOnly.unnamed') })), _jsx("noscript", { children: _jsx("p", { class: workspace ? `alert alert-warning ${BAR}` : 'alert alert-warning mb-4', children: t('admin.noscript') }) }), workspace ? _jsx("div", { class: "flex min-h-0 flex-1 flex-col", children: body }) : body] })] }), _jsxs("div", { class: "drawer-side z-40", children: [_jsx("label", { for: "admin-nav-toggle", "aria-label": t('admin.nav.close'), class: "drawer-overlay", children: _jsx("span", { class: "sr-only", children: t('admin.nav.close') }) }), _jsxs("aside", { class: "flex min-h-full w-64 flex-col border-r border-base-300 bg-base-100 lg:w-full lg:border-r-0", children: [_jsx("header", { class: "flex h-14 shrink-0 items-center border-b border-base-300 px-4", children: _jsx("a", { href: "/admin", class: "inline-flex min-w-0 items-center", children: _jsx(Brand, { ctx: ctx, size: "h-7 max-w-40" }) }) }), _jsx(Nav, { ctx: ctx, actor: opts.actor, section: opts.section, counts: counts })] })] })] }), _jsx(PickerDialog, {}), _jsx(PublishDialog, {}), notice !== undefined && _jsx(Notice, { text: notice })] })] }));
146
159
  return `<!doctype html>${await renderToString(page)}`;
147
160
  }
148
161
  /** A page for someone who isn't signed in (setup, login, consent, uploads): a centered card with the brand, no navigation. */
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createInterface } from 'node:readline';
3
3
  import { Writable } from 'node:stream';
4
- import { runCli } from './main.js';
5
4
  async function readSecret(prompt) {
6
5
  if (process.stdin.isTTY) {
7
6
  let muted = false;
@@ -34,9 +33,15 @@ async function readSecret(prompt) {
34
33
  rl.close();
35
34
  }
36
35
  }
37
- process.exitCode = await runCli(process.argv.slice(2), {
36
+ const argv = process.argv.slice(2);
37
+ const io = {
38
38
  cwd: process.cwd(),
39
39
  out: console.log,
40
40
  err: console.error,
41
41
  readSecret,
42
- });
42
+ };
43
+ // `serve` skips main.js so the primary and every worker load only what serving needs, not the whole CLI.
44
+ process.exitCode =
45
+ argv.length === 1 && argv[0] === 'serve'
46
+ ? await (await import('../../host/serve.js')).serve([], io)
47
+ : await (await import('./main.js')).runCli(argv, io);
@@ -31,6 +31,7 @@ import { EMPTY_SITE } from '../../host/app.js';
31
31
  import { ensureDataDir, hostPaths, readDataDir, readHostConfig, readTrustedKeys } from '../../host/config.js';
32
32
  import { dev } from '../../host/dev.js';
33
33
  import { formatDiff } from '../../host/diff.js';
34
+ import { releaseInfo } from '../../host/push.js';
34
35
  import { serve } from '../../host/serve.js';
35
36
  import { currentRelease, getRelease, listReleases, releaseDir, storeRelease } from '../../host/store.js';
36
37
  import { activateRemote, checkTransport, isRemote, listRemoteReleases, pushFile } from './remote.js';
@@ -355,11 +356,18 @@ async function releases(io, flags) {
355
356
  await db.destroy();
356
357
  }
357
358
  }
358
- printReleases(io, rows, flags.json);
359
+ printReleases(io, rows.map(releaseInfo), flags.json);
359
360
  return 0;
360
361
  }
361
362
  function printReleases(io, rows, json) {
362
- const listed = rows.map((r) => ({ id: r.id, name: r.name, state: r.state, pushedAt: r.pushed_at, activatedAt: r.activated_at }));
363
+ const listed = rows.map((r) => ({
364
+ id: r.id,
365
+ name: r.name,
366
+ state: r.state,
367
+ pushedAt: r.pushed_at,
368
+ activatedAt: r.activated_at,
369
+ ...(r.warning !== undefined && { warning: r.warning }),
370
+ }));
363
371
  if (json)
364
372
  return io.out(JSON.stringify(listed, null, 2));
365
373
  if (listed.length === 0)
@@ -372,6 +380,8 @@ function printReleases(io, rows, json) {
372
380
  pushedAt: r.pushedAt,
373
381
  activatedAt: r.activatedAt ?? t('cli.releaseNeverLive'),
374
382
  }));
383
+ if (r.warning !== undefined)
384
+ io.out(t('cli.releaseWarning', { warning: r.warning }));
375
385
  }
376
386
  }
377
387
  /** The push token: `--token`, or INLAY_PUSH_TOKEN. Answers exit code 2, having said so, when there is neither. */
@@ -1,8 +1,9 @@
1
1
  import { type AgentRefs } from '../../core/agent/format.js';
2
+ import { type TrailingSlash } from '../../core/site/paths.js';
2
3
  import type { DocumentData } from '../../core/types.js';
3
4
  import type { McpDeps } from './server.js';
4
5
  /** The absolute URL of a decoded site path, or `null` for a document without a page. */
5
- export declare function pageUrl(baseUrl: string, path: string | null): string | null;
6
+ export declare function pageUrl(baseUrl: string, path: string | null, trailingSlash: TrailingSlash): string | null;
6
7
  /** The absolute URL of a media file. */
7
8
  export declare function mediaUrl(baseUrl: string, id: string): string;
8
9
  /** Everything `toAgent` and `agentLinks` look up for `data`, read up front in `locale` (drafts included). */
@@ -1,8 +1,8 @@
1
1
  import { agentRefsNeeded } from '../../core/agent/format.js';
2
- import { encodePath } from '../../core/site/paths.js';
2
+ import { encodePath, presentHref } from '../../core/site/paths.js';
3
3
  /** The absolute URL of a decoded site path, or `null` for a document without a page. */
4
- export function pageUrl(baseUrl, path) {
5
- return path === null ? null : `${baseUrl}${encodePath(path)}`;
4
+ export function pageUrl(baseUrl, path, trailingSlash) {
5
+ return path === null ? null : `${baseUrl}${presentHref(encodePath(path), trailingSlash)}`;
6
6
  }
7
7
  /** The absolute URL of a media file. */
8
8
  export function mediaUrl(baseUrl, id) {
@@ -17,7 +17,7 @@ export async function loadAgentRefs(deps, type, locale, data) {
17
17
  return {
18
18
  document(groupId) {
19
19
  const doc = documents.get(groupId);
20
- return doc ? { title: doc.title, url: pageUrl(baseUrl, doc.path) } : null;
20
+ return doc ? { title: doc.title, url: pageUrl(baseUrl, doc.path, core.registry.site.trailingSlash) } : null;
21
21
  },
22
22
  media: (id) => media.get(id) ?? { status: 'unknown' },
23
23
  mediaUrl: (id) => mediaUrl(baseUrl, id),
@@ -71,7 +71,7 @@ async function describeDone(deps, action, ids) {
71
71
  out.push(item);
72
72
  continue;
73
73
  }
74
- out.push({ ...item, url: pageUrl(deps.baseUrl, await livePath(deps, doc, 'published')) });
74
+ out.push({ ...item, url: pageUrl(deps.baseUrl, await livePath(deps, doc, 'published'), deps.core.registry.site.trailingSlash) });
75
75
  }
76
76
  return out;
77
77
  }