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