// TEMPORARY TEST FILE TO DELETE! /* HOW IT WORKS: ........_______________. APP -> | SECURE RENDER | <-> DATA ........---------------. The app ONLY feeds *in* view logic. Secure Render NEVER sends back or up. */ ;(function(){ var i = document.createElement('iframe'); i.style = "position: fixed; border: 0; width: 100%; height: 100%; top: 0; left: 0; right: 0; bottom: 0;"; function sub(msg){ i.contentWindow.postMessage(msg, '*') } i.onload = function(){ sub({rpc: 'html', put: html}) } i.sandbox = 'allow-scripts'; i.csp = "default-src 'unsafe-inline'; img-src data:;"; i.srcdoc = "<!DOCTYPE html><div id='securerender'></div><script>"+(function(){ window.R = "SecureRender1"; console.log("IN", window.R, location, self.crossOriginIsolated, 'SEA?', window.SEA, '------------', window.parent.frames, 'COOKIES!', document.cookies); document.cookies = "A=1;"; window.onmessage = function(e){ var msg = e.data; if(!msg){ return } console.log("from parent:", msg); securerender.innerHTML = msg.put; }; setInterval(function(){ console.log("ping", window.R); }, 1000); }+'').slice(11,-1)+"</script>"; var html = document.body.innerHTML; document.body.innerHTML = ""; document.body.appendChild(i); window.i = i; ;(async function go(){ return; console.log("go"); if(!window.GUN){ return load('http://localhost:8765/gun.js',go) } window.gun = GUN('http://localhost:8765/gun'); gun.get('test').map().once(function(data){ if("data:" !== data.slice(0,5)){ return } //console.log("base64", data); //sub({rpc: 'html', put: "<img src='"+data+"'>"}) }) }()); function load(src, cb){ var script = document.createElement('script'); script.onload = cb; script.src = src; document.head.appendChild(script); } }());