From 8f6be645ed465e50f204112c3099622045f5d818 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 7 Jul 2026 12:43:54 -0500 Subject: [PATCH] Fix auto-detect agent install button: commands shown for Windows/Linux no longer use flags the scripts dont actually support (install-windows.ps1 has no -JarvisUrl/-Key params, install.sh has no --jarvis-url/--key flags), download links use the current page origin instead of a hardcoded URL thats unreachable from outside the LAN, Windows command reflects the new no-Python exe install, fixed the top-level install-agent.sh which still pointed at the pre-migration DO server IP (165.22.1.228) and would have failed outright --- public_html/agent/install.sh | 13 +++++++-- public_html/assets/js/panels/jarvis-agents.js | 29 +++++++++++++------ public_html/install-agent.sh | 19 ++++++++---- 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/public_html/agent/install.sh b/public_html/agent/install.sh index 5d6c268..a37b1d3 100644 --- a/public_html/agent/install.sh +++ b/public_html/agent/install.sh @@ -1,15 +1,22 @@ #!/bin/bash # JARVIS Agent Installer — one-liner for any Linux host: -# curl -sk https://jarvis.orbishosting.com/install-agent.sh | bash -s +# curl -sk http://jarvis.orbishosting.com:1972/agent/install.sh | bash -s # # agent_type: linux | proxmox | homeassistant -# Example: curl -sk https://jarvis.orbishosting.com/install-agent.sh | bash -s myserver linux +# Example: curl -sk http://jarvis.orbishosting.com:1972/agent/install.sh | bash -s myserver linux +# +# On the LAN, set JARVIS_URL to the direct internal address instead (faster, +# doesn't hairpin through Cloudflare): JARVIS_URL=http://10.48.200.211 curl ... | bash -s ... set -e HOSTNAME_ARG="${1:-$(hostname -s)}" AGENT_TYPE="${2:-linux}" -JARVIS_URL="${JARVIS_URL:-https://jarvis.orbishosting.com}" +# Fixed 2026-07-07: jarvis.orbishosting.com on the default port isn't reachable +# from outside the LAN at all (no FortiGate VIP forwards it) — :1972 is the +# confirmed-working external path (same fix as the GitHub webhook and the +# Windows agent installer). +JARVIS_URL="${JARVIS_URL:-http://jarvis.orbishosting.com:1972}" JARVIS_HOST="" INSTALL_DIR="/opt/jarvis-agent" CONFIG_DIR="/etc/jarvis-agent" diff --git a/public_html/assets/js/panels/jarvis-agents.js b/public_html/assets/js/panels/jarvis-agents.js index 0d1c97e..7a0a894 100644 --- a/public_html/assets/js/panels/jarvis-agents.js +++ b/public_html/assets/js/panels/jarvis-agents.js @@ -438,8 +438,13 @@ function openAgentModal() { const content = document.getElementById('agentModalContent'); const modal = document.getElementById('agentModal'); const regKey = 'f846a9aaf7ce9a61742c63c87c4186052a71d2a580c65518'; - const baseUrl = 'https://jarvis.orbishosting.com/agent'; const jUrl = window.location.origin; + // Fixed 2026-07-07: this used to be hardcoded to https://jarvis.orbishosting.com/agent, + // which isn't reachable from outside the LAN at all (no FortiGate VIP forwards the + // default port there — confirmed HTTP:000). Using the current page's own origin + // instead means the download link always matches wherever the visitor actually + // reached this dashboard from, LAN or external. + const baseUrl = jUrl + '/agent'; if (os === 'tablet') { title.textContent = '● JARVIS — TABLET / MOBILE'; @@ -460,9 +465,12 @@ function openAgentModal() { const inst = { windows: { label:'Windows', - cmd:'# Run PowerShell as Administrator:\nSet-ExecutionPolicy Bypass -Scope Process -Force\nInvoke-WebRequest -Uri "'+baseUrl+'/install-windows.ps1" -OutFile "$env:TEMP\\install.ps1"\n& "$env:TEMP\\install.ps1" -JarvisUrl '+jUrl+' -Key '+regKey, - dl: baseUrl+'/install-windows.ps1', - note:'Run PowerShell as Administrator. Installs as a Windows Task Scheduler service.' + // install-windows.ps1 takes no parameters — it reads the reg key from + // $env:JARVIS_REG_KEY and downloads the standalone exe itself (no + // Python/pywin32 needed on the target machine as of the 2026-07-07 rebuild). + cmd:'# Run PowerShell as Administrator:\n$env:JARVIS_REG_KEY=\''+regKey+'\'\nirm '+baseUrl+'/install-windows.ps1 | iex', + dl: baseUrl+'/install-windows.exe', + note:'Run PowerShell as Administrator. Installs as a real Windows Service (auto-starts at boot, no window to keep open).' }, mac: { label:'macOS', @@ -472,15 +480,18 @@ function openAgentModal() { }, linux: { label:'Linux', - cmd:'curl -sSL '+baseUrl+'/install.sh | sudo bash -s -- \\\n --jarvis-url '+jUrl+' \\\n --key '+regKey, + // install.sh takes positional args (hostname, agent_type) and reads the + // JARVIS URL from an env var — the registration key is already baked in, + // no --key flag exists. + cmd:'curl -sSL '+baseUrl+'/install.sh | JARVIS_URL='+jUrl+' bash -s -- $(hostname) linux', dl: baseUrl+'/install.sh', - note:'Run in terminal. Installs as a systemd service.' + note:'Run in terminal (sudo). Installs as a systemd service.' }, unknown: { label:'Your System', - cmd:'# Browse installers:\nhttps://jarvis.orbishosting.com/agent/', - dl: 'https://jarvis.orbishosting.com/agent/', - note:'Choose your platform installer from the JARVIS agent directory.' + cmd:'# Couldn\'t detect your OS automatically. Installers are at:\n'+baseUrl+'/install.sh (Linux)\n'+baseUrl+'/install-mac.sh (macOS)\n'+baseUrl+'/install-windows.ps1 (Windows)', + dl: baseUrl+'/install.sh', + note:'Auto-detection didn\'t recognize this browser/OS — pick the matching installer above.' } }; const i = inst[os] || inst.unknown; diff --git a/public_html/install-agent.sh b/public_html/install-agent.sh index ff7374e..a37b1d3 100755 --- a/public_html/install-agent.sh +++ b/public_html/install-agent.sh @@ -1,16 +1,23 @@ #!/bin/bash # JARVIS Agent Installer — one-liner for any Linux host: -# curl -sk https://jarvis.orbishosting.com/install-agent.sh | bash -s +# curl -sk http://jarvis.orbishosting.com:1972/agent/install.sh | bash -s # # agent_type: linux | proxmox | homeassistant -# Example: curl -sk https://jarvis.orbishosting.com/install-agent.sh | bash -s myserver linux +# Example: curl -sk http://jarvis.orbishosting.com:1972/agent/install.sh | bash -s myserver linux +# +# On the LAN, set JARVIS_URL to the direct internal address instead (faster, +# doesn't hairpin through Cloudflare): JARVIS_URL=http://10.48.200.211 curl ... | bash -s ... set -e HOSTNAME_ARG="${1:-$(hostname -s)}" AGENT_TYPE="${2:-linux}" -JARVIS_URL="https://165.22.1.228" -JARVIS_HOST="jarvis.orbishosting.com" +# Fixed 2026-07-07: jarvis.orbishosting.com on the default port isn't reachable +# from outside the LAN at all (no FortiGate VIP forwards it) — :1972 is the +# confirmed-working external path (same fix as the GitHub webhook and the +# Windows agent installer). +JARVIS_URL="${JARVIS_URL:-http://jarvis.orbishosting.com:1972}" +JARVIS_HOST="" INSTALL_DIR="/opt/jarvis-agent" CONFIG_DIR="/etc/jarvis-agent" STATE_DIR="/var/lib/jarvis-agent" @@ -38,7 +45,7 @@ mkdir -p "$INSTALL_DIR" "$CONFIG_DIR" "$STATE_DIR" # ── Download agent ───────────────────────────────────────────────────────────── echo "Downloading agent..." -curl -sk -H "Host: $JARVIS_HOST" "$JARVIS_URL/agent/jarvis-agent.py" -o "$INSTALL_DIR/jarvis-agent.py" +curl -sk "$JARVIS_URL/agent/jarvis-agent.py" -o "$INSTALL_DIR/jarvis-agent.py" cp "$INSTALL_DIR/jarvis-agent.py" /usr/local/bin/jarvis-agent.py chmod +x "$INSTALL_DIR/jarvis-agent.py" /usr/local/bin/jarvis-agent.py @@ -50,7 +57,7 @@ else { "jarvis_url": "$JARVIS_URL", "host_header": "$JARVIS_HOST", - "ssl_verify": false, + "ssl_verify": true, "registration_key": "$REG_KEY", "hostname": "$HOSTNAME_ARG", "agent_type": "$AGENT_TYPE",