forked from
microcosm.blue/microcosm-rs
Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
1<!doctype html>
2<html>
3 <head>
4 <style>
5 body {
6 background: #333;
7 color: #ccc;
8 font-family: sans-serif;
9 }
10 </style>
11 </head>
12
13 <body>
14 <h1>hey <span id="who"></span></h1>
15 <p><code id="jwt"></code></p>
16
17 <iframe src="http://127.0.0.1:9997/prompt" id="whoami" style="border: none" height="160" width="320"></iframe>
18
19 <script type="text/javascript">
20 (whoami => {
21 const handleMessage = ev => {
22 if (ev.source !== whoami.contentWindow) {
23 // TODO: ALSO CHECK ev.origin!!!!
24 console.log('nah');
25 return;
26 }
27 whoami.remove();
28 window.removeEventListener('message', handleMessage);
29
30 document.getElementById('who').textContent = ev.data.handle;
31 document.getElementById('jwt').textContent = ev.data.token;
32 }
33 window.addEventListener('message', handleMessage);
34 })(document.getElementById('whoami'));
35 </script>
36 </body>
37</html>