Update TGBeta.ps1

This commit is contained in:
2025-01-05 19:30:22 -05:00
parent af9905249a
commit cb486e014e

View File

@@ -697,95 +697,102 @@ function GetHtmlContent {
} }
function triggerInstall() { function triggerInstall() {
const dropdown = document.getElementById('dattoRmmDropdown'); const dropdown = document.getElementById('dattoRmmDropdown');
const UID = dropdown.options[dropdown.selectedIndex].value const UID = dropdown && dropdown.options[dropdown.selectedIndex]
const Name = dropdown.options[dropdown.selectedIndex].text ? dropdown.options[dropdown.selectedIndex].value
: null;
const Name = dropdown && dropdown.options[dropdown.selectedIndex]
? dropdown.options[dropdown.selectedIndex].text
: "Unknown Site";
const setSVSPowerplan = document.querySelector('input[name="setSVSPowerplan"]'); const setSVSPowerplan = document.querySelector('input[name="setSVSPowerplan"]');
const installSVSMSPModule = document.querySelector('input[name="installSVSMSPModule"]'); const installSVSMSPModule = document.querySelector('input[name="installSVSMSPModule"]');
const installDattoRMM = document.querySelector('input[name="installDattoRMM"]'); const installDattoRMM = document.querySelector('input[name="installDattoRMM"]');
const installCyberQP = document.querySelector('input[name="installCyberQP"]'); const installCyberQP = document.querySelector('input[name="installCyberQP"]');
const installSplashtop = document.querySelector('input[name="installSplashtop"]'); const installSplashtop = document.querySelector('input[name="installSplashtop"]');
const installSVSHelpDesk = document.querySelector('input[name="installSVSHelpDesk"]'); const installSVSHelpDesk = document.querySelector('input[name="installSVSHelpDesk"]');
const installSVSWatchtower = document.querySelector('input[name="installSVSWatchtower"]'); const installSVSWatchtower = document.querySelector('input[name="installSVSWatchtower"]');
const installThreatLocker = document.querySelector('input[name="installThreatLocker"]'); const installThreatLocker = document.querySelector('input[name="installThreatLocker"]');
const installRocketCyber = document.querySelector('input[name="installRocketCyber"]'); const installRocketCyber = document.querySelector('input[name="installRocketCyber"]');
// Priority 1: Install SVSMSP Module // Ensure UID is selected before proceeding
if (installSVSMSPModule.checked) { if (!UID) {
appendLog("Installing SVSMSP Module (Priority 1)...", "cyan"); appendLog("Please select a site from the dropdown.", "red");
fetch('/installSVSMSPModule', { method: 'GET' }) return;
.then(() => appendLog("SVSMSP Module installed successfully.", "green")) }
.catch(error => appendLog(`Error installing SVSMSP Module: ${error.message}`, "red"));
return; // Stop further execution as this is the highest priority
}
// Priority 2: Install DattoRMM // Install DattoRMM if checked
if (installDattoRMM.checked) { if (installDattoRMM.checked) {
const DattoRMMCheckbox = document.querySelectorAll('input[name="dattoRMMOption"]:checked'); const DattoRMMCheckbox = document.querySelectorAll('input[name="dattoRMMOption"]:checked');
appendLog("Installing selected site RMM (Priority 2)...", "cyan"); appendLog("Installing selected site RMM...", "cyan");
const checkedValues = Array.from(DattoRMMCheckbox).map(c => c.value); const checkedValues = Array.from(DattoRMMCheckbox).map(c => c.value);
const payload = { const payload = {
checkedValues, // Array of selected checkbox values checkedValues, // Array of selected checkbox values
UID, // Selected site UID UID, // Selected site UID
Name // Selected site name Name // Selected site name
}; };
fetch('/installrmm', { fetch('/installrmm', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload) body: JSON.stringify(payload)
}) })
.then(() => appendLog("Datto RMM installation triggered successfully.", "green")) .then(() => appendLog("Datto RMM installation triggered successfully.", "green"))
.catch(error => appendLog(`Error installing Datto RMM: ${error.message}`, "red")); .catch(error => appendLog(`Error installing Datto RMM: ${error.message}`, "red"));
return; // Stop further execution as this is the second highest priority }
}
// Lower-priority tasks // Execute lower-priority tasks sequentially
if (setSVSPowerplan.checked) { if (setSVSPowerplan.checked) {
fetch('/SetSVSPowerplan', { method: 'GET' }) fetch('/SetSVSPowerplan', { method: 'GET' })
.then(() => appendLog("SVS Powerplan set successfully.", "green")) .then(() => appendLog("SVS Powerplan set successfully.", "green"))
.catch(error => appendLog(`Error setting SVS Powerplan: ${error.message}`, "red")); .catch(error => appendLog(`Error setting SVS Powerplan: ${error.message}`, "red"));
} }
if (installCyberQP.checked) { if (installSVSMSPModule.checked) {
fetch('/installCyberQP', { method: 'GET' }) fetch('/installSVSMSPModule', { method: 'GET' })
.then(() => appendLog("CyberQP installed successfully.", "green")) .then(() => appendLog("SVSMSP Module installed successfully.", "green"))
.catch(error => appendLog(`Error installing CyberQP: ${error.message}`, "red")); .catch(error => appendLog(`Error installing SVSMSP Module: ${error.message}`, "red"));
} }
if (installSplashtop.checked) { if (installCyberQP.checked) {
fetch('/installSplashtop', { method: 'GET' }) fetch('/installCyberQP', { method: 'GET' })
.then(() => appendLog("Splashtop installed successfully.", "green")) .then(() => appendLog("CyberQP installed successfully.", "green"))
.catch(error => appendLog(`Error installing Splashtop: ${error.message}`, "red")); .catch(error => appendLog(`Error installing CyberQP: ${error.message}`, "red"));
} }
if (installSVSHelpDesk.checked) { if (installSplashtop.checked) {
fetch('/installSVSHelpDesk', { method: 'GET' }) fetch('/installSplashtop', { method: 'GET' })
.then(() => appendLog("SVS HelpDesk installed successfully.", "green")) .then(() => appendLog("Splashtop installed successfully.", "green"))
.catch(error => appendLog(`Error installing SVS HelpDesk: ${error.message}`, "red")); .catch(error => appendLog(`Error installing Splashtop: ${error.message}`, "red"));
} }
if (installSVSWatchtower.checked) { if (installSVSHelpDesk.checked) {
fetch('/installSVSWatchtower', { method: 'GET' }) fetch('/installSVSHelpDesk', { method: 'GET' })
.then(() => appendLog("SVS Watchtower installed successfully.", "green")) .then(() => appendLog("SVS HelpDesk installed successfully.", "green"))
.catch(error => appendLog(`Error installing SVS Watchtower: ${error.message}`, "red")); .catch(error => appendLog(`Error installing SVS HelpDesk: ${error.message}`, "red"));
} }
if (installThreatLocker.checked) { if (installSVSWatchtower.checked) {
fetch('/installThreatLocker', { method: 'GET' }) fetch('/installSVSWatchtower', { method: 'GET' })
.then(() => appendLog("ThreatLocker installed successfully.", "green")) .then(() => appendLog("SVS Watchtower installed successfully.", "green"))
.catch(error => appendLog(`Error installing ThreatLocker: ${error.message}`, "red")); .catch(error => appendLog(`Error installing SVS Watchtower: ${error.message}`, "red"));
} }
if (installThreatLocker.checked) {
fetch('/installThreatLocker', { method: 'GET' })
.then(() => appendLog("ThreatLocker installed successfully.", "green"))
.catch(error => appendLog(`Error installing ThreatLocker: ${error.message}`, "red"));
}
if (installRocketCyber.checked) {
fetch('/installRocketCyber', { method: 'GET' })
.then(() => appendLog("RocketCyber installed successfully.", "green"))
.catch(error => appendLog(`Error installing RocketCyber: ${error.message}`, "red"));
}
}
if (installRocketCyber.checked) {
fetch('/installRocketCyber', { method: 'GET' })
.then(() => appendLog("RocketCyber installed successfully.", "green"))
.catch(error => appendLog(`Error installing RocketCyber: ${error.message}`, "red"));
}
}