00fc7d6d81
Problem: ttyd auf :7682 war von aussen per ufw geblockt (nur 7681/9001 offen), also im Browser Timeout — und ufw oeffnen braucht sudo, das MC2 hier nicht passwortlos hat. Fix: ttyd bindet jetzt NUR an Loopback (--interface lo, --base-path /console) und wird von MC2 ueber den ohnehin offenen Port 9001 same-origin durchgereicht: - routers/console.py: HTTP-Passthrough (index/token) + WebSocket-Bridge (tty-Subprotokoll auf beiden Seiten) → /console/ + /console/ws. - app.py: console.router VOR dem SPA-Catch-all eingehaengt. - config: BOX_CONSOLE_UPSTREAM (127.0.0.1:7682) + BOX_CONSOLE_PATH (/console/); agent_status liefert box_console_url=/console/ + reachable=Upstream-Check. - deploy/box-console.service: --interface lo --base-path /console. - vite: /console (ws:true) fuer die Dev-Vorschau geproxyt. Kein Firewall-/sudo-Eingriff noetig; Konsole laeuft same-origin zum Dashboard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
21 lines
757 B
TypeScript
21 lines
757 B
TypeScript
import { defineConfig } from "vite"
|
|
import react from "@vitejs/plugin-react"
|
|
import tailwindcss from "@tailwindcss/vite"
|
|
import path from "node:path"
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: {
|
|
alias: { "@": path.resolve(__dirname, "./src") },
|
|
},
|
|
server: {
|
|
proxy: {
|
|
// Dev: /api → FastAPI-Backend (Override via MC_API_TARGET, z.B. die Box)
|
|
"/api": { target: process.env.MC_API_TARGET || "http://127.0.0.1:9000", changeOrigin: true },
|
|
// Box-Konsole (ttyd) läuft same-origin über den MC2-Reverse-Proxy (/console/ + /console/ws).
|
|
"/console": { target: process.env.MC_API_TARGET || "http://127.0.0.1:9000", changeOrigin: true, ws: true },
|
|
},
|
|
},
|
|
build: { outDir: "dist" },
|
|
})
|