From f4085f8cf07a5a068911b517ceb9c5d7cf63601f Mon Sep 17 00:00:00 2001 From: KOWX712 Date: Tue, 26 Nov 2024 00:42:57 +0800 Subject: [PATCH] Invisible + UI fix integrate module action.sh and WebUI into tricky store, module now is not visible root manager, Thanks for ideaa from @backslashxx . Add uninstall button in the bottom of WebUI. Fix some UI bug. --- README.md | 1 + changelog.md | 8 ++++ module/action.sh | 6 ++- module/common/get_WebUI.sh | 1 - module/common/temp/remove | 0 module/common/temp/service.sh | 3 ++ module/{ => common/temp}/uninstall.sh | 11 ++++- module/customize.sh | 3 +- module/install_func.sh | 23 ++++------- module/module.prop | 2 +- module/service.sh | 36 ++++++++++------- module/webroot/index.html | 25 ++++++++---- module/webroot/index.js | 20 +++++++-- module/webroot/locales/A-translate.md | 7 ++-- module/webroot/locales/en-US.json | 5 ++- module/webroot/locales/ru-RU.json | 6 ++- module/webroot/locales/tl-PH.json | 6 ++- module/webroot/locales/zh-CN.json | 8 +++- module/webroot/locales/zh-TW.json | 8 +++- module/webroot/styles.css | 58 ++++++++++++++++++++++----- 20 files changed, 170 insertions(+), 67 deletions(-) create mode 100644 module/common/temp/remove create mode 100644 module/common/temp/service.sh rename module/{ => common/temp}/uninstall.sh (56%) diff --git a/README.md b/README.md index 70b907b..e0da97d 100755 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ A **KSU WebUI** to configure tricky store target.txt ## Description - Automated script to update tricky store target list. - System app excluded by default +- This module is **not** a part of Tricky Store module, DO NOT report to Tricky Store if you encounter any issue. - This is **not** a necessary module for root hide but for those who lazy to do it manually ## Requirements diff --git a/changelog.md b/changelog.md index ba7aa1f..10c00b4 100755 --- a/changelog.md +++ b/changelog.md @@ -3,11 +3,19 @@ A **KSU WebUI** to configure tricky store target.txt Requirement: Tricky Store module installed +This module is not a part of Tricky Store, DO NOT report to Tricky Store if you encounter any issue. + GitHub release: [Tricky Addon: Update Target List](https://github.com/KOWX712/Tricky-Addon-Update-Target-List/releases/latest) Telegram channel: [KOW's Little World](https://t.me/kowchannel) ## Changelog +### v2.6-beta.2 +- Due to extensive code refactoring, you might encounter unexpected bugs in this version, feedback in [Telegram](https://t.me/kowchannel) or [create issue](https://github.com/KOWX712/Tricky-Addon-Update-Target-List/issues) if you found any issue. +- This module now invisible, use shortcut on Tricky Store module. To uninstall module, scroll down to the botttom of WebUI and press Uninstall WebUI. +- Compatiple with Tricky Store 1.2.0. Tested on Magisk Alpha 28001, Apatch Next 11010, KernelSU 11895. +- Fixed some UI bug. + ### v2.6-beta.1 - Check in [release notes](https://github.com/KOWX712/Tricky-Addon-Update-Target-List/releases/tag/v2.6-beta.1). diff --git a/module/action.sh b/module/action.sh index c93e6a0..0b379a1 100644 --- a/module/action.sh +++ b/module/action.sh @@ -1,4 +1,8 @@ -MODPATH="${0%/*}" +########################################### +## This file is NOT a part of Tricky Store +########################################### + +MODPATH="/data/adb/modules/.TA_utl" COMPATH="$MODPATH/common" SCRIPT_DIR="/data/adb/tricky_store" diff --git a/module/common/get_WebUI.sh b/module/common/get_WebUI.sh index 642e9fa..b9cfcb5 100644 --- a/module/common/get_WebUI.sh +++ b/module/common/get_WebUI.sh @@ -1,6 +1,5 @@ URL="https://github.com/5ec1cff/KsuWebUIStandalone/releases/download/v1.0/KsuWebUI-1.0-34-release.apk" APK_DIR="$COMPATH" -LOG_FILE="$COMPATH/webuiError.log" find_busybox check_wget diff --git a/module/common/temp/remove b/module/common/temp/remove new file mode 100644 index 0000000..e69de29 diff --git a/module/common/temp/service.sh b/module/common/temp/service.sh new file mode 100644 index 0000000..f1b1805 --- /dev/null +++ b/module/common/temp/service.sh @@ -0,0 +1,3 @@ +MODPATH=${0%/*} + +rm -rf "$MODPATH" \ No newline at end of file diff --git a/module/uninstall.sh b/module/common/temp/uninstall.sh similarity index 56% rename from module/uninstall.sh rename to module/common/temp/uninstall.sh index 210309d..30ca28f 100644 --- a/module/uninstall.sh +++ b/module/common/temp/uninstall.sh @@ -1,4 +1,5 @@ MODPATH=${0%/*} +TS="/data/adb/modules/tricky_store" SCRIPT_DIR="/data/adb/tricky_store" # Enable back TSupport-A auto update @@ -7,7 +8,15 @@ if [ -f "/storage/emulated/0/stop-tspa-auto-target" ]; then fi # Remove residue and restore aosp keybox. +rm -rf "/data/adb/modules/.TA_utl" rm -rf "$SCRIPT_DIR/target_list_config" rm -f "$SCRIPT_DIR/UpdateTargetList.sh" rm -f "/data/adb/boot_hash" -xxd -r -p "$MODPATH/common/.default" | base64 -d > "$SCRIPT_DIR/keybox.xml" +if [ -d "$TS" ]; then + if [ -f "$MODPATH/action.sh" ]; then + rm -f "$TS/action.sh" + else + rm -rf "$TS/webroot" + fi +fi +xxd -r -p "$MODPATH/.default" | base64 -d > "$SCRIPT_DIR/keybox.xml" diff --git a/module/customize.sh b/module/customize.sh index 70ca8a7..5e8fef2 100644 --- a/module/customize.sh +++ b/module/customize.sh @@ -4,8 +4,7 @@ COMPATH="$MODPATH/common" TS="/data/adb/modules/tricky_store" SCRIPT_DIR="/data/adb/tricky_store" CONFIG_DIR="$SCRIPT_DIR/target_list_config" -MODID=`grep_prop id $TMPDIR/module.prop` -ORG_DIR="/data/adb/modules/$MODID" +NEW_MODID=.TA_utl kb="$COMPATH/.default" ui_print " "; diff --git a/module/install_func.sh b/module/install_func.sh index da8fc65..e54a086 100644 --- a/module/install_func.sh +++ b/module/install_func.sh @@ -5,14 +5,18 @@ initialize() { if [ -f "$CONFIG_DIR/skipwebui" ]; then rm -f "$CONFIG_DIR/skipwebui" fi - cp "$MODPATH/module.prop" "$COMPATH/module.prop.orig" + if [ -d "/data/adb/modules/$NEW_MODID" ]; then + rm -rf "/data/adb/modules/$NEW_MODID" + fi + cp "$MODPATH/module.prop" "$COMPATH/temp/module.prop" + cp "$COMPATH/.default" "$COMPATH/temp/.default" mv "$COMPATH/UpdateTargetList.sh" "$SCRIPT_DIR/UpdateTargetList.sh" - sed -i "s|\"set-path\"|\"/data/adb/modules/$MODID/common/\"|" "$MODPATH/webroot/index.js" || { + sed -i "s|\"set-path\"|\"/data/adb/modules/$NEW_MODID/common/\"|" "$MODPATH/webroot/index.js" || { ui_print "! Failed to set path" abort } - sed -i "s|\"set-id\"|\"$MODID\"|" "$COMPATH/util_func.sh" || { + sed -i "s|\"set-id\"|\"$NEW_MODID\"|" "$COMPATH/util_func.sh" || { ui_print "! Failed to set id" abort } @@ -77,19 +81,8 @@ find_config() { migrate_old_boot_hash() { if [ ! -f "/data/adb/boot_hash" ]; then - if [ -f "$ORG_DIR/boot_hash" ]; then - mv "$ORG_DIR/boot_hash" "/data/adb/boot_hash" - fi - mv "$COMPATH/boot_hash" "/data/adb/boot_hash" + mv "$COMPATH/boot_hash" "/data/adb/boot_hash" else rm -f "$COMPATH/boot_hash" fi - - # Migrate from old version setup - if [ -f "$ORG_DIR/system.prop" ]; then - hash_value=$(sed -n 's/^ro.boot.vbmeta.digest=//p' "$ORG_DIR/system.prop") - if [ -n "$hash_value" ]; then - echo -e "\n$hash_value" >> "/data/adb/boot_hash" - fi - fi } \ No newline at end of file diff --git a/module/module.prop b/module/module.prop index 07a0512..fdedd96 100644 --- a/module/module.prop +++ b/module/module.prop @@ -1,6 +1,6 @@ id=TA_utl name=Tricky Addon - Update Target List -version=v2.6-beta.1 +version=v2.6-beta.2 versionCode=250 author=KOWX712 description=A WebUI to conifgure tricky store target.txt diff --git a/module/service.sh b/module/service.sh index 034eec0..96eb500 100644 --- a/module/service.sh +++ b/module/service.sh @@ -1,6 +1,5 @@ MODPATH=${0%/*} -OUTPUT_APP="$MODPATH/common/applist" -OUTPUT_SKIP="$MODPATH/common/skiplist" +HIDE_DIR="/data/adb/modules/.TA_utl" TS="/data/adb/modules/tricky_store" SCRIPT_DIR="/data/adb/tricky_store" TSPA="/data/adb/modules/tsupport-advance" @@ -19,23 +18,32 @@ elif [ ! -d "$TSPA" ] && [ -f "/storage/emulated/0/stop-tspa-auto-target" ]; the rm -f "/storage/emulated/0/stop-tspa-auto-target" fi -if [ ! -f "$MODPATH/common/module.prop.orig" ]; then - sed -i 's/^description=.*/description=Module is corrupted, please reinstall module./' "$MODPATH/module.prop" - touch "$MODPATH/disable" - exit 1 +rm -f "$MODPATH/module.prop" +if [ ! -d "$HIDE_DIR" ]; then + mv "$MODPATH" "$HIDE_DIR" fi +MODPATH="$HIDE_DIR" +OUTPUT_APP="$MODPATH/common/applist" +OUTPUT_SKIP="$MODPATH/common/skiplist" if [ ! -d "$TS" ]; then - sed -i 's/^description=.*/description=Tricky store is not installed/' "$MODPATH/module.prop" - touch "$MODPATH/disable" + cp -rf "$MODPATH/common/temp/" "/data/adb/modules/TA_utl/" + rm -rf "$MODPATH" + exit 1 elif [ -f "$TS/disable" ]; then - sed -i 's/^description=.*/description=Tricky store is disabled/' "$MODPATH/module.prop" - touch "$MODPATH/disable" -elif [ ! -f "$SCRIPT_DIR/UpdateTargetList.sh" ]; then - sed -i 's/^description=.*/description=Script missing, please install module again/' "$MODPATH/module.prop" - touch "$MODPATH/disable" + exit 1 else - cat "$MODPATH/common/module.prop.orig" > "$MODPATH/module.prop" + if [ -f "$MODPATH/action.sh" ]; then + if [ -f "$TS/action.sh" ]; then + rm -f "$TS/action.sh" + fi + ln -s "$MODPATH/action.sh" "$TS/action.sh" + else + if [ ! -d "$TS/webroot" ]; then + rm -rf "$TS/webroot" + fi + ln -s "$MODPATH/webroot" "$TS/webroot" + fi until [ "$(getprop sys.boot_completed)" = "1" ]; do sleep 1 done diff --git a/module/webroot/index.html b/module/webroot/index.html index 5c1e2ee..ccb5341 100644 --- a/module/webroot/index.html +++ b/module/webroot/index.html @@ -11,7 +11,7 @@
-
Tricky Addon - Update Target List
+
No Connection Icon @@ -106,27 +106,36 @@
-

