Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
29 lines
717 B
TypeScript
29 lines
717 B
TypeScript
import Head from 'next/head'
|
|
import { sanitizeJsonLd } from 'web/lib/json-ld'
|
|
|
|
export function JsonLd(props: { data: object | null; id: string }) {
|
|
const { data, id } = props
|
|
if (!data) return null
|
|
|
|
// Defensive try/catch — if JSON.stringify fails, skip
|
|
// the script tag rather than crashing SSR.
|
|
let html: string
|
|
try {
|
|
html = sanitizeJsonLd(data)
|
|
} catch {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<Head>
|
|
<script
|
|
key={`jsonld-${id}`}
|
|
type="application/ld+json"
|
|
dangerouslySetInnerHTML={{ __html: html }}
|
|
/>
|
|
</Head>
|
|
)
|
|
}
|
|
// WARNING: Never construct JSON-LD via template literals with user content.
|
|
// Always use JSON.stringify + sanitizeJsonLd to prevent XSS.
|