Skip to content

Commit c7de3bf

Browse files
committed
Fix UI connectivity issues in v2.3.4
- Update iframe URLs to use relative paths for ingress compatibility - Add proxy server to route /chat and /terminal to correct services - Add http-proxy dependency for proxying - Fix WebSocket support for terminal
1 parent 3a883b1 commit c7de3bf

File tree

4 files changed

+52
-4
lines changed

4 files changed

+52
-4
lines changed

claude-home/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN ARCH="$(dpkg --print-architecture)" && \
3232
chmod +x /usr/local/bin/ttyd
3333

3434
# Install Claude Code globally - it just works on Debian!
35-
RUN npm install -g @anthropic-ai/claude-code http-server
35+
RUN npm install -g @anthropic-ai/claude-code http-server http-proxy
3636

3737
# Copy and install hass-mcp in a virtual environment
3838
COPY hass-mcp-lite /opt/hass-mcp

claude-home/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "Claude Home"
22
description: "AI-powered terminal and chat interface with Claude Code CLI"
3-
version: "2.3.3"
3+
version: "2.3.4"
44
slug: "claude_home"
55
init: false
66

claude-home/ui/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
<div class="container">
165165
<!-- Chat Panel -->
166166
<div class="chat-panel">
167-
<iframe id="chat-frame" src="http://localhost:3000" title="Chat Interface">
167+
<iframe id="chat-frame" src="/chat" title="Chat Interface">
168168
<div class="loading">Loading chat...</div>
169169
</iframe>
170170
<button class="toggle-terminal" onclick="toggleTerminal()" title="Open Terminal">
@@ -178,7 +178,7 @@
178178
<!-- Terminal Panel -->
179179
<div class="terminal-panel" id="terminal-panel">
180180
<button class="close-terminal" onclick="toggleTerminal()" style="display:none;"></button>
181-
<iframe id="terminal-frame" src="http://localhost:7681" title="Terminal Interface">
181+
<iframe id="terminal-frame" src="/terminal" title="Terminal Interface">
182182
<div class="loading">Loading terminal...</div>
183183
</iframe>
184184
</div>

claude-home/ui/server.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
const http = require('http');
2+
const httpProxy = require('http-proxy');
23
const fs = require('fs');
34
const path = require('path');
45

56
const PORT = 8080;
67

8+
// Create proxy instances
9+
const chatProxy = httpProxy.createProxyServer({target: 'http://localhost:3000'});
10+
const terminalProxy = httpProxy.createProxyServer({target: 'http://localhost:7681', ws: true});
11+
const gatewayProxy = httpProxy.createProxyServer({target: 'http://localhost:8001'});
12+
713
const server = http.createServer((req, res) => {
14+
// Route based on path
815
if (req.url === '/' || req.url === '/index.html') {
16+
// Serve the main UI
917
fs.readFile(path.join(__dirname, 'index.html'), (err, data) => {
1018
if (err) {
1119
res.writeHead(500);
@@ -15,12 +23,52 @@ const server = http.createServer((req, res) => {
1523
res.writeHead(200, {'Content-Type': 'text/html'});
1624
res.end(data);
1725
});
26+
} else if (req.url.startsWith('/chat')) {
27+
// Proxy to Anse chat UI
28+
chatProxy.web(req, res, {}, (err) => {
29+
console.error('Chat proxy error:', err);
30+
res.writeHead(502);
31+
res.end('Chat service unavailable');
32+
});
33+
} else if (req.url.startsWith('/terminal')) {
34+
// Proxy to ttyd terminal
35+
terminalProxy.web(req, res, {}, (err) => {
36+
console.error('Terminal proxy error:', err);
37+
res.writeHead(502);
38+
res.end('Terminal service unavailable');
39+
});
40+
} else if (req.url.startsWith('/v1/')) {
41+
// Proxy to gateway API
42+
gatewayProxy.web(req, res, {}, (err) => {
43+
console.error('Gateway proxy error:', err);
44+
res.writeHead(502);
45+
res.end('Gateway service unavailable');
46+
});
1847
} else {
1948
res.writeHead(404);
2049
res.end('Not found');
2150
}
2251
});
2352

53+
// Handle WebSocket upgrade for terminal
54+
server.on('upgrade', (req, socket, head) => {
55+
if (req.url.startsWith('/terminal')) {
56+
terminalProxy.ws(req, socket, head, {}, (err) => {
57+
console.error('Terminal WebSocket error:', err);
58+
socket.destroy();
59+
});
60+
}
61+
});
62+
63+
// Error handling
64+
chatProxy.on('error', (err) => console.error('Chat proxy error:', err));
65+
terminalProxy.on('error', (err) => console.error('Terminal proxy error:', err));
66+
gatewayProxy.on('error', (err) => console.error('Gateway proxy error:', err));
67+
2468
server.listen(PORT, '0.0.0.0', () => {
2569
console.log(`Responsive UI server running on port ${PORT}`);
70+
console.log('Proxying:');
71+
console.log(' /chat -> localhost:3000 (Anse)');
72+
console.log(' /terminal -> localhost:7681 (ttyd)');
73+
console.log(' /v1/* -> localhost:8001 (Gateway)');
2674
});

0 commit comments

Comments
 (0)