From b255b5d701004769bfdca4e1b729f3e0472bd947 Mon Sep 17 00:00:00 2001 From: Justin Ribeiro Date: Thu, 21 Jul 2022 16:47:16 -0700 Subject: [PATCH] feat(csp): add support for csp nonce to inline style (#68) --- lite-youtube.ts | 9 ++++++++- test/lite-youtube.test.ts | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lite-youtube.ts b/lite-youtube.ts index 48b75d8..f2db6f5 100644 --- a/lite-youtube.ts +++ b/lite-youtube.ts @@ -111,8 +111,12 @@ export class LiteYTEmbed extends HTMLElement { */ private setupDom(): void { const shadowDom = this.attachShadow({ mode: 'open' }); + let nonce = ''; + if (window.liteYouTubeNonce) { + nonce = `nonce="${window.liteYouTubeNonce}"`; + } shadowDom.innerHTML = ` -