Update TGBeta.ps1

This commit is contained in:
2025-01-05 19:21:06 -05:00
parent 2b6ead5402
commit 7a152ae8df

View File

@@ -700,8 +700,8 @@ 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.options[dropdown.selectedIndex]?.value || null; // Handle case where no site is selected
const Name = dropdown.options[dropdown.selectedIndex].text; const Name = 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"]');
@@ -713,68 +713,84 @@ function GetHtmlContent {
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
if (installSVSMSPModule.checked) {
appendLog("Installing SVSMSP Module (Priority 1)...", "cyan");
fetch('/installSVSMSPModule', { method: 'GET' })
.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
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...", "cyan"); appendLog("Installing selected site RMM (Priority 2)...", "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"))
fetch('/installrmm', { .catch(error => appendLog(`Error installing Datto RMM: ${error.message}`, "red"));
method: 'POST', return; // Stop further execution as this is the second highest priority
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ installRMMCommand, UID, Name })
});
} }
// Lower-priority tasks
if (setSVSPowerplan.checked) { if (setSVSPowerplan.checked) {
fetch('/SetSVSPowerplan', { method: 'GET' }); fetch('/SetSVSPowerplan', { method: 'GET' })
appendLog("Setting SVS Powerplan", "cyan"); .then(() => appendLog("SVS Powerplan set successfully.", "green"))
} .catch(error => appendLog(`Error setting SVS Powerplan: ${error.message}`, "red"));
if (installSVSMSPModule.checked) {
fetch('/installSVSMSPModule', { method: 'GET' });
appendLog("Installing CyberQP", "cyan");
} }
if (installCyberQP.checked) { if (installCyberQP.checked) {
fetch('/installCyberQP', { method: 'GET' }); fetch('/installCyberQP', { method: 'GET' })
appendLog("Installing CyberQP", "cyan"); .then(() => appendLog("CyberQP installed successfully.", "green"))
.catch(error => appendLog(`Error installing CyberQP: ${error.message}`, "red"));
} }
if (installSplashtop.checked) { if (installSplashtop.checked) {
fetch('/installSplashtop', { method: 'GET' }); fetch('/installSplashtop', { method: 'GET' })
appendLog("Installing Splashtop", "cyan"); .then(() => appendLog("Splashtop installed successfully.", "green"))
.catch(error => appendLog(`Error installing Splashtop: ${error.message}`, "red"));
} }
if (installSVSHelpDesk.checked) { if (installSVSHelpDesk.checked) {
fetch('/installSVSHelpDesk', { method: 'GET' }); fetch('/installSVSHelpDesk', { method: 'GET' })
appendLog("Installing SVSHelpdesk", "cyan"); .then(() => appendLog("SVS HelpDesk installed successfully.", "green"))
.catch(error => appendLog(`Error installing SVS HelpDesk: ${error.message}`, "red"));
} }
if (installSVSWatchtower.checked) { if (installSVSWatchtower.checked) {
fetch('/installSVSWatchtower', { method: 'GET' }); fetch('/installSVSWatchtower', { method: 'GET' })
appendLog("Installing SVSWatchtower", "cyan"); .then(() => appendLog("SVS Watchtower installed successfully.", "green"))
.catch(error => appendLog(`Error installing SVS Watchtower: ${error.message}`, "red"));
} }
if (installThreatLocker.checked) { if (installThreatLocker.checked) {
fetch('/installThreatLocker', { method: 'GET' }); fetch('/installThreatLocker', { method: 'GET' })
appendLog("Installing ThreatLocker", "cyan"); .then(() => appendLog("ThreatLocker installed successfully.", "green"))
.catch(error => appendLog(`Error installing ThreatLocker: ${error.message}`, "red"));
} }
if (installRocketCyber.checked) { if (installRocketCyber.checked) {
fetch('/installRocketCyber', { method: 'GET' }); fetch('/installRocketCyber', { method: 'GET' })
appendLog("Installing RocketCyber", "cyan"); .then(() => appendLog("RocketCyber installed successfully.", "green"))
.catch(error => appendLog(`Error installing RocketCyber: ${error.message}`, "red"));
} }
} }
function endSession() { function endSession() {
appendLog("Session ended. Closing application...", "yellow"); appendLog("Session ended. Closing application...", "yellow");
fetch('/quit', { method: 'GET' }) fetch('/quit', { method: 'GET' })