Skip to content

armgit / bygga

Public Imported from GitHub
0

IKEA assembly, step by step: animated, manual-style 3D guides. Scan any paper manual with Together AI.

TypeScript

Zod without its eval probe, so the new CSP logs nothing on guide pages

Youssef6db4ba702450
diff --git a/src/lib/spec.ts b/src/lib/spec.ts
index 1b8c5c9..fad3ea7 100644
--- a/src/lib/spec.ts
+++ b/src/lib/spec.ts
@@ -1,6 +1,9 @@
import { z } from "zod";
import type { ProductSpec } from "./types";
+// the site's CSP allows no eval, so zod shouldn't probe for it (the probe logs a violation on every guide)
+z.config({ jitless: true });
+
const num = (lo: number, hi: number) => z.coerce.number().transform((n) => Math.min(hi, Math.max(lo, n)));
const optNum = (lo: number, hi: number) => num(lo, hi).optional().catch(undefined);
const optBool = z.coerce.boolean().optional().catch(undefined);