Update TGBeta.ps1
This commit is contained in:
42
TGBeta.ps1
42
TGBeta.ps1
@@ -912,49 +912,7 @@ function GetHtmlContent {
|
||||
|
||||
});
|
||||
|
||||
function runSelectedTweaks() {
|
||||
const tweaks = [];
|
||||
const tweakCheckboxes = document.querySelectorAll('#tweaksTab input[type="checkbox"]:not(#selectAllTweaksCheckbox)');
|
||||
|
||||
// Collect selected tweaks
|
||||
tweakCheckboxes.forEach((checkbox) => {
|
||||
if (checkbox.checked) {
|
||||
tweaks.push(checkbox.id); // Use checkbox IDs as identifiers
|
||||
}
|
||||
});
|
||||
|
||||
// Check if no tweaks are selected
|
||||
if (tweaks.length === 0) {
|
||||
appendLog("No tweaks selected. Please select at least one tweak to run.", "red");
|
||||
return;
|
||||
}
|
||||
|
||||
appendLog("Running selected tweaks...", "yellow");
|
||||
|
||||
// Prepare payload
|
||||
const payload = JSON.stringify({ tweaks });
|
||||
|
||||
// Use fetch to call the backend
|
||||
fetch('/runTweaks', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: payload,
|
||||
})
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to run tweaks. Status: ${response.status}`);
|
||||
}
|
||||
return response.text(); // Parse response as text
|
||||
})
|
||||
.then((result) => {
|
||||
appendLog(result, "green");
|
||||
})
|
||||
.catch((error) => {
|
||||
appendLog(`Error running tweaks: ${error.message}`, "red");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user