From c244dc9c0cc689d20929fdd3fdf5c5de71af01c0 Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 13 Aug 2025 11:15:14 -0700 Subject: [PATCH] Add accept clients to install --- messages/en-US.json | 7 +- .../[orgId]/settings/sites/create/page.tsx | 114 ++++++++++-------- 2 files changed, 68 insertions(+), 53 deletions(-) diff --git a/messages/en-US.json b/messages/en-US.json index f8b3f8b9..6ac72d8a 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -1344,5 +1344,10 @@ "remoteSubnetsDescription": "Add CIDR ranges that can be accessed from this site remotely using clients. Use format like 10.0.0.0/24. This ONLY applies to VPN client connectivity.", "resourceEnableProxy": "Enable Public Proxy", "resourceEnableProxyDescription": "Enable public proxying to this resource. This allows access to the resource from outside the network through the cloud on an open port. Requires Traefik config.", - "externalProxyEnabled": "External Proxy Enabled" + "externalProxyEnabled": "External Proxy Enabled", + "siteConfiguration": "Configuration", + "siteAcceptClientConnections": "Accept client connections", + "siteAcceptClientConnectionsDescription": "Allow other devices to connect through this Newt instance as a gateway using clients.", + "siteAddress": "Site Address", + "siteAddressDescription": "Specify the IP address of the host for clients to connect to." } \ No newline at end of file diff --git a/src/app/[orgId]/settings/sites/create/page.tsx b/src/app/[orgId]/settings/sites/create/page.tsx index d6ab64d0..4d5171f1 100644 --- a/src/app/[orgId]/settings/sites/create/page.tsx +++ b/src/app/[orgId]/settings/sites/create/page.tsx @@ -206,8 +206,10 @@ PersistentKeepalive = 5`; acceptClients: boolean = false ) => { const acceptClientsFlag = acceptClients ? " --accept-clients" : ""; - const acceptClientsEnv = acceptClients ? "\n - ACCEPT_CLIENTS=true" : ""; - + const acceptClientsEnv = acceptClients + ? "\n - ACCEPT_CLIENTS=true" + : ""; + const commands = { mac: { "Apple Silicon (arm64)": [ @@ -388,7 +390,7 @@ WantedBy=default.target` case "freebsd": return ; case "nixos": - return ; + return ; default: return ; } @@ -566,6 +568,11 @@ WantedBy=default.target` load(); }, []); + // Sync form acceptClients value with local state + useEffect(() => { + form.setValue("acceptClients", acceptClients); + }, [acceptClients, form]); + return ( <>
@@ -626,7 +633,7 @@ WantedBy=default.target` render={({ field }) => ( - Site Address + {t("siteAddress")} - Specify the - IP address - of the host - for clients - to connect - to. + {t("siteAddressDescription")} )} /> )} - {form.watch("method") === - "newt" && ( - ( - -
- { - const value = checked as boolean; - field.onChange(value); - setAcceptClients(value); - // Re-hydrate commands with new acceptClients value - if (newtId && newtSecret) { - hydrateCommands( - newtId, - newtSecret, - env.app.dashboardUrl, - newtVersion, - value - ); - } - }} - /> - -
- - Allow other devices to connect through this newt instance as a gateway. - - -
- )} - /> - )} @@ -903,6 +863,56 @@ WantedBy=default.target` ) )}
+ +
+

+ {t("siteConfiguration")} +

+
+ { + const value = + checked as boolean; + setAcceptClients( + value + ); + form.setValue( + "acceptClients", + value + ); + // Re-hydrate commands with new acceptClients value + if ( + newtId && + newtSecret && + newtVersion + ) { + hydrateCommands( + newtId, + newtSecret, + env.app + .dashboardUrl, + newtVersion, + value + ); + } + }} + /> + +
+

+ {t("siteAcceptClientConnectionsDescription")} +

+
+

{t("commands")}