change update method

This commit is contained in:
KOWX712
2024-12-31 17:02:04 +08:00
parent 1d5428e683
commit 502e6f6ea6
14 changed files with 386 additions and 83 deletions

View File

@@ -87,8 +87,8 @@
<!-- Applist Display -->
<div id="apps-list"></div>
<div class="update-card" id="update-card">
<p id="update-available" data-i18n="update_banner.update_available"></p>
<p id="redirect-to-release" data-i18n="update_banner.redirect_to_release"></p>
<p id="update-available" data-i18n="update.update_available"></p>
<p id="redirect-to-release" data-i18n="update.redirect_to_release"></p>
</div>
<div class="mode-overlay"></div>
<template id="app-template">
@@ -97,29 +97,29 @@
<div class="content" data-package="">
<div class="mode">
<label class="mode-switch" id="normal">
<input type="radio" class="mode-input" id="normal-mode">
<i class="mode-icon">
<div class="status-indicator" id="normal-indicator">
<svg xmlns="http://www.w3.org/2000/svg" height="30px" viewBox="0 -960 960 960" width="30px" fill="#ffffff"><path d="M480-480Zm0 280q-116 0-198-82t-82-198q0-116 82-198t198-82q116 0 198 82t82 198q0 116-82 198t-198 82Zm0-80q83 0 141.5-58.5T680-480q0-83-58.5-141.5T480-680q-83 0-141.5 58.5T280-480q0 83 58.5 141.5T480-280Z"/></svg>
</div>
</i>
</label>
<label class="mode-switch" id="generate">
<input type="radio" class="mode-input" id="generate-mode">
<i class="mode-icon">
<div class="status-indicator" id="generate-indicator">
<svg xmlns="http://www.w3.org/2000/svg" height="18px" viewBox="0 -960 960 960" width="18px" fill="#ffffff"><path d="M480-120q-33 0-56.5-23.5T400-200q0-33 23.5-56.5T480-280q33 0 56.5 23.5T560-200q0 33-23.5 56.5T480-120Zm-80-240v-480h160v480H400Z"/></svg>
</div>
</i>
</label>
<label class="mode-switch" id="hack">
<input type="radio" class="mode-input" id="hack-mode">
<i class="mode-icon">
<div class="status-indicator" id="hack-indicator">
<svg xmlns="http://www.w3.org/2000/svg" height="19px" viewBox="0 -960 960 960" width="19px" fill="#ffffff"><path d="M424-320q0-81 14.5-116.5T500-514q41-36 62.5-62.5T584-637q0-41-27.5-68T480-732q-51 0-77.5 31T365-638l-103-44q21-64 77-111t141-47q105 0 161.5 58.5T698-641q0 50-21.5 85.5T609-475q-49 47-59.5 71.5T539-320H424Zm56 240q-33 0-56.5-23.5T400-160q0-33 23.5-56.5T480-240q33 0 56.5 23.5T560-160q0 33-23.5 56.5T480-80Z"/></svg>
</div>
</i>
</label>
<input type="radio" class="mode-input" id="normal-mode">
<i class="mode-icon">
<div class="status-indicator" id="normal-indicator">
<svg xmlns="http://www.w3.org/2000/svg" height="30px" viewBox="0 -960 960 960" width="30px" fill="#ffffff"><path d="M480-480Zm0 280q-116 0-198-82t-82-198q0-116 82-198t198-82q116 0 198 82t82 198q0 116-82 198t-198 82Zm0-80q83 0 141.5-58.5T680-480q0-83-58.5-141.5T480-680q-83 0-141.5 58.5T280-480q0 83 58.5 141.5T480-280Z"/></svg>
</div>
</i>
</label>
<label class="mode-switch" id="generate">
<input type="radio" class="mode-input" id="generate-mode">
<i class="mode-icon">
<div class="status-indicator" id="generate-indicator">
<svg xmlns="http://www.w3.org/2000/svg" height="18px" viewBox="0 -960 960 960" width="18px" fill="#ffffff"><path d="M480-120q-33 0-56.5-23.5T400-200q0-33 23.5-56.5T480-280q33 0 56.5 23.5T560-200q0 33-23.5 56.5T480-120Zm-80-240v-480h160v480H400Z"/></svg>
</div>
</i>
</label>
<label class="mode-switch" id="hack">
<input type="radio" class="mode-input" id="hack-mode">
<i class="mode-icon">
<div class="status-indicator" id="hack-indicator">
<svg xmlns="http://www.w3.org/2000/svg" height="19px" viewBox="0 -960 960 960" width="19px" fill="#ffffff"><path d="M424-320q0-81 14.5-116.5T500-514q41-36 62.5-62.5T584-637q0-41-27.5-68T480-732q-51 0-77.5 31T365-638l-103-44q21-64 77-111t141-47q105 0 161.5 58.5T698-641q0 50-21.5 85.5T609-475q-49 47-59.5 71.5T539-320H424Zm56 240q-33 0-56.5-23.5T400-160q0-33 23.5-56.5T480-240q33 0 56.5 23.5T560-160q0 33-23.5 56.5T480-80Z"/></svg>
</div>
</i>
</label>
</div>
<p class="name"></p>
<div class="checkbox-wrapper">
@@ -237,6 +237,21 @@
</div>
</div>
<!-- Update Overlay -->
<div class="update-overlay">
<div class="update-menu">
<button class="close-update">&#x2715;</button>
<div class="update-content">
<h1 data-i18n="update.changelog"></h1>
<p class="changelog"></p>
<div class="update-button-container">
<button class="install" data-i18n="update.install"></button>
<button class="reboot" data-i18n="update.reboot"></button>
</div>
</div>
</div>
</div>
<!-- Footer -->
<div class="footer">
<div class="uninstall-container hidden-uninstall">

