Update StackMonkey.ps1
This commit is contained in:
@@ -852,18 +852,44 @@ $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;
|
||||||
try {
|
|
||||||
await fetch(t.handler, { method: "GET" });
|
// special-case DattoRMM: POST JSON with sub-options + site info
|
||||||
} catch (e) {
|
if (t.id === 'installDattoRMM') {
|
||||||
console.error(`Error running ${t.label}:`, e);
|
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 {
|
||||||
|
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) {
|
||||||
|
console.error(`Error running ${t.label}:`, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// Shutdown Handler
|
// Shutdown Handler
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user