From 694e55befcf398d6b2806a723f72751c138bfec9 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sun, 3 May 2026 22:00:43 -0500 Subject: [PATCH] refactor(NomadNetworkPage): improve logic for determining .mu page rendering and update related tests --- .../nomadnetwork/NomadNetworkPage.vue | 20 ++++++++++++++----- tests/frontend/NomadNetworkPage.test.js | 13 ++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/meshchatx/src/frontend/components/nomadnetwork/NomadNetworkPage.vue b/meshchatx/src/frontend/components/nomadnetwork/NomadNetworkPage.vue index 57fecb8..3140a42 100644 --- a/meshchatx/src/frontend/components/nomadnetwork/NomadNetworkPage.vue +++ b/meshchatx/src/frontend/components/nomadnetwork/NomadNetworkPage.vue @@ -151,7 +151,7 @@
GlobalState.config?.nomad_micron_default_engine, () => { - if (this.nodePageContent && this.nodePagePath && this.nodePagePath.toLowerCase().endsWith(".mu")) { + if (this.nodePageContent && this.nodePagePathIsMicronMu) { const content = this.nodePageContent; this.nodePageContent = null; this.$nextTick(() => { @@ -1010,7 +1020,7 @@ export default { try { const cfg = await patchServerConfig({ nomad_micron_default_engine: next }, window.api); mergeGlobalConfig(cfg); - if (this.nodePageContent && this.nodePagePath && this.nodePagePath.toLowerCase().endsWith(".mu")) { + if (this.nodePageContent && this.nodePagePathIsMicronMu) { const content = this.nodePageContent; this.nodePageContent = null; this.$nextTick(() => { diff --git a/tests/frontend/NomadNetworkPage.test.js b/tests/frontend/NomadNetworkPage.test.js index 93407a9..0a23bce 100644 --- a/tests/frontend/NomadNetworkPage.test.js +++ b/tests/frontend/NomadNetworkPage.test.js @@ -180,6 +180,19 @@ describe("NomadNetworkPage.vue", () => { }); expect(wrapper.vm.showMicronRendererInMobileMenu).toBe(false); }); + + it("is true on .mu page when URL has Nomad data suffix after backtick", async () => { + const dest = "e".repeat(32); + const wrapper = mountNomadNetworkPage(); + await wrapper.setData({ + wasmBundled: true, + selectedNode: { destination_hash: dest, display_name: "N" }, + nodePagePath: `${dest}:/page/repo.mu\`g=reticulum|r=nomadnet`, + isShowingNodePageSource: false, + }); + expect(wrapper.vm.nodePagePathIsMicronMu).toBe(true); + expect(wrapper.vm.showMicronRendererInMobileMenu).toBe(true); + }); }); describe("partials", () => {