View File

@@ -14,15 +14,18 @@
"select_denylist": "Select From DenyList",
"select_denylist_description": "Available in Magisk only, select apps that are in the DenyList. Recommended.",
"deselect_unnecessary": "Deselect Unnecessary",
"deselect_unnecessary_description": "Unnecessary category: Xposed module, root manager, root-related apps, and general apps that never check bootloader status. This option requires an Internet connection.",
"deselect_unnecessary_description": "Unnecessary category: Xposed module, root manager, root-related apps, and general apps that never check bootloader status. This option requires Internet connection.",
"set_keybox": "Set AOSP & Valid Keybox",
"set_keybox_description": "Replace tricky store keybox.xml. AOSP keybox will be replaced if there's no more valid keybox. Valid keybox option requires Internet connection.",
"set_verified_boot_hash": "Set Verified Boot Hash",
"set_verified_boot_hash_description": "Get verifiedBootHash value from Key Attestation Demo. Fix abnormal boot state by resetting ro.boot.vbmeta.digest."
},
"update_banner": {
"update": {
"update_available": "A new version is ready",
"redirect_to_release": "tap to download the latest version"
"redirect_to_release": "tap to download the latest version",
"changelog": "Changelog",
"install": "Install",
"reboot": "Reboot"
},
"search_bar": {
"search_placeholder": "Search"
@@ -70,6 +73,14 @@
"save_error": "Failed to save config",
"uninstall_prompt": "WebUI will be removed after reboot",
"uninstall_failed": "Failed to uninstall WebUI",
"new_update": "A new update is available!"
"new_update": "A new update is available!",
"downloading": "Downloading new update...",
"downloaded": "Download completed",
"download_fail": "Fail to download update",
"installing": "Installing update...",
"installed": "Installed successfully, reboot now.",
"install_fail": "Fail to install, please update manual",
"rebooting": "Rebooting...",
"reboot_fail": "Fail to reboot, please reboot manually"
}
}

View File

