mirror of
https://github.com/styppo/hamstr.git
synced 2024-10-18 05:23:28 +00:00
Fix initial message decryption
This commit is contained in:
parent
0d9673ad3f
commit
02f0a13f2b
@ -17,10 +17,6 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
sent: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
@ -44,7 +40,9 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
async decrypt() {
|
async decrypt() {
|
||||||
try {
|
try {
|
||||||
const counterparty = this.sent ? this.message.recipient : this.message.author
|
const counterparty = this.message.author === this.app.myPubkey
|
||||||
|
? this.message.recipient
|
||||||
|
: this.message.author
|
||||||
this.plaintext = await this.app.decryptMessage(counterparty, this.message.content)
|
this.plaintext = await this.app.decryptMessage(counterparty, this.message.content)
|
||||||
this.message.cachePlaintext(this.plaintext)
|
this.message.cachePlaintext(this.plaintext)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -158,6 +158,13 @@ export const useNostrStore = defineStore('nostr', {
|
|||||||
limit: 50,
|
limit: 50,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Fetch our messages once.
|
||||||
|
this.fetch({
|
||||||
|
kinds: [EventKind.DM],
|
||||||
|
authors: [pubkey],
|
||||||
|
limit: 500,
|
||||||
|
})
|
||||||
|
|
||||||
const subs = []
|
const subs = []
|
||||||
|
|
||||||
// Subscribe to events created by us.
|
// Subscribe to events created by us.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
:sent="message.author === app.myPubkey"
|
:sent="message.author === app.myPubkey"
|
||||||
:stamp="formatMessageDate(message.createdAt)"
|
:stamp="formatMessageDate(message.createdAt)"
|
||||||
>
|
>
|
||||||
<EncryptedMessage :message="message" :sent="message.author === app.myPubkey" />
|
<EncryptedMessage :message="message" />
|
||||||
</q-chat-message>
|
</q-chat-message>
|
||||||
<p v-if="!conversation?.length" class="placeholder">
|
<p v-if="!conversation?.length" class="placeholder">
|
||||||
This is the beginning of your message history with <UserName :pubkey="counterparty" clickable />.
|
This is the beginning of your message history with <UserName :pubkey="counterparty" clickable />.
|
||||||
|
Loading…
Reference in New Issue
Block a user