Inline intent doc when fetching an intent index.html#4853
Open
zatteo wants to merge 3 commits into
Open
Conversation
zatteo
force-pushed
the
feat/inline-intent
branch
from
July 16, 2026 13:01
e3283ea to
82aa654
Compare
zatteo
requested review from
shepilov and
taratatach
and removed request for
shepilov
July 16, 2026 13:02
shepilov
reviewed
Jul 16, 2026
| )) | ||
|
|
||
| intentTemplate = template.Must(template.New("intent-data").Parse( | ||
| `<script>window.__COZY_INTENT__ = JSON.parse({{.}})</script>`, |
Member
There was a problem hiding this comment.
Have you tested it locally? It's supposed to be blocked by CSP
Member
Author
There was a problem hiding this comment.
Oh interesting. I tested locally but by default I use --disable-csp. So in this case I can add it in a meta tag that will be fetched in the DOM and parsed like existing CozyData.
Member
There was a problem hiding this comment.
<script type="application/json"> shoudl help
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Eliminate the
GET /intents/:idfetch request that the intent service app (inside the iframe) makes to the stack, by inlining the full intent object into the HTML response when the stack serves the service app'sindex.html.The stack already loads the intent from CouchDB in
handleIntent()when serving a page with?intent=<id>but currently discards it after setting CSPframe-ancestorsrules. This change keeps the loaded intent and serializesit into a
<script>tag in the<head>, so the service app can read it synchronously fromwindow.__COZY_INTENT__instead of making a second network round-trip.Estimated save: 1 blocking API call, 233ms (average of 5 call on stg.lin-saas.com)
Front end: github.com/linagora/cozy-libs/pull/3082