@@ -14,15 +14,18 @@
"select_denylist": "Select From DenyList",
"select_denylist_description": "Available in Magisk only, select apps that are in the DenyList. Recommended.",
"deselect_unnecessary": "Deselect Unnecessary",
"deselect_unnecessary_description": "Unnecessary category: Xposed module, root manager, root-related apps, and general apps that never check bootloader status. This option requires an Internet connection.",
"deselect_unnecessary_description": "Unnecessary category: Xposed module, root manager, root-related apps, and general apps that never check bootloader status. This option requires Internet connection.",
"set_keybox": "Set AOSP & Valid Keybox",
"set_keybox_description": "Replace tricky store keybox.xml. AOSP keybox will be replaced if there's no more valid keybox. Valid keybox option requires Internet connection.",
"set_verified_boot_hash": "Set Verified Boot Hash",
"set_verified_boot_hash_description": "Get verifiedBootHash value from Key Attestation Demo. Fix abnormal boot state by resetting ro.boot.vbmeta.digest."
},
"update_banner": {
"update": {
"update_available": "A new version is ready",
"redirect_to_release": "tap to download the latest version"
"redirect_to_release": "tap to download the latest version",
"changelog": "Changelog",
"install": "Install",
"reboot": "Reboot"
},
"search_bar": {
"search_placeholder": "Search"
@@ -70,6 +73,14 @@
"save_error": "Failed to save config",
"uninstall_prompt": "WebUI will be removed after reboot",
"uninstall_failed": "Failed to uninstall WebUI",
"new_update": "A new update is available!"
"new_update": "A new update is available!",
"downloading": "Downloading new update...",
"downloaded": "Download completed",
"download_fail": "Fail to download update",
"installing": "Installing update...",
"installed": "Installed successfully, reboot now.",
"install_fail": "Fail to install, please update manual",
"rebooting": "Rebooting...",
"reboot_fail": "Fail to reboot, please reboot manually"
}
}

View File

@@ -20,9 +20,12 @@
"set_verified_boot_hash": "Configurar Boot Hash Verificado",
"set_verified_boot_hash_description": "Obtén el valor de verifiedBootHash del Key Attestation Demo. Corrige un estado de arranque anormal reiniciando ro.boot.vbmeta.digest."
},
"update_banner": {
"update": {
"update_available": "Una nueva versión está lista",
"redirect_to_release": "toca para descargar la última versión"
"redirect_to_release": "toca para descargar la última versión",
"changelog": "Registro de cambios",
"install": "Instalar",
"reboot": "Reiniciar"
},
"search_bar": {
"search_placeholder": "Buscar"
@@ -70,6 +73,14 @@
"save_error": "Error al guardar la configuración",
"uninstall_prompt": "El WebUI se eliminará después de reiniciar",
"uninstall_failed": "Error al desinstalar el WebUI",
"new_update": "¡Una nueva actualización está disponible!"
"new_update": "¡Una nueva actualización está disponible!",
"downloading": "Descargando nueva actualización...",
"downloaded": "Descarga completada",
"download_fail": "Error al descargar la actualización",
"installing": "Instalando actualización...",
"installed": "Instalado con éxito, reinicia ahora.",
"install_fail": "Error al instalar, actualiza manualmente",
"rebooting": "Reiniciando...",
"reboot_fail": "Error al reiniciar, reinicia manualmente"
}
}

View File

@@ -20,9 +20,12 @@
"set_verified_boot_hash": "確認付きブートハッシュを設定",
"set_verified_boot_hash_description": "Key Attestation Demo から確認付きブートハッシュの値を取得します。ro.boot.vbmeta.digest をリセットして異常なブート状態を修正します。"
},
"update_banner": {
"update": {
"update_available": "新しいバージョンの準備完了",
"redirect_to_release": "タップで最新のバージョンをダウンロード"
"redirect_to_release": "タップで最新のバージョンをダウンロード",
"changelog": "変更履歴",
"install": "インストール",
"reboot": "再起動"
},
"search_bar": {
"search_placeholder": "検索"
@@ -70,6 +73,14 @@
"save_error": "設定の保存に失敗しました。",
"uninstall_prompt": "WebUI は再起動後に削除されます。",
"uninstall_failed": "WebUI のアンインストールに失敗しました。",
"new_update": "新しいバージョンがあります!"
"new_update": "新しいバージョンがあります!",
"downloading": "新しい更新をダウンロード中...",
"downloaded": "ダウンロードが完了しました",
"download_fail": "更新のダウンロードに失敗しました",
"installing": "更新をインストール中...",
"installed": "正常にインストールされました。再起動してください。",
"install_fail": "インストールに失敗しました。手動で更新してください。",
"rebooting": "再起動中...",
"reboot_fail": "再起動に失敗しました。手動で再起動してください。"
}
}

