From 42ce63e0b5af49e30cffb18a4ded4836d489c11f Mon Sep 17 00:00:00 2001 From: claudio torres Date: Mon, 12 Aug 2024 15:45:46 -0400 Subject: [PATCH] fix: properly configure host in 'config panel' cmd --- lib/agent/control-panel/secure.js | 33 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/agent/control-panel/secure.js b/lib/agent/control-panel/secure.js index 3326fe0d8..fa17c9c30 100644 --- a/lib/agent/control-panel/secure.js +++ b/lib/agent/control-panel/secure.js @@ -20,23 +20,6 @@ let privateKey; let publicKey; let publicKeys = {}; -const protocol = config.getData('control-panel.protocol'); -const host = config.getData('control-panel.host'); -let panelHost; -switch (host) { - case 'solid.preyproject.com': - panelHost = 'panel.preyproject.com'; - break; - case 'solid.preyhq.com': - panelHost = 'panel.preyhq.com'; - break; - default: - panelHost = host; - break; -} -const base = `${protocol}://${panelHost}`; -const authUrl = `${base}/auth/configuration/start`; - const notifyLinked = (hardware) => { if (!common.helpers.running_on_background()) return; const data = { @@ -144,6 +127,22 @@ exports.generate_keys = (cb) => { }; exports.open_config = (deviceKey, cb) => { + const protocol = config.getData('control-panel.protocol'); + const host = config.getData('control-panel.host'); + let panelHost; + switch (host) { + case 'solid.preyproject.com': + panelHost = 'panel.preyproject.com'; + break; + case 'solid.preyhq.com': + panelHost = 'panel.preyhq.com'; + break; + default: + panelHost = host; + break; + } + const base = `${protocol}://${panelHost}`; + const authUrl = `${base}/auth/configuration/start`; setTimeout(() => { const lang = common.system.lang || 'en';