From eccac69f7f1207861b898dd6f7e3fdf123254cb5 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Mon, 3 Jul 2023 17:38:44 +0300 Subject: [PATCH] feat: show raw message data --- .../direct-messages/direct-messages.html | 15 +++++++++--- .../direct-messages/direct-messages.js | 24 ++++++++++++------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/static/components/direct-messages/direct-messages.html b/static/components/direct-messages/direct-messages.html index b307783..9e6e6f8 100644 --- a/static/components/direct-messages/direct-messages.html +++ b/static/components/direct-messages/direct-messages.html @@ -57,9 +57,8 @@
-
- -
+ ... + @@ -88,5 +87,15 @@ + + + +
+ + Close +
+ +
+
\ No newline at end of file diff --git a/static/components/direct-messages/direct-messages.js b/static/components/direct-messages/direct-messages.js index 6fc8043..3248838 100644 --- a/static/components/direct-messages/direct-messages.js +++ b/static/components/direct-messages/direct-messages.js @@ -14,7 +14,7 @@ async function directMessages(path) { } }, computed: { - messagesAsJson: function() { + messagesAsJson: function () { return this.messages.map(m => { try { return { @@ -40,11 +40,13 @@ async function directMessages(path) { messages: [], newMessage: '', showAddPublicKey: false, - newPublicKey: null + newPublicKey: null, + showRawMessage: false, + rawMessage: null, } }, methods: { - sendMessage: async function () {}, + sendMessage: async function () { }, buildCustomerLabel: function (c) { let label = `${c.profile.name || 'unknown'} ${c.profile.about || ''}` if (c.unread_messages) { @@ -61,7 +63,7 @@ async function directMessages(path) { return } try { - const {data} = await LNbits.api.request( + const { data } = await LNbits.api.request( 'GET', '/nostrmarket/api/v1/message/' + pubkey, this.inkey @@ -75,7 +77,7 @@ async function directMessages(path) { }, getCustomers: async function () { try { - const {data} = await LNbits.api.request( + const { data } = await LNbits.api.request( 'GET', '/nostrmarket/api/v1/customer', this.inkey @@ -86,10 +88,10 @@ async function directMessages(path) { LNbits.utils.notifyApiError(error) } }, - + sendDirectMesage: async function () { try { - const {data} = await LNbits.api.request( + const { data } = await LNbits.api.request( 'POST', '/nostrmarket/api/v1/message', this.adminkey, @@ -105,9 +107,9 @@ async function directMessages(path) { LNbits.utils.notifyApiError(error) } }, - addPublicKey: async function(){ + addPublicKey: async function () { try { - const {data} = await LNbits.api.request( + const { data } = await LNbits.api.request( 'POST', '/nostrmarket/api/v1/customer', this.adminkey, @@ -141,6 +143,10 @@ async function directMessages(path) { await this.getDirectMessages(this.activePublicKey) await this.getCustomers() }, + showMessageRawData: function (index) { + this.rawMessage = this.messages[index]?.message + this.showRawMessage = true + }, focusOnChatBox: function (index) { setTimeout(() => { const lastChatBox = document.getElementsByClassName(