From cdeaef67ac62e60e0d16eca9578e325a7c9d0a0c Mon Sep 17 00:00:00 2001 From: syelle Date: Fri, 28 Nov 2025 21:11:33 -0500 Subject: [PATCH] add task completed --- samy.js | 5 +++++ samy.ps1 | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/samy.js b/samy.js index b59dfeb..61cc003 100644 --- a/samy.js +++ b/samy.js @@ -336,6 +336,11 @@ async function triggerInstall() { if (totalTasks > 0) { console.info(`[Info] All tasks completed (${completedTasks}/${totalTasks})`); } + try { + await fetch("/tasksCompleted", { method: "POST" }); + } catch (err) { + console.warn("Could not notify server about completion:", err); + } } } diff --git a/samy.ps1 b/samy.ps1 index 31346a9..21308b4 100644 --- a/samy.ps1 +++ b/samy.ps1 @@ -1208,6 +1208,13 @@ function Send-JSON { } #endregion HTTP responder helpers + function Invoke-TasksCompleted { + param($Context) + + Write-LogHybrid "All UI-selected tasks processed" Info UI -LogToEvent + Send-Text $Context "Tasks completion acknowledged." + } + #region Datto handlers function Invoke-FetchSites { param($Context) @@ -1732,6 +1739,12 @@ function Install-DattoRMM { return } + # ---- Tasks completed notification ---- + if ($Context.Request.HttpMethod -eq 'POST' -and $path -eq 'tasksCompleted') { + Invoke-TasksCompleted $Context + return + } + # ---- Fetch Sites endpoint ---- if ($Context.Request.HttpMethod -eq 'POST' -and $path -eq 'getpw') { Invoke-FetchSites $Context