From 8da806fb7f62d4e7c3c52866a1d9f0ceeedc5a73 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Mon, 6 May 2024 00:43:25 +1200 Subject: [PATCH] start implementing nomadnet node page browser --- public/index.html | 468 ++++++++++++++++++++++++++-------------------- 1 file changed, 266 insertions(+), 202 deletions(-) diff --git a/public/index.html b/public/index.html index 0f052c8..9011e9c 100644 --- a/public/index.html +++ b/public/index.html @@ -209,34 +209,256 @@
- -
+ + + + +
+ + + + +
+ + +
+
{{ selectedNode.name }}
+
@<{{ selectedNode.destination_hash }}>
+
+ -
-
+
+
@@ -249,192 +471,18 @@
- -
-
-
+ +
+ NAV BAR +
- -
{{ selectedPeer.name }}
- - -
- -
- - -
{{ chatItem.lxmf_message.content }}
- - -
- -
- - - - -
- - -
- - - - -
- -
- - -
-
- - -
- {{ chatItem.lxmf_message.state }} - {{ chatItem.lxmf_message.progress.toFixed(0) }}% -
- - -
- - - -
- - -
- - - -
- - -
- - - -
- -
-
- -
+ +
+
+ {{ nodePageContent }}
- -
-
- - -
- - -
-
- - - - - -
-
-
- - - -
-
-
- - -
-
{{ formatBytes(newMessageImage.size) }}
-
- -
-
- - -
-
-
-
- {{ file.name }} - {{ formatBytes(file.size) }} -
-
- - - -
-
-
-
- - - - - -
- - - - - - - - - - -
- -
- -
-
- -
- - -
-
- - - -
-
No Active Chat
-
Select a Peer to start chatting!
@@ -478,6 +526,8 @@ lxmfMessagesRequestSequence: 0, chatItems: [], + nodePageContent: null, + nomadnetPageDownloadCallbacks: {}, nomadnetFileDownloadCallbacks: {}, @@ -780,7 +830,7 @@ "display_name": this.displayName, }); }, - async downloadNomadNetFile(destinationHash, filePath, onSuccessCallback, onFailureCallback, onProgressCallback) { + downloadNomadNetFile(destinationHash, filePath, onSuccessCallback, onFailureCallback, onProgressCallback) { // do nothing if not connected to websocket if(!this.isWebsocketConnected){ @@ -811,7 +861,7 @@ } }, - async downloadNomadNetPage(destinationHash, pagePath, onSuccessCallback, onFailureCallback, onProgressCallback) { + downloadNomadNetPage(destinationHash, pagePath, onSuccessCallback, onFailureCallback, onProgressCallback) { // do nothing if not connected to websocket if(!this.isWebsocketConnected){ @@ -948,6 +998,19 @@ // do nothing if failed to load messages } }, + async loadNodeIndexPage(node) { + this.nodePageContent = "Requesting page: /page/index.mu"; + this.downloadNomadNetPage(node.destination_hash, "/page/index.mu", (pageContent) => { + console.log("pageContent", pageContent); + this.nodePageContent = pageContent; + }, (failureReason) => { + console.log("failureReason", failureReason); + this.nodePageContent = `Failed loading page: ${failureReason}`; + }, (progress) => { + console.log("progress", progress); + this.nodePageContent = `Loading page: ${progress}`; + }); + }, async deleteChatItem(chatItem) { try { @@ -1012,6 +1075,7 @@ onNodeClick: function(node) { this.selectedPeer = null; this.selectedNode = node; + this.loadNodeIndexPage(node); }, parseSeconds: function(secondsToFormat) { secondsToFormat = Number(secondsToFormat);