cornfield 0.47.0 → 0.48.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.
- package/core/contrast.js +6 -6
- package/explorer/css/account.css +46 -0
- package/explorer/css/base.css +159 -0
- package/explorer/css/changes.css +160 -0
- package/explorer/css/decision.css +68 -0
- package/explorer/css/dialogs.css +50 -0
- package/explorer/css/header.css +75 -0
- package/explorer/css/layers.css +92 -0
- package/explorer/css/live.css +48 -0
- package/explorer/css/map.css +43 -0
- package/explorer/css/node-panel.css +188 -0
- package/explorer/css/page.css +83 -0
- package/explorer/css/proposal.css +151 -0
- package/explorer/css/search.css +84 -0
- package/explorer/css/sheets.css +134 -0
- package/explorer/css/whatif.css +55 -0
- package/explorer/css/work.css +288 -0
- package/explorer/engine/map-style.js +2 -2
- package/explorer/focus-room.js +1 -1
- package/explorer/header-fit.js +3 -3
- package/explorer/house.css +1 -1
- package/explorer/index.html +18 -3
- package/explorer/pieces/map-stage.css +1 -1
- package/explorer/review.js +1 -1
- package/explorer/theme-model.js +1 -1
- package/explorer/theme.js +1 -1
- package/explorer/tokens.css +2 -2
- package/package.json +1 -1
- package/server/components.js +144 -0
- package/server/embed.js +3 -1
- package/server/server.js +9 -1
- package/explorer/explorer.css +0 -1512
package/server/embed.js
CHANGED
|
@@ -36,7 +36,7 @@ const SLUG = '[^/]+';
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* The routes a listed origin may reach, and nothing else. `session`: behind the sign-in guard, so the credentialed form of CORS; `open`:
|
|
39
|
-
* answered before it (the look of the sign-in pages: theme.css, a named theme, and the images and fonts a theme names).
|
|
39
|
+
* answered before it (the look of the sign-in pages: theme.css, a named theme, and the images and fonts a theme names; and the web components, which a browser loads without the cookie).
|
|
40
40
|
* `methods` are what a preflight may ask for; `headers` are the request headers it may list (lowercase).
|
|
41
41
|
* @type {readonly Route[]}
|
|
42
42
|
*/
|
|
@@ -58,6 +58,8 @@ export const ROUTES = Object.freeze([
|
|
|
58
58
|
{ test: '/cornfield/theme.css', kind: 'open', methods: READ, headers: [] },
|
|
59
59
|
{ test: /^\/cornfield\/theme\/[^/]+\.css$/, kind: 'open', methods: READ, headers: [] },
|
|
60
60
|
{ test: /^\/cornfield\/theme\/assets\/.+$/, kind: 'open', methods: READ, headers: [] },
|
|
61
|
+
// The web components (server/components.js): a host loads them as module scripts, which a browser fetches with CORS and without the cookie
|
|
62
|
+
{ test: /^\/cornfield\/components\/.+$/, kind: 'open', methods: READ, headers: [] },
|
|
61
63
|
]);
|
|
62
64
|
|
|
63
65
|
/**
|
package/server/server.js
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
* GET /cornfield/theme.css, /cornfield/theme/<name>.css
|
|
20
20
|
* the stylesheets the config's `theme` names (css, names): those files only, as text/css
|
|
21
21
|
* GET /cornfield/theme/assets/<path> an image or font beside the theme files (png, svg, webp, gif, avif, woff2, woff; 1 MB each)
|
|
22
|
+
* GET /cornfield/components/<file> the built web components (components/dist, listed by its manifest.json), open without a session; a plain 404
|
|
23
|
+
* that says how to build them when this checkout has none (server/components.js)
|
|
22
24
|
* GET /cornfield/brand/<key>.<ext> a brand image the config's `brand` names (logo, wordmark, favicon; svg or png, 512 KB each): those files only
|
|
23
25
|
* GET /manifest.webmanifest the web app manifest: the repo's title, or built from `brand` when the config sets one
|
|
24
26
|
* GET /api/forge/… issues, pull requests, their files and checks, release notes: read from the forge (server/forge-routes.js)
|
|
@@ -75,6 +77,7 @@ import { createAuth, signInSettings } from './auth.js';
|
|
|
75
77
|
import { createHooks, hooksSettings } from './hooks.js';
|
|
76
78
|
import { createLander } from './lander.js';
|
|
77
79
|
import { createEmbed } from './embed.js';
|
|
80
|
+
import { COMPONENTS_PREFIX, createComponents } from './components.js';
|
|
78
81
|
import { createSpecPoll } from './spec-poll.js';
|
|
79
82
|
import { createRunnerWatch, runnerPresence } from './runner-presence.js';
|
|
80
83
|
import { createTriggers } from './triggers.js';
|
|
@@ -280,7 +283,7 @@ export const HA_CACHE_MS = 30_000;
|
|
|
280
283
|
/**
|
|
281
284
|
* The server for one repo. It does not listen: `listen(config)` does, where server/bind.js allows.
|
|
282
285
|
* @param {object} config a loaded config (core/config.js `loadConfig`)
|
|
283
|
-
* @param {Parameters<typeof createAuth>[1] & { homeAssistant?: object, hookFetch?: typeof fetch, hookTimer?: { setTimeout: Function, clearTimeout: Function }, landTimer?: { setTimeout: Function, clearTimeout: Function }, specPollTimer?: { setTimeout: Function, clearTimeout: Function } }} [opts] what sign-in reads (`env`, and tests' fakes;
|
|
286
|
+
* @param {Parameters<typeof createAuth>[1] & { componentsDir?: string, homeAssistant?: object, hookFetch?: typeof fetch, hookTimer?: { setTimeout: Function, clearTimeout: Function }, landTimer?: { setTimeout: Function, clearTimeout: Function }, specPollTimer?: { setTimeout: Function, clearTimeout: Function } }} [opts] what sign-in reads (`env`, and tests' fakes;
|
|
284
287
|
* see server/auth.js); the Home Assistant URL and token are read from the same `env`, and `homeAssistant` is what
|
|
285
288
|
* `homeAssistantHouse` is handed besides them (the tests' fake WebSocket); `hookFetch` and `hookTimer` are the
|
|
286
289
|
* tests' fake network and clock for the event hooks (server/hooks.js); `landTimer` is the clock of landing on approval (server/lander.js); `specPollTimer` is the clock of the `spec.ready` poll (server/spec-poll.js)
|
|
@@ -313,6 +316,8 @@ export function createCornfieldServer(config, opts = {}) {
|
|
|
313
316
|
const publicOrigin = config.publicUrl ? new URL(config.publicUrl).origin : null;
|
|
314
317
|
// The sibling origins that may read and decide a review as the signed-in maintainer (server/embed.js): none unless `embed.origins` lists some
|
|
315
318
|
const embed = createEmbed(config.embed?.origins ?? []);
|
|
319
|
+
// The web components, when built (components/dist; the image builds them, a checkout does not): served at /cornfield/components/, open (server/components.js)
|
|
320
|
+
const components = createComponents({ dir: opts.componentsDir ?? path.join(CORNFIELD_DIR, 'components', 'dist') });
|
|
316
321
|
const where = { root, proposals: config.proposals, worktrees: config.worktrees, worktreeMaxAgeDays: config.worktreeMaxAgeDays, topology: config.topology, dataDir: config.dataDir, publicHost, publicOrigin, embedOrigins: embed.origins };
|
|
317
322
|
const fixtureCache = new Map();
|
|
318
323
|
// What the line above Approve says an approval does besides posting (spec 0007 D1, server/decision.js): landing, and the run a trigger asks for
|
|
@@ -463,6 +468,9 @@ export function createCornfieldServer(config, opts = {}) {
|
|
|
463
468
|
const runner = runnerRoute(reqPath);
|
|
464
469
|
if (runner && !(reqPath === REQUESTS_PATH && req.method !== 'GET' && req.method !== 'HEAD')) return serveRunnerCall(req, res, runner, url, { config, auth, runs, now: opts.now });
|
|
465
470
|
if (reqPath === REQUESTS_PATH) return serveAgentCall(req, res, { config, auth, runs, now: opts.now });
|
|
471
|
+
// The web components answer without a session: a browser fetches a module script from another origin without the cookie, and holds nothing secret
|
|
472
|
+
// (it is the published package). The CORS headers for a listed origin are already on the answer; a write to this prefix goes on to the guard as before
|
|
473
|
+
if ((req.method === 'GET' || req.method === 'HEAD') && reqPath.startsWith(COMPONENTS_PREFIX)) return components.serve(req, res, reqPath);
|
|
466
474
|
// The look of the sign-in pages (cornfield's tokens and its sign-in stylesheet, the repo's theme, fonts and brand images) answers without a
|
|
467
475
|
// session: a visitor sees the brand before they are in. Presentation files only, never data (docs/sign-in.md, "What answers without a session")
|
|
468
476
|
if (auth.enabled && (req.method === 'GET' || req.method === 'HEAD')) {
|