Why Nostr? What is Njump?
2023-12-31 12:07:59

no_name on Nostr: #nip95 in 19 lines of html + js: ```js <html> <body> <img/> <script> let socket = new ...

#nip95 in 19 lines of html + js:

```js
<html>
<body>
<img/>
<script>
let socket = new WebSocket("wss://relay.nostr.band")

socket.onopen = function(){
this.send(JSON.stringify(["REQ", "q", {"ids": [location.hash.substring(1)]}]))
}

socket.onmessage = function(msg){
socket.close()
const evt = JSON.parse(msg.data)[2]
const mime = (evt.tags.find(t => t[0] == "type")[1])
document.querySelector("img").src = "data:" + mime + ";base64," + evt.content
}
</script>
</body>
</html>
```
Author Public Key
npub146y59dkatpwkx0ncs9u34vhmm60dedmdla0s8zy8yw22pqfj4huq36dp2y