From a0c4520f4b606a0fa5e28efeb3605ce378c19459 Mon Sep 17 00:00:00 2001 From: "Jon \"The Nice Guy\" Spriggs" Date: Mon, 7 Oct 2024 16:25:03 +0100 Subject: [PATCH] Add admin-url to the add-peer dialogue (#416) * Add admin-url to the add-peer dialogue * Missed "let" from defining the variable * Update netbird.ts Fix isNetBirdHosted check --------- Co-authored-by: Eduard Gert --- src/utils/netbird.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/utils/netbird.ts b/src/utils/netbird.ts index cd02c347..897d89d7 100644 --- a/src/utils/netbird.ts +++ b/src/utils/netbird.ts @@ -5,8 +5,16 @@ export const GRPC_API_ORIGIN = config.grpcApiOrigin; export const getNetBirdUpCommand = () => { let cmd = "netbird up"; - if (!GRPC_API_ORIGIN) return cmd; - cmd += " --management-url " + GRPC_API_ORIGIN; + if (GRPC_API_ORIGIN) { + cmd += " --management-url " + GRPC_API_ORIGIN + } + if (!isNetBirdHosted()) { + let admin_url = window.location.protocol + "://" + window.location.hostname + if (window.location.port != "") { + admin_url += ":" + window.location.port + } + cmd += " --admin-url " + admin_url + }; return cmd; };