diff --git a/module/common/get_extra.sh b/module/common/get_extra.sh
index b18f270..9d37736 100644
--- a/module/common/get_extra.sh
+++ b/module/common/get_extra.sh
@@ -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 "
[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} | " | head -n 1 | sed 's/\(.*\)<\/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
diff --git a/module/webui/index.html b/module/webui/index.html
index 47ae420..23053d8 100644
--- a/module/webui/index.html
+++ b/module/webui/index.html
@@ -325,9 +325,12 @@
-
diff --git a/module/webui/locales/A-template.json b/module/webui/locales/A-template.json
index e778795..163f859 100644
--- a/module/webui/locales/A-template.json
+++ b/module/webui/locales/A-template.json
@@ -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",
diff --git a/module/webui/locales/en-US.json b/module/webui/locales/en-US.json
index e778795..163f859 100644
--- a/module/webui/locales/en-US.json
+++ b/module/webui/locales/en-US.json
@@ -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",
diff --git a/module/webui/locales/es-ES.json b/module/webui/locales/es-ES.json
index 10c026a..f63149d 100644
--- a/module/webui/locales/es-ES.json
+++ b/module/webui/locales/es-ES.json
@@ -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",
diff --git a/module/webui/locales/ja-JP.json b/module/webui/locales/ja-JP.json
index 0f41388..ece7c0b 100644
--- a/module/webui/locales/ja-JP.json
+++ b/module/webui/locales/ja-JP.json
@@ -95,8 +95,10 @@
"security_patch": {
"title": "セキュリティ补丁",
"advanced_mode": "高度",
+ "get_date": "セキュリティパッチの日付を取得",
"auto": "自動",
"save": "保存",
+ "get_failed": "セキュリティパッチの日付の取得に失敗しました",
"auto_success": "自動配置已成功啟用",
"auto_failed": "自動設定を有効にできませんでした",
"save_success": "セキュリティパッチが正常に保存されました",
diff --git a/module/webui/locales/ru-RU.json b/module/webui/locales/ru-RU.json
index bc392b4..1dee3fa 100644
--- a/module/webui/locales/ru-RU.json
+++ b/module/webui/locales/ru-RU.json
@@ -95,8 +95,10 @@
"security_patch": {
"title": "Патч безопасности",
"advanced_mode": "Расширенный",
+ "get_date": "Получить дату патча безопасности",
"auto": "Авто",
"save": "Сохранить",
+ "get_failed": "Не удалось получить дату патча безопасности",
"auto_success": "Автоматическая конфигурация успешно включена",
"auto_failed": "Не удалось включить автоматическую конфигурацию",
"save_success": "Патч безопасности успешно сохранен",
diff --git a/module/webui/locales/tl-PH.json b/module/webui/locales/tl-PH.json
index c13e75a..f8d3222 100644
--- a/module/webui/locales/tl-PH.json
+++ b/module/webui/locales/tl-PH.json
@@ -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",
diff --git a/module/webui/locales/tr-TR.json b/module/webui/locales/tr-TR.json
index 951e7ac..4013ea3 100644
--- a/module/webui/locales/tr-TR.json
+++ b/module/webui/locales/tr-TR.json
@@ -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",
diff --git a/module/webui/locales/zh-CN.json b/module/webui/locales/zh-CN.json
index 46a9964..517672f 100644
--- a/module/webui/locales/zh-CN.json
+++ b/module/webui/locales/zh-CN.json
@@ -95,8 +95,10 @@
"security_patch": {
"title": "安全补丁",
"advanced_mode": "高级",
+ "get_date": "获取安全补丁日期",
"auto": "自动",
"save": "保存",
+ "get_failed": "获取安全补丁日期失败",
"auto_success": "自动配置成功启用",
"auto_failed": "无法启用自动配置",
"save_success": "安全补丁成功保存",
diff --git a/module/webui/locales/zh-TW.json b/module/webui/locales/zh-TW.json
index 845b908..6c7a017 100644
--- a/module/webui/locales/zh-TW.json
+++ b/module/webui/locales/zh-TW.json
@@ -95,8 +95,10 @@
"security_patch": {
"title": "安全補丁",
"advanced_mode": "進階",
+ "get_date": "獲取安全補丁日期",
"auto": "自動",
"save": "保存",
+ "get_failed": "獲取安全補丁日期失敗",
"auto_success": "自動配置成功啟用",
"auto_failed": "無法啟用自動配置",
"save_success": "安全補丁成功保存",
diff --git a/module/webui/scripts/main.js b/module/webui/scripts/main.js
index 99e396c..32d6af4 100644
--- a/module/webui/scripts/main.js
+++ b/module/webui/scripts/main.js
@@ -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;
diff --git a/module/webui/scripts/security_patch.js b/module/webui/scripts/security_patch.js
index 00276a3..79faf16 100644
--- a/module/webui/scripts/security_patch.js
+++ b/module/webui/scripts/security_patch.js
@@ -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);
+ }
+ });
}
diff --git a/module/webui/styles/security-patch.css b/module/webui/styles/security-patch.css
index 3b4956a..2d0e42d 100644
--- a/module/webui/styles/security-patch.css
+++ b/module/webui/styles/security-patch.css
@@ -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;
|