Fix relay server issues: images and URL display
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 `
|
||||
|
||||
Reference in New Issue
Block a user