From 59254383ad93c312538da25a00ba4f3aa37945a4 Mon Sep 17 00:00:00 2001 From: jknapp Date: Mon, 5 Jan 2026 20:42:45 -0800 Subject: [PATCH] Fix relay server issues: images and URL display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Images not showing through relay: - Use getApiUrl() for image paths in relay mode - Add password as query param for img tags (can't use headers) 2. URL not updating in desktop app: - Set _connected=True before on_session_id callback fires - Ensures update_ip_label() shows relay URL immediately 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- relay_client.py | 2 ++ web/js/app.js | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/relay_client.py b/relay_client.py index 4ce4677..af1935e 100644 --- a/relay_client.py +++ b/relay_client.py @@ -141,6 +141,8 @@ class RelayClient: if response.get("type") == "auth_response": if response.get("success"): + # Mark as connected before callbacks so update_ip_label works + self._connected = True new_session_id = response.get("sessionId") if new_session_id and new_session_id != self.session_id: self.session_id = new_session_id diff --git a/web/js/app.js b/web/js/app.js index c7fbbd5..b20f7bf 100644 --- a/web/js/app.js +++ b/web/js/app.js @@ -308,9 +308,16 @@ class MacroPadApp { } container.innerHTML = macroEntries.map(([id, macro]) => { - const imageSrc = macro.image_path - ? `/api/image/${macro.image_path}` - : null; + let imageSrc = null; + if (macro.image_path) { + const basePath = this.getApiUrl(`/api/image/${macro.image_path}`); + // Add password as query param for relay mode (img tags can't use headers) + if (this.relayMode && this.password) { + imageSrc = `${basePath}?password=${encodeURIComponent(this.password)}`; + } else { + imageSrc = basePath; + } + } const firstChar = macro.name.charAt(0).toUpperCase(); return `