option to fetch a security patch date

This commit is contained in:
KOWX712
2025-02-18 18:05:10 +08:00
parent 581d81d5dd
commit c44a101776
14 changed files with 56 additions and 5 deletions

View File

@@ -153,6 +153,11 @@ set_security_patch() {
fi
}
get_latest_security_patch() {
security_patch=$(download --fetch https://source.android.com/docs/security/bulletin/pixel | grep -o "<td>[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}</td>" | head -n 1 | sed 's/<td>\(.*\)<\/td>/\1/')
[ -n "$security_patch" ] && echo "$security_patch" || exit 1
}
case "$1" in
--kb)
get_kb
@@ -190,4 +195,8 @@ case "$1" in
set_security_patch
exit
;;
--get-security-patch)
get_latest_security_patch
exit
;;
esac

View File

@@ -325,9 +325,12 @@
<label for="advanced-mode" data-i18n="security_patch.advanced_mode"></label>
</div>
<div class="button-container">
<button id="auto-config" class="auto-button" data-i18n="security_patch.auto">Auto</button>
<button id="save-patch" class="save-button" data-i18n="security_patch.save">Save</button>
<div>
<button id="get-patch" class="get-button" data-i18n="security_patch.get_date"></button>
<div class="button-container">
<button id="auto-config" class="auto-button" data-i18n="security_patch.auto"></button>
<button id="save-patch" class="save-button" data-i18n="security_patch.save"></button>
</div>
</div>
</div>
</div>

View File

