Skip to content

Commit

Permalink
Enabler to make scripts loaded from CDN more secure (#1127)
Browse files Browse the repository at this point in the history
* added integrity property to load scripts

* fix contribution
  • Loading branch information
gorootde authored Oct 25, 2024
1 parent 8acb112 commit e83f3eb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions web/components/panel_html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ function updateHeight() {
}
}
function loadJsByUrl(url) {
function loadJsByUrl(url,integrity=null) {
const script = document.createElement("script");
script.src = url;
if(integrity){
script.integrity=integrity;
script.crossorigin="anonymous";
}
return new Promise((resolve) => {
script.onload = resolve;
Expand All @@ -104,4 +109,4 @@ function loadJsByUrl(url) {
<body>
</body>
</html>`;
</html>`;

0 comments on commit e83f3eb

Please sign in to comment.