Why Nostr? What is Njump?
2023-12-30 12:32:03

no_name on Nostr: could this work? request some kind of instruction json from server it has ...

could this work?

request some kind of instruction json from server
it has instructions how to fetch preview for certain url

quick draft:

url for which we want to resolve #preview img: https://domain.ext/app.html#12345

let preview_instruction = await fetch("https://domain.ext/preview.json";)
let socket = new WebSocket(preview_instruction.url)

// we take parameter(s) from url hash and add these to preview instruction query
let preview_query = preview_instruction.query[preview_instruction.key] = 12345

socket.onopen = function(){
// send preview instruction query with dynamically populated parameters
this.send(preview_query)
}
socket.onmessage = function(e){
// we receive preview image data
let preview_img = JSON.parse(e.data)[preview_instruction.response_key])
}
here is a challenge for fellow #devs
solve link #previews in era of dynamic #webapps
do not rely on server
app is hosted in #ipfs. server is dump
Author Public Key
npub146y59dkatpwkx0ncs9u34vhmm60dedmdla0s8zy8yw22pqfj4huq36dp2y