diff --git a/meshchatx/src/frontend/components/messages/MessagesPage.vue b/meshchatx/src/frontend/components/messages/MessagesPage.vue index d16c6da..27339e5 100644 --- a/meshchatx/src/frontend/components/messages/MessagesPage.vue +++ b/meshchatx/src/frontend/components/messages/MessagesPage.vue @@ -15,6 +15,7 @@ @peer-click="onPeerClick" @conversation-search-changed="onConversationSearchChanged" @conversation-filter-changed="onConversationFilterChanged" + @ingest-paper-message="openIngestPaperMessageModal" />
+ + +
+
+
+

Ingest Paper Message

+ +
+
+

+ You can read LXMF paper messages by scanning a QR code or pasting an lxmf:// or + lxm:// link. +

+
+
+ +
+ + +
+
+ +
+
+
+
@@ -41,6 +102,7 @@ import ConversationViewer from "./ConversationViewer.vue"; import GlobalState from "../../js/GlobalState"; import DialogUtils from "../../js/DialogUtils"; import GlobalEmitter from "../../js/GlobalEmitter"; +import ToastUtils from "../../js/ToastUtils"; export default { name: "MessagesPage", @@ -72,6 +134,9 @@ export default { filterFailedOnly: false, filterHasAttachmentsOnly: false, isLoadingConversations: false, + + isIngestModalOpen: false, + ingestUri: "", }; }, computed: { @@ -190,6 +255,19 @@ export default { await this.getConversations(); break; } + case "lxm.ingest_uri.result": { + if (json.status === "success") { + ToastUtils.success(json.message); + await this.getConversations(); + } else if (json.status === "error") { + ToastUtils.error(json.message); + } else if (json.status === "warning") { + ToastUtils.warning(json.message); + } else { + ToastUtils.info(json.message); + } + break; + } } }, async getLxmfDeliveryAnnounces() { @@ -328,6 +406,32 @@ export default { } this.requestConversationsRefresh(); }, + openIngestPaperMessageModal() { + this.ingestUri = ""; + this.isIngestModalOpen = true; + }, + async pasteFromClipboard() { + try { + this.ingestUri = await navigator.clipboard.readText(); + } catch { + ToastUtils.error("Failed to read from clipboard"); + } + }, + async ingestPaperMessage() { + if (!this.ingestUri) return; + + try { + WebSocketConnection.send( + JSON.stringify({ + type: "lxm.ingest_uri", + uri: this.ingestUri, + }) + ); + this.isIngestModalOpen = false; + } catch { + ToastUtils.error("Failed to send ingest request"); + } + }, getHashPopoutValue() { const hash = window.location.hash || ""; const match = hash.match(/popout=([^&]+)/);