View File

@@ -20,9 +20,12 @@
"set_verified_boot_hash": "Установить Verified Boot Hash",
"set_verified_boot_hash_description": "Получите значение verifiedBootHash из Key Attestation Demo. Исправьте аномальное состояние загрузки, сбросив ro.boot.vbmeta.digest."
},
"update_banner": {
"update": {
"update_available": "Доступна новая версия",
"redirect_to_release": "нажмите, чтобы скачать последнюю версию"
"redirect_to_release": "нажмите, чтобы скачать последнюю версию",
"changelog": "Список изменений",
"install": "Установить",
"reboot": "Перезагрузить"
},
"search_bar": {
"search_placeholder": "Поиск"
@@ -70,6 +73,14 @@
"save_error": "Не удалось сохранить конфигурацию",
"uninstall_prompt": "WebUI будет удален после перезагрузки",
"uninstall_failed": "Не удалось удалить WebUI",
"new_update": "Доступно новое обновление!"
"new_update": "Доступно новое обновление!",
"downloading": "Загрузка нового обновления...",
"downloaded": "Загрузка завершена",
"download_fail": "Не удалось загрузить обновление",
"installing": "Установка обновления...",
"installed": "Успешно установлено, перезагрузите устройство.",
"install_fail": "Не удалось установить, обновите вручную",
"rebooting": "Перезагрузка...",
"reboot_fail": "Не удалось перезагрузить, перезагрузите вручную"
}
}

View File

@@ -20,9 +20,12 @@
"set_verified_boot_hash": "I-set ang Verified Boot Hash",
"set_verified_boot_hash_description": "Kunin ang verifiedBootHash mula sa Key Attestation Demo. Ayusin ang abnormal na boot state sa pamamagitan ng pag-reset ng ro.boot.vbmeta.digest."
},
"update_banner": {
"update": {
"update_available": "Handa na ang bagong bersyon",
"redirect_to_release": "i-tap para i-download ang pinakabagong bersyon"
"redirect_to_release": "i-tap para i-download ang pinakabagong bersyon",
"changelog": "Mga Pagbabago",
"install": "I-install",
"reboot": "I-reboot"
},
"search_bar": {
"search_placeholder": "Maghanap"
@@ -70,6 +73,14 @@
"save_error": "Nabigong i-save ang config",
"uninstall_prompt": "Mawawala ang WebUI pagkatapos ng reboot",
"uninstall_failed": "Nabigong i-uninstall ang WebUI",
"new_update": "May bagong update na available!"
"new_update": "May bagong update na available!",
"downloading": "Nagda-download ng bagong update...",
"downloaded": "Natapos ang pag-download",
"download_fail": "Nabigo ang pag-download ng update",
"installing": "Nag-i-install ng update...",
"installed": "Matagumpay na na-install, mag-reboot na ngayon.",
"install_fail": "Nabigo ang pag-install, pakisubukang mag-update nang manu-mano",
"rebooting": "Nag-re-reboot...",
"reboot_fail": "Nabigo ang pag-reboot, pakisubukang mag-reboot nang manu-mano"
}
}

View File