Module Name Line 1

-

Module Name Line 2

-

by KOWX712

+

+

+

KOWX712


- : + +
t.me/kowchannel


- GitHub: + +
github.com/KOWX712/Tricky-Addon-Update-Target-List


-

Acknowledgment

+

+
+

j-hc/zygisk-detach: WebUI template

- + \ No newline at end of file diff --git a/module/webroot/index.js b/module/webroot/index.js index bf0974d..e70ca88 100644 --- a/module/webroot/index.js +++ b/module/webroot/index.js @@ -245,13 +245,15 @@ async function refreshAppList() { clearBtn.style.display = "none"; appListContainer.innerHTML = ''; loadingIndicator.style.display = 'flex'; + document.querySelector('.uninstall-container').classList.add('hidden'); await new Promise(resolve => setTimeout(resolve, 500)); window.scrollTo(0, 0); if (noConnection.style.display === "flex") { await runExtraScript(); } - await fetchAppList();[] + await fetchAppList(); loadingIndicator.style.display = 'none'; + document.querySelector('.uninstall-container').classList.remove('hidden'); isRefreshing = false; } @@ -649,6 +651,7 @@ document.addEventListener('DOMContentLoaded', async () => { await fetchAppList(); checkMagisk(); loadingIndicator.style.display = "none"; + document.querySelector('.uninstall-container').classList.remove('hidden'); runExtraScript(); }); @@ -675,12 +678,12 @@ languageOptions.forEach(option => { // Scroll event let lastScrollY = window.scrollY; -const scrollThreshold = 35; +const scrollThreshold = 40; window.addEventListener('scroll', () => { if (isRefreshing) return; if (window.scrollY > lastScrollY && window.scrollY > scrollThreshold) { title.style.transform = 'translateY(-100%)'; - searchMenuContainer.style.transform = 'translateY(-35px)'; + searchMenuContainer.style.transform = 'translateY(-40px)'; floatingBtn.style.transform = 'translateY(0)'; } else if (window.scrollY < lastScrollY) { title.style.transform = 'translateY(0)'; @@ -719,4 +722,15 @@ helpOverlay.addEventListener("click", (event) => { if (event.target === helpOverlay) { hideHelpOverlay(); } +}); + +// Uninstall WebUI button +document.querySelector(".uninstall-container").addEventListener("click", async () => { + try { + await execCommand('cp -rf "/data/adb/modules/.TA_utl/common/temp/" "/data/adb/modules/TA_utl/"'); + showPrompt("uninstall_prompt"); + } catch (error) { + console.error("Failed to execute uninstall command:", error); + showPrompt("uninstall_failed", false); + } }); \ No newline at end of file diff --git a/module/webroot/locales/A-translate.md b/module/webroot/locales/A-translate.md index 1efe07d..0d97740 100644 --- a/module/webroot/locales/A-translate.md +++ b/module/webroot/locales/A-translate.md @@ -6,19 +6,20 @@ 4. Create a Pull Request. --- -## Create a New Language +## Add a New Language ### Simple -- Contact me in Telegram to create a new translation langauge for you. +- Contact me in Telegram to add a new translation langauge for you. ### Advanced 1. Fork this repository. 2. Rename `/module/webroot/locales/A-translate.json` to `language_code-COUNTRY_CODE.json`, e.g., `en-US.json`. 3. Translate the string value inside. 4. Add `langauge-option` into `/module/webroot/index.html`. +Format: ```xml ``` -Format: +Example: ```xml
diff --git a/module/webroot/locales/en-US.json b/module/webroot/locales/en-US.json index a35a639..228ca52 100644 --- a/module/webroot/locales/en-US.json +++ b/module/webroot/locales/en-US.json @@ -5,6 +5,7 @@ "boot_hash_save_button": "Save", "loading": "Loading...", "boot_hash_input_placeholder": "Paste your verified Boot Hash here", + "uninstall_webui": "Uninstall WebUI", "refresh": "Refresh", "select_all": "Select All", @@ -32,6 +33,7 @@ "by": "by ", "telegram_channel": "Telegram Channel", "github": "GitHub", + "disclaimer": "This WebUI is not a part of Tricky Store, DO NOT report to Tricky Store author if you encounter any issue.", "acknowledgment": "Acknowledgment", "no_internet": "Please check your Internet connection", @@ -43,5 +45,6 @@ "boot_hash_set_error": "Failed to update Verified Boot Hash", "saved_and_updated": "Config and target.txt updated", "saved_not_updated": "Config saved, but failed to update target list", - "save_error": "Failed to save config" + "uninstall_prompt": "WebUI will be removed after reboot", + "uninstall_failed": "Failed to uninstall WebUI" } \ No newline at end of file diff --git a/module/webroot/locales/ru-RU.json b/module/webroot/locales/ru-RU.json index 9f9be19..c95cb31 100644 --- a/module/webroot/locales/ru-RU.json +++ b/module/webroot/locales/ru-RU.json @@ -5,6 +5,7 @@ "boot_hash_save_button": "Сохранить", "loading": "Загрузка...", "boot_hash_input_placeholder": "Вставьте свой проверенный Boot Hash сюда", + "uninstall_webui": "Удалить WebUI", "refresh": "Обновить", "select_all": "Выбрать все", @@ -32,6 +33,7 @@ "by": "от ", "telegram_channel": "Канал в Telegram", "github": "GitHub", + "disclaimer": "Этот WebUI не является частью Tricky Store, НЕ сообщайте автору Tricky Store о любых возникающих проблемах.", "acknowledgment": "Благодарности", "no_internet": "Пожалуйста, проверьте ваше подключение к интернету", @@ -43,5 +45,7 @@ "boot_hash_set_error": "Не удалось обновить Verified Boot Hash", "saved_and_updated": "Конфигурация и target.txt обновлены", "saved_not_updated": "Конфигурация сохранена, но не удалось обновить список целей", - "save_error": "Не удалось сохранить конфигурацию" + "save_error": "Не удалось сохранить конфигурацию", + "uninstall_prompt": "WebUI будет удален после перезагрузки", + "uninstall_failed": "Не удалось удалить WebUI" } \ No newline at end of file diff --git a/module/webroot/locales/tl-PH.json b/module/webroot/locales/tl-PH.json index 459146c..55e61b2 100644 --- a/module/webroot/locales/tl-PH.json +++ b/module/webroot/locales/tl-PH.json @@ -5,6 +5,7 @@ "boot_hash_save_button": "I-save", "loading": "Naglo-load...", "boot_hash_input_placeholder": "I-paste ang iyong verified Boot Hash dito", + "uninstall_webui": "I-uninstall ang WebUI", "refresh": "I-refresh", "select_all": "Piliin Lahat", @@ -32,6 +33,7 @@ "by": "ni ", "telegram_channel": "Telegram Channel", "github": "GitHub", + "disclaimer": "Ang WebUI na ito ay hindi bahagi ng Tricky Store, HUWAG i-report sa may-akda ng Tricky Store kung makaranas ka ng anumang isyu.", "acknowledgment": "Pagkilala", "no_internet": "Pakitingnan ang iyong koneksyon sa Internet", @@ -43,5 +45,7 @@ "boot_hash_set_error": "Nabigong i-update ang Verified Boot Hash", "saved_and_updated": "Na-save ang config at na-update ang target.txt", "saved_not_updated": "Na-save ang config, ngunit nabigong i-update ang target list", - "save_error": "Nabigong i-save ang config" + "save_error": "Nabigong i-save ang config", + "uninstall_prompt": "Mawawala ang WebUI pagkatapos ng reboot", + "uninstall_failed": "Nabigong i-uninstall ang WebUI" } \ No newline at end of file diff --git a/module/webroot/locales/zh-CN.json b/module/webroot/locales/zh-CN.json index e856266..268e2f9 100644 --- a/module/webroot/locales/zh-CN.json +++ b/module/webroot/locales/zh-CN.json @@ -5,7 +5,8 @@ "boot_hash_save_button": "保存", "loading": "加载中...", "boot_hash_input_placeholder": "在此粘贴您的哈希值", - + "uninstall_webui": "卸载 WebUI", + "refresh": "刷新", "select_all": "全选", "deselect_all": "取消全选", @@ -32,6 +33,7 @@ "by": "作者:", "telegram_channel": "TG频道", "github": "GitHub", + "disclaimer": "此 WebUI 不是 Tricky Store 的一部分,遇到任何问题请勿向 Tricky Store 作者反馈。", "acknowledgment": "特别鸣谢", "no_internet": "请检查您的网络连接", @@ -43,5 +45,7 @@ "boot_hash_set_error": "哈希值重置失败", "saved_and_updated": "成功保存配置和更新目标列表", "saved_not_updated": "配置已保存,但更新目标列表失败", - "save_error": "保存配置失败" + "save_error": "保存配置失败", + "uninstall_prompt": "WebUI 将在重启后被移除", + "uninstall_failed": "卸载 WebUI 失败" } \ No newline at end of file diff --git a/module/webroot/locales/zh-TW.json b/module/webroot/locales/zh-TW.json index b8ca405..01132b4 100644 --- a/module/webroot/locales/zh-TW.json +++ b/module/webroot/locales/zh-TW.json @@ -5,7 +5,8 @@ "boot_hash_save_button": "保存", "loading": "加載中...", "boot_hash_input_placeholder": "在此粘貼您的哈希值", - + "uninstall_webui": "卸載 WebUI", + "refresh": "刷新", "select_all": "全選", "deselect_all": "取消全選", @@ -32,6 +33,7 @@ "by": "作者:", "telegram_channel": "TG頻道", "github": "GitHub", + "disclaimer": "此 WebUI 不是 Tricky Store 的一部分,遇到任何問題請勿向 Tricky Store 作者反饋。", "acknowledgment": "特別鳴謝", "no_internet": "請檢查您的網路連接", @@ -43,5 +45,7 @@ "boot_hash_set_error": "哈希值重置失敗", "saved_and_updated": "成功保存配置和更新目標列表", "saved_not_updated": "配置已保存,但更新目標列表失敗", - "save_error": "保存配置失敗" + "save_error": "保存配置失敗", + "uninstall_prompt": "WebUI 將在重啟後被移除", + "uninstall_failed": "卸載 WebUI 失敗" } \ No newline at end of file diff --git a/module/webroot/styles.css b/module/webroot/styles.css index c5e317e..77bf825 100644 --- a/module/webroot/styles.css +++ b/module/webroot/styles.css @@ -20,20 +20,21 @@ body { } #title { - font-size: 18px; + font-size: 16.5px; font-weight: bold; } .no-connection { + padding-bottom: 2px; display: none; - align-items: center; + position: relative; + margin-right: 0px; color: #7E7E7E; } .no-connection .wifi-icon { - width: 18px; - height: 18px; - margin-right: 0; + width: 22px; + height: 22px; filter: invert(0.6) sepia(0) saturate(0) hue-rotate(180deg) brightness(0.8) contrast(1); } @@ -45,9 +46,9 @@ body { .language-button { background: none; border: none; - font-size: 24px; + font-size: 23px; color: #333; - margin-left: 10px; + margin-right: -3px; } .language-menu { @@ -57,7 +58,6 @@ body { position: absolute; right: 0; background-color: #fff; - min-width: 120px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); z-index: 2000; border: 1px solid #ccc; @@ -89,10 +89,9 @@ body { .help-button { margin-right: auto; - padding: 0 7px; background: none; border: none; - font-size: 23px; + font-size: 22px; align-items: center; justify-content: center; } @@ -270,7 +269,6 @@ body { background: #fff; border-radius: 8px; padding: 25px 30px; - padding-right: 50px; z-index: 1200; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); opacity: 0; @@ -308,6 +306,14 @@ body { font-size: 14px; } +.about-content p span[data-i18n="telegram_channel"] { + font-weight: bold; +} + +.about-content p span[data-i18n="github"] { + font-weight: bold; +} + .about-content p[data-i18n="acknowledgment"] { font-size: 18px; text-align: left; @@ -544,6 +550,7 @@ body { } .floating-btn { + flex-shrink: 0; background-color: #007bff; border: none; box-shadow: 0 4px 8px #0003; @@ -576,6 +583,35 @@ body { .footer { padding: 25px; + position: relative; +} + +.uninstall-container { + padding: 10px 10px; + position: absolute; + right: 15px; + top: 50%; + transform: translateY(-50%); + display: flex; + align-items: center; + border-radius: 8px; + background-color: #B10000 +} + +.uninstall-container i { + margin-right: 5px; + font-size: 18px; + color: #fff; +} + +.uninstall-container span { + font-size: 16px; + font-weight: bold; + color: #fff; +} + +.hidden { + display: none; } @media (prefers-color-scheme: dark) {