Skip to content

Commit 8312551

Browse files
committed
Write window.__CSP_NONCE__ to index.html
1 parent efddd8a commit 8312551

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/qwc2_viewer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ def qwc2_index(self, identity, params, request_url):
223223
viewer_index = viewer_index.replace('<head>', '<head>\n<meta http-equiv="Content-Security-Policy" content="%s">' % csp)
224224
viewer_index = viewer_index.replace('<script ', '<script nonce="%s" ' % nonce)
225225
viewer_index = viewer_index.replace('<script>', '<script nonce="%s">' % nonce)
226+
viewer_index = viewer_index.replace('</head>', '<script nonce="%s">window.__CSP_NONCE__ = "%s";</script>\n</head>' % (nonce, nonce))
226227

227228
return viewer_index
228229

0 commit comments

Comments
 (0)