add kinds

This commit is contained in:
Melvin Carvalho
2024-05-28 21:01:32 +02:00
parent e15ccf5cb1
commit 3aa73d1321

View File

@@ -1,5 +1,5 @@
; (() => {
globalThis.qs = Object.fromEntries(new URLSearchParams(document.location.search))
(() => {
globalThis.qs = Object.fromEntries(new URLSearchParams(document.location.search).entries())
const t = qs.t || 5
@@ -16,7 +16,8 @@
filter.authors = [qs.pubkey]
}
if (qs.kind) {
filter.kinds = [parseInt(qs.kind)]
const kinds = Array.isArray(qs.kind) ? qs.kind : [qs.kind]
filter.kinds = kinds.map(kind => parseInt(kind))
}
let subscribe = JSON.stringify(['REQ', 'tail', filter])
@@ -26,18 +27,18 @@
}
console.log(subscribe)
socket.send(subscribe)
}
};
socket.onmessage = function (event) {
const json = JSON.parse(event?.data)
if (json[0] === 'EOSE') {
console.log('EOSE')
return
return;
}
console.log('refreshing in', t)
setTimeout(() => {
document.location.reload()
}, t * 1000)
}
};
}
}
)()
})()