bug: fetch zapper when indexedDb is not available

This commit is contained in:
Kieran 2023-03-06 10:10:52 +00:00
parent 5f0bd9699f
commit 840e2ff400
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
1 changed files with 13 additions and 12 deletions

View File

@ -98,20 +98,21 @@ export class UserProfileCache {
const existing = this.get(m.pubkey);
const refresh = existing && existing.created === m.created && existing.loaded < m.loaded;
if (!existing || existing.created < m.created || refresh) {
// fetch zapper key
const lnurl = m.lud16 || m.lud06;
if (lnurl) {
try {
const svc = new LNURL(lnurl);
await svc.load();
m.zapService = svc.zapperPubkey;
} catch {
console.debug("Failed to load LNURL for zapper pubkey", lnurl);
}
// ignored
}
this.#cache.set(m.pubkey, m);
if (db.ready) {
// fetch zapper key
const lnurl = m.lud16 || m.lud06;
if (lnurl) {
try {
const svc = new LNURL(lnurl);
await svc.load();
m.zapService = svc.zapperPubkey;
} catch {
console.debug("Failed to load LNURL for zapper pubkey", lnurl);
}
// ignored
}
await db.users.put(m);
this.#diskCache.add(m.pubkey);
}