@runeditrun/rer 0.2.60 → 0.2.62

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.
@@ -11,11 +11,14 @@
11
11
  // CONTRACT.md gets it parsed as sitePages({ contract }), for its /contract
12
12
  // page; one that does not parse stops the build, naming its lines.
13
13
  // Usage: node site-render.mjs ROOT ENTRY OUTPUT [CONFIG]
14
+ import { shared } from './shared.mjs';
15
+ const { seedIcons, readIconFiles } = await shared('icon-files.mjs');
14
16
  import { cp, lstat, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
15
17
  import { createRequire } from 'node:module';
16
18
  import { dirname, join, resolve, sep } from 'node:path';
17
19
  import { pathToFileURL } from 'node:url';
18
20
  import { buildClients, writeSiteAsset } from './site-client.mjs';
21
+ import { htmlElements } from './site-markup.mjs';
19
22
  import { redactSiteOutput, siteBuildDiagnostic } from './site-diagnostics.mjs';
20
23
  import { ContractError, parseContract } from '../foundation/runtime/seed-contract.mjs';
21
24
 
@@ -46,6 +49,7 @@ const server = `${output}.render`;
46
49
  let module, styles = [], files = [];
47
50
  try {
48
51
  const built = await vite.build({
52
+ plugins: [seedIcons()],
49
53
  root, configFile: config ? resolve(root, config) : false, envFile: false, logLevel: 'error', mode: 'production',
50
54
  build: {
51
55
  ssr: resolve(root, entry), outDir: server, emptyOutDir: true, copyPublicDir: false, ssrEmitAssets: true,
@@ -82,6 +86,18 @@ try {
82
86
  await lstat(source).catch(() => fail(`Missing site asset public/${asset}.`));
83
87
  await cp(source, join(output, asset), { recursive: true, errorOnExist: true, force: false, verbatimSymlinks: true });
84
88
  }
89
+ const icons = await readIconFiles(publicDirectory);
90
+ // A custom site entry may not use Base's head. Export selected icons only
91
+ // when a generated page actually links them, like its other public assets.
92
+ const linkedIcons = new Set(build.pages.flatMap(({ html }) => htmlElements(html)
93
+ .filter(({ tag, attributes }) => tag === 'link' && (attributes.get('rel') ?? '').toLowerCase().split(/\s+/).some(rel => ['icon', 'apple-touch-icon'].includes(rel)))
94
+ .map(({ attributes }) => attributes.get('href')?.split(/[?#]/)[0])));
95
+ for (const [path, { bytes }] of icons.files) {
96
+ if (!linkedIcons.has(path)) continue;
97
+ const target = join(output, path.slice(1));
98
+ await mkdir(dirname(target), { recursive: true });
99
+ await writeFile(target, bytes);
100
+ }
85
101
  // Only the emitted files: the Node chunks share the folder and never ship.
86
102
  for (const file of files) {
87
103
  await writeSiteAsset(output,file,await readFile(join(server,file)));
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.62
4
+
5
+ - **Themed demo gates keep waiting visibly disabled (#292).** Waiting, working and other non-actionable buttons use muted outlines from the seed’s theme tokens. Turnstile explicitly follows the card’s painted light/dark scheme, including declared dark media tokens.
6
+ - **First paint returns to the 0.2.59 baseline.** Critical theme/import/font CSS is inline under the existing CSP, font faces use swap or optional, and prefetch lists are unchanged. The reviewed browser-cold local-host Plinth medians for 0.2.59 / 0.2.60 / this fix were 20 / 28 / 20 ms; Default was 20 / 24 / 20 ms. Seeds pick up the fix with rer 0.2.62 and a normal demo refresh.
7
+
8
+ ## 0.2.61
9
+
10
+ - **One import path for every seed (#272).** The signed-in move-in screen, rer and Business can share upload → plan → reviewed fingerprint → apply → reconcile → undo, retaining native edit protection, history and erasure across catch-up chains. This integration supersedes #246, #262, #252, #250, #259 and #267.
11
+ - **Seed adoption and migrations.** Follow [modules/import-kit/src/door/ADOPTING.md](../modules/import-kit/src/door/ADOPTING.md). Vendor the current import-kit source/schema and sibling d1-transport through the seed's Base provenance workflow. Add any missing D1 kit schemas in the order shown there, including `d1CustodyStateReplaceSchema`: Base's default seed supplies the additive `migrations/core/0026_import_custody_replace.sql`. Keep previously applied migration names and bytes. For a new door apply `importDoorSchema` once after the kit migrations. For an existing door, add separate new numbered seed migrations for **`importDoorApplyFailureMigration` as one atomic batch with foreign keys on, then `importDoorScopesMigration`**; never reapply the updated `importDoorSchema`. The door returns 503 `import_door_schema_outdated` until those upgrades are applied. Run the seed's normal local migration path (`rer dev` for Base's default seed), its existing HTTP import conformance and every erasure journey with retained door rows; then run `rer deploy --dry-run` and `rer deploy` through its declared deployment path. Preserve the permanent server-owned `installationId`; mount the operator handler with the seed's real owner session/CSRF checks, replace old importer routes/callers, and explicitly opt in to Business grants only where configured. The copyable `checkDoor` journey and complete adapter/erasure checklist are in ADOPTING.md.
12
+ - **Crisp seed favicons (#287).** Shared Base heads choose existing ICO, small SVG/32px PNG and Apple icons before a full mark. Adopting seeds copy the updated runtime heads, include `seedIcons()` in app Vite configuration (`@runeditrun/rer/seed-icons`), and refresh rer for Run, installer and native-demo heads. Preserve seed-owned layouts such as Plinth's Lobby. Seeds without small assets must supply their own artwork.
13
+
3
14
  ## 0.2.60
4
15
 
5
16
  - **Hosted demo gates wear each seed’s theme.** Start and ended pages load the seed’s mark, palette, fonts and focus styles, with Base theme assets when absent (#284).
@@ -13,8 +13,13 @@ host. See [adoption and deployment](../../export/DEMO.md#hosting-the-demo).
13
13
  - `worker.mjs`, `pages.mjs`, `start-script.mjs`: Turnstile start, progress,
14
14
  cancellation and visitor routing. Static assets are served at the edge.
15
15
  - `theme.mjs`, `page-style.mjs`, `theme-script.mjs`: the start and ended pages
16
- link the seed's built `rer-theme.css` and fonts, as the Lobby does. Their
17
- colours, type and mark follow its `--rer-*` tokens, including media rules.
16
+ inline the seed's built `rer-theme.css`, fonts CSS and imports in the same
17
+ cascade as the Lobby. Their colours, type and mark follow its `--rer-*` tokens,
18
+ including media rules. Font faces use swap or optional display, so neither
19
+ CSS fetches nor fonts hold first paint. Disabled buttons use the surface,
20
+ border and muted-text tokens; only actionable buttons use the accent fill.
21
+ `theme-script.mjs` sets the page and Turnstile scheme from the painted card's
22
+ background and text before the widget renders, and updates on preference changes.
18
23
  The maintained default seed's theme assets supply missing tokens or an
19
24
  absent theme, under `/__demo/theme/`. Styles, fonts and marks stay same-origin;
20
25
  a missing mark leaves the product name visible.
@@ -1,3 +1,4 @@
1
+ import { shared } from '../../../cli/shared.mjs';
1
2
  import { readFile, writeFile, cp } from 'node:fs/promises';
2
3
  import { resolve, join, relative } from 'node:path';
3
4
  import { createHash } from 'node:crypto';
@@ -34,10 +35,12 @@ export async function prepareNative(folder) {
34
35
  const assets = await collectFiles(join(app, 'dist/client'));
35
36
  await cp(join(app, 'dist/client'), join(folder, 'assets'), { recursive: true });
36
37
  const theme = await prepareTheme(folder, assets);
37
- const bundle = { compatibilityDate: config.compatibility_date, compatibilityFlags: [...new Set([...(config.compatibility_flags ?? []), 'nodejs_compat'])], modules,
38
+ const { readIconFiles } = await shared('icon-files.mjs');
39
+ const { links: iconHead } = await readIconFiles(join(app, 'dist/client'));
40
+ const bundle = { iconHead, compatibilityDate: config.compatibility_date, compatibilityFlags: [...new Set([...(config.compatibility_flags ?? []), 'nodejs_compat'])], modules,
38
41
  bindings, migrations: manifest.migrations, vars: config.vars ?? {}, crons: config.triggers?.crons ?? [],
39
42
  assetPaths: [...assets.filter(file => !file.path.split('/').some(part => part.startsWith('.'))).map(file => '/' + file.path), ...theme.paths],
40
- theme: theme.stylesheets,
43
+ theme: theme.css,
41
44
  immutable: [...builtChunks(assets, manifest.assetsDir)].sort(),
42
45
  warm: (await warmList(assets, root, manifest.operatorPath, manifest.assetsDir)).paths };
43
46
  bundle.digest = createHash('sha256').update(JSON.stringify(bundle)).digest('hex');
@@ -98,7 +98,7 @@ export class NativeDemo extends DurableObject {
98
98
  return this.object(binding, id, 'fetch', [new Request(request, { headers })]);
99
99
  }
100
100
  const runtime = await this.session();
101
- if (!runtime) return endedPage({ ...this.env, DEMO_THEME: bundle.theme }, { headers: { 'set-cookie': clearCookie(this.env) } });
101
+ if (!runtime) return endedPage({ ...this.env, DEMO_THEME: bundle.theme, DEMO_ICON_HEAD: bundle.iconHead }, { headers: { 'set-cookie': clearCookie(this.env) } });
102
102
  return application(this.env, this.ctx, this.ctx.id.toString(), runtime).fetch(request);
103
103
  }
104
104
  // The seed signs the visitor out, then the copy ends as an expired one does.
@@ -106,12 +106,12 @@ export class NativeDemo extends DurableObject {
106
106
  // its next page load finds the ended page.
107
107
  async signOut(request) {
108
108
  const runtime = await this.session();
109
- if (!runtime) return endedPage({ ...this.env, DEMO_THEME: bundle.theme }, { headers: { 'set-cookie': clearCookie(this.env) } });
109
+ if (!runtime) return endedPage({ ...this.env, DEMO_THEME: bundle.theme, DEMO_ICON_HEAD: bundle.iconHead }, { headers: { 'set-cookie': clearCookie(this.env) } });
110
110
  const response = await application(this.env, this.ctx, this.ctx.id.toString(), runtime).fetch(request);
111
111
  if (response.status >= 400) return response;
112
112
  const body = await response.arrayBuffer();
113
113
  await this.end();
114
- if (/text\/html/.test(request.headers.get('accept') ?? '')) return endedPage({ ...this.env, DEMO_THEME: bundle.theme }, { headers: { 'set-cookie': clearCookie(this.env) } });
114
+ if (/text\/html/.test(request.headers.get('accept') ?? '')) return endedPage({ ...this.env, DEMO_THEME: bundle.theme, DEMO_ICON_HEAD: bundle.iconHead }, { headers: { 'set-cookie': clearCookie(this.env) } });
115
115
  return new Response(response.status === 204 ? null : body, response);
116
116
  }
117
117
  database(binding, method, args) { return database(this, binding, method, args); }
@@ -21,6 +21,6 @@ export default {
21
21
  return new Response(response.body, { status: response.status, headers });
22
22
  }
23
23
  // The start page prefetches the console's chunks while the visitor waits.
24
- return front.fetch(request, { ...env, DEMO_WARM: bundle.warm, DEMO_THEME: bundle.theme }, ctx);
24
+ return front.fetch(request, { ...env, DEMO_WARM: bundle.warm, DEMO_THEME: bundle.theme, DEMO_ICON_HEAD: bundle.iconHead }, ctx);
25
25
  },
26
26
  };
@@ -1,12 +1,12 @@
1
1
  // Gate layout; presentation comes from the same --rer-* tokens as the Lobby.
2
- export const STYLE = `*{box-sizing:border-box}body{margin:0;background:var(--rer-page);color:var(--rer-text);font-family:var(--rer-font-body);-webkit-font-smoothing:antialiased}
2
+ export const STYLE = `:root{color-scheme:light}:root[data-demo-scheme=dark]{color-scheme:dark}*{box-sizing:border-box}body{margin:0;background:var(--rer-page);color:var(--rer-text);font-family:var(--rer-font-body);-webkit-font-smoothing:antialiased}
3
3
  main{width:666px;margin:clamp(32px,18vh,184px) auto 48px}.card{padding:40px 42px 44px;background:var(--rer-surface);border:1px solid var(--rer-border);border-radius:var(--rer-radius);box-shadow:0 12px 45px color-mix(in srgb,var(--rer-text) 5%,transparent)}
4
4
  .brand{display:flex;align-items:center;gap:12px;font-family:var(--rer-font-heading,var(--rer-font-body));font-size:18px;line-height:22px;font-weight:var(--rer-wordmark-weight,600);letter-spacing:var(--rer-wordmark-tracking,normal);color:var(--rer-text);margin:0 0 20px}.brand img{display:block;width:40px;height:40px;object-fit:contain}.brand img[hidden]{display:none}
5
5
  h1{font-family:var(--rer-font-heading,var(--rer-font-body));font-size:42px;line-height:50px;letter-spacing:-1.3px;margin:0 0 14px;font-weight:700}.intro{font-size:20px;line-height:28px;color:var(--rer-muted);margin:0}
6
6
  ul{padding:0;margin:23px 0 35px;list-style:none;color:var(--rer-muted);font-size:18px;line-height:33px}li{position:relative;padding-left:33px}li:before{content:'';position:absolute;left:7px;top:14px;width:7px;height:7px;background:var(--rer-accent);border-radius:50%}
7
7
  .notice{margin:0 0 16px;padding:12px 16px;border-radius:8px;background:var(--rer-page);color:var(--rer-text);border:1px solid var(--rer-border);font-size:16px;line-height:22px}
8
8
  .cf-turnstile{min-height:65px}.button{display:flex;align-items:center;justify-content:center;gap:12px;width:100%;margin-top:28px;min-height:58px;border:1px solid var(--rer-accent);border-radius:var(--rer-button-radius,var(--rer-radius));background:var(--rer-accent);color:var(--rer-accent-text);font:inherit;font-size:20px;font-weight:700;line-height:26px;padding:15px;text-align:center;text-decoration:none;cursor:pointer}
9
- .button:disabled{cursor:progress}[data-state=waiting] .button{font-weight:600;cursor:default}
9
+ .button:disabled{background:var(--rer-surface);border-color:var(--rer-border);color:var(--rer-muted);font-weight:600;cursor:default}
10
10
  .spinner{display:none;flex:none;width:20px;height:20px;border:3px solid color-mix(in srgb,currentColor 35%,transparent);border-top-color:currentColor;border-radius:50%;animation:spin .8s linear infinite}[data-state=working] .spinner,[data-state=signing] .spinner{display:block}@keyframes spin{to{transform:rotate(360deg)}}
11
11
  ol.steps{display:none;list-style:none;margin:22px auto 0;padding:0;width:max-content;max-width:100%;font-size:16px;line-height:22px;color:var(--rer-muted)}[data-state=working] .steps,[data-state=signing] .steps,[data-state=slow] .steps{display:grid;gap:10px}[data-state=failed] .note{display:none}
12
12
  .steps li{padding-left:30px;margin:0}.steps li:before{left:0;top:2px;width:18px;height:18px;box-sizing:border-box;background:none;border:2px solid var(--rer-muted)}.steps [data-at=done]{color:var(--rer-muted)}.steps [data-at=done]:before{content:'✓';border:0;background:var(--rer-accent);color:var(--rer-accent-text);font-size:12px;line-height:18px;font-weight:700;text-align:center}.steps [data-at=now]{color:var(--rer-text);font-weight:600}.steps [data-at=now]:before{border-color:var(--rer-border);border-top-color:var(--rer-accent);animation:spin .8s linear infinite}
@@ -3,7 +3,7 @@
3
3
  // Both are one card in the family's quiet sign-in style.
4
4
  import { START_SCRIPT } from './start-script.mjs';
5
5
  import { STYLE } from './page-style.mjs';
6
- import { LOGO_SCRIPT } from './theme-script.mjs';
6
+ import { THEME_SCRIPT } from './theme-script.mjs';
7
7
 
8
8
  const escape = value => String(value).replace(/[&<>"']/g, character => `&#${character.charCodeAt(0)};`);
9
9
 
@@ -15,8 +15,8 @@ const warm = env => (env.DEMO_WARM ?? []).map(path => `<link rel="prefetch" href
15
15
  function html(env, { page, title, body, status = 200, headers = {}, turnstile = false, refresh = false }) {
16
16
  const nonce = crypto.randomUUID().replaceAll('-', ''), site = new URL(env.DEMO_SITE);
17
17
  const policy = `default-src 'none'; style-src 'self' 'nonce-${nonce}'; font-src 'self'; img-src 'self'; form-action 'self'; base-uri 'none'; frame-ancestors 'none'; script-src 'nonce-${nonce}'${turnstile ? ` https://challenges.cloudflare.com; frame-src https://challenges.cloudflare.com; connect-src 'self' https://challenges.cloudflare.com` : ''}`;
18
- return new Response(`<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex"><title>${escape(title)}</title>${refresh ? '<noscript><meta http-equiv="refresh" content="2;url=/__demo/status"></noscript>' : ''}${(env.DEMO_THEME ?? []).map(path => `<link rel="stylesheet" href="${escape(path)}">`).join('')}<style nonce="${nonce}">${STYLE}</style>${turnstile ? `<noscript><style nonce="${nonce}">#note{display:none}</style></noscript><script nonce="${nonce}">${START_SCRIPT}</script><script nonce="${nonce}" src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>${warm(env)}` : ''}</head>
19
- <body class="${page}"><main><section class="card" aria-labelledby="title"><p class="brand"><img class="mark" alt="${escape(env.DEMO_NAME)}" width="40" height="40" hidden><span>${escape(env.DEMO_NAME)}</span></p>${body}</section><nav class="back" aria-label="Return"><a href="${escape(site.origin)}/">Back to ${escape(site.host)}</a></nav></main><script nonce="${nonce}">${LOGO_SCRIPT}</script></body></html>`,
18
+ return new Response(`<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex"><title>${escape(title)}</title>${env.DEMO_ICON_HEAD ?? ''}${refresh ? '<noscript><meta http-equiv="refresh" content="2;url=/__demo/status"></noscript>' : ''}<style nonce="${nonce}">${(env.DEMO_THEME ?? '').replace(/<(?=\/style)/gi, '\\3c ')}\n${STYLE}</style>${turnstile ? `<noscript><style nonce="${nonce}">#note{display:none}</style></noscript><script nonce="${nonce}">${START_SCRIPT}</script>${warm(env)}` : ''}</head>
19
+ <body class="${page}"><main><section class="card" aria-labelledby="title"><p class="brand"><img class="mark" alt="${escape(env.DEMO_NAME)}" width="40" height="40" hidden><span>${escape(env.DEMO_NAME)}</span></p>${body}</section><nav class="back" aria-label="Return"><a href="${escape(site.origin)}/">Back to ${escape(site.host)}</a></nav></main><script nonce="${nonce}">${THEME_SCRIPT}</script>${turnstile ? `<script nonce="${nonce}" src="https://challenges.cloudflare.com/turnstile/v0/api.js?onload=rerDemoRender&render=explicit" async defer></script>` : ''}</body></html>`,
20
20
  { status, headers: { 'content-type': 'text/html; charset=utf-8', 'cache-control': 'no-store', 'content-security-policy': policy, 'referrer-policy': 'strict-origin', 'x-content-type-options': 'nosniff', ...headers } });
21
21
  }
22
22
 
@@ -26,8 +26,8 @@ export function startPage(env, { status = 200, notice, pending = false, headers
26
26
  return html(env, { page: 'start', title: `Try ${env.DEMO_NAME}`, status, headers, turnstile: true, refresh: pending, body: `<h1 id="title">Try ${name}</h1>
27
27
  <p class="intro">Your own copy of ${name}, signed in as its owner, with sample data.</p>
28
28
  <ul><li>Public checks run live. Messages and account changes are simulated.</li><li>It ends after an hour, or 15 idle minutes.</li><li>Then it is deleted. Nobody else can see it.</li></ul>
29
- <p class="notice" id="notice" role="alert"${notice ? '' : ' hidden'}>${notice ? escape(notice) : ''}</p><form id="start" method="post" action="/__demo/start" data-auto="${notice || pending ? '0' : '1'}"${pending ? ' data-resume="1" data-state="working"' : ''}><div class="cf-turnstile" data-sitekey="${escape(env.TURNSTILE_SITE_KEY)}" data-size="flexible" data-callback="rerDemoVerified" data-before-interactive-callback="rerDemoInteractive" data-after-interactive-callback="rerDemoChecking" data-expired-callback="rerDemoExpired" data-error-callback="rerDemoCheckFailed"></div>
30
- <button class="button" type="submit"${pending ? ' disabled' : ''}><span class="spinner" aria-hidden="true"></span><span class="label">${pending ? 'Starting your demo…' : 'Start the demo'}</span></button>
29
+ <p class="notice" id="notice" role="alert"${notice ? '' : ' hidden'}>${notice ? escape(notice) : ''}</p><form id="start" method="post" action="/__demo/start" data-auto="${notice || pending ? '0' : '1'}"${pending ? ' data-resume="1" data-state="working"' : ' data-state="waiting"'}><div class="cf-turnstile" data-theme="light" data-sitekey="${escape(env.TURNSTILE_SITE_KEY)}" data-size="flexible" data-callback="rerDemoVerified" data-before-interactive-callback="rerDemoInteractive" data-after-interactive-callback="rerDemoChecking" data-expired-callback="rerDemoExpired" data-error-callback="rerDemoCheckFailed"></div>
30
+ <button class="button" type="submit" disabled><span class="spinner" aria-hidden="true"></span><span class="label">${pending ? 'Starting your demo…' : 'Waiting for the human check…'}</span></button>
31
31
  <ol class="steps" aria-hidden="true"><li data-at="done">Checking you're human</li><li data-at="now">Starting a private copy</li><li data-at="next">Signing you in</li></ol>
32
32
  <p class="note" id="note">${pending ? 'Your demo will open automatically when ready.' : 'Complete the human check to start your demo.'}</p><noscript><p class="note">The human check needs JavaScript. Turn it on to start the demo.</p></noscript><p class="visually-hidden" id="status" role="status"></p></form>` });
33
33
  }
@@ -77,7 +77,7 @@ window.rerDemoExpired=()=>checking()&&waiting();
77
77
  window.rerDemoCheckFailed=()=>checking()&&show('failed',{label:'Try again',note:'',live:'',notice:'The human check did not load. Try again.'});
78
78
  addEventListener('DOMContentLoaded',()=>{
79
79
  if(el().form.dataset.resume==='1')go(true);
80
- else if(!el().form.dataset.state)waiting();
80
+ else if(el().form.dataset.state==='waiting')waiting();
81
81
  el().form.addEventListener('submit',event=>{
82
82
  event.preventDefault();
83
83
  const state=el().form.dataset.state;
@@ -0,0 +1,49 @@
1
+ // Resolve the built seed's CSS before serving the gate: no stylesheet round
2
+ // trips, and relative imports/font/mark URLs still refer to their source file.
3
+ const origin = 'https://theme.invalid';
4
+ const imports = /@import\s+(?:url\(\s*(['"]?)([^'"\s)]+)\1\s*\)|(['"])([^'"]+)\3)\s*([^;]*);/gi;
5
+
6
+ function localURL(value, path) {
7
+ const url = new URL(value, origin + path);
8
+ if (url.origin !== origin) throw Error(`Demo theme must use same-origin assets: ${value}`);
9
+ return url.pathname + url.search + url.hash;
10
+ }
11
+
12
+ function conditioned(css, conditions) {
13
+ // @import allows layer, supports, then media; keep their cascade semantics.
14
+ const wrappers = [];
15
+ let rest = conditions.trim();
16
+ for (const kind of ['layer', 'supports']) {
17
+ if (!rest.startsWith(kind)) continue;
18
+ rest = rest.slice(kind.length).trimStart();
19
+ let value = '';
20
+ if (rest.startsWith('(')) {
21
+ let depth = 0, end = 0;
22
+ do { if (rest[end] === '(') depth++; if (rest[end] === ')') depth--; end++; } while (depth && end < rest.length);
23
+ if (depth) throw Error(`Invalid demo theme import: ${conditions}`);
24
+ value = rest.slice(1, end - 1); rest = rest.slice(end).trimStart();
25
+ } else if (kind === 'supports') throw Error(`Invalid demo theme import: ${conditions}`);
26
+ wrappers.push(kind === 'supports' ? `@supports (${value})` : `@layer ${value}`);
27
+ }
28
+ if (rest) wrappers.push(`@media ${rest}`);
29
+ return wrappers.reduceRight((body, wrapper) => `${wrapper}{${body}}`, css);
30
+ }
31
+
32
+ export function inlineTheme(files, paths) {
33
+ function expand(path, parents = []) {
34
+ const key = new URL(path, origin).pathname;
35
+ if (parents.includes(key)) throw Error(`Cyclic demo theme import: ${[...parents, key].join(' -> ')}`);
36
+ const bytes = files.get(key);
37
+ if (!bytes) throw Error(`Demo theme asset missing: ${key}`);
38
+ const css = bytes.toString().replace(/\/\*[\s\S]*?\*\//g, '').replace(/@charset\s+['"][^'"]+['"]\s*;/gi, '');
39
+ // Rebase before expansion so an imported file keeps its own URL base.
40
+ const rebased = css.replace(/url\(\s*(['"]?)([^'"\s)]+)\1\s*\)/gi, (_, _quote, value) => `url("${localURL(value, key)}")`);
41
+ return rebased.replace(imports, (_, _q1, url, _q2, string, conditions) => conditioned(expand(localURL(url ?? string, key), [...parents, key]), conditions));
42
+ }
43
+ return paths.map(path => expand(path)).join('\n').replace(/@font-face\s*\{([^{}]*)\}/gi, (_, body) => {
44
+ // A seed's block/auto/default display must not hold the gate's first paint.
45
+ const declarations = body.replace(/font-display\s*:[^;}]*(;|$)/gi, '');
46
+ const display = /font-display\s*:\s*optional\s*(?:;|$)/i.test(body) ? 'optional' : 'swap';
47
+ return `@font-face{${declarations.trim().replace(/;?$/, ';')}font-display:${display};}`;
48
+ });
49
+ }
@@ -1,10 +1,25 @@
1
- // Like the Lobby, load the seed's served theme and show its mark beside the
2
- // product name. Resolve the CSS token in the browser so dark-mode marks work
3
- // too. A missing or broken image leaves the product's text visible.
4
- export const LOGO_SCRIPT = `(()=>{
5
- const mark=document.querySelector('.brand img'),name=document.querySelector('.brand span');
1
+ // Resolve the seed's actual painted palette, including CSS aliases and dark
2
+ // media rules, before Turnstile renders. A light-only seed stays light even
3
+ // when the visitor prefers dark. Marks follow the same media changes.
4
+ export const THEME_SCRIPT = `(()=>{
5
+ const root=document.documentElement,card=document.querySelector('.card');
6
+ const widget=document.querySelector('.cf-turnstile'),mark=document.querySelector('.brand img'),name=document.querySelector('.brand span');
7
+ let widgetId,pixel;
8
+ const luminance=colour=>{
9
+ if(!pixel){const canvas=document.createElement('canvas');canvas.width=canvas.height=1;pixel=canvas.getContext('2d',{willReadFrequently:true})}
10
+ pixel.fillStyle=colour;pixel.fillRect(0,0,1,1);
11
+ const [r,g,b]=[...pixel.getImageData(0,0,1,1).data].slice(0,3).map(value=>{const c=value/255;return c<=.04045?c/12.92:((c+.055)/1.055)**2.4});
12
+ return .2126*r+.7152*g+.0722*b;
13
+ };
14
+ window.rerDemoRender=()=>{update();if(widget)widgetId=turnstile.render(widget,{theme:widget.dataset.theme})};
6
15
  const update=()=>{
7
- const token=getComputedStyle(document.documentElement).getPropertyValue('--rer-logo');
16
+ const style=getComputedStyle(card),scheme=luminance(style.backgroundColor)<luminance(style.color)?'dark':'light';
17
+ root.dataset.demoScheme=scheme;
18
+ if(widget&&widget.dataset.theme!==scheme){
19
+ widget.dataset.theme=scheme;
20
+ if(widgetId!==undefined){window.rerDemoExpired();turnstile.remove(widgetId);window.rerDemoRender()}
21
+ }
22
+ const token=getComputedStyle(root).getPropertyValue('--rer-logo');
8
23
  const match=/url\\(\\s*(['"]?)([^'"\\)]+)\\1\\s*\\)/.exec(token);
9
24
  mark.hidden=true;name.removeAttribute('aria-hidden');
10
25
  if(!match)return;
@@ -14,5 +29,7 @@ export const LOGO_SCRIPT = `(()=>{
14
29
  mark.onerror=()=>{mark.hidden=true;name.removeAttribute('aria-hidden')};
15
30
  mark.src=url.href;
16
31
  };
17
- update();matchMedia('(prefers-color-scheme: dark)').addEventListener('change',update);
32
+ // The inline CSS paints the card immediately; mark/scheme work follows that
33
+ // first frame. If Turnstile arrives sooner, its callback updates before render.
34
+ requestAnimationFrame(()=>setTimeout(update,0));matchMedia('(prefers-color-scheme: dark)').addEventListener('change',update);
18
35
  })()`;
@@ -2,26 +2,26 @@ import { mkdir, writeFile } from 'node:fs/promises';
2
2
  import { dirname, join } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { shared } from '../../cli/shared.mjs';
5
+ import { inlineTheme } from './theme-css.mjs';
5
6
 
6
7
  const prefix = '/__demo/theme';
7
8
 
8
- // Ship the maintained default seed's actual theme, font and mark, rather than
9
- // another set of fallback values. Namespace its assets so they cannot replace
10
- // a seed's own files. The seed stylesheet follows it, just as in the Lobby;
11
- // the browser resolves imports, token aliases and light/dark media rules.
9
+ // Keep the Lobby's cascade (maintained defaults, seed fonts, seed theme), but
10
+ // resolve it at build time so the gate can paint without blocking CSS fetches.
12
11
  export async function prepareTheme(folder, assets) {
13
12
  const { loadSeedTheme } = await shared('theme-files.mjs');
14
13
  const defaults = await loadSeedTheme(fileURLToPath(new URL('../../default-seed/', import.meta.url)), 'public/rer-theme.css');
15
- const paths = [];
14
+ const paths = [], files = new Map(assets.map(file => ['/' + file.path, Buffer.from(file.base64, 'base64')]));
16
15
  for (const [path, file] of defaults.files) {
17
16
  const target = join(folder, 'assets', prefix, path);
18
17
  await mkdir(dirname(target), { recursive: true });
19
18
  const bytes = file.type === 'text/css'
20
- ? file.bytes.toString().replace(/url\((['"]?)(\/[^)'"\s]+)\1\)/g, (_, quote, url) => `url(${quote}${prefix}${url}${quote})`)
19
+ ? Buffer.from(file.bytes.toString().replace(/url\((['"]?)(\/[^)'"\s]+)\1\)/g, (_, quote, url) => `url(${quote}${prefix}${url}${quote})`))
21
20
  : file.bytes;
22
21
  await writeFile(target, bytes);
22
+ files.set(prefix + path, bytes);
23
23
  paths.push(prefix + path);
24
24
  }
25
- const has = path => assets.some(file => file.path === path);
26
- return { paths, stylesheets: [prefix + '/rer-theme.css', ...(has('fonts/fonts.css') ? ['/fonts/fonts.css'] : []), ...(has('rer-theme.css') ? ['/rer-theme.css'] : [])] };
25
+ const stylesheets = [prefix + '/rer-theme.css', ...['/fonts/fonts.css', '/rer-theme.css'].filter(path => files.has(path))];
26
+ return { paths, css: inlineTheme(files, stylesheets) };
27
27
  }
@@ -1,3 +1,4 @@
1
+ import { iconHead } from './icon-head.mjs';
1
2
  import { rejectedResponse } from './rejected-response.mjs';
2
3
  import { constantEqual } from './crypto.mjs';
3
4
  import { escapeHtml, isLoopbackHost, localCookieName } from './http.mjs';
@@ -88,9 +89,9 @@ export function devGate({ key, origin, local }) {
88
89
  // The seed's declared branding (its product name and theme) brands the page; without it the page is unnamed.
89
90
  const brand = branding === undefined ? undefined : configureBranding(branding);
90
91
  const theme = brand?.theme;
91
- const body = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex, nofollow"><title>Opening the local app</title>${theme ? `<link rel="stylesheet" href="${escapeHtml(theme)}">` : ''}<style>${PAGE_STYLE}</style></head><body><main>${brand ? `<p class="brand"><span>${escapeHtml(brand.productName)}</span></p>` : ''}<h1>Opening the local app</h1><p>Open the RER_OPEN link that rer prints on this computer.</p></main>${theme ? `<script>${LOGO_SCRIPT}</script>` : ''}<script>${EXCHANGE_SCRIPT}</script></body></html>`;
92
+ const body = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex, nofollow"><title>Opening the local app</title>${iconHead}${theme ? `<link rel="stylesheet" href="${escapeHtml(theme)}">` : ''}<style>${PAGE_STYLE}</style></head><body><main>${brand ? `<p class="brand"><span>${escapeHtml(brand.productName)}</span></p>` : ''}<h1>Opening the local app</h1><p>Open the RER_OPEN link that rer prints on this computer.</p></main>${theme ? `<script>${LOGO_SCRIPT}</script>` : ''}<script>${EXCHANGE_SCRIPT}</script></body></html>`;
92
93
  return new Response(request.method === 'HEAD' ? null : body, { headers: { ...privateHeaders, 'content-type': 'text/html; charset=utf-8',
93
- 'content-security-policy': `default-src 'none'; script-src ${script}${theme ? ` ${logo}` : ''}; style-src ${theme ? "'self' " : ''}${style}${theme ? "; font-src 'self'; img-src 'self'" : ''}; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'` } });
94
+ 'content-security-policy': `default-src 'none'; img-src 'self'; script-src ${script}${theme ? ` ${logo}` : ''}; style-src ${theme ? "'self' " : ''}${style}${theme ? "; font-src 'self'" : ''}; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'` } });
94
95
  }
95
96
  if (request.method !== 'POST' || request.headers.get('sec-fetch-site') === 'cross-site' || !request.headers.get('content-type')?.startsWith('application/json')) return rejectedResponse(request, devNotFound());
96
97
  const text = await request.text();
@@ -0,0 +1 @@
1
+ export const iconHead: string;
@@ -0,0 +1,3 @@
1
+ // Replaced by seedIcons() when Vite builds the app or run site. Direct Node
2
+ // consumers have no declared public directory, so emit no speculative links.
3
+ export const iconHead = typeof __RER_ICON_HEAD__ === 'undefined' ? '' : __RER_ICON_HEAD__;
@@ -1,3 +1,4 @@
1
+ import { iconHead } from './icon-head.mjs';
1
2
  import { accentInk } from './branding.mjs';
2
3
  import { escapeHtml, securityHeaders } from './http.mjs';
3
4
 
@@ -23,11 +24,12 @@ export async function pageResponse({ branding, title, heading, content, status =
23
24
  const digest = new Uint8Array(await crypto.subtle.digest('SHA-256', new TextEncoder().encode(css)));
24
25
  const hash = btoa(String.fromCharCode(...digest));
25
26
  const product = escapeHtml(branding.productName);
26
- const html = `<!doctype html><html lang="en"${branding.theme ? ' class="rer-themed"' : ''}><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${title ?? heading}</title>${branding.theme ? `<link rel="stylesheet" href="${escapeHtml(branding.theme)}">` : ''}<style>${css}</style></head><body><main><p class="brand"><span class="mark" aria-hidden="true"></span><span data-rer-name>${product}</span></p><h1>${heading}</h1>${content}</main></body></html>`;
27
+ const html = `<!doctype html><html lang="en"${branding.theme ? ' class="rer-themed"' : ''}><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${title ?? heading}</title>${iconHead}${branding.theme ? `<link rel="stylesheet" href="${escapeHtml(branding.theme)}">` : ''}<style>${css}</style></head><body><main><p class="brand"><span class="mark" aria-hidden="true"></span><span data-rer-name>${product}</span></p><h1>${heading}</h1>${content}</main></body></html>`;
27
28
  const headers = { ...securityHeaders(), 'Content-Type': 'text/html; charset=utf-8' };
28
29
  // A form may post to this origin only, plus any origin its own redirect must reach (a provider's authorization endpoint).
29
30
  if (formTargets.length) headers['Content-Security-Policy'] = headers['Content-Security-Policy'].replace("form-action 'self'", `form-action 'self' ${formTargets.join(' ')}`);
30
31
  headers['Content-Security-Policy'] += branding.theme ? `; style-src 'self' 'sha256-${hash}'; font-src 'self'; img-src 'self'` : `; style-src 'sha256-${hash}'`;
32
+ if (iconHead && !branding.theme) headers['Content-Security-Policy'] += "; img-src 'self'";
31
33
  // Native form POSTs need their Origin; never disclose the path or query.
32
34
  if (referrer) headers['Referrer-Policy'] = referrer;
33
35
  return new Response(method === 'HEAD' ? null : html, { status, headers });
@@ -1,3 +1,4 @@
1
+ import { iconHead } from '../operator-auth/icon-head.mjs';
1
2
  import { escapeHtml, securityHeaders } from '../operator-auth/http.mjs';
2
3
  export function confirmationPage(config, head = false) {
3
4
  const nonce = btoa(crypto.randomUUID());
@@ -6,6 +7,6 @@ export function confirmationPage(config, head = false) {
6
7
  window.addEventListener('message',event=>{if(received||!source||event.source!==source||event.origin!==issuer||event.data?.type!=='rer-owner-claim'||typeof event.data.token!=='string'||event.data.token.length>8192)return;received=true;form.elements.token.value=event.data.token;form.querySelector('button').disabled=false;message.textContent='Ready to claim your workspace.';window.opener=null;});
7
8
  if(source)source.postMessage({type:'rer-owner-claim-ready'},issuer);else message.textContent='Open this confirmation from your installation in Run Edit Run.';`;
8
9
  const headers = { ...securityHeaders(), 'Content-Type': 'text/html; charset=utf-8', 'Referrer-Policy': 'strict-origin',
9
- 'Content-Security-Policy': `default-src 'none'; script-src 'nonce-${nonce}'; style-src 'nonce-${nonce}'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'` };
10
- return new Response(head ? null : `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Claim your workspace</title><style nonce="${nonce}">*{box-sizing:border-box}body{margin:0;font:16px/1.5 system-ui;background:#f5f7fb;color:#182130}main{max-width:32rem;margin:8vh auto;padding:2rem}label{display:block;margin:1rem 0 .3rem}input,button{width:100%;font:inherit;padding:.7rem;border:1px solid #687385;border-radius:.4rem}button{margin-top:1.5rem;background:#183dad;color:white}button:disabled{background:#566274}h1{font-size:2rem;line-height:1.2}p{overflow-wrap:anywhere}</style></head><body><main><h1>Claim your workspace</h1><p>Confirm to create your owner account and sign in.</p><form method="post" action="/auth/owner-claim"><label for="email">Owner email</label><input id="email" type="email" value="${escapeHtml(config.expectedEmail)}" readonly><label for="name">Your name</label><input id="name" name="displayName" autocomplete="name" maxlength="100" value="Owner" required><input type="hidden" name="token"><button disabled>Claim your workspace</button></form><p role="status">Waiting for your secure claim.</p></main><script nonce="${nonce}">${script}</script></body></html>`, { headers });
10
+ 'Content-Security-Policy': `default-src 'none'; img-src 'self'; script-src 'nonce-${nonce}'; style-src 'nonce-${nonce}'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'` };
11
+ return new Response(head ? null : `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Claim your workspace</title>${iconHead}<style nonce="${nonce}">*{box-sizing:border-box}body{margin:0;font:16px/1.5 system-ui;background:#f5f7fb;color:#182130}main{max-width:32rem;margin:8vh auto;padding:2rem}label{display:block;margin:1rem 0 .3rem}input,button{width:100%;font:inherit;padding:.7rem;border:1px solid #687385;border-radius:.4rem}button{margin-top:1.5rem;background:#183dad;color:white}button:disabled{background:#566274}h1{font-size:2rem;line-height:1.2}p{overflow-wrap:anywhere}</style></head><body><main><h1>Claim your workspace</h1><p>Confirm to create your owner account and sign in.</p><form method="post" action="/auth/owner-claim"><label for="email">Owner email</label><input id="email" type="email" value="${escapeHtml(config.expectedEmail)}" readonly><label for="name">Your name</label><input id="name" name="displayName" autocomplete="name" maxlength="100" value="Owner" required><input type="hidden" name="token"><button disabled>Claim your workspace</button></form><p role="status">Waiting for your secure claim.</p></main><script nonce="${nonce}">${script}</script></body></html>`, { headers });
11
12
  }
@@ -0,0 +1,8 @@
1
+ export function readIconFiles(publicDirectory: string): Promise<{
2
+ links: string;
3
+ files: Map<string, { bytes: Uint8Array; type: string }>;
4
+ }>;
5
+ export function seedIcons(): {
6
+ name: string;
7
+ config(config: { root?: string; publicDir?: string | false }): Promise<{ define: Record<string, string> }>;
8
+ };
@@ -0,0 +1,49 @@
1
+ import { lstat, readFile } from 'node:fs/promises';
2
+ import { join, resolve } from 'node:path';
3
+
4
+ // Prefer the seed's small artwork, including the names shipped under brand/.
5
+ const small = ['favicon-32.svg', 'favicon.svg', 'icon.svg', 'favicon-32.png', 'favicon-32x32.png', 'favicon.png', 'icon-32.png', 'icon.png'];
6
+ const candidates = ['favicon.ico', 'brand/favicon.ico', ...small.flatMap(name => [name, `brand/${name}`]), 'apple-touch-icon.png', 'brand/apple-touch-icon.png', 'brand/mark.svg'];
7
+ const type = path => path.endsWith('.svg') ? 'image/svg+xml' : path.endsWith('.ico') ? 'image/x-icon' : 'image/png';
8
+
9
+ /** Read once at build/installer start. Missing files never become browser probes. */
10
+ export async function readIconFiles(publicDirectory) {
11
+ const files = new Map();
12
+ for (const path of candidates) {
13
+ try {
14
+ // Do not export links outside public/ through a symbolic directory or file.
15
+ const directory = await lstat(publicDirectory);
16
+ if (!directory.isDirectory() || directory.isSymbolicLink()) throw Error('The public icon directory must be a regular directory.');
17
+ if (path.startsWith('brand/')) {
18
+ const brand = await lstat(join(publicDirectory, 'brand'));
19
+ if (!brand.isDirectory() || brand.isSymbolicLink()) throw Error('The brand icon directory must be a regular directory.');
20
+ }
21
+ const stat = await lstat(join(publicDirectory, path));
22
+ if (!stat.isFile() || stat.isSymbolicLink()) throw Error(`Icon ${path} must be a regular file.`);
23
+ const bytes = await readFile(join(publicDirectory, path));
24
+ if (path.endsWith('.png') && !path.includes('apple-touch-icon')) {
25
+ if (bytes.length < 24 || bytes.subarray(0, 8).toString('hex') !== '89504e470d0a1a0a' || bytes.readUInt32BE(16) !== 32 || bytes.readUInt32BE(20) !== 32) continue;
26
+ }
27
+ files.set('/' + path, { bytes, type: type(path) });
28
+ } catch (error) { if (error.code !== 'ENOENT') throw error; }
29
+ }
30
+ const ico = ['favicon.ico', 'brand/favicon.ico'].find(path => files.has('/' + path));
31
+ const favicon = small.flatMap(name => [name, `brand/${name}`]).find(path => files.has('/' + path));
32
+ const apple = ['apple-touch-icon.png', 'brand/apple-touch-icon.png'].find(path => files.has('/' + path));
33
+ const selected = [ico, favicon, apple].filter(Boolean);
34
+ if (!selected.length && files.has('/brand/mark.svg')) selected.push('brand/mark.svg');
35
+ const links = selected.map(path => `<link rel="${path.includes('apple-touch-icon') ? 'apple-touch-icon' : 'icon'}" href="/${path}"${path.includes('apple-touch-icon') ? '' : ` type="${type(path)}" sizes="${path.endsWith('.png') ? '32x32' : 'any'}"`}>`).join('');
36
+ return { links, files: new Map(selected.map(path => ['/' + path, files.get('/' + path)])) };
37
+ }
38
+
39
+ /** Freeze the existing public icons into every shared server-rendered head. */
40
+ export function seedIcons() {
41
+ return {
42
+ name: 'rer:seed-icons',
43
+ async config(config) {
44
+ const publicDirectory = config.publicDir === false ? null : resolve(config.root ?? process.cwd(), config.publicDir ?? 'public');
45
+ const icons = publicDirectory ? await readIconFiles(publicDirectory) : { links: '' };
46
+ return { define: { __RER_ICON_HEAD__: JSON.stringify(icons.links) } };
47
+ },
48
+ };
49
+ }
@@ -1,3 +1,4 @@
1
+ import { readIconFiles } from './icon-files.mjs';
1
2
  import { loadInstallerSeed } from './setup-manifest.mjs';
2
3
  import { readSettings } from './adapter-settings.mjs';
3
4
  import { createAppProcesses } from './app-processes.mjs';
@@ -27,6 +28,7 @@ export async function startInstaller(root,{seed,port=0,answers,secretInput,noPre
27
28
  const accent=seed.branding?.accent;
28
29
  const accentStyle=/^#[0-9a-f]{6}$/i.test(accent||'')?`<style>:root{--installer-accent:${accent};--installer-accent-text:${[1,3,5].map((start,i)=>parseInt(accent.slice(start,start+2),16)*[.299,.587,.114][i]).reduce((a,b)=>a+b,0)>150?'#173753':'#ffffff'}}</style>`:'';
29
30
  const theme=seed.theme?await loadSeedTheme(root,seed.theme):null;
31
+ const icons=await readIconFiles(join(root,'public'));
30
32
  const uiRoot=fileURLToPath(new URL('./ui/',import.meta.url));
31
33
  if(resume&&noPrefill)throw Error('--resume cannot be combined with --no-prefill.');
32
34
  const store=await createState(root,seed),token=randomBytes(32).toString('hex'),cookie=randomBytes(32).toString('hex');let origin,work,connection,starting=false,mutations=0;const apps=createAppProcesses();const abort=new AbortController();let attemptAbort,attemptProcesses;
@@ -175,11 +177,13 @@ export async function startInstaller(root,{seed,port=0,answers,secretInput,noPre
175
177
  if(req.method==='GET'&&path==='/rer-setup.json'){res.writeHead(200,{'Content-Type':'application/json'});res.end(seed.manifestBytes);return;}
176
178
  if(req.method==='GET'&&path==='/SETUP.schema.json'){res.writeHead(200,{'Content-Type':'application/json'});res.end(seed.schemaBytes);return;}
177
179
  if(req.method==='GET'&&path==='/model-options.json'){json(200,seed.modelOptions);return;}
180
+ const iconFile=req.method==='GET'&&icons.files.get(path);
181
+ if(iconFile){res.writeHead(200,{'Content-Type':iconFile.type});res.end(iconFile.bytes);return;}
178
182
  const themeFile=req.method==='GET'&&theme?.files.get(path);
179
183
  if(themeFile){res.writeHead(200,{'Content-Type':themeFile.type});res.end(themeFile.bytes);return;}
180
184
  if(req.method!=='GET'||!assets[path]||(path==='/theme.css'&&!theme))return json(404,{error:'Not found.'});
181
185
  const [file,type]=assets[path];let content=await readFile(file?(path==='/seed.mjs'?join(root,file):join(uiRoot,file)):join(root,seed.background));
182
- if(path==='/'){content=content.toString().replaceAll('{{product}}',String(seed.product).replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]))).replace('</head>',`${accentStyle}<meta name="installer-token" content="${token}"></head>`);if(theme)content=content.replace('<html lang="en">','<html lang="en" class="rer-themed">').replace('<link rel="stylesheet" href="/style.css">','<link rel="stylesheet" href="/style.css"><link rel="stylesheet" href="/rer-theme.css"><link rel="stylesheet" href="/theme.css">');res.setHeader('Set-Cookie',`rer_installer=${cookie}; Path=/; HttpOnly; SameSite=Strict`);res.setHeader('Content-Security-Policy',"default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self'; frame-ancestors 'none'; base-uri 'none'")}
186
+ if(path==='/'){content=content.toString().replaceAll('{{product}}',String(seed.product).replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]))).replace('</head>',`${icons.links}${accentStyle}<meta name="installer-token" content="${token}"></head>`);if(theme)content=content.replace('<html lang="en">','<html lang="en" class="rer-themed">').replace('<link rel="stylesheet" href="/style.css">','<link rel="stylesheet" href="/style.css"><link rel="stylesheet" href="/rer-theme.css"><link rel="stylesheet" href="/theme.css">');res.setHeader('Set-Cookie',`rer_installer=${cookie}; Path=/; HttpOnly; SameSite=Strict`);res.setHeader('Content-Security-Policy',"default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self'; frame-ancestors 'none'; base-uri 'none'")}
183
187
  res.writeHead(200,{'Content-Type':type});res.end(content);
184
188
  }catch{json(500,{error:'The installer could not complete this request.'})}finally{if(mutation)mutations--;}
185
189
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runeditrun/rer",
3
- "version": "0.2.60",
3
+ "version": "0.2.62",
4
4
  "description": "The rer command: install, set up, run and launch Run Edit Run checkouts.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,6 +42,10 @@
42
42
  "./production-runtime": "./onboarding/production-runtime.mjs",
43
43
  "./production-modules": "./onboarding/production-modules.mjs",
44
44
  "./queued-entry": "./onboarding/queued-entry.mjs",
45
+ "./seed-icons": {
46
+ "types": "./onboarding/icon-files.d.mts",
47
+ "default": "./onboarding/icon-files.mjs"
48
+ },
45
49
  "./archive-output": {
46
50
  "types": "./onboarding/archive-output.d.mts",
47
51
  "default": "./onboarding/archive-output.mjs"