diff options
author | Sebastian <sebasjm@gmail.com> | 2022-06-09 16:11:49 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-06-09 16:12:18 -0300 |
commit | 3ebb1d18154375471e329f2bad40534d858cbe1e (patch) | |
tree | 5a7e5d14eb03c88eddbe0d61afa4ee1335768d65 /packages/anastasis-webui/html | |
parent | 78b056a0b1613ef19d1d72c17fd256c2e86e6774 (diff) | |
download | wallet-core-3ebb1d18154375471e329f2bad40534d858cbe1e.tar.xz |
better select secret screen
Diffstat (limited to 'packages/anastasis-webui/html')
-rw-r--r-- | packages/anastasis-webui/html/ui-dev.html | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/packages/anastasis-webui/html/ui-dev.html b/packages/anastasis-webui/html/ui-dev.html index 4cc36268e..5b1dd31cf 100644 --- a/packages/anastasis-webui/html/ui-dev.html +++ b/packages/anastasis-webui/html/ui-dev.html @@ -23,13 +23,13 @@ <body> <div id="container" class="anastasis-container"></div> - <script type="application/javascript"> + <script id="code" type="application/javascript"> ANASTASIS_SCRIPT_CONTENT; </script> <script type="application/javascript"> - function setupLiveReload(port) { - const socketPath = `ws://localhost:${port}/socket`; - + function setupLiveReload() { + const socketPath = `ws://localhost:8003/socket`; + console.log("connecting to ", socketPath) const ws = new WebSocket(socketPath); ws.onmessage = (message) => { const event = JSON.parse(message.data); @@ -39,12 +39,27 @@ if (event.type === "RELOAD") { window.location.reload(); } + if (event.type === "UPDATE") { + document.body.removeChild(document.getElementById("container")) + const d = document.createElement('div') + d.setAttribute('id',"container") + d.setAttribute('class',"anastasis-container"); + document.body.appendChild(d) + const s = document.createElement('script') + s.setAttribute('id',"code") + s.setAttribute('type',"application/javascript"); + s.textContent = atob(event.content) + document.body.appendChild(s) + } }; ws.onerror = (error) => { console.error(error); }; + ws.onclose = (e) => { + setTimeout(setupLiveReload, 500) + }; } - setupLiveReload(8003); + setupLiveReload(); </script> </body> </html> |