Update TGBeta.ps1

This commit is contained in:
2025-01-07 02:07:27 -05:00
parent d3608f76c0
commit 09a9cc4a37

View File

@@ -912,13 +912,14 @@ function GetHtmlContent {
});
async function runSelectedTweaks() {
function runSelectedTweaks() {
const tweaks = [];
const tweakCheckboxes = document.querySelectorAll('#tweaksTab input[type="checkbox"]:not(#selectAllTweaksCheckbox)');
// Collect the selected tweaks
tweakCheckboxes.forEach((checkbox) => {
if (checkbox.checked) {
tweaks.push(checkbox.id); // Use the checkbox IDs as tweak identifiers
tweaks.push(checkbox.id); // Use checkbox IDs as identifiers
}
});
@@ -929,25 +930,31 @@ function GetHtmlContent {
appendLog("Running selected tweaks...", "yellow");
try {
const response = await fetch('/runTweaks', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ tweaks }),
});
// Prepare the payload
const payload = { tweaks };
// Make the request using fetch with a promise-based approach
fetch('/runTweaks', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
})
.then((response) => {
if (!response.ok) {
throw new Error('Failed to run selected tweaks. Please try again.');
}
const result = await response.text();
return response.text(); // Extract text response
})
.then((result) => {
appendLog(result, "green");
} catch (error) {
})
.catch((error) => {
appendLog(`Error: ${error.message}`, "red");
}
});
}
function appendLog(message, color = "white") {
const log = document.createElement('p');
log.style.color = color;