Skip to content

Commit

Permalink
add an exception if the csp met tag is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
pomdtr committed Dec 7, 2023
1 parent 2673e64 commit 5e660fd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ async function main() {
if (params.has("port")) {
const portNumber = params.get("port")
const csp = document.getElementById("CSP")
csp?.setAttribute("content", `default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self' ws://localhost:${portNumber} http://localhost:${portNumber}`)
if (!csp) {
throw new Error("CSP meta tag not found")
}
csp.setAttribute("content", `default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self' ws://localhost:${portNumber} http://localhost:${portNumber}`)
origin = new URL(`http://localhost:${portNumber}`)
} else if (__TWEETY_ORIGIN__) {
origin = new URL(__TWEETY_ORIGIN__)
Expand Down

0 comments on commit 5e660fd

Please sign in to comment.