diff --git a/module/action.sh b/module/action.sh index 781fc9f..0eadb92 100644 --- a/module/action.sh +++ b/module/action.sh @@ -10,10 +10,10 @@ SCRIPT_DIR="/data/adb/tricky_store" if pm list packages | grep -q "$PACKAGE_NAME"; then echo "- Launching WebUI in KSUWebUIStandalone..." - am start -n "${PACKAGE_NAME}/.WebUIActivity" -e id "$MODID" + am start -n "${PACKAGE_NAME}/.WebUIActivity" -e id "tricky_store" elif pm list packages | grep -q "com.dergoogler.mmrl"; then echo "- Launching WebUI in MMRL WebUI..." - am start -n "com.dergoogler.mmrl/.ui.activity.webui.WebUIActivity" -e MOD_ID "$MODID" + am start -n "com.dergoogler.mmrl/.ui.activity.webui.WebUIActivity" -e MOD_ID "tricky_store" else echo "- Installing KSU WebUI..." . "$COMPATH/get_WebUI.sh" diff --git a/module/common/get_WebUI.sh b/module/common/get_WebUI.sh index 1e5b61f..4309998 100644 --- a/module/common/get_WebUI.sh +++ b/module/common/get_WebUI.sh @@ -18,7 +18,7 @@ install_webui echo "- Done." rm -f "$APK_PATH" echo "- Launching..." -am start -n "${PACKAGE_NAME}/.WebUIActivity" -e id "$MODID" &1 | cat +am start -n "${PACKAGE_NAME}/.WebUIActivity" -e id "tricky_store" &1 | cat if [ $? -ne 0 ]; then echo "Error: Failed to start application." exit 1 diff --git a/module/customize.sh b/module/customize.sh index 1596afe..2c0fb15 100644 --- a/module/customize.sh +++ b/module/customize.sh @@ -33,7 +33,7 @@ fi ui_print "- Installing..." initialize -ui_print "- Creating config directory..." +ui_print "- Finalizing..." find_config migrate_old_boot_hash diff --git a/module/install_func.sh b/module/install_func.sh index da715b4..c87f142 100644 --- a/module/install_func.sh +++ b/module/install_func.sh @@ -1,35 +1,24 @@ initialize() { - if [ -f "$SCRIPT_DIR/UpdateTargetList.sh" ]; then - rm -f "$SCRIPT_DIR/UpdateTargetList.sh" - fi - if [ -d "/data/adb/modules/$NEW_MODID" ]; then - rm -rf "/data/adb/modules/$NEW_MODID" - fi + # Cleanup left over + [ -d "/data/adb/modules/$NEW_MODID" ] && rm -rf "/data/adb/modules/$NEW_MODID" + # Set permission set_perm $COMPATH/get_extra.sh 0 2000 0755 set_perm $COMPATH/get_WebUI.sh 0 2000 0755 - + + # Handdle Magisk/non-Magisk root manager if [ "$ACTION" = "false" ]; then rm -f "$MODPATH/action.sh" rm -f "$COMPATH/get_WebUI.sh" - echo "**********************************************" - echo "- Tricky Addon's visibility in root manager?" - echo " VOL [+]: Visible" - echo " VOL [-]: Invisible (default)" - echo "**********************************************" - - key_check - if [[ "$keycheck" == "KEY_VOLUMEUP" ]]; then - echo "- Setting to visible..." - rm -rf "$COMPATH/temp" - NEW_MODID="$MODID" - else - tmp_dir - fi + NEW_MODID="$MODID" else - tmp_dir + mkdir -p "$COMPATH/temp/common" + cp "$COMPATH/.default" "$COMPATH/temp/common/.default" + cp "$MODPATH/uninstall.sh" "$COMPATH/temp/uninstall.sh" fi - sed -i "s|\"set-path\"|\"/data/adb/modules/$NEW_MODID/\"|" "$MODPATH/webroot/index.js" || { + + #Set specific path + sed -i "s|\"set-path\"|\"/data/adb/modules/$NEW_MODID/\"|" "$MODPATH/webui/index.js" || { ui_print "! Failed to set path" abort } @@ -38,22 +27,17 @@ initialize() { abort } + # Set aapt binary + cp "$MODPATH/module.prop" "$COMPATH/temp/module.prop" mv "$MODPATH/bin/$(getprop ro.product.cpu.abi)/aapt" "$COMPATH/aapt" set_perm $COMPATH/aapt 0 2000 0755 rm -rf "$MODPATH/bin" } -tmp_dir() { - mkdir -p "$COMPATH/temp/common" - cp "$COMPATH/.default" "$COMPATH/temp/common/.default" - cp "$MODPATH/module.prop" "$COMPATH/temp/module.prop" - cp "$MODPATH/uninstall.sh" "$COMPATH/temp/uninstall.sh" -} - find_config() { - if [ -d "$CONFIG_DIR" ]; then - rm -rf "$CONFIG_DIR" - fi + # Remove legacy setup + [ -f "$SCRIPT_DIR/UpdateTargetList.sh" ] && rm -f "$SCRIPT_DIR/UpdateTargetList.sh" + [ -d "$CONFIG_DIR" ] && rm -rf "$CONFIG_DIR" } migrate_old_boot_hash() { @@ -63,23 +47,3 @@ migrate_old_boot_hash() { rm -f "$COMPATH/boot_hash" fi } - -key_check() { - while true; do - key_check=$(/system/bin/getevent -qlc 1) - key_event=$(echo "$key_check" | awk '{ print $3 }' | grep 'KEY_') - key_status=$(echo "$key_check" | awk '{ print $4 }') - if [[ "$key_event" == *"KEY_"* && "$key_status" == "DOWN" ]]; then - keycheck="$key_event" - break - fi - done - while true; do - key_check=$(/system/bin/getevent -qlc 1) - key_event=$(echo "$key_check" | awk '{ print $3 }' | grep 'KEY_') - key_status=$(echo "$key_check" | awk '{ print $4 }') - if [[ "$key_event" == *"KEY_"* && "$key_status" == "UP" ]]; then - break - fi - done -} \ No newline at end of file diff --git a/module/post-fs-data.sh b/module/post-fs-data.sh index e348b16..eca7bdd 100644 --- a/module/post-fs-data.sh +++ b/module/post-fs-data.sh @@ -6,18 +6,13 @@ while [ -z "$(ls -A /data/adb/modules/)" ]; do done if [ ! -d "$TS" ] || [ -f "$TS/remove" ]; then - if [ -d "$MODPATH/common/temp" ]; then - mkdir -p "/data/adb/modules/TA_utl" - cp -rf "$MODPATH/common/temp"/* "/data/adb/modules/TA_utl/" + if [ -f "$MODPATH/action.sh" ]; then + [ -d "/data/adb/modules/TA_utl" ] && rm -rf "/data/adb/modules/TA_utl" + cp -rf "$MODPATH/common/temp" "/data/adb/modules/TA_utl" touch "/data/adb/modules/TA_utl/remove" else touch "$MODPATH/remove" fi - exit 1 -fi - -if [ ! -d "$MODPATH/common/temp" ]; then - rm -rf "/data/adb/modules/.TA_utl" fi rm -f "$TS/action.sh" diff --git a/module/service.sh b/module/service.sh index 4af70db..f4c5c0a 100644 --- a/module/service.sh +++ b/module/service.sh @@ -1,10 +1,12 @@ MODPATH=${0%/*} 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" aapt() { "$MODPATH/common/aapt" "$@"; } +# Reset verified Boot Hash hash_value=$(grep -v '^#' "/data/adb/boot_hash" | tr -d '[:space:]') if [ -n "$hash_value" ]; then resetprop -n ro.boot.vbmeta.digest "$hash_value" @@ -17,21 +19,23 @@ elif [ ! -d "$TSPA" ] && [ -f "/storage/emulated/0/stop-tspa-auto-target" ]; the rm -f "/storage/emulated/0/stop-tspa-auto-target" fi -if [ -d "$MODPATH/common/temp" ]; then - if [ "$KSU" ] || [ "$APATCH" ]; then - rm -f "$MODPATH/module.prop" - fi +# Hide module +if [ -f "$MODPATH/action.sh" ]; then if [[ "$MODPATH" != "$HIDE_DIR" ]]; then rm -rf "$HIDE_DIR" mv "$MODPATH" "$HIDE_DIR" fi MODPATH="$HIDE_DIR" - if [ -f "$MODPATH/action.sh" ]; then - ln -s "$MODPATH/action.sh" "$TS/action.sh" - fi - ln -s "$MODPATH/webroot" "$TS/webroot" +elif [ -d "$HIDE_DIR" ]; then + rm -rf "$HIDE_DIR" fi +rm -f "$MODPATH/module.prop" +# Symlink tricky store +[ -f "$MODPATH/action.sh" ] && ln -s "$MODPATH/action.sh" "$TS/action.sh" +ln -s "$MODPATH/webui" "$TS/webroot" + +# Optimization OUTPUT_APP="$MODPATH/common/applist" OUTPUT_SKIP="$MODPATH/common/skiplist" diff --git a/module/uninstall.sh b/module/uninstall.sh index 620cdea..4146dac 100644 --- a/module/uninstall.sh +++ b/module/uninstall.sh @@ -11,10 +11,7 @@ fi rm -rf "/data/adb/modules/.TA_utl" rm -f "/data/adb/boot_hash" if [ -d "$TS" ]; then - if [ -f "$TS/action.sh" ]; then - rm -f "$TS/action.sh" - else - rm -rf "$TS/webroot" - fi + rm -f "$TS/action.sh" + rm -rf "$TS/webroot" fi xxd -r -p "$MODPATH/common/.default" | base64 -d > "$SCRIPT_DIR/keybox.xml" diff --git a/module/webroot/index.html b/module/webui/index.html similarity index 100% rename from module/webroot/index.html rename to module/webui/index.html diff --git a/module/webroot/index.js b/module/webui/index.js similarity index 98% rename from module/webroot/index.js rename to module/webui/index.js index 4d5dba9..03b0e04 100644 --- a/module/webroot/index.js +++ b/module/webui/index.js @@ -470,6 +470,7 @@ async function extrakb() { const sourcePath = `${basePath}common/.extra`; const destinationPath = "/data/adb/tricky_store/keybox.xml"; try { + await new Promise(resolve => setTimeout(resolve, 300)); const fileExists = await execCommand(`[ -f ${sourcePath} ] && echo "exists"`); if (fileExists.trim() !== "exists") { throw new Error(".extra file not found"); @@ -713,12 +714,14 @@ document.querySelector(".uninstall-container").addEventListener("click", async ( try { await execCommand(` su -c " - if [ -d '${basePath}common/temp/' ]; then - mkdir -p '/data/adb/modules/TA_utl' && - cp -rf '${basePath}common/temp/'* '/data/adb/modules/TA_utl/' && + if [ -f '${basePath}action.sh' ]; then + if [ -d "/data/adb/modules/TA_utl" ]; then + rm -rf "/data/adb/modules/TA_utl" + fi + cp -rf '${basePath}common/temp' '/data/adb/modules/TA_utl' && touch '/data/adb/modules/TA_utl/remove' else - touch '/data/adb/modules/TA_utl/remove' + touch '${basePath}remove' fi " `); diff --git a/module/webroot/locales/A-template.json b/module/webui/locales/A-template.json similarity index 100% rename from module/webroot/locales/A-template.json rename to module/webui/locales/A-template.json diff --git a/module/webroot/locales/A-translate.md b/module/webui/locales/A-translate.md similarity index 89% rename from module/webroot/locales/A-translate.md rename to module/webui/locales/A-translate.md index a0e0f42..af334b5 100644 --- a/module/webroot/locales/A-translate.md +++ b/module/webui/locales/A-translate.md @@ -1,5 +1,5 @@ # Translation Guide -## Fix Translation Error +## Fix Bad Translation 1. Fork this repository. 2. Find your language string file in `/module/webroot/locales/`. 3. Edit the string value with translated incorrectly. @@ -8,7 +8,7 @@ --- ## Add a New Language ### Simple -- Contact me in Telegram to add a new translation langauge for you. +- Contact me in Telegram to add a new translation langauge. ### Advanced 1. Fork this repository. diff --git a/module/webroot/locales/en-US.json b/module/webui/locales/en-US.json similarity index 100% rename from module/webroot/locales/en-US.json rename to module/webui/locales/en-US.json diff --git a/module/webroot/locales/ru-RU.json b/module/webui/locales/ru-RU.json similarity index 100% rename from module/webroot/locales/ru-RU.json rename to module/webui/locales/ru-RU.json diff --git a/module/webroot/locales/tl-PH.json b/module/webui/locales/tl-PH.json similarity index 100% rename from module/webroot/locales/tl-PH.json rename to module/webui/locales/tl-PH.json diff --git a/module/webroot/locales/zh-CN.json b/module/webui/locales/zh-CN.json similarity index 100% rename from module/webroot/locales/zh-CN.json rename to module/webui/locales/zh-CN.json diff --git a/module/webroot/locales/zh-TW.json b/module/webui/locales/zh-TW.json similarity index 100% rename from module/webroot/locales/zh-TW.json rename to module/webui/locales/zh-TW.json diff --git a/module/webroot/styles.css b/module/webui/styles.css similarity index 100% rename from module/webroot/styles.css rename to module/webui/styles.css diff --git a/module/webroot/wifi-slash.svg b/module/webui/wifi-slash.svg similarity index 100% rename from module/webroot/wifi-slash.svg rename to module/webui/wifi-slash.svg