From 561bcbe545edad67e1a6adb6795596fab88b9162 Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 9 Dec 2021 21:14:11 +0100 Subject: [PATCH] replace secureprivacy with onetrust --- ui/component/app/view.jsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ui/component/app/view.jsx b/ui/component/app/view.jsx index 5db8135dd..7463a6d03 100644 --- a/ui/component/app/view.jsx +++ b/ui/component/app/view.jsx @@ -359,8 +359,9 @@ function App(props: Props) { } }, []); - // add secure privacy script + // add OneTrust script useEffect(() => { + // don't add script for embedded content function inIframe() { try { return window.self !== window.top; @@ -378,6 +379,9 @@ function App(props: Props) { script.setAttribute('charset', 'UTF-8'); script.setAttribute('data-domain-script', 'af95e703-a783-4d6d-af3d-94365fdb3cbd-test'); + const secondScript = document.createElement('script'); + // OneTrust asks to add this + secondScript.innerHTML = 'function OptanonWrapper() { }'; const getLocaleEndpoint = 'https://api.odysee.com/locale/get'; let gdprRequired; @@ -390,9 +394,8 @@ function App(props: Props) { if (gdprRequired === 'true') { // $FlowFixMe document.head.appendChild(script); - - // OneTrust asks us to add this - function OptanonWrapper() { } + // $FlowFixMe + document.head.appendChild(secondScript); } // haven't done a gdpr check, do it now @@ -407,7 +410,7 @@ function App(props: Props) { // $FlowFixMe document.head.appendChild(script); // $FlowFixMe - document.head.appendChild(cmpScript); + document.head.appendChild(secondScript); // note we don't need gdpr, save to session } else if (gdprRequiredBasedOnLocation === false) { localStorage.setItem('gdprRequired', 'false'); @@ -420,7 +423,7 @@ function App(props: Props) { // $FlowFixMe document.head.removeChild(script); // $FlowFixMe - document.head.removeChild(cmpScript); + document.head.removeChild(secondScript); } catch (err) { console.log(err); }