From 2f9d7a0e2eba071c5ca677d898ac9ad560f83001 Mon Sep 17 00:00:00 2001 From: j-hc Date: Sun, 28 Jan 2024 13:47:48 +0300 Subject: [PATCH 1/9] fix uptodown --- utils.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/utils.sh b/utils.sh index d6c8029..e07f8e4 100755 --- a/utils.sh +++ b/utils.sh @@ -284,9 +284,7 @@ get_uptodown_vers() { $HTMLQ --text ".version" <<<"$__UPTODOWN_RESP__"; } dl_uptodown() { local uptodown_dlurl=$1 version=$2 output=$3 local url - if [ -n "$version" ]; then - url=$(grep -F "${version}" -B 2 <<<"$__UPTODOWN_RESP__" | head -1 | sed -n 's;.*data-url=".*download\/\(.*\)".*;\1;p') || return 1 - else url=""; fi + url=$(grep -F "${version}" -B 2 <<<"$__UPTODOWN_RESP__" | head -1 | sed -n 's;.*data-url=".*download\/\(.*\)".*;\1;p') || return 1 url="https://dw.uptodown.com/dwn/$(req "${uptodown_dlurl}/post-download/${url}" - | sed -n 's;.*class="post-download" data-url="\(.*\)".*;\1;p')" || return 1 req "$url" "$output" } @@ -398,8 +396,7 @@ build_rv() { for dl_p in archive apkmirror uptodown apkmonk; do if [ -z "${args[${dl_p}_dlurl]}" ]; then continue; fi pr "Downloading '${table}' from ${dl_p}" - if [ "$get_latest_ver" = true ] && [ $dl_p = uptodown ]; then local vver=""; else local vver=$version; fi - if ! dl_${dl_p} "${args[${dl_p}_dlurl]}" "$vver" "$stock_apk" "$arch" "${args[dpi]}"; then + if ! dl_${dl_p} "${args[${dl_p}_dlurl]}" "$version" "$stock_apk" "$arch" "${args[dpi]}"; then epr "ERROR: Could not download '${table}' from ${dl_p} with version '${version}', arch '${arch}', dpi '${args[dpi]}'" continue fi From 162f21978d0b3ec9fb1f4965383a52e65138b9df Mon Sep 17 00:00:00 2001 From: j-hc Date: Sun, 28 Jan 2024 14:14:27 +0300 Subject: [PATCH 2/9] cli generates unique paths anyway --- utils.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils.sh b/utils.sh index e07f8e4..168544f 100755 --- a/utils.sh +++ b/utils.sh @@ -323,8 +323,7 @@ get_archive_pkg_name() { echo "$__ARCHIVE_PKG_NAME__"; } patch_apk() { local stock_input=$1 patched_apk=$2 patcher_args=$3 rv_cli_jar=$4 rv_patches_jar=$5 - declare -r tdir=$(mktemp -d -p $TEMP_DIR) - local cmd="java -jar $rv_cli_jar patch $stock_input -r $tdir -p -o $patched_apk -b $rv_patches_jar \ + local cmd="java -jar $rv_cli_jar patch $stock_input -p -o $patched_apk -b $rv_patches_jar \ --keystore=ks.keystore --keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --alias=jhc $patcher_args --options=options.json" if [ "$OS" = Android ]; then cmd+=" --custom-aapt2-binary=${TEMP_DIR}/aapt2"; fi pr "$cmd" From c467b3ea613bf37f82391a85b8da7b32a7e7d8ad Mon Sep 17 00:00:00 2001 From: j-hc Date: Sun, 28 Jan 2024 14:21:21 +0300 Subject: [PATCH 3/9] up actions --- .github/workflows/build.yml | 12 +++--------- .github/workflows/ci.yml | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 266f574..3b22993 100755 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,13 +14,13 @@ jobs: permissions: write-all runs-on: ubuntu-latest steps: - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: distribution: "zulu" java-version: "17" - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true @@ -100,7 +100,7 @@ jobs: find . -name "*-update.json" | grep . || : >dummy-update.json - - uses: stefanzweifel/git-auto-commit-action@v4 + - uses: stefanzweifel/git-auto-commit-action@v5 with: branch: update skip_checkout: true @@ -145,9 +145,3 @@ jobs: MSG=${MSG:0:9450} POST="https://api.telegram.org/bot${TG_TOKEN}/sendMessage" curl -X POST --data-urlencode "parse_mode=Markdown" --data-urlencode "disable_web_page_preview=true" --data-urlencode "text=${MSG}" --data-urlencode "chat_id=${TG_CHAT}" "$POST" - - - uses: actions/upload-artifact@v3 - with: - name: logs - path: logs - if-no-files-found: ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d348b74..7a1a0b3 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 From a5f336ba7d6fe78db4b7bc48dd85996256884602 Mon Sep 17 00:00:00 2001 From: j-hc Date: Sun, 28 Jan 2024 14:41:04 +0300 Subject: [PATCH 4/9] disable extended --- config.toml | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/config.toml b/config.toml index 473a942..5d327aa 100755 --- a/config.toml +++ b/config.toml @@ -17,25 +17,6 @@ build-mode = "both" archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music" arch = "both" -[Music-Extended] -app-name = "Music" -patches-source = "inotia00/revanced-patches" -integrations-source = "inotia00/revanced-integrations" -cli-source = "inotia00/revanced-cli" -rv-brand = "ReVanced Extended" -build-mode = "both" -archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music" -arch = "both" - -[YouTube-Extended] -app-name = "YouTube" -patches-source = "inotia00/revanced-patches" -integrations-source = "inotia00/revanced-integrations" -cli-source = "inotia00/revanced-cli" -rv-brand = "ReVanced Extended" -build-mode = "both" -archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube" - [Twitter] build-mode = "apk" archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.twitter.android" @@ -61,3 +42,24 @@ uptodown-dlurl = "https://spotify.en.uptodown.com/android" [IconPackStudio] enabled = false apkmirror-dlurl = "https://www.apkmirror.com/apk/smart-launcher-team/icon-pack-studio/" + +[Music-Extended] +enabled = false +app-name = "Music" +patches-source = "inotia00/revanced-patches" +integrations-source = "inotia00/revanced-integrations" +cli-source = "inotia00/revanced-cli" +rv-brand = "ReVanced Extended" +build-mode = "both" +archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music" +arch = "both" + +[YouTube-Extended] +enabled = false +app-name = "YouTube" +patches-source = "inotia00/revanced-patches" +integrations-source = "inotia00/revanced-integrations" +cli-source = "inotia00/revanced-cli" +rv-brand = "ReVanced Extended" +build-mode = "both" +archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube" \ No newline at end of file From d182bd749c54eb7a96ec0e5f35bdd5bef87d9e3c Mon Sep 17 00:00:00 2001 From: j-hc Date: Sat, 2 Mar 2024 22:50:03 +0300 Subject: [PATCH 5/9] fix downloading rv --- utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils.sh b/utils.sh index 168544f..282f8c9 100755 --- a/utils.sh +++ b/utils.sh @@ -64,7 +64,7 @@ get_rv_prebuilts() { local rv_cli_jar="${cli_dir}/${rv_cli_url##*/}" echo "CLI: $(cut -d/ -f4 <<<"$rv_cli_url")/$(cut -d/ -f9 <<<"$rv_cli_url") " >"$patches_dir/changelog.md" - rv_integrations_url=$(gh_req "$rv_integrations_rel" - | json_get 'browser_download_url') || return 1 + rv_integrations_url=$(gh_req "$rv_integrations_rel" - | json_get 'browser_download_url' | grep -E '\.apk$') || return 1 local rv_integrations_apk="${integrations_dir}/${rv_integrations_url##*/}" echo "Integrations: $(cut -d/ -f4 <<<"$rv_integrations_url")/$(cut -d/ -f9 <<<"$rv_integrations_url") " >>"$patches_dir/changelog.md" @@ -72,7 +72,7 @@ get_rv_prebuilts() { # rv_patches_changelog=$(json_get 'body' <<<"$rv_patches" | sed 's/\(\\n\)\+/\\n/g') rv_patches_dl=$(json_get 'browser_download_url' <<<"$rv_patches") rv_patches_json="${patches_dir}/patches-$(json_get 'tag_name' <<<"$rv_patches").json" - rv_patches_url=$(grep 'jar' <<<"$rv_patches_dl") + rv_patches_url=$(grep -E '\.jar$' <<<"$rv_patches_dl") local rv_patches_jar="${patches_dir}/${rv_patches_url##*/}" [ -f "$rv_patches_jar" ] || REBUILD=true local nm From 64b9266354cc1212b83df1a0fac70fe9ad4b9510 Mon Sep 17 00:00:00 2001 From: j-hc Date: Sun, 3 Mar 2024 00:27:04 +0300 Subject: [PATCH 6/9] add x86 --- CONFIG.md | 1 + build.sh | 1 + scripts/customize.sh | 9 ++++++--- utils.sh | 26 ++++++++++++++------------ 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index edd117e..3256feb 100755 --- a/CONFIG.md +++ b/CONFIG.md @@ -41,4 +41,5 @@ apkmonk-dlurl = "https://www.apkmonk.com/app/com.app.app/" module-prop-name = "some-app-magisk" # magisk module prop name. apkmirror-dpi = "360-480dpi" # used to select apk variant from apkmirror. default: nodpi arch = "arm64-v8a" # 'arm64-v8a', 'arm-v7a', 'all', 'both'. 'both' downloads both arm64-v8a and arm-v7a. default: all +riplib = true # enables ripping x86 and x86_64 libs from apks with j-hc revanced cli. default: true ``` diff --git a/build.sh b/build.sh index 4850687..36f679f 100755 --- a/build.sh +++ b/build.sh @@ -100,6 +100,7 @@ for table_name in $(toml_get_table_names); do app_args[riplib]=false fi fi + if [ "${app_args[riplib]}" = "true" ] && [ "$(toml_get "$t" riplib)" = "false" ]; then app_args[riplib]=false; fi app_args[rv_brand]=$(toml_get "$t" rv-brand) || app_args[rv_brand]="$DEF_RV_BRAND" app_args[excluded_patches]=$(toml_get "$t" excluded-patches) || app_args[excluded_patches]="" diff --git a/scripts/customize.sh b/scripts/customize.sh index 48e1711..a024f52 100755 --- a/scripts/customize.sh +++ b/scripts/customize.sh @@ -9,16 +9,19 @@ elif [ $ARCH = "arm64" ]; then #arm64 ARCH_LIB=arm64-v8a alias cmpr='$MODPATH/bin/arm64/cmpr' +elif [ $ARCH = "x86" ]; then + ARCH_LIB=x86 + alias cmpr='$MODPATH/bin/x86/cmpr' else abort "ERROR: unsupported arch: ${ARCH}" fi set_perm_recursive $MODPATH/bin 0 0 0755 0777 -nsenter -t1 -m -- grep __PKGNAME /proc/mounts | while read -r line; do +su -M -c "grep __PKGNAME /proc/mounts" | while read -r line; do ui_print "* Un-mount" mp=${line#* } mp=${mp%% *} - nsenter -t1 -m -- umount -l "${mp%%\\*}" + su -M -c "umount -l ${mp%%\\*}" done am force-stop __PKGNAME @@ -97,7 +100,7 @@ mkdir -p $NVBASE/rvhc RVPATH=$NVBASE/rvhc/${MODPATH##*/}.apk mv -f $MODPATH/base.apk $RVPATH -if ! op=$(nsenter -t1 -m -- mount -o bind $RVPATH $BASEPATH/base.apk 2>&1); then +if ! op=$(su -M -c "mount -o bind $RVPATH $BASEPATH/base.apk" 2>&1); then ui_print "ERROR: Mount failed!" ui_print "$op" fi diff --git a/utils.sh b/utils.sh index 282f8c9..b5c7808 100755 --- a/utils.sh +++ b/utils.sh @@ -97,9 +97,10 @@ get_prebuilts() { dl_if_dne ${TEMP_DIR}/aapt2 https://github.com/rendiix/termux-aapt/raw/d7d4b4a344cc52b94bcdab3500be244151261d8e/prebuilt-binary/${arch}/aapt2 chmod +x "${TEMP_DIR}/aapt2" fi - mkdir -p ${MODULE_TEMPLATE_DIR}/bin/arm64 ${MODULE_TEMPLATE_DIR}/bin/arm + mkdir -p ${MODULE_TEMPLATE_DIR}/bin/arm64 ${MODULE_TEMPLATE_DIR}/bin/arm ${MODULE_TEMPLATE_DIR}/bin/x86 dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/arm64/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-arm64-v8a" dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/arm/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-armeabi-v7a" + dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/x86/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-x86" HTMLQ="${TEMP_DIR}/htmlq" if [ ! -f "$HTMLQ" ]; then @@ -432,15 +433,6 @@ build_rv() { # fi # fi # fi - - if [ "${args[riplib]}" = true ]; then - p_patcher_args+=("--rip-lib x86_64 --rip-lib x86") - if [ "$arch" = "arm64-v8a" ]; then - p_patcher_args+=("--rip-lib armeabi-v7a") - elif [ "$arch" = "arm-v7a" ]; then - p_patcher_args+=("--rip-lib arm64-v8a") - fi - fi if [ "$mode_arg" = module ]; then build_mode_arr=(module) elif [ "$mode_arg" = apk ]; then @@ -464,8 +456,18 @@ build_rv() { else patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk" fi - if [ "$build_mode" = module ] && [ "${args[riplib]}" = true ]; then - patcher_args+=("--unsigned --rip-lib arm64-v8a --rip-lib armeabi-v7a") + if [ "${args[riplib]}" = true ]; then + if [ "$build_mode" = module ]; then + patcher_args+=("--unsigned --rip-lib arm64-v8a --rip-lib armeabi-v7a") + else + patcher_args+=("--rip-lib x86_64 --rip-lib x86") + if [ "$arch" = "arm64-v8a" ]; then + patcher_args+=("--rip-lib armeabi-v7a") + elif [ "$arch" = "arm-v7a" ]; then + patcher_args+=("--rip-lib arm64-v8a") + fi + + fi fi if [ ! -f "$patched_apk" ] || [ "$REBUILD" = true ]; then if ! patch_apk "$stock_apk" "$patched_apk" "${patcher_args[*]}" "${args[cli]}" "${args[ptjar]}"; then From ade6f6be3b15670f3b887999f3a9091ff6fe2403 Mon Sep 17 00:00:00 2001 From: j-hc Date: Sun, 3 Mar 2024 13:26:36 +0300 Subject: [PATCH 7/9] add x64 --- utils.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils.sh b/utils.sh index b5c7808..a39b3d7 100755 --- a/utils.sh +++ b/utils.sh @@ -97,10 +97,11 @@ get_prebuilts() { dl_if_dne ${TEMP_DIR}/aapt2 https://github.com/rendiix/termux-aapt/raw/d7d4b4a344cc52b94bcdab3500be244151261d8e/prebuilt-binary/${arch}/aapt2 chmod +x "${TEMP_DIR}/aapt2" fi - mkdir -p ${MODULE_TEMPLATE_DIR}/bin/arm64 ${MODULE_TEMPLATE_DIR}/bin/arm ${MODULE_TEMPLATE_DIR}/bin/x86 + mkdir -p ${MODULE_TEMPLATE_DIR}/bin/arm64 ${MODULE_TEMPLATE_DIR}/bin/arm ${MODULE_TEMPLATE_DIR}/bin/x86 ${MODULE_TEMPLATE_DIR}/bin/x64 dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/arm64/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-arm64-v8a" dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/arm/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-armeabi-v7a" dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/x86/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-x86" + dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/x64/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-x86_64" HTMLQ="${TEMP_DIR}/htmlq" if [ ! -f "$HTMLQ" ]; then @@ -457,10 +458,10 @@ build_rv() { patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk" fi if [ "${args[riplib]}" = true ]; then + patcher_args+=("--rip-lib x86_64 --rip-lib x86") if [ "$build_mode" = module ]; then - patcher_args+=("--unsigned --rip-lib arm64-v8a --rip-lib armeabi-v7a") + patcher_args+=("--rip-lib arm64-v8a --rip-lib armeabi-v7a --unsigned") else - patcher_args+=("--rip-lib x86_64 --rip-lib x86") if [ "$arch" = "arm64-v8a" ]; then patcher_args+=("--rip-lib armeabi-v7a") elif [ "$arch" = "arm-v7a" ]; then From 8e7a489b000da51db71e14d99d79be0b91a745e0 Mon Sep 17 00:00:00 2001 From: j-hc Date: Sun, 3 Mar 2024 20:50:13 +0300 Subject: [PATCH 8/9] fix update_config --- utils.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utils.sh b/utils.sh index a39b3d7..a3cc119 100755 --- a/utils.sh +++ b/utils.sh @@ -137,10 +137,13 @@ config_update() { if [ "$enabled" = false ]; then continue; fi PATCHES_SRC=$(toml_get "$t" patches-source) || PATCHES_SRC=$DEF_PATCHES_SRC if [[ -v sources[$PATCHES_SRC] ]]; then - if [ "${sources[$PATCHES_SRC]}" = 1 ]; then echo "$t"; fi + if [ "${sources[$PATCHES_SRC]}" = 1 ]; then + conf+="$t" + conf+=$'\n' + fi else sources[$PATCHES_SRC]=0 - if ! last_patches_url=$(gh_req "https://api.github.com/repos/${PATCHES_SRC}/releases/latest" - 2>&1 | json_get 'browser_download_url' | grep 'jar'); then + if ! last_patches_url=$(gh_req "https://api.github.com/repos/${PATCHES_SRC}/releases/latest" - 2>&1 | json_get 'browser_download_url' | grep -E '\.jar$'); then abort oops fi last_patches=${last_patches_url##*/} From 45ac4ff034a0f1130376e0c8575ccc3123e9834e Mon Sep 17 00:00:00 2001 From: yhc <25510067+j-hc@users.noreply.github.com> Date: Sun, 3 Mar 2024 23:11:48 +0300 Subject: [PATCH 9/9] Update customize.sh --- scripts/customize.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/customize.sh b/scripts/customize.sh index a024f52..85a2454 100755 --- a/scripts/customize.sh +++ b/scripts/customize.sh @@ -12,6 +12,9 @@ elif [ $ARCH = "arm64" ]; then elif [ $ARCH = "x86" ]; then ARCH_LIB=x86 alias cmpr='$MODPATH/bin/x86/cmpr' +elif [ $ARCH = "x64" ]; then + ARCH_LIB=x86_64 + alias cmpr='$MODPATH/bin/x64/cmpr' else abort "ERROR: unsupported arch: ${ARCH}" fi