Update StackMonkey.ps1

This commit is contained in:
2025-05-29 01:11:54 -04:00
parent 98b7602043
commit e37eccee17

View File

@@ -854,9 +854,34 @@ $style = @'
async function triggerInstall() { async function triggerInstall() {
for (const t of tasks) { for (const t of tasks) {
const cb = document.getElementById(t.id); const cb = document.getElementById(t.id);
if (cb && cb.checked) { if (!cb || !cb.checked) continue;
// special-case DattoRMM: POST JSON with sub-options + site info
if (t.id === 'installDattoRMM') {
const checkedValues = Array.from(
document.querySelectorAll('.sub-option-installDattoRMM')
)
.filter(sub => sub.checked)
.map(sub => sub.value);
const dropdown = document.getElementById('dattoDropdown');
const UID = dropdown.value;
const Name = dropdown.options[dropdown.selectedIndex].text;
try { try {
await fetch(t.handler, { method: "GET" }); await fetch('/installDattoRMM', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ checkedValues, UID, Name })
});
} catch (e) {
console.error(`Error running ${t.label}:`, e);
}
} else {
// everything else remains a simple GET
try {
await fetch(t.handler, { method: 'GET' });
} catch (e) { } catch (e) {
console.error(`Error running ${t.label}:`, e); console.error(`Error running ${t.label}:`, e);
} }
@@ -864,6 +889,7 @@ $style = @'
} }
} }
// ======================================================================= // =======================================================================
// Shutdown Handler // Shutdown Handler
// ======================================================================= // =======================================================================