You've already forked Tricky-Addon-Update-Target-List
mirror of
https://github.com/KOWX712/Tricky-Addon-Update-Target-List.git
synced 2025-09-06 06:37:09 +00:00
opt: use ksu.spawn for long script
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { exec } from './assets/kernelsu.js';
|
||||
import { exec, spawn } from './assets/kernelsu.js';
|
||||
import { basePath, showPrompt } from './main.js';
|
||||
|
||||
const overlay = document.getElementById('security-patch-overlay');
|
||||
@@ -218,24 +218,29 @@ export function securityPatch() {
|
||||
|
||||
// Auto config button
|
||||
autoButton.addEventListener('click', () => {
|
||||
exec(`sh ${basePath}/common/get_extra.sh --security-patch`)
|
||||
.then(({ errno, stdout }) => {
|
||||
if (errno !== 0 || stdout.trim() === "not set") {
|
||||
showPrompt('security_patch.auto_failed', false);
|
||||
} else {
|
||||
exec(`touch /data/adb/tricky_store/security_patch_auto_config`)
|
||||
// Reset inputs
|
||||
allPatchInput.value = '';
|
||||
systemPatchInput.value = '';
|
||||
bootPatchInput.value = '';
|
||||
vendorPatchInput.value = '';
|
||||
const output = spawn('sh', [`${basePath}/common/get_extra.sh`, '--security-patch']);
|
||||
output.stdout.on('data', (data) => {
|
||||
if (data.includes("not set")) {
|
||||
showPrompt('security_patch.auto_failed', false);
|
||||
}
|
||||
});
|
||||
output.on('exit', (code) => {
|
||||
if (code === 0) {
|
||||
exec(`touch /data/adb/tricky_store/security_patch_auto_config`)
|
||||
// Reset inputs
|
||||
allPatchInput.value = '';
|
||||
systemPatchInput.value = '';
|
||||
bootPatchInput.value = '';
|
||||
vendorPatchInput.value = '';
|
||||
|
||||
checkAdvanced(false);
|
||||
showPrompt('security_patch.auto_success');
|
||||
}
|
||||
hideSecurityPatchDialog();
|
||||
loadCurrentConfig();
|
||||
});
|
||||
checkAdvanced(false);
|
||||
showPrompt('security_patch.auto_success');
|
||||
} else {
|
||||
showPrompt('security_patch.auto_failed', false);
|
||||
}
|
||||
hideSecurityPatchDialog();
|
||||
loadCurrentConfig();
|
||||
});
|
||||
});
|
||||
|
||||
// Save button
|
||||
@@ -308,21 +313,18 @@ export function securityPatch() {
|
||||
// Get button
|
||||
getButton.addEventListener('click', async () => {
|
||||
showPrompt('security_patch.fetching');
|
||||
setTimeout(() => {
|
||||
exec(`sh ${basePath}/common/get_extra.sh --get-security-patch`)
|
||||
.then(({ errno, stdout }) => {
|
||||
if (errno !== 0) {
|
||||
showPrompt('security_patch.get_failed', false);
|
||||
} else {
|
||||
showPrompt('security_patch.fetched', true, 1000);
|
||||
checkAdvanced(true);
|
||||
const output = spawn('sh', [`${basePath}/common/get_extra.sh`, '--get-security-patch']);
|
||||
output.stdout.on('data', (data) => {
|
||||
showPrompt('security_patch.fetched', true, 1000);
|
||||
checkAdvanced(true);
|
||||
|
||||
allPatchInput.value = stdout.replace(/-/g, '');
|
||||
systemPatchInput.value = 'prop';
|
||||
bootPatchInput.value = stdout;
|
||||
vendorPatchInput.value = stdout;
|
||||
}
|
||||
})
|
||||
}, 200);
|
||||
allPatchInput.value = data.replace(/-/g, '');
|
||||
systemPatchInput.value = 'prop';
|
||||
bootPatchInput.value = data;
|
||||
vendorPatchInput.value = data;
|
||||
});
|
||||
output.on('exit', (code) => {
|
||||
if (code !== 0) showPrompt('security_patch.get_failed', false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user