shapewall 0.0.0-stage → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +139 -0
- package/Dockerfile.agent +45 -0
- package/LICENSE +202 -0
- package/NOTICE +12 -0
- package/README.md +651 -2
- package/THIRD_PARTY.md +165 -0
- package/bin/shapewall.js +29 -0
- package/dist/agent/package-lock.json +8384 -0
- package/dist/client/assets/BoardChat-D5SFd8HE.js +28 -0
- package/dist/client/assets/BuzzDialog-HWXBy52W.js +1 -0
- package/dist/client/assets/ChecksPanel-DTdImWoD.js +1 -0
- package/dist/client/assets/History-CEv6b-av.js +1 -0
- package/dist/client/assets/LocalSettings-C4vriEVQ.js +1 -0
- package/dist/client/assets/Management-DCfhcEUY.js +1 -0
- package/dist/client/assets/QuickConnect-DQGgUsl1.js +1 -0
- package/dist/client/assets/ShareDialog-C_plIto0.js +2 -0
- package/dist/client/assets/app-update-dialog-2hPz_N9G.js +1 -0
- package/dist/client/assets/circle-x-BZMPi8Zf.js +1 -0
- package/dist/client/assets/index-ByQRKVit.css +2 -0
- package/dist/client/assets/index-DweQ8Qtu.js +29 -0
- package/dist/client/assets/refresh-cw-CRow0Nbq.js +1 -0
- package/dist/client/assets/runtime-Bft6x_6E.js +4 -0
- package/dist/client/assets/square-A8EnIYLR.js +1 -0
- package/dist/client/assets/tts-dist-DYlBQmwG.js +18 -0
- package/dist/client/assets/tts-en-g2p-BPUtBFGG.js +1 -0
- package/dist/client/assets/tts-ort-wasm-simd-threaded-qh98TCA_.wasm +0 -0
- package/dist/client/assets/tts-ort.wasm.bundle.min-rEkcs_ow.js +12 -0
- package/dist/client/assets/tts-rolldown-runtime-D8NudN84.js +1 -0
- package/dist/client/assets/tts-spacy-en-tokenizer-6SNMl--A.json +1 -0
- package/dist/client/assets/tts-tts.worker-Bzm6aWbv.js +1 -0
- package/dist/client/assets/tts-us_gold-DcjeNMH1.json +92589 -0
- package/dist/client/assets/tts-us_silver-C964mEB5.json +93363 -0
- package/dist/client/assets/ui-CLbws0rx.js +41 -0
- package/dist/client/build-info.json +1 -0
- package/dist/client/favicon.svg +7 -0
- package/dist/client/icons/apple-touch-icon.png +0 -0
- package/dist/client/icons/icon-192.png +0 -0
- package/dist/client/icons/icon-512.png +0 -0
- package/dist/client/icons/maskable-512.png +0 -0
- package/dist/client/index.html +25 -0
- package/dist/client/manifest.webmanifest +15 -0
- package/dist/client/sw.js +53 -0
- package/dist/client/theme-boot.js +27 -0
- package/dist/console/assets/LocalAccountsApp-BQCcmj3x.js +1 -0
- package/dist/console/assets/LocalConsole-Bb2FUDs7.js +1 -0
- package/dist/console/assets/app-update-dialog-DIeYepLZ.js +1 -0
- package/dist/console/assets/console-C7uJLLOn.js +51 -0
- package/dist/console/assets/console-R8IBY3Am.css +2 -0
- package/dist/console/build-info.json +1 -0
- package/dist/console/console.html +21 -0
- package/dist/console/favicon.svg +7 -0
- package/dist/console/icons/apple-touch-icon.png +0 -0
- package/dist/console/icons/icon-192.png +0 -0
- package/dist/console/icons/icon-512.png +0 -0
- package/dist/console/icons/maskable-512.png +0 -0
- package/dist/console/manifest.webmanifest +15 -0
- package/dist/console/theme-boot.js +27 -0
- package/docs/agent-hardening.md +342 -0
- package/docs/agent-recipes.md +187 -0
- package/docs/agent-workflow.md +320 -0
- package/docs/agents.md +894 -0
- package/docs/architecture.md +242 -0
- package/docs/buzz.md +140 -0
- package/docs/capture-warnings.md +57 -0
- package/docs/config.md +489 -0
- package/docs/deployment.md +289 -0
- package/docs/design-system.md +162 -0
- package/docs/github.md +107 -0
- package/docs/hosted.md +764 -0
- package/docs/images/board-overview.png +0 -0
- package/docs/images/journeys.png +0 -0
- package/docs/images/live-comment.png +0 -0
- package/docs/images/phone-comment.png +0 -0
- package/docs/images/phone-overview.png +0 -0
- package/docs/images/variant.png +0 -0
- package/docs/interaction-audits.md +40 -0
- package/docs/journeys.md +137 -0
- package/docs/local-accounts.md +80 -0
- package/docs/notifications.md +237 -0
- package/docs/page-checks.md +69 -0
- package/docs/performance.md +174 -0
- package/docs/starter-agent.md +325 -0
- package/docs/updates.md +87 -0
- package/examples/audits/interaction.audit.json +17 -0
- package/package.json +132 -4
- package/src/accounts/avatar.js +121 -0
- package/src/accounts/local.js +464 -0
- package/src/agent/acp/command.js +204 -0
- package/src/agent/acp/detect.js +75 -0
- package/src/agent/acp/sandbox.js +160 -0
- package/src/agent/agent-health.js +75 -0
- package/src/agent/backends/acp.js +1297 -0
- package/src/agent/backends/index.js +61 -0
- package/src/agent/backends/openai.js +308 -0
- package/src/agent/composer.js +221 -0
- package/src/agent/config.js +338 -0
- package/src/agent/context.js +191 -0
- package/src/agent/control.js +122 -0
- package/src/agent/errors.js +17 -0
- package/src/agent/feedback-loop.js +137 -0
- package/src/agent/manage.js +94 -0
- package/src/agent/next-steps.js +51 -0
- package/src/agent/owner-mcp.js +38 -0
- package/src/agent/plain-text.js +52 -0
- package/src/agent/ratings-core.js +213 -0
- package/src/agent/ratings.js +100 -0
- package/src/agent/reply-text.js +67 -0
- package/src/agent/routes.js +1065 -0
- package/src/agent/run.js +326 -0
- package/src/agent/settings-routes.js +704 -0
- package/src/agent/showable.js +23 -0
- package/src/agent/starter/approvals.js +181 -0
- package/src/agent/starter/build-image.js +90 -0
- package/src/agent/starter/cli.js +163 -0
- package/src/agent/starter/disk.js +53 -0
- package/src/agent/starter/doctor.js +180 -0
- package/src/agent/starter/egress-proxy.js +351 -0
- package/src/agent/starter/gate.js +90 -0
- package/src/agent/starter/loop.js +114 -0
- package/src/agent/starter/model-relay.js +289 -0
- package/src/agent/starter/pause.js +14 -0
- package/src/agent/starter/probe.js +272 -0
- package/src/agent/starter/prompt.js +41 -0
- package/src/agent/starter/push-guard.js +146 -0
- package/src/agent/starter/rpc.js +164 -0
- package/src/agent/starter/runtime.js +287 -0
- package/src/agent/starter/sandbox-main.js +121 -0
- package/src/agent/starter/settings.js +290 -0
- package/src/agent/starter/source.js +69 -0
- package/src/agent/starter/supervisor.js +755 -0
- package/src/agent/starter/sweep.js +46 -0
- package/src/agent/starter/tools.js +524 -0
- package/src/agent/starter/watch.js +84 -0
- package/src/agent/starter/worktree.js +409 -0
- package/src/agent/text-diff.js +210 -0
- package/src/agent/thread-history.js +223 -0
- package/src/agent/threads.js +399 -0
- package/src/agent/tools.js +200 -0
- package/src/agent/turn-changes.js +424 -0
- package/src/agent/undo-state.js +26 -0
- package/src/agent/user-settings.js +308 -0
- package/src/auth/record.js +375 -0
- package/src/broken-links.js +164 -0
- package/src/buzz/client.js +75 -0
- package/src/buzz/config.js +151 -0
- package/src/buzz/environment.js +13 -0
- package/src/buzz/gateway.js +192 -0
- package/src/buzz/routes.js +61 -0
- package/src/buzz/signer-child.js +205 -0
- package/src/buzz/store.js +89 -0
- package/src/buzz/transport.js +60 -0
- package/src/buzz/verify.js +140 -0
- package/src/capture/actions.js +159 -0
- package/src/capture/capture.js +776 -0
- package/src/capture/dom-names.js +189 -0
- package/src/capture/element-map.js +509 -0
- package/src/capture/live.js +827 -0
- package/src/capture/media-scheme.js +317 -0
- package/src/capture/network-summary.js +86 -0
- package/src/capture/pacing.js +34 -0
- package/src/capture/requests.js +167 -0
- package/src/capture/sanitize.js +752 -0
- package/src/checks/accessibility.js +134 -0
- package/src/checks/budgets.js +58 -0
- package/src/checks/cli.js +55 -0
- package/src/checks/comparison.js +113 -0
- package/src/checks/environments.js +32 -0
- package/src/checks/flow-config.js +82 -0
- package/src/checks/flow-origin.js +53 -0
- package/src/checks/flows.js +398 -0
- package/src/checks/lighthouse-auth.js +145 -0
- package/src/checks/lighthouse-findings.js +130 -0
- package/src/checks/lighthouse.js +395 -0
- package/src/checks/robots.js +85 -0
- package/src/checks/routes.js +52 -0
- package/src/checks/run-control.js +259 -0
- package/src/checks/runner.js +724 -0
- package/src/checks/schema.js +133 -0
- package/src/checks/seo-analysis.js +443 -0
- package/src/checks/seo-probe.js +190 -0
- package/src/checks/seo-snapshot.js +99 -0
- package/src/checks/store.js +214 -0
- package/src/checks/transport.js +47 -0
- package/src/cli/args.js +319 -0
- package/src/cli/capture.js +79 -0
- package/src/cli/commands.js +92 -0
- package/src/cli/comments.js +84 -0
- package/src/cli/help.js +243 -0
- package/src/cli/init.js +214 -0
- package/src/cli/misc.js +64 -0
- package/src/cli/notify.js +87 -0
- package/src/cli/open.js +22 -0
- package/src/cli/serve.js +274 -0
- package/src/cli/variant.js +82 -0
- package/src/cli/watch.js +70 -0
- package/src/cli.js +130 -0
- package/src/comment-fields.js +76 -0
- package/src/comments-cli.js +208 -0
- package/src/config-reload.js +100 -0
- package/src/config.js +1061 -0
- package/src/devices-cli.js +21 -0
- package/src/diff.js +95 -0
- package/src/discover.js +284 -0
- package/src/doctor.js +295 -0
- package/src/event-log.js +268 -0
- package/src/events-cli.js +102 -0
- package/src/events.js +113 -0
- package/src/export.js +119 -0
- package/src/feedback.js +246 -0
- package/src/github.js +551 -0
- package/src/hosted/LICENSE.md +105 -0
- package/src/hosted/access-cli.js +78 -0
- package/src/hosted/admin.js +682 -0
- package/src/hosted/agent-approvals.js +163 -0
- package/src/hosted/agent-policy.js +189 -0
- package/src/hosted/app.js +510 -0
- package/src/hosted/auth-routes.js +540 -0
- package/src/hosted/auth.js +536 -0
- package/src/hosted/backup.js +483 -0
- package/src/hosted/board-context.js +35 -0
- package/src/hosted/board-routes.js +486 -0
- package/src/hosted/board-view.js +94 -0
- package/src/hosted/clean-worker.js +24 -0
- package/src/hosted/cleaner.js +89 -0
- package/src/hosted/comments.js +355 -0
- package/src/hosted/console-routes.js +401 -0
- package/src/hosted/cookies.js +18 -0
- package/src/hosted/crypto.js +80 -0
- package/src/hosted/db.js +496 -0
- package/src/hosted/device-routes.js +175 -0
- package/src/hosted/device.js +233 -0
- package/src/hosted/events.js +63 -0
- package/src/hosted/guards.js +172 -0
- package/src/hosted/guest-view.js +65 -0
- package/src/hosted/http.js +39 -0
- package/src/hosted/import.js +300 -0
- package/src/hosted/mail.js +73 -0
- package/src/hosted/mcp-http.js +71 -0
- package/src/hosted/membership.js +114 -0
- package/src/hosted/operator.js +478 -0
- package/src/hosted/ops-cli.js +345 -0
- package/src/hosted/pages.js +146 -0
- package/src/hosted/permissions.js +113 -0
- package/src/hosted/presence.js +372 -0
- package/src/hosted/projects.js +124 -0
- package/src/hosted/public.js +109 -0
- package/src/hosted/push.js +622 -0
- package/src/hosted/quotas.js +115 -0
- package/src/hosted/ratelimit.js +96 -0
- package/src/hosted/rebind.js +316 -0
- package/src/hosted/retention.js +128 -0
- package/src/hosted/server.js +260 -0
- package/src/hosted/setup-link.js +64 -0
- package/src/hosted/setup.js +323 -0
- package/src/hosted/shares.js +444 -0
- package/src/hosted/tailscale.js +204 -0
- package/src/hosted/tenancy.js +301 -0
- package/src/hosted/token-api.js +455 -0
- package/src/hosted/token-events.js +60 -0
- package/src/hosted/tokens.js +57 -0
- package/src/hosted/turnstile.js +49 -0
- package/src/hosted/usercontent.js +154 -0
- package/src/hosted/zip.js +155 -0
- package/src/invocation.js +58 -0
- package/src/journey-paths.js +282 -0
- package/src/journeys.js +189 -0
- package/src/links.js +106 -0
- package/src/local-projects.js +182 -0
- package/src/lock.js +193 -0
- package/src/mcp.js +417 -0
- package/src/mentions.js +151 -0
- package/src/net.js +15 -0
- package/src/notify/config.js +275 -0
- package/src/notify/index.js +301 -0
- package/src/notify/lease.js +73 -0
- package/src/notify/messages.js +212 -0
- package/src/notify/run.js +174 -0
- package/src/pixeldiff.js +49 -0
- package/src/png.js +143 -0
- package/src/reactions.js +111 -0
- package/src/remote/cli.js +133 -0
- package/src/remote/credentials.js +62 -0
- package/src/remote/ids.js +12 -0
- package/src/remote/login.js +155 -0
- package/src/remote/remote-mcp.js +237 -0
- package/src/remote/remote-watch.js +291 -0
- package/src/remote/remote.js +313 -0
- package/src/remote/share-state.js +78 -0
- package/src/remote/share.js +369 -0
- package/src/remote/terminal.js +13 -0
- package/src/serve-state.js +64 -0
- package/src/server/app.js +824 -0
- package/src/server/devices.js +186 -0
- package/src/server/local-console.js +28 -0
- package/src/server/local-user.js +59 -0
- package/src/server/pairing-routes.js +159 -0
- package/src/server/share-routes.js +89 -0
- package/src/server/tailscale.js +97 -0
- package/src/sitemap.js +431 -0
- package/src/store.js +983 -0
- package/src/tokens.js +11 -0
- package/src/update/routes.js +245 -0
- package/src/watch.js +403 -0
- package/src/which.js +58 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
// Explicit local or CI navigation audits. No server route imports this module,
|
|
2
|
+
// and screenshots never call it. Only bounded reports leave the runner.
|
|
3
|
+
import fs from 'node:fs'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import { randomUUID } from 'node:crypto'
|
|
6
|
+
import { createRequire } from 'node:module'
|
|
7
|
+
import { authFor, boardViewports, getBoard, getEnvironment, joinUrl, viewportDevice } from '../config.js'
|
|
8
|
+
import { entryVersion, readManifest } from '../store.js'
|
|
9
|
+
import { resolveStorageState } from '../capture/capture.js'
|
|
10
|
+
import { fingerprint, reportId, validateReport } from './schema.js'
|
|
11
|
+
import { applyBudgets } from './budgets.js'
|
|
12
|
+
import { saveReport, targetFingerprint } from './store.js'
|
|
13
|
+
import {
|
|
14
|
+
AuditTargetError,
|
|
15
|
+
applyStorageState,
|
|
16
|
+
assertSupportedActions,
|
|
17
|
+
runConfiguredActions,
|
|
18
|
+
translateStorageState,
|
|
19
|
+
verifyTarget,
|
|
20
|
+
} from './lighthouse-auth.js'
|
|
21
|
+
import { finiteMetric, lighthouseFindings, lighthouseMetrics } from './lighthouse-findings.js'
|
|
22
|
+
|
|
23
|
+
export const LIGHTHOUSE_VERSION = '13.6.0'
|
|
24
|
+
export const AUDIT_LIMITS = Object.freeze({ pages: 20, runs: 40, samples: 10, timeoutMs: 120000 })
|
|
25
|
+
const require = createRequire(import.meta.url)
|
|
26
|
+
const number = (value, fallback, max, name) => {
|
|
27
|
+
const n = value === undefined ? fallback : Number(value)
|
|
28
|
+
if (typeof value === 'boolean' || !Number.isInteger(n) || n < 1 || n > max)
|
|
29
|
+
throw new Error(`${name} must be a whole number from 1 to ${max}.`)
|
|
30
|
+
return n
|
|
31
|
+
}
|
|
32
|
+
const list = (value) =>
|
|
33
|
+
value == null ? null : [...new Set((Array.isArray(value) ? value : String(value).split(',')).map((id) => id.trim()).filter(Boolean))]
|
|
34
|
+
|
|
35
|
+
export function auditPlan(config, options = {}) {
|
|
36
|
+
const board = getBoard(config, options.boardId)
|
|
37
|
+
const environment = getEnvironment(board, options.envId)
|
|
38
|
+
const samples = number(options.samples, 1, AUDIT_LIMITS.samples, 'samples')
|
|
39
|
+
const maxPages = number(options.maxPages, 5, AUDIT_LIMITS.pages, 'max-pages')
|
|
40
|
+
const maxRuns = number(options.maxRuns, 10, AUDIT_LIMITS.runs, 'max-runs')
|
|
41
|
+
const only = list(options.only),
|
|
42
|
+
viewports = list(options.viewports)
|
|
43
|
+
if (only?.some((id) => !board.pages.some((page) => page.id === id))) throw new Error('Choose page ids from this board.')
|
|
44
|
+
const sizes = boardViewports(config, board)
|
|
45
|
+
if (viewports?.some((id) => !Object.hasOwn(sizes, id))) throw new Error('Choose configured viewport names.')
|
|
46
|
+
const pages = board.pages.filter((page) => !only || only.includes(page.id))
|
|
47
|
+
if (!pages.length || pages.length > maxPages)
|
|
48
|
+
throw new Error('The selected page count exceeds max-pages or is empty. Narrow the page selection or set an explicit cap.')
|
|
49
|
+
const targets = pages.flatMap((page) =>
|
|
50
|
+
page.viewports
|
|
51
|
+
.filter((name) => !viewports || viewports.includes(name))
|
|
52
|
+
.map((name) => ({ page, viewport: { name, width: sizes[name].width, height: sizes[name].height } })),
|
|
53
|
+
)
|
|
54
|
+
if (!targets.length || targets.length * samples > maxRuns)
|
|
55
|
+
throw new Error('The selected navigation count exceeds max-runs or is empty. Narrow the selection or set an explicit cap.')
|
|
56
|
+
const configured = Boolean(authFor(config, board).storageState || authFor(config, board).loginScript)
|
|
57
|
+
const cache = options.cache || (configured ? 'auth-preserved' : 'cold')
|
|
58
|
+
if (
|
|
59
|
+
!['cold', 'warm', 'auth-preserved'].includes(cache) ||
|
|
60
|
+
(configured && cache !== 'auth-preserved') ||
|
|
61
|
+
(!configured && cache === 'auth-preserved')
|
|
62
|
+
)
|
|
63
|
+
throw new Error('Configured authentication requires auth-preserved cache; anonymous audits use cold or warm cache.')
|
|
64
|
+
const production = options.production || 'unknown'
|
|
65
|
+
if (!['production', 'development', 'unknown'].includes(production))
|
|
66
|
+
throw new Error('production must be production, development or unknown.')
|
|
67
|
+
if (options.sourceBuild != null && (typeof options.sourceBuild !== 'string' || !/^[A-Za-z0-9._-]{1,120}$/.test(options.sourceBuild)))
|
|
68
|
+
throw new Error('source-build must be an identifier of up to 120 letters, digits, dots, underscores or hyphens.')
|
|
69
|
+
if (options.browserVersion != null && !/^[a-zA-Z0-9.+-]{1,60}$/.test(options.browserVersion))
|
|
70
|
+
throw new Error('browser-version must be a browser version identifier.')
|
|
71
|
+
return { board, environment, targets, samples, configured, cache, production }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const FAILURE = {
|
|
75
|
+
'unsupported-runtime': [
|
|
76
|
+
'The audit runtime is unsupported',
|
|
77
|
+
'The pinned Lighthouse runner requires Node 22.19 or later.',
|
|
78
|
+
'Upgrade Node and install the pinned runner dependencies before repeating this audit.',
|
|
79
|
+
],
|
|
80
|
+
'unsupported-auth': [
|
|
81
|
+
'Authentication is not supported by this adapter',
|
|
82
|
+
'The configured storage state uses an unsupported form.',
|
|
83
|
+
'Use cookies and local storage with an explicit ready selector, or prepare a supported login fixture.',
|
|
84
|
+
],
|
|
85
|
+
'auth-needs-ready': [
|
|
86
|
+
'Authentication needs a ready state',
|
|
87
|
+
'A configured signed-in audit requires a visible ready selector.',
|
|
88
|
+
'Set waitFor to a selector that is present only in the intended signed-in state.',
|
|
89
|
+
],
|
|
90
|
+
'unsupported-actions': [
|
|
91
|
+
'Configured actions are unsupported',
|
|
92
|
+
'This adapter cannot faithfully execute a configured action or selector.',
|
|
93
|
+
'Use supported CSS selectors and actions or audit this page with its original runner.',
|
|
94
|
+
],
|
|
95
|
+
'unsupported-browser': [
|
|
96
|
+
'The browser profile is unsupported',
|
|
97
|
+
'The installed browser does not match the requested audit profile.',
|
|
98
|
+
'Install the expected Chrome version or explicitly choose a supported local Chrome executable.',
|
|
99
|
+
],
|
|
100
|
+
'wrong-target': [
|
|
101
|
+
'The intended route was not reached',
|
|
102
|
+
'Navigation ended at a different route or query state.',
|
|
103
|
+
'Check the original route and test account; do not compare a sign-in page with the intended app.',
|
|
104
|
+
],
|
|
105
|
+
'not-ready': [
|
|
106
|
+
'The intended state was not ready',
|
|
107
|
+
'The configured ready selector was not visible.',
|
|
108
|
+
'Verify the test account and ready selector before running another audit.',
|
|
109
|
+
],
|
|
110
|
+
'document-status': [
|
|
111
|
+
'The document did not load as expected',
|
|
112
|
+
'The original document returned an unexpected response status.',
|
|
113
|
+
'Check the app response and configured expected statuses before repeating the audit.',
|
|
114
|
+
],
|
|
115
|
+
timeout: [
|
|
116
|
+
'The audit timed out',
|
|
117
|
+
'The local audit exceeded its bounded navigation window.',
|
|
118
|
+
'Check the original app and shorten slow setup or actions before repeating the audit.',
|
|
119
|
+
],
|
|
120
|
+
'runner-failed': [
|
|
121
|
+
'The audit did not complete',
|
|
122
|
+
'The local browser or runner could not finish this navigation.',
|
|
123
|
+
'Verify the installed Chrome, local app and trusted login fixture, then run the audit again.',
|
|
124
|
+
],
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function failureReport(report, error) {
|
|
128
|
+
const code = Object.hasOwn(FAILURE, error?.code) ? error.code : 'runner-failed'
|
|
129
|
+
const [title, observation, nextAction] = FAILURE[code]
|
|
130
|
+
report.state = code.startsWith('unsupported') || code === 'auth-needs-ready' ? 'unsupported' : 'failed'
|
|
131
|
+
report.metrics = lighthouseMetrics(null)
|
|
132
|
+
report.completeness.network = 'unavailable'
|
|
133
|
+
report.findings = [
|
|
134
|
+
{
|
|
135
|
+
id: code,
|
|
136
|
+
category: 'performance',
|
|
137
|
+
severity: 'warning',
|
|
138
|
+
title,
|
|
139
|
+
observation,
|
|
140
|
+
impact: 'No trustworthy navigation metrics are available for this target.',
|
|
141
|
+
nextAction,
|
|
142
|
+
},
|
|
143
|
+
]
|
|
144
|
+
return report
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function auditTarget(config, plan, target, options, runId) {
|
|
148
|
+
const { board, environment, configured, cache, production } = plan
|
|
149
|
+
const { page: pageConfig, viewport } = target
|
|
150
|
+
const manifest = readManifest(config, board.id, environment.id)
|
|
151
|
+
const report = {
|
|
152
|
+
schemaVersion: 1,
|
|
153
|
+
id: reportId(),
|
|
154
|
+
runId,
|
|
155
|
+
boardId: board.id,
|
|
156
|
+
pageId: pageConfig.id,
|
|
157
|
+
environment: environment.id,
|
|
158
|
+
viewport,
|
|
159
|
+
captureVersion: entryVersion(manifest?.pages?.[pageConfig.id]?.[viewport.name], manifest),
|
|
160
|
+
sampledSeparately: true,
|
|
161
|
+
state: 'failed',
|
|
162
|
+
auditedAt: new Date().toISOString(),
|
|
163
|
+
profile: {
|
|
164
|
+
runner: 'lighthouse',
|
|
165
|
+
version: LIGHTHOUSE_VERSION,
|
|
166
|
+
mode: 'navigation',
|
|
167
|
+
cache,
|
|
168
|
+
authRole: configured ? 'configured' : 'anonymous',
|
|
169
|
+
sourceBuild: options.sourceBuild == null ? null : fingerprint(options.sourceBuild),
|
|
170
|
+
stateFingerprint: targetFingerprint(config, board, pageConfig, environment, viewport.name),
|
|
171
|
+
seo: Boolean(options.seo),
|
|
172
|
+
production,
|
|
173
|
+
location: 'local',
|
|
174
|
+
sampleCount: 1,
|
|
175
|
+
},
|
|
176
|
+
completeness: {
|
|
177
|
+
window: 'navigation-through-configured-actions',
|
|
178
|
+
network: 'unavailable',
|
|
179
|
+
serviceWorker: null,
|
|
180
|
+
limitations: [
|
|
181
|
+
'These are local lab navigation metrics, not real user measurements.',
|
|
182
|
+
'Navigation metrics do not establish field input responsiveness.',
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
metrics: lighthouseMetrics(null),
|
|
186
|
+
findings: [],
|
|
187
|
+
}
|
|
188
|
+
let chrome, browser, playwrightBrowser, workDir, timer
|
|
189
|
+
let stopped = false
|
|
190
|
+
const task = async () => {
|
|
191
|
+
const [major, minor] = process.versions.node.split('.').map(Number)
|
|
192
|
+
if (major < 22 || (major === 22 && minor < 19)) throw new AuditTargetError('unsupported-runtime')
|
|
193
|
+
if (configured && !pageConfig.waitFor) throw new AuditTargetError('auth-needs-ready')
|
|
194
|
+
assertSupportedActions(pageConfig)
|
|
195
|
+
if (config.browser?.channel && config.browser.channel !== 'chrome' && !config.browser.executablePath)
|
|
196
|
+
throw new AuditTargetError('unsupported-browser')
|
|
197
|
+
const [{ Launcher, getChromePath }, { default: puppeteer }, { navigation }, { userAgents }] = await Promise.all([
|
|
198
|
+
import('chrome-launcher'),
|
|
199
|
+
import('puppeteer-core'),
|
|
200
|
+
import('lighthouse'),
|
|
201
|
+
import('lighthouse/core/config/constants.js'),
|
|
202
|
+
])
|
|
203
|
+
const toolVersion = JSON.parse(
|
|
204
|
+
fs.readFileSync(path.join(path.dirname(require.resolve('lighthouse')), '..', 'package.json'), 'utf8'),
|
|
205
|
+
).version
|
|
206
|
+
if (toolVersion !== LIGHTHOUSE_VERSION) throw new AuditTargetError('unsupported-runtime')
|
|
207
|
+
if (stopped) throw new AuditTargetError('timeout')
|
|
208
|
+
let chromePath
|
|
209
|
+
try {
|
|
210
|
+
chromePath = options.chromePath || config.browser?.executablePath || getChromePath()
|
|
211
|
+
fs.accessSync(chromePath, fs.constants.X_OK)
|
|
212
|
+
} catch {
|
|
213
|
+
throw new AuditTargetError('unsupported-browser')
|
|
214
|
+
}
|
|
215
|
+
const parent = path.join(config.outputDir, '.checks-browser')
|
|
216
|
+
fs.mkdirSync(parent, { recursive: true, mode: 0o700 })
|
|
217
|
+
workDir = fs.mkdtempSync(path.join(parent, 'run-'))
|
|
218
|
+
fs.chmodSync(workDir, 0o700)
|
|
219
|
+
chrome = new Launcher({
|
|
220
|
+
chromePath,
|
|
221
|
+
userDataDir: workDir,
|
|
222
|
+
chromeFlags: ['--headless=new', '--no-first-run', '--disable-dev-shm-usage'],
|
|
223
|
+
handleSIGINT: false,
|
|
224
|
+
logLevel: 'silent',
|
|
225
|
+
})
|
|
226
|
+
await chrome.launch()
|
|
227
|
+
if (stopped) {
|
|
228
|
+
await chrome.kill()
|
|
229
|
+
fs.rmSync(workDir, { recursive: true, force: true })
|
|
230
|
+
throw new AuditTargetError('timeout')
|
|
231
|
+
}
|
|
232
|
+
browser = await puppeteer.connect({ browserURL: `http://127.0.0.1:${chrome.port}`, defaultViewport: null })
|
|
233
|
+
const page = await browser.newPage()
|
|
234
|
+
page.setDefaultTimeout(config.timeouts.page)
|
|
235
|
+
page.setDefaultNavigationTimeout(config.timeouts.page)
|
|
236
|
+
const version = await page.createCDPSession().then((session) => session.send('Browser.getVersion'))
|
|
237
|
+
const browserVersion = version.product.split('/').at(-1)
|
|
238
|
+
if (options.browserVersion && browserVersion !== options.browserVersion) throw new AuditTargetError('unsupported-browser')
|
|
239
|
+
const mobile = viewportDevice(viewport.name, boardViewports(config, board)[viewport.name]).mobile,
|
|
240
|
+
userAgent = mobile ? userAgents.mobile : userAgents.desktop
|
|
241
|
+
const throttling = mobile
|
|
242
|
+
? { rttMs: 150, throughputKbps: 1638.4, cpuSlowdownMultiplier: 4 }
|
|
243
|
+
: { rttMs: 40, throughputKbps: 10240, cpuSlowdownMultiplier: 1 }
|
|
244
|
+
report.profile.browser = { version: browserVersion, userAgentHash: fingerprint(userAgent) }
|
|
245
|
+
report.profile.throttling = { method: 'simulate', ...throttling }
|
|
246
|
+
report.profile.device = { mobile, deviceScaleFactor: 1, screenEmulationDisabled: false }
|
|
247
|
+
await page.setViewport({ width: viewport.width, height: viewport.height, deviceScaleFactor: 1, isMobile: mobile, hasTouch: mobile })
|
|
248
|
+
await page.setUserAgent(userAgent)
|
|
249
|
+
if (configured) {
|
|
250
|
+
const { chromium } = await import('playwright')
|
|
251
|
+
playwrightBrowser = await chromium.connectOverCDP(`http://127.0.0.1:${chrome.port}`)
|
|
252
|
+
let storage
|
|
253
|
+
try {
|
|
254
|
+
storage = translateStorageState(await resolveStorageState(playwrightBrowser, config, { ...board, baseUrl: environment.baseUrl }))
|
|
255
|
+
} catch (error) {
|
|
256
|
+
throw error instanceof AuditTargetError ? error : new AuditTargetError('unsupported-auth')
|
|
257
|
+
}
|
|
258
|
+
await applyStorageState(page, storage)
|
|
259
|
+
report.profile.authStateHash = storage.hash
|
|
260
|
+
report.completeness.limitations.push('Authentication storage, browser cache and service workers were retained.')
|
|
261
|
+
}
|
|
262
|
+
const url = joinUrl(environment.baseUrl, pageConfig.path)
|
|
263
|
+
if (cache === 'cold') {
|
|
264
|
+
const session = await page.createCDPSession()
|
|
265
|
+
await session.send('Network.clearBrowserCache')
|
|
266
|
+
await session.send('Storage.clearDataForOrigin', { origin: new URL(url).origin, storageTypes: 'all' })
|
|
267
|
+
await session.detach()
|
|
268
|
+
}
|
|
269
|
+
const navigate = async (actions) => {
|
|
270
|
+
const response = await page.goto(url, { waitUntil: 'domcontentloaded', timeout: config.timeouts.page })
|
|
271
|
+
if (!response || !(pageConfig.expectStatus || [200]).includes(response.status())) throw new AuditTargetError('document-status')
|
|
272
|
+
await verifyTarget(page, url, pageConfig, config.timeouts.page)
|
|
273
|
+
if (actions) await runConfiguredActions(page, pageConfig.actions, config.timeouts.page)
|
|
274
|
+
await verifyTarget(page, url, pageConfig, config.timeouts.page)
|
|
275
|
+
}
|
|
276
|
+
if (configured || cache === 'warm') {
|
|
277
|
+
await navigate(false)
|
|
278
|
+
await page.goto('about:blank')
|
|
279
|
+
}
|
|
280
|
+
let targetError = null
|
|
281
|
+
// The runner waits for this callback after its load window. Catch an
|
|
282
|
+
// early route failure here to avoid an unhandled rejected navigation.
|
|
283
|
+
const result = await navigation(
|
|
284
|
+
page,
|
|
285
|
+
async () => {
|
|
286
|
+
try {
|
|
287
|
+
await navigate(true)
|
|
288
|
+
} catch (error) {
|
|
289
|
+
targetError = error
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
flags: {
|
|
294
|
+
logLevel: 'silent',
|
|
295
|
+
output: 'json',
|
|
296
|
+
onlyCategories: ['performance', 'best-practices', ...(options.seo ? ['seo'] : [])],
|
|
297
|
+
formFactor: mobile ? 'mobile' : 'desktop',
|
|
298
|
+
screenEmulation: { mobile, width: viewport.width, height: viewport.height, deviceScaleFactor: 1, disabled: false },
|
|
299
|
+
emulatedUserAgent: userAgent,
|
|
300
|
+
throttlingMethod: 'simulate',
|
|
301
|
+
throttling,
|
|
302
|
+
disableStorageReset: cache !== 'cold',
|
|
303
|
+
disableFullPageScreenshot: true,
|
|
304
|
+
maxWaitForFcp: Math.min(config.timeouts.page, 30000),
|
|
305
|
+
maxWaitForLoad: Math.min(config.timeouts.page, 45000),
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
)
|
|
309
|
+
if (targetError) throw targetError
|
|
310
|
+
await verifyTarget(page, url, pageConfig, config.timeouts.page)
|
|
311
|
+
if (!result?.lhr || result.lhr.runtimeError || result.lhr.lighthouseVersion !== LIGHTHOUSE_VERSION)
|
|
312
|
+
throw new AuditTargetError('runner-failed')
|
|
313
|
+
report.metrics = lighthouseMetrics(result.lhr)
|
|
314
|
+
report.findings = lighthouseFindings(result.lhr)
|
|
315
|
+
report.completeness.network = Array.isArray(result.lhr.audits['network-requests']?.details?.items) ? 'observed' : 'partial'
|
|
316
|
+
report.completeness.serviceWorker = await page.evaluate(() => Boolean(navigator.serviceWorker?.controller))
|
|
317
|
+
report.state = ['largestContentfulPaintMs', 'cumulativeLayoutShift', 'firstContentfulPaintMs', 'totalBlockingTimeMs'].every(
|
|
318
|
+
(key) => finiteMetric(report.metrics[key]) !== null,
|
|
319
|
+
)
|
|
320
|
+
? 'complete'
|
|
321
|
+
: 'partial'
|
|
322
|
+
if (pageConfig.actions?.length)
|
|
323
|
+
report.completeness.limitations.push(
|
|
324
|
+
'Configured actions ran during the navigation window; interaction responsiveness was not measured.',
|
|
325
|
+
)
|
|
326
|
+
return report
|
|
327
|
+
}
|
|
328
|
+
try {
|
|
329
|
+
return await Promise.race([
|
|
330
|
+
task(),
|
|
331
|
+
new Promise((_, reject) => {
|
|
332
|
+
timer = setTimeout(() => reject(new AuditTargetError('timeout')), AUDIT_LIMITS.timeoutMs)
|
|
333
|
+
}),
|
|
334
|
+
])
|
|
335
|
+
} catch (error) {
|
|
336
|
+
return failureReport(report, error)
|
|
337
|
+
} finally {
|
|
338
|
+
stopped = true
|
|
339
|
+
clearTimeout(timer)
|
|
340
|
+
browser?.disconnect()
|
|
341
|
+
await playwrightBrowser?.close().catch(() => {})
|
|
342
|
+
await chrome?.kill()
|
|
343
|
+
if (workDir) fs.rmSync(workDir, { recursive: true, force: true })
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export async function runLighthouseAudits({ config, log = () => {}, ...options }) {
|
|
348
|
+
const plan = auditPlan(config, options),
|
|
349
|
+
runId = randomUUID(),
|
|
350
|
+
reports = []
|
|
351
|
+
for (const target of plan.targets)
|
|
352
|
+
for (let sample = 0; sample < plan.samples; sample += 1) {
|
|
353
|
+
log(`Lighthouse ${target.page.id} ${target.viewport.name}, sample ${sample + 1} of ${plan.samples}`)
|
|
354
|
+
const report = validateReport(applyBudgets(await auditTarget(config, plan, target, options, runId), config.checks?.budgets))
|
|
355
|
+
await saveReport(config, report)
|
|
356
|
+
reports.push(report)
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
reports,
|
|
360
|
+
summary: {
|
|
361
|
+
runId,
|
|
362
|
+
total: reports.length,
|
|
363
|
+
complete: reports.filter((report) => report.state === 'complete').length,
|
|
364
|
+
partial: reports.filter((report) => report.state === 'partial').length,
|
|
365
|
+
failed: reports.filter((report) => ['failed', 'unsupported'].includes(report.state)).length,
|
|
366
|
+
},
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Mounted by the CLI only, with its already loaded configuration.
|
|
371
|
+
export async function auditCommand(config, positional = [], flags = {}, out = console.log, err = console.error) {
|
|
372
|
+
const result = await runLighthouseAudits({
|
|
373
|
+
config,
|
|
374
|
+
boardId: flags.board || positional[0],
|
|
375
|
+
envId: flags.env,
|
|
376
|
+
only: flags.only,
|
|
377
|
+
viewports: flags.viewports,
|
|
378
|
+
samples: flags.samples,
|
|
379
|
+
maxPages: flags['max-pages'],
|
|
380
|
+
maxRuns: flags['max-runs'],
|
|
381
|
+
// --seo, or the config's checks.seo default (any opted-in page).
|
|
382
|
+
seo: Boolean(flags.seo) || (!flags['no-seo'] && Boolean(config.checks?.seo === true || config.checks?.seo?.length)),
|
|
383
|
+
cache: flags.cache,
|
|
384
|
+
sourceBuild: flags['source-build'],
|
|
385
|
+
production: flags.production,
|
|
386
|
+
browserVersion: flags['browser-version'],
|
|
387
|
+
log: flags.json ? () => {} : err,
|
|
388
|
+
})
|
|
389
|
+
out(
|
|
390
|
+
flags.json
|
|
391
|
+
? JSON.stringify(result)
|
|
392
|
+
: `Lighthouse: ${result.summary.complete} complete, ${result.summary.partial} partial, ${result.summary.failed} failed or unsupported.`,
|
|
393
|
+
)
|
|
394
|
+
return result.summary.failed || result.summary.partial ? 1 : 0
|
|
395
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Bounded Googlebot rule observation, not a crawler or an indexing verdict.
|
|
2
|
+
// Google robots specification and RFC 9309 are linked in docs/page-checks.md.
|
|
3
|
+
export const ROBOTS_MAX_BYTES = 500 * 1024
|
|
4
|
+
const MAX_LINES = 10000
|
|
5
|
+
const MAX_PATH = 4096
|
|
6
|
+
|
|
7
|
+
function normalizeOctets(value) {
|
|
8
|
+
return [...value]
|
|
9
|
+
.map((c) => (c.charCodeAt(0) > 127 ? encodeURIComponent(c) : c))
|
|
10
|
+
.join('')
|
|
11
|
+
.replace(/%[a-f0-9]{2}/gi, (encoded) => {
|
|
12
|
+
const c = String.fromCharCode(parseInt(encoded.slice(1), 16))
|
|
13
|
+
return /[A-Za-z0-9._~-]/.test(c) ? c : encoded.toUpperCase()
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Greedy wildcard matching avoids a backtracking regular expression made from
|
|
18
|
+
// untrusted patterns. A rule without a final dollar matches a path prefix.
|
|
19
|
+
function matches(pattern, value, budget) {
|
|
20
|
+
const exact = pattern.endsWith('$')
|
|
21
|
+
if (exact) pattern = pattern.slice(0, -1)
|
|
22
|
+
let p = 0,
|
|
23
|
+
v = 0,
|
|
24
|
+
star = -1,
|
|
25
|
+
restart = 0
|
|
26
|
+
while (v < value.length) {
|
|
27
|
+
if (--budget.remaining < 0) return null
|
|
28
|
+
if (p === pattern.length && !exact) return true
|
|
29
|
+
if (pattern[p] === '*') {
|
|
30
|
+
star = p++
|
|
31
|
+
restart = v
|
|
32
|
+
} else if (pattern[p] === value[v]) {
|
|
33
|
+
p++
|
|
34
|
+
v++
|
|
35
|
+
} else if (star >= 0) {
|
|
36
|
+
p = star + 1
|
|
37
|
+
v = ++restart
|
|
38
|
+
} else return false
|
|
39
|
+
}
|
|
40
|
+
while (pattern[p] === '*') p++
|
|
41
|
+
return p === pattern.length
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function robotsDecision(body, path) {
|
|
45
|
+
if (typeof body !== 'string' || Buffer.byteLength(body) > ROBOTS_MAX_BYTES || typeof path !== 'string' || path.length > MAX_PATH)
|
|
46
|
+
return { state: 'unsupported' }
|
|
47
|
+
const lines = body.replace(/^\uFEFF/, '').split(/\r\n|\r|\n/)
|
|
48
|
+
if (lines.length > MAX_LINES || lines.some((line) => line.length > MAX_PATH)) return { state: 'unsupported' }
|
|
49
|
+
const groups = []
|
|
50
|
+
let group = null,
|
|
51
|
+
hasRules = false
|
|
52
|
+
for (const line of lines) {
|
|
53
|
+
const clean = line.split('#')[0].trim()
|
|
54
|
+
const colon = clean.indexOf(':')
|
|
55
|
+
if (colon < 0) continue
|
|
56
|
+
const key = clean.slice(0, colon).trim().toLowerCase()
|
|
57
|
+
const value = clean.slice(colon + 1).trim()
|
|
58
|
+
if (key === 'user-agent') {
|
|
59
|
+
if (!group || hasRules) {
|
|
60
|
+
group = { agents: [], rules: [] }
|
|
61
|
+
groups.push(group)
|
|
62
|
+
hasRules = false
|
|
63
|
+
}
|
|
64
|
+
// Google ignores suffixes such as version or wildcard on crawler tokens.
|
|
65
|
+
const agent = value.toLowerCase().match(/^(\*|[a-z_-]+)/)?.[0]
|
|
66
|
+
if (agent) group.agents.push(agent)
|
|
67
|
+
} else if (group && (key === 'allow' || key === 'disallow')) {
|
|
68
|
+
hasRules = true
|
|
69
|
+
if (value.startsWith('/')) group.rules.push({ allow: key === 'allow', path: normalizeOctets(value) })
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const specific = groups.filter((g) => g.agents.includes('googlebot'))
|
|
73
|
+
const selected = specific.length ? specific : groups.filter((g) => g.agents.includes('*'))
|
|
74
|
+
const target = normalizeOctets(path)
|
|
75
|
+
let winner = null
|
|
76
|
+
const budget = { remaining: 2000000 }
|
|
77
|
+
for (const rule of selected.flatMap((g) => g.rules)) {
|
|
78
|
+
const matched = matches(rule.path, target, budget)
|
|
79
|
+
if (matched === null) return { state: 'unsupported' }
|
|
80
|
+
if (!matched) continue
|
|
81
|
+
const length = rule.path.length
|
|
82
|
+
if (!winner || length > winner.length || (length === winner.length && rule.allow)) winner = { length, allow: rule.allow }
|
|
83
|
+
}
|
|
84
|
+
return { state: winner && !winner.allow ? 'blocked' : 'allowed' }
|
|
85
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import express from 'express'
|
|
2
|
+
import { getBoard } from '../config.js'
|
|
3
|
+
import { checksView, readReport } from './store.js'
|
|
4
|
+
import { latestSeoReports } from './seo-analysis.js'
|
|
5
|
+
import { readSnapshot } from './seo-snapshot.js'
|
|
6
|
+
|
|
7
|
+
// Mount behind the same local board capability guard. This router never
|
|
8
|
+
// runs a browser or fetches a target. Hosted routes require member access;
|
|
9
|
+
// share and public routes must not mount this private diagnostic API.
|
|
10
|
+
export function checksRouter(getConfig) {
|
|
11
|
+
const router = express.Router()
|
|
12
|
+
router.get('/api/boards/:boardId/checks', (req, res) => {
|
|
13
|
+
try {
|
|
14
|
+
res.set('Cache-Control', 'no-store').json(checksView(getConfig(), req.params.boardId, req.query.env || null))
|
|
15
|
+
} catch {
|
|
16
|
+
res.status(404).json({ error: { code: 'not_found', message: 'Board or environment not found.' } })
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
// Local search previews for the SEO view: one per page, for the report its
|
|
20
|
+
// row uses. They hold page text and URLs, so this is never mounted on
|
|
21
|
+
// hosted, share or public routes and previews are never exported.
|
|
22
|
+
router.get('/api/boards/:boardId/checks/seo', (req, res) => {
|
|
23
|
+
try {
|
|
24
|
+
const config = getConfig()
|
|
25
|
+
const board = getBoard(config, req.params.boardId)
|
|
26
|
+
const view = checksView(config, board.id, req.query.env || null)
|
|
27
|
+
const snapshots = {}
|
|
28
|
+
const reports = latestSeoReports(
|
|
29
|
+
view.views,
|
|
30
|
+
board.pages.map((p) => p.id),
|
|
31
|
+
)
|
|
32
|
+
for (const report of reports.values()) {
|
|
33
|
+
const snapshot = readSnapshot(config, board.id, report.id)
|
|
34
|
+
if (snapshot) snapshots[report.id] = snapshot
|
|
35
|
+
}
|
|
36
|
+
res.set('Cache-Control', 'no-store').json({
|
|
37
|
+
schemaVersion: 1,
|
|
38
|
+
environment: view.environment,
|
|
39
|
+
privatePages: board.pages.filter((p) => p.seo?.indexable === false).map((p) => p.id),
|
|
40
|
+
snapshots,
|
|
41
|
+
})
|
|
42
|
+
} catch {
|
|
43
|
+
res.status(404).json({ error: { code: 'not_found', message: 'Board or environment not found.' } })
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
router.get('/api/boards/:boardId/checks/:id', (req, res) => {
|
|
47
|
+
const report = readReport(getConfig(), req.params.boardId, req.params.id)
|
|
48
|
+
if (!report) return res.status(404).json({ error: { code: 'not_found', message: 'Check report not found.' } })
|
|
49
|
+
res.set('Cache-Control', 'no-store').json({ report })
|
|
50
|
+
})
|
|
51
|
+
return router
|
|
52
|
+
}
|