Trim zapper info to avoid wasting space

This commit is contained in:
Jonathan Staab 2023-03-14 15:46:55 -05:00
parent 1adc003a98
commit 96d8f148c2
4 changed files with 14 additions and 8 deletions

View File

@ -2,9 +2,7 @@
- [ ] Fix memory usage
- [x] Add table of user events, derive profile from this using `watch`.
- [ ] Remove petnames from users, retrieve lazily. Then, increase people table size
- [ ] Make zapper info more compact
- [ ] Move settings storage to an encrypted event https://github.com/nostr-protocol/nips/blob/master/78.md
- [x] Make zapper info more compact
- [ ] Migrate
- [ ] Test
- [ ] Test that relays/follows made as anon don't stomp user settings on login
@ -100,6 +98,7 @@
- [ ] Ability to leave/mute DM conversation
- [ ] Add notifications for chat messages
- [ ] Add encrypted settings storage using nostr events
- [ ] github.com/nostr-protocol/nips/blob/master/78.md
- [ ] Save DM/chat read status in encrypted note
- [ ] Relay recommendations based on follows/followers
- [ ] Pinned posts ala snort

View File

@ -14,7 +14,7 @@
import {timedelta, shuffle, now, sleep} from "src/util/misc"
import {displayPerson, isLike} from "src/util/nostr"
import cmd from "src/agent/cmd"
import {ready, onReady, relays} from "src/agent/tables"
import {onReady, relays} from "src/agent/tables"
import keys from "src/agent/keys"
import network from "src/agent/network"
import pool from "src/agent/pool"
@ -69,6 +69,7 @@
export let url = ""
let ready = false
let scrollY
const closeModal = async () => {
@ -115,7 +116,9 @@
})
onReady(() => {
initializeRelayList()
initializeRelayList().then(() => {
ready = true
})
if (user.getProfile()) {
loadAppData(user.getPubkey())
@ -169,7 +172,7 @@
<Router {url}>
<div use:links class="h-full">
{#if $ready}
{#if ready}
<div class="h-full pt-16 text-white lg:ml-56">
<Route path="/alerts" component={Alerts} />
<Route path="/search">

View File

@ -102,7 +102,11 @@ const verifyZapper = async (pubkey, address) => {
const lnurl = lnurlEncode("lnurl", url)
if (zapper?.allowsNostr && zapper?.nostrPubkey) {
updatePerson(pubkey, {zapper, lnurl})
updatePerson(pubkey, {
lnurl,
// Trim zapper so we don't have so much metadata filling up memory
zapper: pick(["callback", "maxSendable", "minSendable", "nostrPubkey"], zapper),
})
}
}

View File

@ -12,7 +12,7 @@ export const routes = new Table("routes", "id")
export const getPersonWithFallback = pubkey => people.get(pubkey) || {pubkey}
export const ready = derived(pluck("ready", Object.values(registry)), all(identity))
const ready = derived(pluck("ready", Object.values(registry)), all(identity))
export const onReady = cb => {
const unsub = ready.subscribe($ready => {