@@ -1,7 +1,7 @@
{
"language": "中文(简体)",
"header": {
"title": "TS插件"
"title": "TS 插件"
},
"help": {
"help_instructions": "使用指南",
@@ -20,9 +20,12 @@
"set_verified_boot_hash": "设置哈希值",
"set_verified_boot_hash_description": "从 Key Attestation Demo 获取 verifiedBootHash哈希值。通过重置 ro.boot.vbmeta.digest 修复异常 boot 状态。"
},
"update_banner": {
"update": {
"update_available": "发现新的版本",
"redirect_to_release": "点击跳转 GitHub 下载最新版本"
"redirect_to_release": "点击跳转 GitHub 下载最新版本",
"changelog": "更新日志",
"install": "安装",
"reboot": "重启"
},
"search_bar": {
"search_placeholder": "搜索"
@@ -70,6 +73,14 @@
"save_error": "保存配置失败",
"uninstall_prompt": "WebUI 将在重启后被移除",
"uninstall_failed": "卸载 WebUI 失败",
"new_update": "发现新的版本!"
"new_update": "发现新的版本!",
"downloading": "正在下载...",
"downloaded": "下载完成",
"download_fail": "下载失败",
"installing": "正常安装...",
"installed": "安装完成,重启生效",
"install_fail": "安装失败,请手动更新",
"rebooting": "正在重启...",
"reboot_fail": "重启失败,请手动重启"
}
}

View File

@@ -1,7 +1,7 @@
{
"language": "中文(繁",
"language": "中文(繁",
"header": {
"title": "TS插件"
"title": "TS 插件"
},
"help": {
"help_instructions": "使用指南",
@@ -13,19 +13,22 @@
"select_description": "選擇或取消選擇當前界面中的所有應用。",
"select_denylist": "從排除列表中選擇",
"select_denylist_description": "僅適用於 Magisk選擇在排除列表中的應用。推薦使用。",
"deselect_unnecessary": "取消選擇非必應用",
"deselect_unnecessary_description": "非必要分類Xposed 模、root 管理器、與 root 相關的應用,以及從不檢查 bootloader 狀態的通用應用。此功能需連網使用。",
"deselect_unnecessary": "取消選擇非必應用",
"deselect_unnecessary_description": "非必要分類Xposed 模、root 管理器、與 root 相關的應用,以及從不檢查 bootloader 狀態的通用應用。此功能需連網使用。",
"set_keybox": "設置 AOSP & 有效密鑰",
"set_keybox_description": "替換 Tricky Store 的密鑰keybox.xml。如果沒有有效密鑰將替換為 AOSP 密鑰。有效密鑰選項需連網使用。",
"set_verified_boot_hash": "設置哈希值",
"set_verified_boot_hash_description": "從 Key Attestation Demo 獲取 verifiedBootHash哈希值。通過重置 ro.boot.vbmeta.digest 修復異常 boot 狀態。"
},
"update_banner": {
"update_available": "發現新版本",
"redirect_to_release": "點擊跳轉 GitHub 下載最新版本"
"update": {
"update_available": "發現新版本",
"redirect_to_release": "點擊跳轉 GitHub 下載最新版本",
"changelog": "更新日誌",
"install": "安裝",
"reboot": "重啟"
},
"search_bar": {
"search_placeholder": "搜"
"search_placeholder": "搜"
},
"functional_button": {
"save_and_update_button": "保存",
@@ -39,27 +42,27 @@
"select_all": "全選",
"deselect_all": "取消全選",
"select_denylist": "從排除列表中選擇",
"deselect_unnecessary": "取消選擇非必應用",
"deselect_unnecessary": "取消選擇非必應用",
"set_aosp_keybox": "設置 AOSP 密鑰",
"set_valid_keybox": "設置有效密鑰",
"set_verified_boot_hash": "設置哈希值",
"about": "關於"
},
"reset_vbmeta": {
"boot_hash_input_placeholder": "在此貼您的哈希值",
"boot_hash_input_placeholder": "在此貼您的哈希值",
"boot_hash_save_button": "保存"
},
"about": {
"module_name_line1": "TS插件",
"module_name_line1": "TS 插件",
"module_name_line2": "更新目標列表",
"by": "作者:",
"telegram_channel": "TG頻道",
"telegram_channel": "Telegram 頻道",
"github": "GitHub",
"disclaimer": "此 WebUI 不是 Tricky Store 的一部分,遇任何問題請勿向 Tricky Store 作者反饋。",
"disclaimer": "此 WebUI 並非 Tricky Store 的一部分,遇任何問題請勿向 Tricky Store 作者反饋。",
"acknowledgment": "特別鳴謝"
},
"prompt": {
"no_internet": "請檢查您的網連接",
"no_internet": "請檢查您的網連接",
"aosp_key_set": "成功設置 AOSP 密鑰",
"key_set_error": "更新密鑰失敗",
"valid_key_set": "成功設置有效密鑰",
@@ -70,6 +73,14 @@
"save_error": "保存配置失敗",
"uninstall_prompt": "WebUI 將在重啟後被移除",
"uninstall_failed": "卸載 WebUI 失敗",
"new_update": "發現新版本!"
"new_update": "發現新版本!",
"downloading": "正在下載...",
"downloaded": "下載完成",
"download_fail": "下載失敗",
"installing": "正在安裝...",
"installed": "安裝完成,重啟生效",
"install_fail": "安裝失敗,請手動更新",
"rebooting": "正在重啟...",
"reboot_fail": "重啟失敗,請手動重啟"
}
}

View File

@@ -235,7 +235,7 @@ function setupModeMenu() {
} else if (event.target.closest(".status-indicator")) {
setTimeout(() => {
hideAllModes();
}, 200);
}, 300);
}
});
window.addEventListener("scroll", hideAllModes);

