Centralize bootstrapping into bootstrap.js and strengthen CSP hash generation#4635
Centralize bootstrapping into bootstrap.js and strengthen CSP hash generation#4635MontrealAI wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70177a338a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| <script type="importmap">{"imports":{"d3":"./d3.exports.js"}}</script> | ||
| <script>window.SW_HASH = 'sha384-jNrRb0RaME0Q+lz0/ITUhfnQBDj97uJPtmPXPc9rSfGvo79YnRebfKvL0rUyytDQ';</script> | ||
| <script src="bootstrap.js"></script> |
There was a problem hiding this comment.
Ship bootstrap.js alongside docs index
This HTML now loads bootstrap.js, but this commit does not add docs/alpha_agi_insight_v1/bootstrap.js, so the browser gets a 404 and none of the moved bootstrap logic runs on the published docs page. In practice, service-worker registration and the early toast fallback are skipped for docs users, which regresses offline/update behavior compared to the previous inline implementation.
Useful? React with 👍 / 👎.
| </script> | ||
|
|
||
| <script type="importmap">{"imports":{"d3":"./d3.exports.js"}}</script> | ||
| <script>window.SW_HASH = 'sha384-jNrRb0RaME0Q+lz0/ITUhfnQBDj97uJPtmPXPc9rSfGvo79YnRebfKvL0rUyytDQ';</script> |
There was a problem hiding this comment.
Keep docs service-worker artifact in tree
The page still configures window.SW_HASH for service-worker.js, but this commit deletes docs/alpha_agi_insight_v1/service-worker.js, so the docs build no longer ships the worker it is wired to verify/register. That breaks service-worker-based caching in docs deployments and conflicts with existing docs checks that expect this file to exist.
Useful? React with 👍 / 👎.
Motivation
Description
bootstrap.jstoalpha_factory_v1/demos/alpha_agi_insight_v1/insight_browser_v1anddocs/alpha_agi_insight_v1to centralize toast implementation, service-worker registration, and demo globals (PINNER_TOKEN,OTEL_ENDPOINT,IPFS_GATEWAY,SW_HASH).index.htmlin both demo and docs to use localstyle.css, remove several CDN/inline scripts, inject theimportmap, setwindow.SW_HASH, and loadbootstrap.jsbefore the module bundle (insight.bundle.js).scripts/ensure_insight_csp.pyto support computing bothsha384andsha256hashes for inline script snippets, allow selecting the algorithm, and add a special-casesha256entry when animportmapis present so the generated CSP covers both hash algorithms used in the HTML.Testing
python3 scripts/ensure_insight_csp.pyagainstdocs/alpha_agi_insight_v1andalpha_factory_v1/demos/alpha_agi_insight_v1/insight_browser_v1, and the script completed successfully and updated the CSP meta tags.Codex Task