Compare commits

..
2 Commits
Author SHA1 Message Date
nezumi d7a7688aa8 fix: resolve the issues 2026-05-15 11:08:20 +07:00
nezumi c48c4abc17 feat: update the message content 2026-04-05 21:50:42 +07:00
17 changed files with 296 additions and 188 deletions
+27 -18
View File
@@ -59,19 +59,21 @@ jobs:
cat build.md >> "$GITHUB_OUTPUT"
echo "${DELIM}" >> "$GITHUB_OUTPUT"
cp -f build.md build.tmp
- name: Upload release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}
BODY: ${{ steps.get_output.outputs.BUILD_LOG }}
run: |
if gh release view "$TAG" >/dev/null 2>&1; then
gh release edit "$TAG" --title "Release" --notes "$BODY"
gh release upload "$TAG" ./build/* --clobber
else
gh release create "$TAG" ./build/* --title "Release" --notes "$BODY"
fi
- name: Upload modules to release
uses: svenstaro/upload-release-action@v2
with:
body: ${{ steps.get_output.outputs.BUILD_LOG }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./build/*
release_name: ReVanced
tag: ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}
file_glob: true
overwrite: true
- name: Update changelog and update json
- name: Update modules changelog and update json
id: update_config
run: |
git checkout -f update || git switch --discard-changes --orphan update
@@ -100,12 +102,19 @@ jobs:
find . -name "*-update.json" | grep . || : >dummy-update.json
- uses: stefanzweifel/git-auto-commit-action@v7
with:
branch: update
skip_checkout: true
file_pattern: build.md *-update.json
commit_message: Bump version ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}
- name: Commit module json changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add build.md *-update.json
if ! git diff --cached --quiet; then
git commit -m "Bump version ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}"
git push origin HEAD:update
else
echo "no changes!"
fi
- name: Report to Telegram
env:
+1 -1
View File
@@ -47,4 +47,4 @@ jobs:
needs: check
uses: ./.github/workflows/build.yml
if: ${{ needs.check.outputs.SHOULD_BUILD == 1 }}
secrets: inherit
secrets: inherit
+1
View File
@@ -6,3 +6,4 @@ test*
/logs
build.md
cmpr
*-temporary-files
+1 -1
View File
@@ -52,7 +52,7 @@ excluded-patches = """\
"""
included-patches = "'Some Patch'" # whitespace seperated list of non-default patches to include. default: ""
include-stock = true # includes stock apk in the module. default: true
include-stock = "merged" # 'merged', 'split' or 'disable'. default: merged
exclusive-patches = false # exclude all patches by default. default: false
apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app"
+7 -3
View File
@@ -33,7 +33,6 @@ DEF_CLI_VER=$(toml_get "$main_config_t" cli-version) || DEF_CLI_VER="latest"
DEF_PATCHES_SRC=$(toml_get "$main_config_t" patches-source) || DEF_PATCHES_SRC="ReVanced/revanced-patches"
DEF_CLI_SRC=$(toml_get "$main_config_t" cli-source) || DEF_CLI_SRC="ReVanced/revanced-cli"
DEF_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced"
DEF_DPI_LIST=$(toml_get "$main_config_t" dpi) || DEF_DPI_LIST="nodpi anydpi"
mkdir -p "$TEMP_DIR" "$BUILD_DIR"
if [ "${2-}" = "--config-update" ]; then
@@ -101,6 +100,11 @@ for table_name in $(toml_get_table_names); do
abort "ERROR: build-mode '${app_args[build_mode]}' is not a valid option for '${table_name}': only 'both', 'apk' or 'module' is allowed"
fi
} || app_args[build_mode]=apk
app_args[include_stock]=$(toml_get "$t" include-stock) && {
if ! isoneof "${app_args[include_stock]}" disable merged split; then
abort "ERROR: include-stock '${app_args[include_stock]}' is not a valid option for '${table_name}': only 'disable', 'merged' or 'split' is allowed"
fi
} || app_args[include_stock]=merged
for dl_from in "${DL_SRCS[@]}"; do
if app_args[${dl_from}_dlurl]=$(toml_get "$t" "${dl_from}-dlurl"); then
@@ -118,8 +122,8 @@ for table_name in $(toml_get_table_names); do
abort "wrong arch '${app_args[arch]}' for '$table_name'"
fi
app_args[include_stock]=$(toml_get "$t" include-stock) || app_args[include_stock]=true && vtf "${app_args[include_stock]}" "include-stock"
app_args[dpi]=$(toml_get "$t" dpi) || app_args[dpi]="$DEF_DPI_LIST"
app_args[pkg_name]=$(toml_get "$t" pkg-name) || app_args[pkg_name]=""
app_args[dpi]=$(toml_get "$t" dpi) || app_args[dpi]=""
table_name_f=${table_name,,}
table_name_f=${table_name_f// /-}
app_args[module_prop_name]=$(toml_get "$t" module-prop-name) || app_args[module_prop_name]="${table_name_f}-jhc"
+30 -8
View File
@@ -51,15 +51,37 @@ archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.reddit.frontpage
uptodown-dlurl = "https://reddit-official-app.en.uptodown.com/android"
dpi = "120-640dpi"
[Twitter]
patches-source = "crimera/piko"
cli-source = "MorpheApp/morphe-cli"
rv-brand = "Piko"
apkmirror-dlurl = "https://www.apkmirror.com/apk/x-corp/twitter/"
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.twitter.android"
build-mode = "module"
version = "11.81.0-release.0"
include-stock = "split"
[GooglePhotos]
patches-source = "RookieEnough/De-Vanced"
cli-source = "MorpheApp/morphe-cli"
rv-brand = "De-Vanced"
build-mode = "both"
arch = "both"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/photos/"
uptodown-dlurl = "https://google-photos.en.uptodown.com/android"
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.photos"
[Instagram]
patches-source = "RookieEnough/De-Vanced"
cli-source = "MorpheApp/morphe-cli"
rv-brand = "De-Vanced"
build-mode = "both"
arch = "both"
apkmirror-dlurl = "https://www.apkmirror.com/apk/instagram/instagram-instagram/"
uptodown-dlurl = "https://instagram.en.uptodown.com/android"
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.photos"
[Twitch]
enabled = false
apkmirror-dlurl = "https://www.apkmirror.com/apk/twitch-interactive-inc/twitch/"
uptodown-dlurl = "https://twitch.en.uptodown.com/android"
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/tv.twitch.android.app"
[Twitter]
enabled = false
apkmirror-dlurl = "https://www.apkmirror.com/apk/x-corp/twitter"
build-mode = "apk"
dpi = "120-640dpi"
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.twitter.android"
View File
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
+65 -73
View File
@@ -37,98 +37,92 @@ pmex() {
return $RET
}
if ! pmex path "$PKG_NAME" >&2; then
if pmex install-existing "$PKG_NAME" >&2; then
pmex uninstall-system-updates "$PKG_NAME"
if OP=$(dumpsys package "$PKG_NAME") && [ "$OP" ]; then
if echo "$OP" | grep -m1 pkgFlags | grep -Fq UPDATED_SYSTEM_APP; then
pmex uninstall-system-updates "$PKG_NAME" >/dev/null 2>&1
fi
else
if pmex install-existing "$PKG_NAME" >/dev/null 2>&1; then
pmex uninstall-system-updates "$PKG_NAME" >/dev/null 2>&1
fi
fi
IS_SYS=false
INS=true
if BASEPATH=$(pmex path "$PKG_NAME"); then
echo >&2 "'$BASEPATH'"
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
if [ "${BASEPATH:1:4}" != data ]; then
ui_print "* $PKG_NAME is a system app."
IS_SYS=true
elif [ ! -f "$MODPATH/$PKG_NAME.apk" ]; then
ui_print "* Stock $PKG_NAME APK was not found"
VERSION=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 versionName) VERSION="${VERSION#*=}"
if [ "$VERSION" = "$PKG_VER" ] || [ -z "$VERSION" ]; then
ui_print "* Skipping stock installation"
INS=false
else
abort "ERROR: Version mismatch
installed: $VERSION
module: $PKG_VER
"
fi
elif "${MODPATH:?}/bin/$ARCH/cmpr" "$BASEPATH/base.apk" "$MODPATH/$PKG_NAME.apk"; then
ui_print "* $PKG_NAME is up-to-date"
INS=false
ui_print "* Detected $PKG_NAME as a system app"
SCNM="/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
mkdir -p /data/adb/post-fs-data.d
echo "mount -t tmpfs none $BASEPATH" >"$SCNM"
chmod +x "$SCNM"
ui_print "* Created the uninstall script."
ui_print ""
ui_print "* Reboot and reflash the module!"
abort
fi
VERSION=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 versionName=) VERSION="${VERSION#*=}"
if [ "$VERSION" ] && [ "$VERSION" = "$PKG_VER" ]; then
ui_print "* $PKG_NAME is up-to-date ($VERSION)"
INS=false
elif [ ! -f "$MODPATH/stock/base.apk" ]; then
ui_print "ERROR: Version mismatch
installed: '$VERSION'
module: '$PKG_VER'"
abort
fi
# TODO:
# elif "${MODPATH:?}/bin/$ARCH/cmpr" "$BASEPATH/base.apk" "$MODPATH/$PKG_NAME.apk"; then
# ui_print "* $PKG_NAME is up-to-date"
# INS=false
# fi
fi
install() {
if [ ! -f "$MODPATH/$PKG_NAME.apk" ]; then
if [ ! -f "$MODPATH/stock/base.apk" ]; then
abort "ERROR: Stock $PKG_NAME apk was not found"
fi
ui_print "* Updating $PKG_NAME to $PKG_VER"
install_err=""
VERIF1=$(settings get global verifier_verify_adb_installs)
VERIF2=$(settings get global package_verifier_enable)
settings put global verifier_verify_adb_installs 0
settings put global package_verifier_enable 0
SZ=$(stat -c "%s" "$MODPATH/$PKG_NAME.apk")
SZ=$(stat -c "%s" "$MODPATH"/stock/*.apk | awk '{sum += $0} END {print sum}')
for IT in 1 2; do
if ! SES=$(pmex install-create --user 0 -i com.android.vending -r -d -S "$SZ"); then
ui_print "* Updating $PKG_NAME to $PKG_VER"
if ! SES=$(pmex install-create --user 0 -i com.android.vending -r -S "$SZ"); then
ui_print "ERROR: install-create failed"
install_err="$SES"
break
fi
SES=${SES#*[} SES=${SES%]*}
set_perm "$MODPATH/$PKG_NAME.apk" 1000 1000 644 u:object_r:apk_data_file:s0
if ! op=$(pmex install-write -S "$SZ" "$SES" "$PKG_NAME.apk" "$MODPATH/$PKG_NAME.apk"); then
ui_print "ERROR: install-write failed"
install_err="$op"
break
fi
for apki in "$MODPATH/stock"/*.apk; do
set_perm "${apki}" 1000 1000 644 u:object_r:apk_data_file:s0
if ! op=$(pmex install-write -S "$SZ" "$SES" "$(basename "${apki}")" "${apki}"); then
ui_print "ERROR: install-write failed"
install_err="$op"
break
fi
done
if [ "$install_err" ]; then break; fi
if ! op=$(pmex install-commit "$SES"); then
ui_print "$op"
if echo "$op" | grep -q -e INSTALL_FAILED_VERSION_DOWNGRADE -e INSTALL_FAILED_UPDATE_INCOMPATIBLE; then
ui_print "* Handling install error"
pmex uninstall-system-updates "$PKG_NAME"
if BASEPATH=$(pmex path "$PKG_NAME"); then
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
if [ "${BASEPATH:1:4}" != data ]; then IS_SYS=true; fi
fi
if [ "$IS_SYS" = true ]; then
SCNM="/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
if [ -f "$SCNM" ]; then
ui_print "* Remove the old module. Reboot and reflash!"
ui_print ""
install_err=" "
ui_print "* Uninstalling..."
if ! op=$(pmex uninstall "$PKG_NAME"); then
ui_print "$op"
if [ $IT = 2 ]; then
install_err="ERROR: pm uninstall failed."
break
fi
mkdir -p /data/adb/rvhc/empty /data/adb/post-fs-data.d
echo "mount -o bind /data/adb/rvhc/empty $BASEPATH" >"$SCNM"
chmod +x "$SCNM"
ui_print "* Created the uninstall script."
ui_print ""
ui_print "* Reboot and reflash the module!"
install_err=" "
break
else
ui_print "* Uninstalling..."
if ! op=$(pmex uninstall -k --user 0 "$PKG_NAME"); then
ui_print "$op"
if [ $IT = 2 ]; then
install_err="ERROR: pm uninstall failed."
break
fi
fi
continue
fi
continue
fi
ui_print "ERROR: install-commit failed"
install_err="$op"
@@ -145,8 +139,7 @@ install() {
settings put global verifier_verify_adb_installs "$VERIF1"
settings put global package_verifier_enable "$VERIF2"
if [ "$install_err" ]; then
ui_print "$install_err"
abort "ERROR: disable the module, reboot, install $PKG_NAME manually and reflash again"
abort "$install_err"
fi
}
if [ $INS = true ] && ! install; then abort; fi
@@ -154,11 +147,11 @@ BASEPATHLIB=${BASEPATH}/lib/${ARCH}
if [ $INS = true ] || [ -z "$(ls -A1 "$BASEPATHLIB")" ]; then
ui_print "* Extracting native libs"
if [ ! -d "$BASEPATHLIB" ]; then mkdir -p "$BASEPATHLIB"; else rm -f "$BASEPATHLIB"/* >/dev/null 2>&1 || :; fi
if ! op=$(unzip -o -j "$MODPATH/$PKG_NAME.apk" "lib/${ARCH_LIB}/*" -d "$BASEPATHLIB" 2>&1); then
ui_print "ERROR: extracting native libs failed"
abort "$op"
if op=$(unzip -o -j "$MODPATH/stock/base.apk" "lib/${ARCH_LIB}/*" -d "$BASEPATHLIB" 2>&1); then
set_perm_recursive "${BASEPATH}/lib" 1000 1000 755 755 u:object_r:apk_data_file:s0
else
echo >&2 "ERROR: extracting native libs failed: '$op'"
fi
set_perm_recursive "${BASEPATH}/lib" 1000 1000 755 755 u:object_r:apk_data_file:s0
fi
ui_print "* Setting Permissions"
@@ -176,14 +169,14 @@ fi
am force-stop "$PKG_NAME"
ui_print "* Optimizing $PKG_NAME"
cmd package compile -m speed-profile -f "$PKG_NAME"
cmd package compile -m speed-profile -f "$PKG_NAME" >/dev/null 2>&1
# nohup cmd package compile -m speed-profile -f "$PKG_NAME" >/dev/null 2>&1
if [ "$KSU" ]; then
UID=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 uid)
UID=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 uid=)
UID=${UID#*=} UID=${UID%% *}
if [ -z "$UID" ]; then
UID=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 userId)
UID=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 userId=)
UID=${UID#*=} UID=${UID%% *}
fi
if [ "$UID" ]; then
@@ -191,15 +184,14 @@ if [ "$KSU" ]; then
ui_print " $OP"
ui_print "* Because you are using a fork of KernelSU, "
ui_print " you need to go to your root manager app and"
ui_print " disable 'Unmount modules' option for $PKG_NAME"
ui_print " disable 'Unmount modules' for $PKG_NAME"
fi
else
ui_print "ERROR: UID could not be found for $PKG_NAME"
dumpsys package "$PKG_NAME" >&2
fi
fi
rm -rf "${MODPATH:?}/bin" "$MODPATH/$PKG_NAME.apk"
rm -rf "${MODPATH:?}/bin" "$MODPATH/stock/"
ui_print "* Done"
ui_print " by j-hc (github.com/j-hc)"
Regular → Executable
+1 -1
View File
@@ -25,7 +25,7 @@ run() {
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
if [ ! -d "$BASEPATH/lib" ]; then
err "mount failed (ROM issue). Dont report this, consider using rvmm-zygisk-mount."
err "mount failed. Dont report this, consider using rvmm-zygisk-mount"
return
fi
VERSION=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 versionName) VERSION="${VERSION#*=}"
Regular → Executable
+5 -9
View File
@@ -1,13 +1,9 @@
#!/system/bin/sh
{
until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done
until [ -d "/sdcard/Android" ]; do sleep 1; done
MODDIR=${0%/*}
. "$MODDIR/config"
MODDIR=${0%/*}
. "$MODDIR/config"
rm -f "/data/adb/rvhc/${MODDIR##*/}.apk"
rmdir "/data/adb/rvhc"
rm "/data/adb/rvhc/${MODDIR##*/}.apk"
rmdir "/data/adb/rvhc"
rm "/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
} &
rm -f "/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
-1
View File
@@ -1,5 +1,4 @@
a2a1ad7ba7f41dfca4514e2afeb90691719af6d0fdbed4b09bbf0ed897701ceb com.google.android.apps.youtube.music
3d7a1223019aa39d9ea0e3436ab7c0896bfb4fb679f4de5fe7c23f326c8f994a com.google.android.youtube
970b91143813b4c9d5f3634f672c9fcaa5621b4efaaedafd6c235cbbb869736f com.reddit.frontpage
9041803e91bcb814b4b4399fb5c85a91640b755e5e8ba76813814bf4cf2ab5ba com.zhiliaoapp.musically
1338f9b049893cc70b78432a177582f90bd4bc6296ea4ed35bcc7df59687ac53 tv.twitch.android.app
+158 -73
View File
@@ -47,8 +47,10 @@ wpr() {
}
abort() {
epr "ABORT: ${1-}"
rm -rf ./${TEMP_DIR}/*tmp.* ./${TEMP_DIR}/*/*tmp.* ./${TEMP_DIR}/*-temporary-files
kill -n 9 0
rm -rf ./${TEMP_DIR}/*tmp.* ./${TEMP_DIR}/*/*tmp.* ./${TEMP_DIR}/*-temporary-files ./*-temporary-files
trap - SIGTERM SIGINT EXIT
kill -- -$$ 2>/dev/null
exit 1
}
java() { env -i java --enable-native-access=ALL-UNNAMED "$@"; }
@@ -89,6 +91,11 @@ get_prebuilts() {
local url file tag_name matches
file=$(find "$dir" -name "*${fprefix}-${name_ver#v}.*" -type f 2>/dev/null)
if [ "$ver" = "latest" ]; then
file=$(grep -v '/[^/]*dev[^/]*$' <<<"$file" | head -1)
else
file=$(grep "/[^/]*${ver#v}[^/]*\$" <<<"$file" | head -1)
fi
if [ -z "$file" ]; then
local resp asset name
resp=$(gh_req "$rv_rel" -) || return 1
@@ -115,11 +122,6 @@ get_prebuilts() {
echo "$tag: $(cut -d/ -f1 <<<"$src")/${name} " >>"${cl_dir}/changelog.md"
else
grab_cl=false
local for_err=$file
if [ "$ver" = "latest" ]; then
file=$(grep -v '/[^/]*dev[^/]*$' <<<"$file" | head -1)
else file=$(grep "/[^/]*${ver#v}[^/]*\$" <<<"$file" | head -1); fi
if [ -z "$file" ]; then abort "filter fail: '$for_err' with '$ver'"; fi
name=$(basename "$file")
tag_name=$(cut -d'-' -f3- <<<"$name")
tag_name=v${tag_name%.*}
@@ -271,7 +273,7 @@ get_patch_last_supported_ver() {
fi
fi
op=$(patches_list_versions "$cli_jar" "$patches_jar" "$pkg_name") || return 1
op=$(sed -n '/(.* patch.*/,$p' <<<"$op" | awk '{$1=$1}1')
op=$(sed -n '/Most common compatible versions:/,$p' <<<"$op" | sed '1d' | awk '{$1=$1}1')
if [ "$op" = "Any" ]; then return; fi
pcount=$(head -1 <<<"$op") pcount=${pcount#*(} pcount=${pcount% *}
if [ -z "$pcount" ]; then
@@ -281,14 +283,28 @@ get_patch_last_supported_ver() {
}
patches_list_versions() {
local cli_jar=$1 patches_jar=$2 pkg_name=$3 op
if ! op=$(java -jar "$cli_jar" list-versions -p "$patches_jar" -f "$pkg_name" -b 2>&1); then
if ! op=$(java -jar "$cli_jar" list-versions "$patches_jar" -f "$pkg_name" 2>&1); then
epr "Could not list versions $cli_jar: '$op'"
return 1
fi
local cli_jar=$1 patches_jar=$2 pkg_name=$3 op cmd
local cmd_base="java -jar '$cli_jar' list-versions"
# TODO: remove this later
local cli_name
cli_name=$(basename "$cli_jar")
if [ "${cli_name::8}" = revanced ]; then cmd_base+=" -b"; fi
cmd="${cmd_base} --patches='$patches_jar' -f '$pkg_name'"
if op=$(eval "$cmd" 2>&1); then
echo "$op"
return
fi
echo "$op"
cmd="${cmd_base} '$patches_jar' -f '$pkg_name'"
if op=$(eval "$cmd" 2>&1); then
echo "$op"
return
fi
epr "Could not list versions $cli_jar: '$op'"
return 1
}
patches_list() {
local cli_jar=$1 patches_jar=$2 pkg_name=$3 op
@@ -330,20 +346,27 @@ merge_splits() {
# -------------------- apkmirror --------------------
apkmirror_search() {
local resp="$1" dpi="$2" arch="$3" apk_bundle="$4"
local apparch dlurl="" node app_table emptyCheck
if [ "$arch" = all ]; then
apparch=(universal noarch 'arm64-v8a + armeabi-v7a')
else apparch=("$arch" universal noarch 'arm64-v8a + armeabi-v7a'); fi
local dlurl="" node app_table emptyCheck
local apparch=('universal' 'noarch' 'arm64-v8a + armeabi-v7a')
if [ "$arch" != all ]; then
apparch+=("$arch")
fi
local appdpi=("nodpi" "anydpi")
if [ "$dpi" ]; then
appdpi+=($dpi)
fi
for ((n = 1; n < 40; n++)); do
node=$($HTMLQ "div.table-row.headerFont:nth-last-child($n)" -r "span:nth-child(n+3)" <<<"$resp")
if [ -z "$node" ]; then break; fi
emptyCheck=$($HTMLQ -t -w "div.table-cell:nth-child(1) > a:nth-child(1)" <<<"$node" | xargs)
if [ "$emptyCheck" ]; then
dlurl=$($HTMLQ --base https://www.apkmirror.com --attribute href "div:nth-child(1) > a:nth-child(1)" <<<"$node")
else break; fi
if [ -z "$emptyCheck" ]; then break; fi
app_table=$($HTMLQ --text --ignore-whitespace <<<"$node")
if [ "$(sed -n 3p <<<"$app_table")" = "$apk_bundle" ] &&
[ "$(sed -n 6p <<<"$app_table")" = "$dpi" ] &&
if [ "$(sed -n 3p <<<"$app_table")" != "$apk_bundle" ]; then continue; fi
dlurl=$($HTMLQ --base https://www.apkmirror.com --attribute href "div:nth-child(1) > a:nth-child(1)" <<<"$node")
if isoneof "$(sed -n 6p <<<"$app_table")" "${appdpi[@]}" &&
isoneof "$(sed -n 4p <<<"$app_table")" "${apparch[@]}"; then
echo "$dlurl"
return 0
@@ -358,32 +381,34 @@ apkmirror_search() {
}
dl_apkmirror() {
local url=$1 version=${2// /-} output=$3 arch=$4 dpi=$5 is_bundle=false
if [ -f "${output}.apkm" ]; then
is_bundle=true
else
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
local resp node app_table apkmname dlurl=""
apkmname=$($HTMLQ "h1.marginZero" --text <<<"$__APKMIRROR_RESP__")
apkmname="${apkmname,,}" apkmname="${apkmname// /-}" apkmname="${apkmname//[^a-z0-9-]/}"
url="${url}/${apkmname}-${version//./-}-release/"
resp=$(req "$url" -) || return 1
node=$($HTMLQ "div.table-row.headerFont:nth-last-child(1)" -r "span:nth-child(n+3)" <<<"$resp")
if [ "$node" ]; then
for current_dpi in $dpi; do
for type in APK BUNDLE; do
if dlurl=$(apkmirror_search "$resp" "$current_dpi" "${arch}" "$type"); then
[[ "$type" == "BUNDLE" ]] && is_bundle=true || is_bundle=false
break 2
fi
done
done
[ -z "$dlurl" ] && return 1
resp=$(req "$dlurl" -)
fi
url=$(echo "$resp" | $HTMLQ --base https://www.apkmirror.com --attribute href "a.btn") || return 1
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]") || return 1
merge_splits "${output}.apkm" "${output}"
return 0
fi
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
local resp node app_table apkmname dlurl=""
apkmname=$($HTMLQ "h1.marginZero" --text <<<"$__APKMIRROR_RESP__")
apkmname="${apkmname,,}" apkmname="${apkmname// /-}" apkmname="${apkmname//[^a-z0-9-]/}"
url="${url}/${apkmname}-${version//./-}-release/"
resp=$(req "$url" -) || return 1
node=$($HTMLQ "div.table-row.headerFont:nth-last-child(1)" -r "span:nth-child(n+3)" <<<"$resp")
if [ "$node" ]; then
for type in APK BUNDLE; do
if dlurl=$(apkmirror_search "$resp" "$dpi" "$arch" "$type"); then
if [ "$type" = "BUNDLE" ]; then
is_bundle=true
else is_bundle=false; fi
break 2
fi
done
if [ -z "$dlurl" ]; then return 1; fi
resp=$(req "$dlurl" -)
fi
url=$(echo "$resp" | $HTMLQ --base https://www.apkmirror.com --attribute href "a.btn") || return 1
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]") || return 1
if [ "$is_bundle" = true ]; then
req "$url" "${output}.apkm" || return 1
merge_splits "${output}.apkm" "${output}"
@@ -421,11 +446,12 @@ get_uptodown_resp() {
get_uptodown_vers() { $HTMLQ --text ".version" <<<"$__UPTODOWN_RESP__"; }
dl_uptodown() {
local uptodown_dlurl=$1 version=$2 output=$3 arch=$4 _dpi=$5
local apparch
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
if [ "$arch" = all ]; then
apparch=('arm64-v8a, armeabi-v7a, x86_64' 'arm64-v8a, armeabi-v7a, x86, x86_64' 'arm64-v8a, armeabi-v7a')
else apparch=("$arch" 'arm64-v8a, armeabi-v7a, x86_64' 'arm64-v8a, armeabi-v7a, x86, x86_64' 'arm64-v8a, armeabi-v7a'); fi
local apparch=('arm64-v8a, armeabi-v7a, x86_64' 'arm64-v8a, armeabi-v7a, x86, x86_64' 'arm64-v8a, armeabi-v7a')
if [ "$arch" != all ]; then
apparch+=("$arch")
fi
local op resp data_code
data_code=$($HTMLQ "#detail-app-name" --attribute data-code <<<"$__UPTODOWN_RESP__")
@@ -478,9 +504,23 @@ get_uptodown_pkg_name() { $HTMLQ --text "tr.full:nth-child(1) > td:nth-child(3)"
# -------------------- archive --------------------
dl_archive() {
local url=$1 version=$2 output=$3 arch=$4
local path version=${version// /}
path=$(grep "${version_f#v}-${arch// /}" <<<"$__ARCHIVE_RESP__") || return 1
req "${url}/${path}" "$output"
local path output_m version=${version// /}
if [ -f "${output}.apkm" ]; then
merge_splits "${output}.apkm" "$output"
return 0
fi
path=$(grep -m1 "${version_f#v}-${arch// /}" <<<"$__ARCHIVE_RESP__") || return 1
if [ "${path##*.}" = "apkm" ]; then
output_m="${output}.apkm"
else
output_m=$output
fi
req "${url}/${path}" "$output_m" || return 1
if [ "${path##*.}" = "apkm" ]; then
merge_splits "$output_m" "$output"
fi
}
get_archive_resp() {
local r
@@ -493,7 +533,7 @@ get_archive_pkg_name() { echo "$__ARCHIVE_PKG_NAME__"; }
# -------------------- direct --------------------
dl_direct() {
local url=$1 version=${2// /-} output=$3 arch=$4 dpi=$5
local url=$1 version=${2// /-} output=$3 arch=$4 _dpi=$5
req "$url" "${output}" || return 1
}
get_direct_vers() { cut -d- -f2 <<<"$__DIRECT_APKNAME__"; }
@@ -547,17 +587,22 @@ build_rv() {
[ "${args[exclusive_patches]}" = true ] && p_patcher_args+=("--exclusive")
local tried_dl=()
for dl_p in "${DL_SRCS[@]}"; do
if [ -z "${args[${dl_p}_dlurl]}" ]; then continue; fi
if ! get_${dl_p}_resp "${args[${dl_p}_dlurl]}" || ! pkg_name=$(get_"${dl_p}"_pkg_name); then
args[${dl_p}_dlurl]=""
epr "ERROR: Could not find ${table} in ${dl_p}"
continue
fi
tried_dl+=("$dl_p")
dl_from=$dl_p
break
done
if [ "${args[pkg_name]}" ]; then
pkg_name="${args[pkg_name]}"
else
for dl_p in "${DL_SRCS[@]}"; do
if [ -z "${args[${dl_p}_dlurl]}" ]; then continue; fi
if ! get_${dl_p}_resp "${args[${dl_p}_dlurl]}" || ! pkg_name=$(get_"${dl_p}"_pkg_name); then
args[${dl_p}_dlurl]=""
epr "ERROR: Could not find ${table} in ${dl_p}"
continue
fi
tried_dl+=("$dl_p")
dl_from=$dl_p
break
done
fi
if [ -z "$pkg_name" ]; then
epr "empty pkg name, not building ${table}."
return 0
@@ -622,9 +667,23 @@ build_rv() {
return 0
fi
fi
if [ ! -f "${stock_apk}.apkm" ] && ! OP=$(check_sig "$stock_apk" "$pkg_name" 2>&1) && ! grep -qFx "ERROR: Missing META-INF/MANIFEST.MF" <<<"$OP"; then
epr "Not building $table, apk signature mismatch '$stock_apk': $OP"
return 0
local sig_op
if [ -f "${stock_apk}.apkm" ]; then
rm -rf "${stock_apk}-zip" || :
unzip -j "${stock_apk}.apkm" -d "${stock_apk}-zip" >/dev/null
for a in "${stock_apk}"-zip/*.apk; do
if ! sig_op=$(check_sig "$a" "$pkg_name" 2>&1); then
epr "Not building $table, apk signature mismatch '$a': $sig_op"
return 0
fi
done
rm -rf "${stock_apk}-zip" || :
else
if ! sig_op=$(check_sig "$stock_apk" "$pkg_name" 2>&1); then
epr "Not building $table, apk signature mismatch '$stock_apk': $sig_op"
return 0
fi
fi
log "${table}: ${version}"
@@ -672,7 +731,9 @@ build_rv() {
zip -d "$stock_apk_to_patch" "lib/x86_64/*" "lib/x86/*" >/dev/null 2>&1 || :
fi
fi
if [ "${NORB:-}" != true ] || [ ! -f "$patched_apk" ]; then
local apk_output="${BUILD_DIR}/${app_name_l}-${rv_brand_f}-v${version_f}-${arch_f}.apk"
if [ "${NORB:-}" != true ] || { [ ! -f "$patched_apk" ] && [ ! -f "$apk_output" ]; }; then
if ! patch_apk "$stock_apk_to_patch" "$patched_apk" "${patcher_args[*]}" "${args[cli]}" "${args[ptjar]}"; then
epr "Building '${table}' failed!"
return 0
@@ -680,8 +741,9 @@ build_rv() {
fi
rm "$stock_apk_to_patch"
if [ "$build_mode" = apk ]; then
local apk_output="${BUILD_DIR}/${app_name_l}-${rv_brand_f}-v${version_f}-${arch_f}.apk"
mv -f "$patched_apk" "$apk_output"
if [ "${NORB:-}" != true ] || { [ ! -f "$patched_apk" ] && [ ! -f "$apk_output" ]; }; then
mv -f "$patched_apk" "$apk_output"
fi
pr "Built ${table} (non-root): '${apk_output}'"
continue
fi
@@ -704,7 +766,30 @@ build_rv() {
local module_output="${app_name_l}-${rv_brand_f}-module-v${version_f}-${arch_f}.zip"
pr "Packing module ${table}"
cp -f "$patched_apk" "${base_template}/base.apk"
if [ "${args[include_stock]}" = true ]; then cp -f "$stock_apk" "${base_template}/${pkg_name}.apk"; fi
if [ "${args[include_stock]}" != "disable" ]; then
mkdir -p "${base_template}/stock/"
if [ "${args[include_stock]}" = "merged" ]; then
cp -f "$stock_apk" "${base_template}/stock/base.apk"
elif [ "${args[include_stock]}" = "split" ]; then
if [ ! -f "${stock_apk}.apkm" ]; then
epr "Cannot include as 'split' because stock apk of $table_name is not a bundle"
return 0
fi
if [ "$arch" = "arm64-v8a" ]; then
unzip -j "${stock_apk}.apkm" '*.apk' -x '*x86_64.apk' -x '*x86.apk' -x '*armeabi_v7a.apk' -d "${base_template}/stock/" >/dev/null 2>&1
elif [ "$arch" = "arm-v7a" ]; then
unzip -j "${stock_apk}.apkm" '*.apk' -x '*x86_64.apk' -x '*x86.apk' -x '*arm64_v8a.apk' -d "${base_template}/stock/" >/dev/null 2>&1
elif [ "$arch" = "x86" ]; then
unzip -j "${stock_apk}.apkm" '*.apk' -x '*x86_64.apk' -x '*arm64_v8a.apk' -x '*armeabi_v7a.apk' -d "${base_template}/stock/" >/dev/null 2>&1
elif [ "$arch" = "x86_64" ]; then
unzip -j "${stock_apk}.apkm" '*.apk' -x '*x86.apk' -x '*arm64_v8a.apk' -x '*armeabi_v7a.apk' -d "${base_template}/stock/" >/dev/null 2>&1
else
unzip -j "${stock_apk}.apkm" '*.apk' -x '*x86_64.apk' -x '*x86.apk' -d "${base_template}/stock/" >/dev/null 2>&1
fi
fi
fi
pushd >/dev/null "$base_template" || abort "Module template dir not found"
zip -"$COMPRESSION_LEVEL" -FSqr "${CWD}/${BUILD_DIR}/${module_output}" .
popd >/dev/null || :