From 09513c0bebf36163d742445bb41b58b3b09b5605 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Sat, 14 Mar 2026 21:29:16 +0100 Subject: [PATCH] Update vpn service --- AppImage/components/secure-gateway-setup.tsx | 109 ++++++++++++++----- AppImage/scripts/flask_oci_routes.py | 3 - AppImage/scripts/oci_manager.py | 6 - 3 files changed, 84 insertions(+), 34 deletions(-) diff --git a/AppImage/components/secure-gateway-setup.tsx b/AppImage/components/secure-gateway-setup.tsx index 6cfac000..ae200b36 100644 --- a/AppImage/components/secure-gateway-setup.tsx +++ b/AppImage/components/secure-gateway-setup.tsx @@ -154,7 +154,6 @@ export function SecureGatewaySetup() { // Remove CIDR notation if present (e.g., "192.168.0.55/24" -> "192.168.0.55") const ip = hostIpValue.split("/")[0] setHostIp(ip) - console.log("[v0] Host IP for Host Only mode:", ip) } } } catch (err) { @@ -194,15 +193,22 @@ export function SecureGatewaySetup() { } } - // Prepare config - for "host_only" mode, set routes to just the host IP + // Prepare config based on access_mode const deployConfig = { ...config } - console.log("[v0] access_mode:", config.access_mode, "hostIp:", hostIp) - if (config.access_mode === "host_only" && hostIp) { - deployConfig.advertise_routes = [`${hostIp}/32`] - console.log("[v0] Set advertise_routes for host_only:", deployConfig.advertise_routes) - } - console.log("[v0] Final deploy config:", JSON.stringify(deployConfig, null, 2)) + if (config.access_mode === "host_only" && hostIp) { + // Host only: just the host IP + deployConfig.advertise_routes = [`${hostIp}/32`] + } else if (config.access_mode === "proxmox_network") { + // Proxmox network: use the recommended network (should already be set) + if (!deployConfig.advertise_routes?.length) { + const recommendedNetwork = networks.find((n) => n.recommended) || networks[0] + if (recommendedNetwork) { + deployConfig.advertise_routes = [recommendedNetwork.subnet] + } + } + } + // For "custom", the user has already selected networks manually setDeployProgress("Creating LXC container...") @@ -419,6 +425,29 @@ export function SecureGatewaySetup() { ) case "select": + // Special handling for access_mode to auto-select networks + const handleSelectChange = (value: string) => { + const newConfig = { ...config, [fieldName]: value } + + // When access_mode changes to proxmox_network, auto-select the recommended network + if (fieldName === "access_mode" && value === "proxmox_network") { + const recommendedNetwork = networks.find((n) => n.recommended) || networks[0] + if (recommendedNetwork) { + newConfig.advertise_routes = [recommendedNetwork.subnet] + } + } + // Clear routes when switching to host_only + if (fieldName === "access_mode" && value === "host_only") { + newConfig.advertise_routes = [] + } + // Clear routes when switching to custom (user will select manually) + if (fieldName === "access_mode" && value === "custom") { + newConfig.advertise_routes = [] + } + + setConfig(newConfig) + } + return (