feat: add port proxy, symlink file save fix, and remote executor improvements (#358)

This commit is contained in:
Carlos Florêncio
2026-03-07 14:53:21 +00:00
committed by GitHub
parent 74a8d7563e
commit 0da44478d1
67 changed files with 2465 additions and 264 deletions
+12 -7
View File
@@ -41,10 +41,13 @@ export default function RootLayout({
}: Readonly<{
children: React.ReactNode;
}>) {
// Extract ports from server-side env vars
// We inject only ports, not full URLs, so client can build URLs from window.location.hostname
// This allows accessing the app from any device (iPhone, Tailscale, etc.)
const apiPort = extractPort(process.env.KANDEV_API_BASE_URL ?? "");
// Runtime URL configuration for the browser client.
// KANDEV_PUBLIC_URL: full external URL when behind a reverse proxy / ingress
// (e.g., "https://kandev.example.com") — injected as window.__KANDEV_API_BASE_URL.
// Otherwise: extract ports so client builds URLs from window.location.hostname,
// allowing access from any device (iPhone, Tailscale, etc.)
const publicUrl = process.env.KANDEV_PUBLIC_URL?.replace(/\/$/, "") || null;
const apiPort = publicUrl ? null : extractPort(process.env.KANDEV_API_BASE_URL ?? "");
const mcpPort = extractPort(process.env.KANDEV_MCP_SERVER_URL ?? "");
const debugMode = process.env.NEXT_PUBLIC_KANDEV_DEBUG === "true";
@@ -54,12 +57,14 @@ export default function RootLayout({
<meta name="apple-mobile-web-app-title" content="KanDev" />
</head>
<body className="antialiased font-sans">
{apiPort || mcpPort || debugMode ? (
// Inject runtime config for production bundles where ports are chosen at launch.
// Client will build full URLs using window.location.hostname + port
{publicUrl || apiPort || mcpPort || debugMode ? (
// Inject runtime config for production bundles.
// publicUrl: full base URL for reverse-proxy deployments (same-origin API)
// ports: client builds URLs using window.location.hostname + port
<script
dangerouslySetInnerHTML={{
__html: [
publicUrl ? `window.__KANDEV_API_BASE_URL = ${JSON.stringify(publicUrl)};` : "",
apiPort ? `window.__KANDEV_API_PORT = ${JSON.stringify(apiPort)};` : "",
mcpPort ? `window.__KANDEV_MCP_PORT = ${JSON.stringify(mcpPort)};` : "",
debugMode ? `window.__KANDEV_DEBUG = true;` : "",