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