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
feat: option to add system app
This commit is contained in:
@@ -46,4 +46,19 @@ migrate_config() {
|
||||
if ! grep -q "^auto_config=" "/data/adb/security_patch"; then
|
||||
echo "auto_config=1" >> "/data/adb/security_patch"
|
||||
fi
|
||||
|
||||
# Additional system app
|
||||
SYSTEM_APP="
|
||||
com.google.android.gms
|
||||
com.google.android.gsf
|
||||
com.android.vending
|
||||
com.oplus.deepthinker
|
||||
com.heytap.speechassist
|
||||
com.coloros.sceneservice"
|
||||
touch "/data/adb/tricky_store/system_app"
|
||||
for app in $SYSTEM_APP; do
|
||||
if pm list packages -s | grep -q "$app" && ! grep -q "$app" "/data/adb/tricky_store/system_app"; then
|
||||
echo "$app" >> "/data/adb/tricky_store/system_app"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -80,7 +80,11 @@ done
|
||||
mkdir -p "$MODPATH/common/tmp"
|
||||
|
||||
# Additional system apps
|
||||
SYSTEM_APP="com.google.android.gms|com.google.android.gsf|com.android.vending"
|
||||
if [ -f "/data/adb/tricky_store/system_app" ]; then
|
||||
SYSTEM_APP=$(cat "/data/adb/tricky_store/system_app" | tr '\n' '|' | sed 's/|*$//')
|
||||
else
|
||||
SYSTEM_APP=""
|
||||
fi
|
||||
|
||||
# Initialize cache files to save app list and skip list
|
||||
echo "# This file is generated from service.sh to speed up load time" > "$OUTPUT_APP"
|
||||
@@ -90,7 +94,7 @@ echo "# This file is generated from service.sh to speed up load time" > "$OUTPUT
|
||||
# Check Xposed module
|
||||
{
|
||||
pm list packages -3 2>/dev/null
|
||||
pm list package -s | grep -E "$SYSTEM_APP" 2>/dev/null || true
|
||||
pm list packages -s | grep -E "$SYSTEM_APP" 2>/dev/null || true
|
||||
} | awk -F: '{print $2}' | while read -r PACKAGE; do
|
||||
# Get APK path for the package
|
||||
APK_PATH=$(pm path "$PACKAGE" 2>/dev/null | grep "base.apk" | awk -F: '{print $2}' | tr -d '\r')
|
||||
|
||||
@@ -12,6 +12,7 @@ rm -rf "/data/adb/modules/.TA_utl"
|
||||
rm -f "/data/adb/boot_hash"
|
||||
rm -f "/data/adb/security_patch"
|
||||
rm -f "/data/adb/tricky_store/target_from_denylist"
|
||||
rm -f "/data/adb/tricky_store/system_app"
|
||||
if [ -d "$TS" ]; then
|
||||
[ -L "$TS/webroot" ] && rm -f "$TS/webroot"
|
||||
[ -L "$TS/action.sh" ] && rm -f "$TS/action.sh"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<link rel="stylesheet" href="styles/header.css" type="text/css">
|
||||
<link rel="stylesheet" href="styles/search_menu.css" type="text/css">
|
||||
<link rel="stylesheet" href="styles/security_patch.css" type="text/css">
|
||||
<link rel="stylesheet" href="styles/system_app.css" type="text/css">
|
||||
<script type="module" crossorigin src="scripts/main.js"></script>
|
||||
<script type="module" crossorigin src="scripts/about.js"></script>
|
||||
<script type="module" crossorigin src="scripts/help.js"></script>
|
||||
@@ -77,6 +78,7 @@
|
||||
<li class="ripple-element" id="deselect-all" data-i18n="menu.deselect_all"></li>
|
||||
<li class="ripple-element" id="select-denylist" data-i18n="menu.select_denylist"></li>
|
||||
<li class="ripple-element" id="deselect-unnecessary" data-i18n="menu.deselect_unnecessary"></li>
|
||||
<li class="ripple-element" id="add-system-app" data-i18n="menu.add_system_app"></li>
|
||||
<li class="ripple-element" id="aospkb" data-i18n="menu.set_aosp_keybox"></li>
|
||||
<li class="ripple-element" id="validkb" data-i18n="menu.set_valid_keybox"></li>
|
||||
<li class="ripple-element" id="customkb" data-i18n="menu.set_custom_keybox"></li>
|
||||
@@ -332,6 +334,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add System App Overlay -->
|
||||
<div id="add-system-app-overlay" class="add-system-app-overlay">
|
||||
<div id="add-system-app-card" class="add-system-app-card">
|
||||
<div class="add-system-app-title" data-i18n="add_system_app.title"></div>
|
||||
<div class="add-system-app-content">
|
||||
<input type="text" id="system-app-input" placeholder="com.example.app">
|
||||
<button id="add-system-app-button" class="add-system-app-button ripple-element" data-i18n="add_system_app.add"></button>
|
||||
<h3 class="current-system-app-list" data-i18n="add_system_app.current_list"></h3>
|
||||
<div class="current-system-app-list-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="footer">
|
||||
<div class="uninstall-container ripple-element hidden-uninstall">
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
"deselect_all": "Deselect All",
|
||||
"select_denylist": "Select From DenyList",
|
||||
"deselect_unnecessary": "Deselect Unnecessary",
|
||||
"add_system_app": "Add System App",
|
||||
"set_aosp_keybox": "Set AOSP Keybox",
|
||||
"set_valid_keybox": "Set Valid Keybox",
|
||||
"set_custom_keybox": "Set Custom Keybox",
|
||||
@@ -91,7 +92,9 @@
|
||||
"reboot_fail": "Fail to reboot, please reboot manually",
|
||||
"custom_key_set": "Custom keybox set successfully",
|
||||
"custom_key_set_error": "Failed to set custom keybox",
|
||||
"no_file_selected": "No file selected"
|
||||
"no_file_selected": "No file selected",
|
||||
"system_app_not_found": "System app not found",
|
||||
"system_app_error": "Failed to add system app"
|
||||
},
|
||||
"security_patch": {
|
||||
"title": "Security Patch",
|
||||
@@ -111,5 +114,10 @@
|
||||
"invalid_boot": "Invalid boot format",
|
||||
"invalid_system": "Invalid system format",
|
||||
"invalid_vendor": "Invalid vendor format"
|
||||
},
|
||||
"add_system_app": {
|
||||
"title": "Add System App",
|
||||
"add": "Add",
|
||||
"current_list": "Current System App List"
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
"deselect_all": "Deselect All",
|
||||
"select_denylist": "Select From DenyList",
|
||||
"deselect_unnecessary": "Deselect Unnecessary",
|
||||
"add_system_app": "Add System App",
|
||||
"set_aosp_keybox": "Set AOSP Keybox",
|
||||
"set_valid_keybox": "Set Valid Keybox",
|
||||
"set_custom_keybox": "Set Custom Keybox",
|
||||
@@ -91,7 +92,9 @@
|
||||
"reboot_fail": "Fail to reboot, please reboot manually",
|
||||
"custom_key_set": "Custom keybox set successfully",
|
||||
"custom_key_set_error": "Failed to set custom keybox",
|
||||
"no_file_selected": "No file selected"
|
||||
"no_file_selected": "No file selected",
|
||||
"system_app_not_found": "System app not found",
|
||||
"system_app_error": "Failed to add system app"
|
||||
},
|
||||
"security_patch": {
|
||||
"title": "Security Patch",
|
||||
@@ -111,5 +114,10 @@
|
||||
"invalid_boot": "Invalid boot format",
|
||||
"invalid_system": "Invalid system format",
|
||||
"invalid_vendor": "Invalid vendor format"
|
||||
},
|
||||
"add_system_app": {
|
||||
"title": "Add System App",
|
||||
"add": "Add",
|
||||
"current_list": "Current System App List"
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
"deselect_all": "Deseleccionar Todo",
|
||||
"select_denylist": "Seleccionar desde DenyList",
|
||||
"deselect_unnecessary": "Deseleccionar innecesarios",
|
||||
"add_system_app": "Agregar Aplicación del Sistema",
|
||||
"set_aosp_keybox": "Configurar AOSP Keybox",
|
||||
"set_valid_keybox": "Configurar Keybox Válido",
|
||||
"set_custom_keybox": "Establecer Keybox Personalizado",
|
||||
@@ -91,7 +92,9 @@
|
||||
"reboot_fail": "Error al reiniciar, reinicia manualmente",
|
||||
"custom_key_set": "Keybox personalizado establecido con éxito",
|
||||
"custom_key_set_error": "Error al establecer el keybox personalizado",
|
||||
"no_file_selected": "Ningún archivo seleccionado"
|
||||
"no_file_selected": "Ningún archivo seleccionado",
|
||||
"system_app_not_found": "Aplicación del sistema no encontrada",
|
||||
"system_app_error": "Error al agregar la aplicación del sistema"
|
||||
},
|
||||
"security_patch": {
|
||||
"title": "Parche de Seguridad",
|
||||
@@ -111,5 +114,10 @@
|
||||
"invalid_boot": "Formato de boot inválido",
|
||||
"invalid_system": "Formato de system inválido",
|
||||
"invalid_vendor": "Formato de vendor inválido"
|
||||
},
|
||||
"add_system_app": {
|
||||
"title": "Agregar Aplicación del Sistema",
|
||||
"add": "Agregar",
|
||||
"current_list": "Lista de Aplicaciones del Sistema Actual"
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
"deselect_all": "すべての選択を解除",
|
||||
"select_denylist": "DenyList から選択",
|
||||
"deselect_unnecessary": "不要な選択を解除",
|
||||
"add_system_app": "システムアプリを追加",
|
||||
"set_aosp_keybox": "AOSP Keybox を設定",
|
||||
"set_valid_keybox": "有効な Keybox を設定",
|
||||
"set_custom_keybox": "カスタム Keybox を設定",
|
||||
@@ -91,7 +92,9 @@
|
||||
"reboot_fail": "再起動に失敗しました。手動で再起動してください。",
|
||||
"custom_key_set": "カスタム Keybox の設定に成功しました",
|
||||
"custom_key_set_error": "カスタム Keybox の設定に失敗しました",
|
||||
"no_file_selected": "ファイルが選択されていません"
|
||||
"no_file_selected": "ファイルが選択されていません",
|
||||
"system_app_not_found": "システムアプリが見つかりません",
|
||||
"system_app_error": "システムアプリの追加に失敗しました"
|
||||
},
|
||||
"security_patch": {
|
||||
"title": "セキュリティパッチ",
|
||||
@@ -111,5 +114,10 @@
|
||||
"invalid_boot": "無効な boot 形式です",
|
||||
"invalid_system": "無効な system 形式です",
|
||||
"invalid_vendor": "無効な vendor 形式です"
|
||||
},
|
||||
"add_system_app": {
|
||||
"title": "システムアプリを追加",
|
||||
"add": "追加",
|
||||
"current_list": "現在のシステムアプリリスト"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
"deselect_all": "Odznacz wszystko",
|
||||
"select_denylist": "Wybierz z listy odrzuconych",
|
||||
"deselect_unnecessary": "Odznacz niepotrzebne",
|
||||
"add_system_app": "Dodaj aplikację systemową",
|
||||
"set_aosp_keybox": "Ustaw klucz AOSP",
|
||||
"set_valid_keybox": "Ustaw ważny klucz",
|
||||
"set_custom_keybox": "Ustaw niestandardowy klucz ",
|
||||
@@ -91,7 +92,9 @@
|
||||
"reboot_fail": "Nie udało się ponownie uruchomić, proszę ponownie uruchomić ręcznie",
|
||||
"custom_key_set": "Niestandardowe klucz został pomyślnie ustawiony",
|
||||
"custom_key_set_error": "Nie udało się ustawić niestandardowego klucza",
|
||||
"no_file_selected": "Nie wybrano pliku"
|
||||
"no_file_selected": "Nie wybrano pliku",
|
||||
"system_app_not_found": "Aplikacja systemowa nie znaleziona",
|
||||
"system_app_error": "Nie udało się dodać aplikacji systemowej"
|
||||
},
|
||||
"security_patch": {
|
||||
"title": "Poprawka bezpieczeństwa",
|
||||
@@ -111,5 +114,10 @@
|
||||
"invalid_boot": "Nieprawidłowy format rozruchu",
|
||||
"invalid_system": "Nieprawidłowy format systemu",
|
||||
"invalid_vendor": "Nieprawidłowy format dostawcy"
|
||||
},
|
||||
"add_system_app": {
|
||||
"title": "Dodaj aplikację systemową",
|
||||
"add": "Dodaj",
|
||||
"current_list": "Aktualna lista aplikacji systemowych"
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
"deselect_all": "Отменить выбор всех",
|
||||
"select_denylist": "Выбрать из DenyList",
|
||||
"deselect_unnecessary": "Отменить выбор ненужных",
|
||||
"add_system_app": "Добавить системное приложение",
|
||||
"set_aosp_keybox": "Установить AOSP Keybox",
|
||||
"set_valid_keybox": "Установить действующий Keybox",
|
||||
"set_custom_keybox": "Установить пользовательский Keybox",
|
||||
@@ -91,7 +92,9 @@
|
||||
"reboot_fail": "Не удалось перезагрузить, перезагрузите вручную",
|
||||
"custom_key_set": "Пользовательский keybox успешно установлен",
|
||||
"custom_key_set_error": "Не удалось установить пользовательский keybox",
|
||||
"no_file_selected": "Файл не выбран"
|
||||
"no_file_selected": "Файл не выбран",
|
||||
"system_app_not_found": "Системное приложение не найдено",
|
||||
"system_app_error": "Не удалось добавить системное приложение"
|
||||
},
|
||||
"security_patch": {
|
||||
"title": "Патч безопасности",
|
||||
@@ -111,5 +114,10 @@
|
||||
"invalid_boot": "Неверный формат boot",
|
||||
"invalid_system": "Неверный формат system",
|
||||
"invalid_vendor": "Неверный формат vendor"
|
||||
},
|
||||
"add_system_app": {
|
||||
"title": "Добавить системное приложение",
|
||||
"add": "Добавить",
|
||||
"current_list": "Текущий список системных приложений"
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
"deselect_all": "Huwag Pumili ng Lahat",
|
||||
"select_denylist": "Piliin mula sa DenyList",
|
||||
"deselect_unnecessary": "Huwag Pumili ng Hindi Kinakailangan",
|
||||
"add_system_app": "Magdagdag ng System App",
|
||||
"set_aosp_keybox": "I-set ang AOSP Keybox",
|
||||
"set_valid_keybox": "I-set ang Valid Keybox",
|
||||
"set_custom_keybox": "I-set ang Custom Keybox",
|
||||
@@ -91,7 +92,9 @@
|
||||
"reboot_fail": "Nabigo ang pag-reboot, pakisubukang mag-reboot nang manu-mano",
|
||||
"custom_key_set": "Matagumpay na na-set ang Custom Keybox",
|
||||
"custom_key_set_error": "Nabigong i-set ang Custom Keybox",
|
||||
"no_file_selected": "Walang napiling file"
|
||||
"no_file_selected": "Walang napiling file",
|
||||
"system_app_not_found": "Walang natagpuan na system app",
|
||||
"system_app_error": "Nabigong dagdag ang system app"
|
||||
},
|
||||
"security_patch": {
|
||||
"title": "Security Patch",
|
||||
@@ -111,5 +114,10 @@
|
||||
"invalid_boot": "Invalid boot format",
|
||||
"invalid_system": "Invalid system format",
|
||||
"invalid_vendor": "Invalid vendor format"
|
||||
},
|
||||
"add_system_app": {
|
||||
"title": "Magdagdag ng System App",
|
||||
"add": "Magdagdag",
|
||||
"current_list": "Kasalukuyang Listahan ng System Apps"
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
"deselect_all": "Tüm Seçimleri Kaldır",
|
||||
"select_denylist": "Reddetme Listesinden Seç",
|
||||
"deselect_unnecessary": "Gereksizleri Seçme",
|
||||
"add_system_app": "Sistem Uygulaması Ekle",
|
||||
"set_aosp_keybox": "AOSP Keybox Ayarla",
|
||||
"set_valid_keybox": "Geçerli Keybox Ayarla",
|
||||
"set_custom_keybox": "Özel Keybox Ayarla",
|
||||
@@ -91,7 +92,9 @@
|
||||
"reboot_fail": "Yeniden başlatma başarısız, lütfen manuel olarak yeniden başlatın",
|
||||
"custom_key_set": "Özel keybox başarıyla ayarlandı",
|
||||
"custom_key_set_error": "Özel keybox ayarlanamadı",
|
||||
"no_file_selected": "Dosya seçilmedi"
|
||||
"no_file_selected": "Dosya seçilmedi",
|
||||
"system_app_not_found": "Sistem uygulaması bulunamadı",
|
||||
"system_app_error": "Sistem uygulaması ekleme hatası"
|
||||
},
|
||||
"security_patch": {
|
||||
"title": "Güvenlik Yaması",
|
||||
@@ -111,5 +114,10 @@
|
||||
"invalid_boot": "Geçersiz boot formatı",
|
||||
"invalid_system": "Geçersiz system formatı",
|
||||
"invalid_vendor": "Geçersiz vendor formatı"
|
||||
},
|
||||
"add_system_app": {
|
||||
"title": "Sistem Uygulaması Ekle",
|
||||
"add": "Ekle",
|
||||
"current_list": "Mevcut Sistem Uygulamaları Listesi"
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
"deselect_all": "取消全选",
|
||||
"select_denylist": "从排除列表中选择",
|
||||
"deselect_unnecessary": "取消选择非必应用",
|
||||
"add_system_app": "添加系统应用",
|
||||
"set_aosp_keybox": "设置 AOSP 密钥",
|
||||
"set_valid_keybox": "设置有效密钥",
|
||||
"set_custom_keybox": "设置自定义密钥",
|
||||
@@ -91,7 +92,9 @@
|
||||
"reboot_fail": "重启失败,请手动重启",
|
||||
"custom_key_set": "成功设置自定义密钥",
|
||||
"custom_key_set_error": "设置自定义密钥失败",
|
||||
"no_file_selected": "未选择文件"
|
||||
"no_file_selected": "未选择文件",
|
||||
"system_app_not_found": "未找到该系统应用",
|
||||
"system_app_error": "系统应用添加失败"
|
||||
},
|
||||
"security_patch": {
|
||||
"title": "安全补丁",
|
||||
@@ -111,5 +114,10 @@
|
||||
"invalid_boot": "无效 boot 格式",
|
||||
"invalid_system": "无效 system 格式",
|
||||
"invalid_vendor": "无效 vendor 格式"
|
||||
},
|
||||
"add_system_app": {
|
||||
"title": "添加系统应用",
|
||||
"add": "添加",
|
||||
"current_list": "当前系统应用列表"
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
"deselect_all": "取消全選",
|
||||
"select_denylist": "從排除列表中選擇",
|
||||
"deselect_unnecessary": "取消選擇非必要應用",
|
||||
"add_system_app": "添加系統應用",
|
||||
"set_aosp_keybox": "設置 AOSP 密鑰",
|
||||
"set_valid_keybox": "設置有效密鑰",
|
||||
"set_custom_keybox": "設置自定義密鑰",
|
||||
@@ -91,7 +92,9 @@
|
||||
"reboot_fail": "重啟失敗,請手動重啟",
|
||||
"custom_key_set": "成功設置自定義密鑰",
|
||||
"custom_key_set_error": "設置自定義密鑰失敗",
|
||||
"no_file_selected": "未選擇文件"
|
||||
"no_file_selected": "未選擇文件",
|
||||
"system_app_not_found": "未找到該系統應用",
|
||||
"system_app_error": "系統應用添加失敗"
|
||||
},
|
||||
"security_patch": {
|
||||
"title": "安全補丁",
|
||||
@@ -111,5 +114,10 @@
|
||||
"invalid_boot": "無效 boot 格式",
|
||||
"invalid_system": "無效 system 格式",
|
||||
"invalid_vendor": "無效 vendor 格式"
|
||||
},
|
||||
"add_system_app": {
|
||||
"title": "添加系統應用",
|
||||
"add": "添加",
|
||||
"current_list": "當前系統應用列表"
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,8 @@ export async function fetchAppList() {
|
||||
|
||||
const result = await execCommand(`
|
||||
pm list packages -3 | awk -F: '{print $2}'
|
||||
pm list packages -s | awk -F: '{print $2}' | grep -Ex "com.google.android.gms|com.google.android.gsf|com.android.vending" 2>/dev/null || true
|
||||
[ -f "/data/adb/tricky_store/system_app" ] && SYSTEM_APP=$(cat "/data/adb/tricky_store/system_app" | tr '\n' '|' | sed 's/|*$//') || SYSTEM_APP=""
|
||||
pm list packages -s | awk -F: '{print $2}' | grep -Ex "$SYSTEM_APP" 2>/dev/null || true
|
||||
`);
|
||||
const appEntries = result
|
||||
.split("\n")
|
||||
@@ -53,7 +54,11 @@ export async function fetchAppList() {
|
||||
for (const entry of appEntries) {
|
||||
if (!entry.appName) {
|
||||
try {
|
||||
const apkPath = await execCommand(`pm path ${entry.packageName} | grep "base.apk" | awk -F: '{print $2}' | tr -d '\\r'`);
|
||||
const apkPath = await execCommand(`
|
||||
base_apk=$(pm path ${entry.packageName} | grep "base.apk" | awk -F: '{print $2}' | tr -d '\\r')
|
||||
[ -n "$base_apk" ] || base_apk=$(pm path ${entry.packageName} | grep ".apk" | awk -F: '{print $2}' | tr -d '\\r')
|
||||
echo "$base_apk"
|
||||
`);
|
||||
if (apkPath) {
|
||||
const appName = await execCommand(`${basePath}common/aapt dump badging ${apkPath.trim()} 2>/dev/null | grep "application-label:" | sed "s/application-label://; s/'//g"`);
|
||||
entry.appName = appName.trim() || "Unknown App";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { appListContainer, fetchAppList, modeActive } from './applist.js';
|
||||
import { initializeAvailableLanguages, detectUserLanguage, loadTranslations, setupLanguageMenu, translations } from './language.js';
|
||||
import { aospkb } from './menu_option.js';
|
||||
import { aospkb, setupSystemAppMenu } from './menu_option.js';
|
||||
import { searchMenuContainer, searchInput, clearBtn, setupMenuToggle } from './search_menu.js';
|
||||
import { updateCheck } from './update.js';
|
||||
import { securityPatch } from './security_patch.js';
|
||||
@@ -40,7 +40,7 @@ async function getModuleVersion() {
|
||||
}
|
||||
|
||||
// Function to refresh app list
|
||||
async function refreshAppList() {
|
||||
export async function refreshAppList() {
|
||||
isRefreshing = true;
|
||||
title.style.transform = 'translateY(0)';
|
||||
searchMenuContainer.style.transform = 'translateY(0)';
|
||||
@@ -326,6 +326,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
await loadTranslations(userLang);
|
||||
setupMenuToggle();
|
||||
setupLanguageMenu();
|
||||
setupSystemAppMenu();
|
||||
await fetchAppList();
|
||||
applyRippleEffect();
|
||||
checkTrickyStoreVersion();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { basePath, execCommand, showPrompt, toast, applyRippleEffect } from './main.js';
|
||||
import { basePath, execCommand, showPrompt, toast, applyRippleEffect, refreshAppList } from './main.js';
|
||||
|
||||
// Function to check or uncheck all app
|
||||
function toggleCheckboxes(shouldCheck) {
|
||||
@@ -75,6 +75,104 @@ document.getElementById("deselect-unnecessary").addEventListener("click", async
|
||||
}
|
||||
});
|
||||
|
||||
// Function to add system app
|
||||
export async function setupSystemAppMenu() {
|
||||
document.getElementById("add-system-app").addEventListener("click", () => openSystemAppOverlay());
|
||||
document.getElementById("add-system-app-overlay").addEventListener("click", (event) => {
|
||||
if (event.target === event.currentTarget) {
|
||||
closeSystemAppOverlay();
|
||||
}
|
||||
});
|
||||
const systemAppOverlay = document.getElementById("add-system-app-overlay");
|
||||
const systemAppInput = document.getElementById("system-app-input");
|
||||
function openSystemAppOverlay() {
|
||||
renderSystemAppList();
|
||||
document.body.classList.add("no-scroll");
|
||||
systemAppOverlay.style.display = "flex";
|
||||
setTimeout(() => {
|
||||
systemAppOverlay.style.opacity = "1";
|
||||
}, 10);
|
||||
systemAppInput.value = "";
|
||||
}
|
||||
function closeSystemAppOverlay() {
|
||||
document.body.classList.remove("no-scroll");
|
||||
systemAppOverlay.style.opacity = "0";
|
||||
setTimeout(() => {
|
||||
systemAppOverlay.style.display = "none";
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// Add system app button
|
||||
document.getElementById("add-system-app-button").addEventListener("click", async () => {
|
||||
const input = document.getElementById("system-app-input");
|
||||
const packageName = input.value;
|
||||
if (packageName) {
|
||||
try {
|
||||
const result = await execCommand(`pm list packages -s | grep -q ${packageName} || echo "false"`);
|
||||
if (result.includes("false")) {
|
||||
showPrompt("prompt.system_app_not_found", false);
|
||||
} else {
|
||||
await execCommand(`
|
||||
touch "/data/adb/tricky_store/system_app"
|
||||
echo "${packageName}" >> "/data/adb/tricky_store/system_app"
|
||||
echo "${packageName}" >> "/data/adb/tricky_store/target.txt"
|
||||
`);
|
||||
systemAppInput.value = "";
|
||||
closeSystemAppOverlay();
|
||||
refreshAppList();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error adding system app:", error);
|
||||
showPrompt("prompt.add_system_app_error", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Display current system app list and remove button
|
||||
async function renderSystemAppList() {
|
||||
const currentSystemAppList = document.querySelector(".current-system-app-list");
|
||||
const currentSystemAppListContent = document.querySelector(".current-system-app-list-content");
|
||||
currentSystemAppListContent.innerHTML = "";
|
||||
try {
|
||||
const systemAppList = await execCommand(`[ -f "/data/adb/tricky_store/system_app" ] && cat "/data/adb/tricky_store/system_app" | sed '/^$/d' || echo "false"`);
|
||||
if (systemAppList.includes("false")) {
|
||||
currentSystemAppList.style.display = "none";
|
||||
} else {
|
||||
systemAppList.split("\n").forEach(app => {
|
||||
currentSystemAppListContent.innerHTML += `
|
||||
<div class="system-app-item">
|
||||
<span>${app}</span>
|
||||
<button class="remove-system-app-button ripple-element">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="22px" viewBox="0 -960 960 960" width="22px" fill="#FFFFFF"><path d="M154-412v-136h652v136H154Z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
currentSystemAppList.style.display = "none";
|
||||
console.error("Error displaying system app list:", error);
|
||||
}
|
||||
|
||||
const removeSystemAppButtons = document.querySelectorAll(".remove-system-app-button");
|
||||
removeSystemAppButtons.forEach(button => {
|
||||
button.addEventListener("click", async () => {
|
||||
const app = button.closest(".system-app-item").querySelector("span").textContent;
|
||||
try {
|
||||
await execCommand(`
|
||||
sed -i "/${app}/d" "/data/adb/tricky_store/system_app" || true
|
||||
sed -i "/${app}/d" "/data/adb/tricky_store/target.txt" || true
|
||||
`);
|
||||
closeSystemAppOverlay();
|
||||
refreshAppList();
|
||||
} catch (error) {
|
||||
console.error("Error removing system app:", error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Function to backup previous keybox and set new keybox
|
||||
async function setKeybox(content) {
|
||||
try {
|
||||
|
||||
128
module/webui/styles/system_app.css
Normal file
128
module/webui/styles/system_app.css
Normal file
@@ -0,0 +1,128 @@
|
||||
.add-system-app-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 2000;
|
||||
transition: opacity 0.2s ease;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.add-system-app-card {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
margin-top: 15%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: calc(90vw - 60px);
|
||||
max-width: 400px;
|
||||
padding: 30px;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.add-system-app-title {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.add-system-app-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.add-system-app-content input {
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
background-color: #F5F5F5;
|
||||
border: 1px solid #ccc;
|
||||
outline-color: #007bff;
|
||||
border-radius: 10px;
|
||||
box-sizing: border-box;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.add-system-app-button {
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.current-system-app-list {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.current-system-app-list-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
width: 100%;
|
||||
max-height: 40vh;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.system-app-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.system-app-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.remove-system-app-button {
|
||||
flex-shrink: 0;
|
||||
margin-left: 10px;
|
||||
background-color: #e84d4d;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.add-system-app-card {
|
||||
background-color: #343434;
|
||||
}
|
||||
|
||||
.add-system-app-content input {
|
||||
background-color: #232323;
|
||||
color: #fff;
|
||||
border: 1px solid #6E6E6E;
|
||||
}
|
||||
|
||||
.system-app-item {
|
||||
border-bottom: 1px solid #6E6E6E;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user