Skip to content

Commit 5ecbc85

Browse files
committed
fix nonces in js
1 parent a3bf16d commit 5ecbc85

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sqlpage/sqlpage.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* !include https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/js/tabler.min.js */
22
/* !include https://cdn.jsdelivr.net/npm/list.js-fixed@2.3.4/dist/list.min.js */
33

4+
const nonce = document.currentScript.nonce;
5+
46
function sqlpage_card() {
57
for (const c of document.querySelectorAll("[data-pre-init=card]")) {
68
const source = c.dataset.embed;
@@ -43,7 +45,7 @@ function sqlpage_select_dropdown(){
4345
script.src= src;
4446
script.integrity = "sha384-aAqv9vleUwO75zAk1sGKd5VvRqXamBXwdxhtihEUPSeq1HtxwmZqQG/HxQnq7zaE";
4547
script.crossOrigin = "anonymous";
46-
script.nonce = document.currentScript.nonce;
48+
script.nonce = nonce;
4749
script.onload = sqlpage_select_dropdown;
4850
document.head.appendChild(script);
4951
return;
@@ -72,7 +74,7 @@ function sqlpage_map() {
7274
leaflet_js.src = "https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.js";
7375
leaflet_js.integrity = "sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=";
7476
leaflet_js.crossOrigin = "anonymous";
75-
leaflet_js.nonce = document.currentScript.nonce;
77+
leaflet_js.nonce = nonce;
7678
leaflet_js.onload = onLeafletLoad;
7779
document.head.appendChild(leaflet_js);
7880
is_leaflet_injected = true;

0 commit comments

Comments
 (0)