create-nextblock 0.15.0 → 0.15.1
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/package.json +1 -1
- package/templates/nextblock-template/app/cms/settings/site-scripts/components/SiteScriptManager.tsx +13 -5
- package/templates/nextblock-template/docs/08-NEXTBLOCK-CORTEX-AI-ARCHITECTURE.md +26 -11
- package/templates/nextblock-template/package.json +1 -1
- package/templates/nextblock-template/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
package/templates/nextblock-template/app/cms/settings/site-scripts/components/SiteScriptManager.tsx
CHANGED
|
@@ -184,14 +184,22 @@ function ScriptEditor({
|
|
|
184
184
|
page's CSP nonce.
|
|
185
185
|
</p>
|
|
186
186
|
<p className="text-xs text-muted-foreground">
|
|
187
|
-
Pages are React-hydrated.
|
|
188
|
-
|
|
187
|
+
Pages are React-hydrated. Do <strong>not</strong> change the text, classes, or attributes
|
|
188
|
+
of existing markup — React reconciles afterwards and reverts your change (a counter
|
|
189
|
+
animates, then snaps back). Waiting for the <code>load</code> event is not enough;
|
|
190
|
+
hydration can still be running. Animate with the Web Animations API instead, which writes
|
|
191
|
+
no attributes:
|
|
189
192
|
</p>
|
|
190
193
|
<pre className="overflow-x-auto rounded-md bg-muted p-3 text-xs">
|
|
191
|
-
<code>{`
|
|
192
|
-
|
|
193
|
-
|
|
194
|
+
<code>{`el.animate(
|
|
195
|
+
[{ opacity: 0 }, { opacity: 1 }],
|
|
196
|
+
{ duration: 600, fill: 'both' }
|
|
197
|
+
);`}</code>
|
|
194
198
|
</pre>
|
|
199
|
+
<p className="text-xs text-muted-foreground">
|
|
200
|
+
Appending your own new elements is always safe — React does not own those. So is anything
|
|
201
|
+
you can express in CSS.
|
|
202
|
+
</p>
|
|
195
203
|
</div>
|
|
196
204
|
|
|
197
205
|
<div className="grid gap-4 sm:grid-cols-2">
|
|
@@ -1561,8 +1561,8 @@ When modifying Cortex AI, keep these invariants:
|
|
|
1561
1561
|
15. A substituted actor identity is for attribution only, never authorization.
|
|
1562
1562
|
16. The audit log for site scripts is append-only in the database. Reverting writes a
|
|
1563
1563
|
new revision; it never removes one.
|
|
1564
|
-
17. Inline scripts in block HTML need the CSP nonce, and must
|
|
1565
|
-
|
|
1564
|
+
17. Inline scripts in block HTML need the CSP nonce, and must not mutate
|
|
1565
|
+
server-rendered DOM at all — `load` is not a post-hydration signal.
|
|
1566
1566
|
|
|
1567
1567
|
## MCP Server: Security Model and Operator Guide
|
|
1568
1568
|
|
|
@@ -1638,15 +1638,30 @@ The site CSP carries a nonce, and per CSP Level 2 a browser **ignores
|
|
|
1638
1638
|
authorized regardless of the CSP host allowlist. That is inherent to the feature
|
|
1639
1639
|
and a reason it is ADMIN-only.
|
|
1640
1640
|
|
|
1641
|
-
Author scripts
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1641
|
+
### Author scripts and React hydration
|
|
1642
|
+
|
|
1643
|
+
Public pages are React-hydrated, and this is the single most common way an author
|
|
1644
|
+
script goes wrong. **Do not change the text, classes, or attributes of
|
|
1645
|
+
server-rendered markup.** React reconciles after the script runs and either reverts
|
|
1646
|
+
the change or logs a hydration mismatch — a counter visibly animates and then snaps
|
|
1647
|
+
back to its server value.
|
|
1648
|
+
|
|
1649
|
+
Waiting for the `load` event is **not** a fix. With streaming and selective
|
|
1650
|
+
hydration, hydration can still be in flight when `load` fires; this was tried and
|
|
1651
|
+
still produced mismatches on `<section className=…>`.
|
|
1652
|
+
|
|
1653
|
+
Patterns that are actually safe:
|
|
1654
|
+
|
|
1655
|
+
- **Web Animations API.** `el.animate([...], {fill: 'both'})` creates an Animation
|
|
1656
|
+
object and writes neither `class` nor `style`, so React has nothing to diff. A
|
|
1657
|
+
paused animation held at `currentTime = 0` hides an element without a class.
|
|
1658
|
+
- **Append your own elements.** React does not own what the script creates, so a
|
|
1659
|
+
progress bar or overlay appended to `<body>` is unconditionally safe.
|
|
1660
|
+
- **CSS.** Anything expressible in CSS carries no hydration risk at all.
|
|
1661
|
+
- **If text must change**, render the FINAL value server-side and animate toward it
|
|
1662
|
+
once the element scrolls into view, so any reconciliation lands on the correct
|
|
1663
|
+
value rather than resetting the animation. Format numbers with a fixed formatter,
|
|
1664
|
+
not `toLocaleString()`, so the client string matches the server byte for byte.
|
|
1650
1665
|
|
|
1651
1666
|
### SSRF
|
|
1652
1667
|
|