@@ -95,8 +95,10 @@
"security_patch": {
"title": "Security Patch",
"advanced_mode": "Advanced",
"get_date": "Get Security Patch Date",
"auto": "Auto",
"save": "Save",
"get_failed": "Failed to fetch security patch date",
"auto_success": "Auto config enabled successfully",
"auto_failed": "Failed to enable auto config",
"save_success": "Security patch saved successfully",

View File

@@ -95,8 +95,10 @@
"security_patch": {
"title": "Security Patch",
"advanced_mode": "Advanced",
"get_date": "Get Security Patch Date",
"auto": "Auto",
"save": "Save",
"get_failed": "Failed to fetch security patch date",
"auto_success": "Auto config enabled successfully",
"auto_failed": "Failed to enable auto config",
"save_success": "Security patch saved successfully",

View File

@@ -95,8 +95,10 @@
"security_patch": {
"title": "Parche de Seguridad",
"advanced_mode": "Avanzado",
"get_date": "Obtener Fecha del Parche de Seguridad",
"auto": "Automático",
"save": "Guardar",
"get_failed": "Error al obtener la fecha del parche de seguridad",
"auto_success": "Configuración automática habilitada con éxito",
"auto_failed": "Error al habilitar la configuración automática",
"save_success": "Parche de seguridad guardado con éxito",

View File

@@ -95,8 +95,10 @@
"security_patch": {
"title": "セキュリティ补丁",
"advanced_mode": "高度",
"get_date": "セキュリティパッチの日付を取得",
"auto": "自動",
"save": "保存",
"get_failed": "セキュリティパッチの日付の取得に失敗しました",
"auto_success": "自動配置已成功啟用",
"auto_failed": "自動設定を有効にできませんでした",
"save_success": "セキュリティパッチが正常に保存されました",

View File

@@ -95,8 +95,10 @@
"security_patch": {
"title": "Патч безопасности",
"advanced_mode": "Расширенный",
"get_date": "Получить дату патча безопасности",
"auto": "Авто",
"save": "Сохранить",
"get_failed": "Не удалось получить дату патча безопасности",
"auto_success": "Автоматическая конфигурация успешно включена",
"auto_failed": "Не удалось включить автоматическую конфигурацию",
"save_success": "Патч безопасности успешно сохранен",

View File

@@ -95,8 +95,10 @@
"security_patch": {
"title": "Security Patch",
"advanced_mode": "Advanced",
"get_date": "Kunin ang Petsa ng Security Patch",
"auto": "Auto",
"save": "I-save",
"get_failed": "Hindi makuha ang petsa ng security patch",
"auto_success": "Matagumpay na na-enable ang auto config",
"auto_failed": "Nabigong i-enable ang auto config",
"save_success": "Matagumpay na na-save ang security patch",

View File

@@ -95,8 +95,10 @@
"security_patch": {
"title": "Güvenlik Yaması",
"advanced_mode": "Gelişmiş",
"get_date": "Güvenlik Yaması Tarihini Al",
"auto": "Otomatik",
"save": "Kaydet",
"get_failed": "Güvenlik yaması tarihi alınamadı",
"auto_success": "Otomatik yapılandırma başarıyla etkinleştirildi",
"auto_failed": "Otomatik yapılandırma etkinleştirilemedi",
"save_success": "Güvenlik yaması başarıyla kaydedildi",

View File

@@ -95,8 +95,10 @@
"security_patch": {
"title": "安全补丁",
"advanced_mode": "高级",
"get_date": "获取安全补丁日期",
"auto": "自动",
"save": "保存",
"get_failed": "获取安全补丁日期失败",
"auto_success": "自动配置成功启用",
"auto_failed": "无法启用自动配置",
"save_success": "安全补丁成功保存",

View File

@@ -95,8 +95,10 @@
"security_patch": {
"title": "安全補丁",
"advanced_mode": "進階",
"get_date": "獲取安全補丁日期",
"auto": "自動",
"save": "保存",
"get_failed": "獲取安全補丁日期失敗",
"auto_success": "自動配置成功啟用",
"auto_failed": "無法啟用自動配置",
"save_success": "安全補丁成功保存",

View File

@@ -21,7 +21,7 @@ export const basePath = "set-path";
export const appsWithExclamation = [];
export const appsWithQuestion = [];
const ADDITIONAL_APPS = [ "android", "com.android.vending", "com.google.android.gms", "io.github.vvb2060.keyattestation", "io.github.vvb2060.mahoshojo", "icu.nullptr.nativetest" ]; // Always keep default apps in target.txt
const rippleClasses = ['.language-option', '.menu-button', '.menu-options li', '.search-card', '.card', '.update-card', '.link-icon', '.floating-btn', '.uninstall-container', '.boot-hash-save-button', '.boot-hash-value', '.reboot', '.install', '.file-item', '.save-button', '.auto-button'];
const rippleClasses = ['.language-option', '.menu-button', '.menu-options li', '.search-card', '.card', '.update-card', '.link-icon', '.floating-btn', '.uninstall-container', '.boot-hash-save-button', '.boot-hash-value', '.reboot', '.install', '.file-item', '.save-button', '.auto-button', '.get-button'];
// Variables
let e = 0;

View File

@@ -9,6 +9,7 @@ const allPatchInput = document.getElementById('all-patch');
const bootPatchInput = document.getElementById('boot-patch');
const systemPatchInput = document.getElementById('system-patch');
const vendorPatchInput = document.getElementById('vendor-patch');
const getButton = document.getElementById('get-patch');
const autoButton = document.getElementById('auto-config');
const saveButton = document.getElementById('save-patch');
@@ -319,4 +320,20 @@ export function securityPatch() {
hideSecurityPatchDialog();
loadCurrentConfig();
});
// Get button
getButton.addEventListener('click', async () => {
try {
const output = await execCommand(`sh ${basePath}common/get_extra.sh --get-security-patch`);
advancedToggle.checked = true;
normalInputs.classList.add('hidden');
advancedInputs.classList.remove('hidden');
systemPatchInput.value = 'prop';
bootPatchInput.value = output;
vendorPatchInput.value = output;
} catch (error) {
showPrompt('security_patch.get_failed', false);
}
});
}

View File

@@ -127,7 +127,9 @@
margin-top: 10px;
}
.auto-button, .save-button {
.get-button,
.auto-button,
.save-button {
width: 100%;
padding: 12px;
border: none;
@@ -139,6 +141,7 @@
transition: background-color 0.2s ease;
}
.get-button,
.auto-button {
background-color: #ddd;
user-select: none;
@@ -174,6 +177,7 @@
border: 1px solid #6E6E6E;
}
.get-button,
.auto-button {
background-color: #6E6E6E;
color: white;