worker/ is a Cloudflare Worker exposing POST /api/preview {url}: it opens
the reader's site in Browser Rendering's real headless Chrome, runs a
scoped port of tools/brand-from-url.mjs's colour/font/logo extraction
(extract.ts - extractInPage ports verbatim since it is a pure
browser-context function; the colour-role decision engine ports with
the same maths against a single hero-viewport histogram instead of the
local tool's hero+full-page pair), and returns brand.json plus a live
preview screenshot, verified end to end against a real account in ~6s.
public/index.html is the landing page: a URL box, the live render, and
"Use this template" CTAs, served directly by the Worker's static
assets binding. Rejects loopback/link-local/private/non-http(s) URLs
before a browser session is ever acquired (SSRF guard on a
user-supplied target), verified against 127.0.0.1, 169.254.169.254 and
malformed input.
Moves the brand-extraction hook moment before the ~10-minute local
toolchain install instead of after it, per STRATEGY-2026-10-23.md
section 4. Deploying needs Browser Rendering enabled on the Cloudflare
account (one owner dashboard click, documented in worker/README.md) -
not done here since it is an account-level change, not a code one.
17 lines
381 B
JSON
17 lines
381 B
JSON
{
|
|
"compilerOptions": {
|
|
"target": "ES2022",
|
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
"module": "ES2022",
|
|
"moduleResolution": "Bundler",
|
|
"types": ["@cloudflare/workers-types"],
|
|
"strict": true,
|
|
"skipLibCheck": true,
|
|
"noEmit": true,
|
|
"esModuleInterop": true,
|
|
"resolveJsonModule": true,
|
|
"isolatedModules": true
|
|
},
|
|
"include": ["*.ts"]
|
|
}
|