From f4860d1a00cc5dd01344f96325aab76add2c6590 Mon Sep 17 00:00:00 2001 From: KOWX712 Date: Fri, 22 Nov 2024 17:02:30 +0800 Subject: [PATCH] Improve xposed detection logic Detect Xposed module from AndroidMainfest.xml instead of relying on LSPosed module repository since not all Xposed module will available in the repo. --- module/common/get_extra.sh | 28 +++++++++++++++++----------- module/common/util_func.sh | 2 ++ module/install_func.sh | 1 - 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/module/common/get_extra.sh b/module/common/get_extra.sh index e6b928a..318b8cd 100644 --- a/module/common/get_extra.sh +++ b/module/common/get_extra.sh @@ -9,24 +9,30 @@ KBOUTPUT="$MODPATH/.extra" find_busybox check_wget -# Fetch Xposed module package names -wget --no-check-certificate -q -O - "https://modules.lsposed.org/modules.json" 2>/dev/null | \ -grep -o '"name":"[^"]*","description":' | \ -awk -F'"' '{print $4}' > "$OUTPUT" - # Fetch additional package names wget --no-check-certificate -q -O - "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/master/more-excldue.json" 2>/dev/null | \ grep -o '"package-name": *"[^"]*"' | \ -awk -F'"' '{print $4}' >> "$OUTPUT" +awk -F'"' '{print $4}' > "$OUTPUT" if [ ! -s "$OUTPUT" ]; then - echo "Error: Failed to fetch data." > "$OUTPUT" rm -f "$KBOUTPUT" - exit 1 + skipkb=true fi -wget --no-check-certificate -qO "$KBOUTPUT" "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/master/.extra" +# Find xposed package name +pm list packages -3 | awk -F: '{print $2}' | while read -r PACKAGE; do + pm path "$PACKAGE" | grep "base.apk" | awk -F: '{print $2}' | tr -d '\r' | \ + while read -r APK_PATH; do + aapt dump xmltree "$APK_PATH" AndroidManifest.xml 2>/dev/null | grep -qE "xposed.category|xposeddescription" && echo "$PACKAGE" >> "$OUTPUT" + done +done -if [ ! -s "$KBOUTPUT" ]; then - rm -f "$KBOUTPUT" +if [ "$skipkb" != "true" ]; then + wget --no-check-certificate -qO "$KBOUTPUT" "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/master/.extra" + + if [ ! -s "$KBOUTPUT" ]; then + rm -f "$KBOUTPUT" + fi +else + exit 1 fi \ No newline at end of file diff --git a/module/common/util_func.sh b/module/common/util_func.sh index 4a26014..6154641 100644 --- a/module/common/util_func.sh +++ b/module/common/util_func.sh @@ -26,6 +26,8 @@ check_wget() { fi } +aapt() { "$MODPATH/aapt" "$@"; } + download_webui() { wget --no-check-certificate -P "$APK_DIR" "$URL" if [ $? -ne 0 ]; then diff --git a/module/install_func.sh b/module/install_func.sh index e262f41..da8fc65 100644 --- a/module/install_func.sh +++ b/module/install_func.sh @@ -17,7 +17,6 @@ initialize() { abort } - mkdir -p "$MODPATH/system/bin" mv "$MODPATH/bin/$(getprop ro.product.cpu.abi)/aapt" "$COMPATH/aapt" rm -rf "$MODPATH/bin"