From dcad8cb6505ec9458bddc326527481f1f03c43a1 Mon Sep 17 00:00:00 2001 From: ngqile Date: Wed, 2 Dec 2026 17:36:54 +0800 Subject: [PATCH] docs(openspec): add-custom-html-block change Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs --- .../add-custom-html-block/.openspec.yaml | 2 + .../changes/add-custom-html-block/design.md | 41 ++++++ .../changes/add-custom-html-block/proposal.md | 54 ++++++++ .../specs/landing-pages/spec.md | 129 ++++++++++++++++++ .../changes/add-custom-html-block/tasks.md | 39 ++++++ 5 files changed, 265 insertions(+) create mode 100644 openspec/changes/add-custom-html-block/.openspec.yaml create mode 100644 openspec/changes/add-custom-html-block/design.md create mode 100644 openspec/changes/add-custom-html-block/proposal.md create mode 100644 openspec/changes/add-custom-html-block/specs/landing-pages/spec.md create mode 100644 openspec/changes/add-custom-html-block/tasks.md diff --git a/openspec/changes/add-custom-html-block/.openspec.yaml b/openspec/changes/add-custom-html-block/.openspec.yaml new file mode 100644 index 0000000..eb2b21e --- /dev/null +++ b/openspec/changes/add-custom-html-block/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-12-02 diff --git a/openspec/changes/add-custom-html-block/design.md b/openspec/changes/add-custom-html-block/design.md new file mode 100644 index 0000000..b305522 --- /dev/null +++ b/openspec/changes/add-custom-html-block/design.md @@ -0,0 +1,41 @@ +# Design + +The full design is `docs/superpowers/specs/2026-12-02-custom-html-block-design.md` (approved 2026-12-02). This file records the technical decisions. + +## Context + +- Pages store their blocks as JSON in `cms_page.blocks`. `CmsBlockValidator` in services-counter checks the blocks, and mobile-api passes them to the portal unchanged. +- The portal's `middleware.ts` gives every page and API response a per-request nonce Content-Security-Policy. An `srcdoc` frame would inherit that policy and block the pasted scripts, inline styles and CDN links. So the pasted HTML needs its own response with its own policy. +- The public page `/p/[company]/[slug]` renders on the server. `routeGuard.isPublicPath` admits only `^/p/[^/]+/[^/]+$` today. + +## Goals / Non-Goals + +**Goals:** +- Pasted HTML renders as designed. +- It runs with an opaque origin on every path, including a direct visit to the frame address. + +**Non-Goals:** +- SEO for the framed content. +- Working forms inside it. +- An HTML editor. + +## Decisions + +1. **Route handlers, not pages.** `app/p/[company]/[slug]/frame/[block]/route.ts` and `app/pages/[id]/preview/frame/[block]/route.ts` return `text/html` directly. They reuse the server helpers that the public page (published read) and the preview (admin read with the session token) already use. +2. **Sandbox in two places.** + - The response header: `Content-Security-Policy: sandbox allow-scripts allow-popups allow-popups-to-escape-sandbox; frame-ancestors 'self'`. This covers a direct visit. + - The `