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