View File

@@ -1,4 +1,4 @@
import { appListContainer, updateCard, fetchAppList } from './applist.js';
import { appListContainer, fetchAppList } from './applist.js';
import { initializeAvailableLanguages, detectUserLanguage, loadTranslations, setupLanguageMenu, translations } from './language.js';
import { aospkb } from './menu_option.js';
import { searchMenuContainer, searchInput, clearBtn, setupMenuToggle } from './search_menu.js';
@@ -19,7 +19,7 @@ export const basePath = "set-path";
export const appsWithExclamation = [];
export const appsWithQuestion = [];
const ADDITIONAL_APPS = [ "com.google.android.gms", "io.github.vvb2060.keyattestation", "io.github.vvb2060.mahoshojo", "icu.nullptr.nativetest" ];
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', '.status-indicator'];
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', '.status-indicator', '.reboot', '.install'];
// Variables
let e = 0;
@@ -84,7 +84,7 @@ async function checkMagisk() {
}
// Function to show the prompt with a success or error message
export function showPrompt(key, isSuccess = true) {
export function showPrompt(key, isSuccess = true, duration = 3000) {
const message = key.split('.').reduce((acc, k) => acc && acc[k], translations) || key;
prompt.textContent = message;
prompt.classList.toggle('error', !isSuccess);
@@ -99,8 +99,8 @@ export function showPrompt(key, isSuccess = true) {
}
window.promptTimeout = setTimeout(() => {
prompt.style.transform = 'translateY(100%)';
}, 3000);
}, 200);
}, duration);
}, 100);
}
// Function to redirect link on external browser
@@ -291,16 +291,6 @@ document.addEventListener('DOMContentLoaded', async () => {
document.querySelector('.uninstall-container').classList.remove('hidden-uninstall');
});
// Redirect to GitHub release page
updateCard.addEventListener('click', async () => {
try {
await execCommand('am start -a android.intent.action.VIEW -d https://github.com/KOWX712/Tricky-Addon-Update-Target-List/releases/latest');
} catch (error) {
toast("Failed!");
console.error('Error opening GitHub Release link:', error);
}
});
// Function to execute shell commands
export async function execCommand(command) {
return new Promise((resolve, reject) => {

View File

@@ -1,6 +1,13 @@
import { basePath, execCommand, showPrompt, noConnection } from './main.js';
import { updateCard } from './applist.js';
const updateCardText = document.getElementById('redirect-to-release');
const UpdateMenu = document.querySelector('.update-overlay');
const closeUpdate = document.querySelector('.close-update');
const releaseNotes = document.querySelector('.changelog');
const installButton = document.querySelector('.install');
const rebootButton = document.querySelector('.reboot');
// Function to run the update check
export async function updateCheck() {
try {
@@ -9,8 +16,9 @@ export async function updateCheck() {
noConnection.style.display = "none";
if (output.includes("update")) {
console.log("Update detected from extra script.");
showPrompt("prompt.new_update");
showPrompt("prompt.new_update", true, 2000);
updateCard.style.display = "flex";
setupUpdateMenu();
} else {
console.log("No update detected from extra script.");
}
@@ -20,3 +28,74 @@ export async function updateCheck() {
noConnection.style.display = "flex";
}
}
// Function to setup update menu
function setupUpdateMenu() {
function openUpdateMenu() {
UpdateMenu.style.display = "flex";
setTimeout(async () => {
UpdateMenu.style.opacity = "1";
}, 10);
document.body.classList.add("no-scroll");
}
function closeUpdateMenu() {
UpdateMenu.style.opacity = "0";
document.body.classList.remove("no-scroll");
setTimeout(async () => {
UpdateMenu.style.display = "none";
}, 200);
}
updateCard.addEventListener('click', async () => {
try {
const module = await execCommand(`[ -f ${basePath}common/tmp/module.zip ] || echo "false"`);
if (module.trim() === "false") {
showPrompt("prompt.downloading");
await new Promise(resolve => setTimeout(resolve, 200));
await execCommand(`sh ${basePath}common/get_extra.sh --get-update`);
showPrompt("prompt.downloaded");
}
const changelog = await execCommand(`sh ${basePath}common/get_extra.sh --release-note`);
const lines = changelog.split('\n');
const formattedChangelog = `
<span style="font-weight: bold; font-size: 18px;">${lines[0]}</span><br>
${lines.slice(1).join('<br>')}
`;
releaseNotes.innerHTML = formattedChangelog;
openUpdateMenu();
} catch (error) {
showPrompt("prompt.download_fail", false);
console.error('Error download module update:', error);
}
});
closeUpdate.addEventListener("click", closeUpdateMenu);
UpdateMenu.addEventListener("click", (event) => {
if (event.target === UpdateMenu) {
closeUpdateMenu();
}
});
installButton.addEventListener('click', async () => {
try {
showPrompt("prompt.installing");
setTimeout(async () => {
await execCommand(`sh ${basePath}common/get_extra.sh --install-update`);
showPrompt("prompt.installed");
installButton.style.display = "none";
rebootButton.style.display = "flex";
}, 300);
} catch (error) {
showPrompt("prompt.install_fail", false);
console.error('Fail to execute installation script:', error);
}
});
rebootButton.addEventListener('click', async () => {
try {
showPrompt("prompt.rebooting");
setTimeout(async () => {
await execCommand("svc power reboot");
}, 1000);
} catch (error) {
showPrompt("prompt.reboot_fail", false);
console.error('Fail to reboot:', error);
}
});
}

View File

@@ -30,13 +30,85 @@
#update-available {
font-size: 20px;
font-weight: bold;
text-align: center;
margin-top: 15px;
margin-bottom: 0;
user-select: none;
}
#redirect-to-release {
text-align: center;
margin-top: 5px;
margin-bottom: 15px;
user-select: none;
}
.update-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1800;
justify-content: center;
align-items: center;
opacity: 0;
transition: opacity 0.2s ease;
}
.update-menu {
position: relative;
width: 90vw;
max-width: 800px;
background-color: white;
padding: 10px 0;
border-radius: 15px;
text-align: left;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.close-update {
position: absolute;
top: 15px;
right: 12px;
background: none;
border: none;
font-size: 20px;
color: #ccc;
}
.update-content {
max-height: 85vh;
padding: 0 30px;
overflow-y: auto;
user-select: none;
}
.update-button-container {
width: 100%;
display: flex;
justify-content: flex-end;
}
.install,
.reboot {
margin-left: 0;
margin-bottom: 15px;
color: #3B3B3B;
background-color: #fff;
border: none;
padding: 10px 15px;
border-radius: 50px 50px;
font-size: 18px;
position: relative;
overflow: hidden;
user-select: none;
}
.reboot {
display: none;
}
.card {
@@ -243,9 +315,19 @@
.update-card {
background-color: #4D4D4D;
}
.mode {
background-color: #343434;
border: 1px solid #6E6E6E;
}
.install,
.reboot {
background-color: #343434;
color: #C2C2C2;
}
.update-menu {
background-color: #343434;
}
}