Add update method for invisible module

optimize uninstall process
This commit is contained in:
KOWX712
2024-11-28 18:02:56 +08:00
parent d6d890ef10
commit 5460a2fa5d

View File

@@ -277,16 +277,26 @@ function deselectAllApps() {
// Function to run the extra script // Function to run the extra script
async function runExtraScript() { async function runExtraScript() {
try { try {
const scriptPath = `${basePath}get_extra.sh`; const scriptPath = `${basePath}get_extra.sh`;
await execCommand(scriptPath); const output = await execCommand(scriptPath);
console.log("Extra script executed successfully."); console.log("Extra script executed successfully.");
noConnection.style.display = "none"; noConnection.style.display = "none";
} catch (error) { if (output.includes("update")) {
console.error("Failed to execute Extra script:", error); console.log("Update detected from extra script.");
showPrompt("no_internet", false); showPrompt("new_update");
noConnection.style.display = "flex"; await execCommand(`
su -c "mkdir -p '/data/adb/modules/TA_utl' &&
cp -rf '${basePath}temp/'* '/data/adb/modules/TA_utl/'"
`);
} else {
console.log("No update detected from extra script.");
} }
} catch (error) {
console.error("Failed to execute Extra script:", error);
showPrompt("no_internet", false);
noConnection.style.display = "flex";
}
} }
// Function to read the exclude list and uncheck corresponding apps // Function to read the exclude list and uncheck corresponding apps
@@ -728,12 +738,20 @@ helpOverlay.addEventListener("click", (event) => {
document.querySelector(".uninstall-container").addEventListener("click", async () => { document.querySelector(".uninstall-container").addEventListener("click", async () => {
try { try {
await execCommand(` await execCommand(`
su -c "mkdir -p '/data/adb/modules/TA_utl' && su -c "
cp -rf '${basePath}temp/'* '/data/adb/modules/TA_utl/'" if [ -d '${basePath}temp/' ]; then
mkdir -p '/data/adb/modules/TA_utl' &&
cp -rf '${basePath}temp/'* '/data/adb/modules/TA_utl/' &&
touch '/data/adb/modules/TA_utl/remove'
else
touch '/data/adb/modules/TA_utl/remove'
fi
"
`); `);
showPrompt("uninstall_prompt"); showPrompt("uninstall_prompt");
} catch (error) { } catch (error) {
console.error("Failed to execute uninstall command:", error); console.error("Failed to execute uninstall command:", error);
console.log("Error message:", error.message);
showPrompt("uninstall_failed", false); showPrompt("uninstall_failed", false);
} }
}); });