allow save empty

This commit is contained in:
KOWX712
2025-02-11 17:20:22 +08:00
parent 6ee2b65b75
commit 41430b4386
10 changed files with 39 additions and 12 deletions

View File

@@ -100,7 +100,7 @@
"auto_failed": "Failed to enable auto config",
"save_success": "Security patch saved successfully",
"save_failed": "Failed to save security patch",
"value_empty": "Value cannot be empty",
"value_empty": "Security patch configuration is disabled.",
"invalid_all": "Invalid format.",
"invalid_boot": "Invalid boot format.",
"invalid_system": "Invalid system format.",

View File

@@ -100,7 +100,7 @@
"auto_failed": "Failed to enable auto config",
"save_success": "Security patch saved successfully",
"save_failed": "Failed to save security patch",
"value_empty": "Value cannot be empty",
"value_empty": "Security patch configuration is disabled.",
"invalid_all": "Invalid format.",
"invalid_boot": "Invalid boot format.",
"invalid_system": "Invalid system format.",

View File

@@ -100,7 +100,7 @@
"auto_failed": "Error al habilitar la configuración automática",
"save_success": "Parche de seguridad guardado con éxito",
"save_failed": "Error al guardar el parche de seguridad",
"value_empty": "El valor no puede estar vacío",
"value_empty": "La configuración del parche de seguridad está deshabilitada.",
"invalid_all": "Formato inválido.",
"invalid_boot": "Formato de arranque inválido.",
"invalid_system": "Formato de sistema inválido.",

View File

@@ -100,7 +100,7 @@
"auto_failed": "自動設定を有効にできませんでした",
"save_success": "セキュリティパッチが正常に保存されました",
"save_failed": "セキュリティパッチの保存に失敗しました",
"value_empty": "値は空にできません",
"value_empty": "セキュリティパッチの設定は無効です。",
"invalid_all": "無効な形式です。",
"invalid_boot": "無効なブート形式です。",
"invalid_system": "無効なシステム形式です。",

View File

@@ -100,7 +100,7 @@
"auto_failed": "Не удалось включить автоматическую конфигурацию",
"save_success": "Патч безопасности успешно сохранен",
"save_failed": "Не удалось сохранить патч безопасности",
"value_empty": "Значение не может быть пустым",
"value_empty": "Конфигурация патча безопасности отключена.",
"invalid_all": "Неверный формат.",
"invalid_boot": "Неверный формат загрузки.",
"invalid_system": "Неверный формат системы.",

View File

@@ -100,7 +100,7 @@
"auto_failed": "Nabigong i-enable ang auto config",
"save_success": "Matagumpay na na-save ang security patch",
"save_failed": "Nabigong i-save ang security patch",
"value_empty": "Hindi pwedeng walang laman ang value",
"value_empty": "Naka-disable ang configuration ng security patch.",
"invalid_all": "Invalid format.",
"invalid_boot": "Invalid boot format.",
"invalid_system": "Invalid system format.",

View File

@@ -100,7 +100,7 @@
"auto_failed": "Otomatik yapılandırma etkinleştirilemedi",
"save_success": "Güvenlik parçası başarıyla kaydedildi",
"save_failed": "Güvenlik parçası kaydedilemedi",
"value_empty": "Değer boş olamaz",
"value_empty": "Güvenlik parçası yapılandırması devre dışı bırakıldı.",
"invalid_all": "Geçersiz format",
"invalid_boot": "Geçersiz başlatma formatı",
"invalid_system": "Geçersiz sistem formatı",

View File

@@ -100,7 +100,7 @@
"auto_failed": "无法启用自动配置",
"save_success": "安全补丁成功保存",
"save_failed": "保存安全补丁失败",
"value_empty": "值不能为空",
"value_empty": "安全补丁配置已禁用。",
"invalid_all": "无效格式。",
"invalid_boot": "无效启动格式。",
"invalid_system": "无效系统格式。",

View File

@@ -100,7 +100,7 @@
"auto_failed": "無法啟用自動配置",
"save_success": "安全補丁成功保存",
"save_failed": "保存安全補丁失敗",
"value_empty": "值不能為空",
"value_empty": "安全補丁配置已禁用。",
"invalid_all": "無效格式。",
"invalid_boot": "無效啟動格式。",
"invalid_system": "無效系統格式。",

View File

@@ -13,7 +13,6 @@ const autoButton = document.getElementById('auto-config');
const saveButton = document.getElementById('save-patch');
export function showSecurityPatchDialog() {
overlay.style.display = 'block';
card.style.display = 'block';
setTimeout(() => {
@@ -132,6 +131,10 @@ export function securityPatch() {
autoButton.addEventListener('click', async () => {
try {
await execCommand(`sed -i "s/^auto_config=.*/auto_config=1/" /data/adb/security_patch`);
allPatchInput.value = '';
bootPatchInput.value = '';
systemPatchInput.value = '';
vendorPatchInput.value = '';
showPrompt('security_patch.auto_success');
} catch (error) {
showPrompt('security_patch.auto_failed');
@@ -146,7 +149,17 @@ export function securityPatch() {
// Normal mode validation
const allValue = allPatchInput.value.trim();
if (!allValue) {
showPrompt('security_patch.value_empty');
// Allow saving empty value
try {
await execCommand(`
sed -i "s/^auto_config=.*/auto_config=0/" /data/adb/security_patch
> /data/adb/tricky_store/security_patch.txt
`);
showPrompt('security_patch.value_empty');
} catch (error) {
showPrompt('security_patch.save_failed');
}
hideSecurityPatchDialog();
return;
}
if (!isValid8Digit(allValue)) {
@@ -158,6 +171,9 @@ export function securityPatch() {
sed -i "s/^auto_config=.*/auto_config=0/" /data/adb/security_patch
echo all=${allValue} > /data/adb/tricky_store/security_patch.txt
`);
bootPatchInput.value = '';
systemPatchInput.value = '';
vendorPatchInput.value = '';
showPrompt('security_patch.save_success');
} catch (error) {
showPrompt('security_patch.save_failed');
@@ -169,7 +185,17 @@ export function securityPatch() {
const vendorValue = vendorPatchInput.value.trim();
if (!bootValue && !systemValue && !vendorValue) {
showPrompt('security_patch.value_empty');
// Allow saving empty values for advanced mode as well
try {
await execCommand(`
sed -i "s/^auto_config=.*/auto_config=0/" /data/adb/security_patch
> /data/adb/tricky_store/security_patch.txt
`);
showPrompt('security_patch.value_empty');
} catch (error) {
showPrompt('security_patch.save_failed');
}
hideSecurityPatchDialog();
return;
}
@@ -198,6 +224,7 @@ export function securityPatch() {
sed -i "s/^auto_config=.*/auto_config=0/" /data/adb/security_patch
echo "${config.join(' ')}" > /data/adb/tricky_store/security_patch.txt
`);
allPatchInput.value = '';
showPrompt('security_patch.save_success');
hideSecurityPatchDialog();
} catch (error) {