save your own notes locally when they're received from relays.

this is useful to keep a local backup of notes you may have published
from other clients in your main client (or even doing a light syncing-
backup strategy for your own notes by using the same key in multiple
clients).
This commit is contained in:
fiatjaf 2020-12-30 00:09:01 -03:00
parent 1ae23c9c20
commit f2f2b6a066
2 changed files with 5 additions and 1 deletions

View File

@ -63,6 +63,10 @@ export default {
}
break
case KIND_TEXTNOTE:
if (event.pubkey === store.getters.pubKeyHex) {
db.mynotes.put(event)
}
store.commit('receivedTextNote', {event, context})
break
case KIND_RECOMMENDSERVER:

View File

@ -2,7 +2,7 @@
import {pubkeyFromPrivate} from './helpers'
import {db} from './globals'
import {CONTEXT_REQUESTED, CONTEXT_NOW, CONTEXT_PAST} from './constants'
import {CONTEXT_REQUESTED} from './constants'
export default {
setInit(state, {relays, following, home, metadata, petnames}) {