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
misc: disable security patch auto config by default
This commit is contained in:
@@ -40,11 +40,11 @@ migrate_config() {
|
||||
fi
|
||||
|
||||
# Migrate security_patch config*
|
||||
if [ ! -s "/data/adb/security_patch" ]; then
|
||||
echo "#Tricky Addon security patch auto config" > "/data/adb/security_patch"
|
||||
if [ -f "/data/adb/security_patch" ]; then
|
||||
if grep -q "^auto_config=1" "/data/adb/security_patch"; then
|
||||
touch "/data/adb/tricky_store/security_patch_auto_config"
|
||||
fi
|
||||
if ! grep -q "^auto_config=" "/data/adb/security_patch"; then
|
||||
echo "auto_config=1" >> "/data/adb/security_patch"
|
||||
rm -f "/data/adb/security_patch"
|
||||
fi
|
||||
|
||||
# Additional system app
|
||||
|
||||
@@ -23,7 +23,7 @@ add_denylist_to_target() {
|
||||
}
|
||||
|
||||
# Spoof security patch
|
||||
if grep -q "^auto_config=1" "/data/adb/security_patch"; then
|
||||
if [ -f "/data/adb/tricky_store/security_patch_auto_config" ]; then
|
||||
sh "$MODPATH/common/get_extra.sh" --security-patch
|
||||
fi
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ fi
|
||||
# Remove residue and restore aosp keybox.
|
||||
rm -rf "/data/adb/modules/.TA_utl"
|
||||
rm -f "/data/adb/boot_hash"
|
||||
rm -f "/data/adb/security_patch"
|
||||
rm -f "/data/adb/tricky_store/security_patch_auto_config"
|
||||
rm -f "/data/adb/tricky_store/target_from_denylist"
|
||||
rm -f "/data/adb/tricky_store/system_app"
|
||||
if [ -d "$TS" ]; then
|
||||
|
||||
@@ -36,7 +36,7 @@ async function handleSecurityPatch(mode, value = null) {
|
||||
if (mode === 'disable') {
|
||||
try {
|
||||
await execCommand(`
|
||||
sed -i "s/^auto_config=.*/auto_config=0/" /data/adb/security_patch
|
||||
rm -f /data/adb/tricky_store/security_patch_auto_config
|
||||
rm -f /data/adb/tricky_store/security_patch.txt
|
||||
`);
|
||||
showPrompt('security_patch.value_empty');
|
||||
@@ -48,7 +48,7 @@ async function handleSecurityPatch(mode, value = null) {
|
||||
} else if (mode === 'manual') {
|
||||
try {
|
||||
await execCommand(`
|
||||
sed -i "s/^auto_config=.*/auto_config=0/" /data/adb/security_patch
|
||||
rm -f /data/adb/tricky_store/security_patch_auto_config
|
||||
echo "${value}" > /data/adb/tricky_store/security_patch.txt
|
||||
chmod 644 /data/adb/tricky_store/security_patch.txt
|
||||
`);
|
||||
@@ -63,23 +63,14 @@ async function handleSecurityPatch(mode, value = null) {
|
||||
|
||||
// Load current configuration
|
||||
async function loadCurrentConfig() {
|
||||
let allValue, systemValue, bootValue, vendorValue;
|
||||
try {
|
||||
const result = await execCommand('cat /data/adb/security_patch');
|
||||
if (result) {
|
||||
const lines = result.split('\n');
|
||||
let autoConfig = '1', allValue = '0', systemValue = '0', bootValue = '0', vendorValue = '0';
|
||||
for (const line of lines) {
|
||||
if (line.startsWith('auto_config=')) {
|
||||
autoConfig = line.split('=')[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (autoConfig === '1') {
|
||||
const autoConfig = await execCommand('[ -f /data/adb/tricky_store/security_patch_auto_config ] && echo "true" || echo "false"');
|
||||
if (autoConfig.trim() === 'true') {
|
||||
allValue = null;
|
||||
systemValue = null;
|
||||
bootValue = null;
|
||||
vendorValue = null;
|
||||
overlay.classList.add('hidden');
|
||||
} else {
|
||||
// Read values from tricky_store if auto_config is 0
|
||||
const trickyResult = await execCommand('cat /data/adb/tricky_store/security_patch.txt');
|
||||
@@ -112,11 +103,7 @@ async function loadCurrentConfig() {
|
||||
}
|
||||
}
|
||||
}
|
||||
overlay.classList.add('hidden');
|
||||
}
|
||||
|
||||
// Check if in advanced mode
|
||||
if (autoConfig === '0' && allValue === null && (bootValue || systemValue || vendorValue)) {
|
||||
if (allValue === null && (bootValue || systemValue || vendorValue)) {
|
||||
checkAdvanced(true);
|
||||
}
|
||||
}
|
||||
@@ -239,7 +226,7 @@ export function securityPatch() {
|
||||
if (output.trim() === "not set") {
|
||||
showPrompt('security_patch.auto_failed', false);
|
||||
} else {
|
||||
await execCommand(`sed -i "s/^auto_config=.*/auto_config=1/" /data/adb/security_patch`);
|
||||
await execCommand(`touch /data/adb/tricky_store/security_patch_auto_config`);
|
||||
// Reset inputs
|
||||
allPatchInput.value = '';
|
||||
systemPatchInput.value = '';
|
||||
|
||||
Reference in New Issue
Block a user