Update TGBeta.ps1

This commit is contained in:
2025-01-07 01:31:35 -05:00
parent b5f988b734
commit 3d647ced22

View File

@@ -822,78 +822,64 @@ function GetHtmlContent {
}
}
function triggerInstall() {
const dropdown = document.getElementById('dattoRmmDropdown');
const UID = dropdown.options[dropdown.selectedIndex]?.value || null;
const Name = dropdown.options[dropdown.selectedIndex]?.text || null;
async function triggerInstall() {
const dropdown = document.getElementById('dattoRmmDropdown');
const UID = dropdown.options[dropdown.selectedIndex]?.value || null;
const Name = dropdown.options[dropdown.selectedIndex]?.text || null;
const setSVSPowerplan = document.querySelector('input[name="setSVSPowerplan"]');
const installSVSMSPModule = document.querySelector('input[name="installSVSMSPModule"]');
const installDattoRMM = document.querySelector('input[name="installDattoRMM"]');
const installCyberQP = document.querySelector('input[name="installCyberQP"]');
const installSplashtop = document.querySelector('input[name="installSplashtop"]');
const installSVSHelpDesk = document.querySelector('input[name="installSVSHelpDesk"]');
const installSVSWatchtower = document.querySelector('input[name="installSVSWatchtower"]');
const installThreatLocker = document.querySelector('input[name="installThreatLocker"]');
const installRocketCyber = document.querySelector('input[name="installRocketCyber"]');
const tasks = [];
// Priority 1: Install SVSMSP Module
if (installSVSMSPModule.checked) {
appendLog("Installing SVSMSP Module (Priority 1)...", "cyan");
fetch('/installSVSMSPModule', { method: 'GET' })
}
if (document.querySelector('input[name="installSVSMSPModule"]').checked) {
tasks.push({ name: "installSVSMSPModule", priority: 1 });
}
// Priority 2: Install DattoRMM
if (installDattoRMM.checked) {
const DattoRMMCheckbox = document.querySelectorAll('input[name="dattoRMMOption"]:checked');
appendLog("Installing selected site RMM (Priority 2)...", "cyan");
if (document.querySelector('input[name="installDattoRMM"]').checked) {
const selectedOptions = Array.from(document.querySelectorAll('input[name="dattoRMMOption"]:checked'))
.map(option => option.value);
const checkedValues = Array.from(DattoRMMCheckbox).map(c => c.value);
tasks.push({
name: "installDattoRMM",
priority: 2,
details: { UID, Name, options: selectedOptions },
});
}
const payload = {
checkedValues, // Array of selected checkbox values
UID, // Selected site UID
Name // Selected site name
};
if (document.querySelector('input[name="setSVSPowerplan"]').checked) {
tasks.push({ name: "setSVSPowerplan", priority: 3 });
}
fetch('/installrmm', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
})
}
if (document.querySelector('input[name="installCyberQP"]').checked) {
tasks.push({ name: "installCyberQP", priority: 4 });
}
// Lower-priority tasks
if (setSVSPowerplan.checked) {
fetch('/SetSVSPowerplan', { method: 'GET' })
}
if (document.querySelector('input[name="installRocketCyber"]').checked) {
tasks.push({ name: "installRocketCyber", priority: 5 });
}
if (installCyberQP.checked) {
fetch('/installCyberQP', { method: 'GET' })
}
if (document.querySelector('input[name="installThreatLocker"]').checked) {
tasks.push({ name: "installThreatLocker", priority: 6 });
}
if (installSplashtop.checked) {
fetch('/installSplashtop', { method: 'GET' })
}
try {
const response = await fetch('/executeTasks', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ tasks }),
});
if (installSVSHelpDesk.checked) {
fetch('/installSVSHelpDesk', { method: 'GET' })
}
if (installSVSWatchtower.checked) {
fetch('/installSVSWatchtower', { method: 'GET' })
}
if (installThreatLocker.checked) {
fetch('/installThreatLocker', { method: 'GET' })
}
if (installRocketCyber.checked) {
fetch('/installRocketCyber', { method: 'GET' })
}
if (!response.ok) {
throw new Error("Failed to execute tasks.");
}
const result = await response.json();
console.log(result);
appendLog("All tasks completed successfully.", "green");
} catch (error) {
console.error(error);
appendLog(`Error executing tasks: ${error.message}`, "red");
}
}
function endSession() {
appendLog("Session ended. Closing application...", "yellow");
fetch('/quit', { method: 'GET' })