From 8c440b6f5415f026ac4591f3e5af8666d8cb4437 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Fri, 26 Dec 2025 22:38:46 +0000 Subject: [PATCH] feat: notify server during agent uninstallation - Add /api/agents/host/uninstall endpoint for agent self-unregistration - Update install.sh to notify server during --uninstall (reads agent ID from disk) - Update install.ps1 with same logic for Windows - Update frontend uninstall command to include URL/token flags This ensures that when an agent is uninstalled, the host record is immediately removed from Pulse and any linked PVE nodes have their +Agent badge cleared. --- .../src/components/Settings/UnifiedAgents.tsx | 7 +-- internal/api/host_agents.go | 45 +++++++++++++++++++ internal/api/router.go | 1 + scripts/install.ps1 | 29 ++++++++++++ scripts/install.sh | 22 +++++++++ 5 files changed, 101 insertions(+), 3 deletions(-) diff --git a/frontend-modern/src/components/Settings/UnifiedAgents.tsx b/frontend-modern/src/components/Settings/UnifiedAgents.tsx index c68293213..85ed9f516 100644 --- a/frontend-modern/src/components/Settings/UnifiedAgents.tsx +++ b/frontend-modern/src/components/Settings/UnifiedAgents.tsx @@ -247,7 +247,9 @@ export const UnifiedAgents: Component = () => { const getUninstallCommand = () => { const url = customAgentUrl() || agentUrl(); - return `curl ${getCurlInsecureFlag()}-fsSL ${url}/install.sh | bash -s -- --uninstall`; + const token = currentToken() || latestRecord()?.id || TOKEN_PLACEHOLDER; + const insecure = insecureMode() ? ' --insecure' : ''; + return `curl ${getCurlInsecureFlag()}-fsSL ${url}/install.sh | bash -s -- --uninstall --url ${url} --token ${token}${insecure}`; }; // Track previously seen host types to prevent flapping when one source temporarily has no data @@ -1023,8 +1025,7 @@ export const UnifiedAgents: Component = () => {