Fix huge qr codes for profile sharing

This commit is contained in:
Jonathan Staab 2023-05-08 14:04:30 -07:00
parent 31b9f1ffde
commit c7b18d2531
3 changed files with 17 additions and 12 deletions

View File

@ -1,5 +1,6 @@
# Current
- [ ] Mentions don't show up in notifications
- [ ] Fix relay recommendations
- [ ] Preview note1
- [ ] Pagination is slow. Maybe load with no window first, then add since?

View File

@ -251,20 +251,24 @@ addHandler(
30078,
profileHandler("last_checked", async (e, p) => {
if (Tags.from(e).getMeta("d") === "coracle/last_checked/v1") {
const payload = await keys.decryptJson(e.content)
const updates = {}
for (const k of Object.keys(payload).concat(p.last_checked)) {
const v = Math.max(payload[k] || 0, p.last_checked[k] || 0)
try {
const payload = await keys.decryptJson(e.content)
const updates = {}
for (const k of Object.keys(payload).concat(p.last_checked)) {
const v = Math.max(payload[k] || 0, p.last_checked[k] || 0)
// A bunch of junk got added to this setting. Integer keys, settings, etc
if (isNaN(v) || v < 1577836800) {
continue
// A bunch of junk got added to this setting. Integer keys, settings, etc
if (isNaN(v) || v < 1577836800) {
continue
}
updates[k] = v
}
updates[k] = v
return updates
} catch (e) {
// pass
}
return updates
}
})
)

View File

@ -8,11 +8,11 @@
export let person
const {pubkey} = person
const relays = pluck("url", getPubkeyWriteRelays(pubkey))
const relays = pluck("url", getPubkeyWriteRelays(pubkey).slice(0, 5))
const nprofile = nip19.nprofileEncode({pubkey, relays})
</script>
<Content size="lg">
<QRCode code={nprofile} />
<QRCode code={`https://coracle.social/${nprofile}`} />
<div class="text-center text-gray-1">Copy or scan from a nostr app to share this profile.</div>
</Content>