diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28de9bf..514dcb0 100755 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -138,6 +138,7 @@ jobs: ${APKS} " echo "'$MSG'" + 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" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f80b9ab..a5a6bdb 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,14 +41,27 @@ jobs: } is_patches_latest() { - PATCHES_SRC=$(toml_get "$(toml_get_table "")" patches-source) || PATCHES_SRC="ReVanced/revanced-patches" - last_patches_url=$(gh_req https://api.github.com/repos/${PATCHES_SRC}/releases/latest - | json_get 'browser_download_url' | grep 'jar') - last_patches=${last_patches_url##*/} - cur_patches=$(sed -n "s/.*Patches: ${PATCHES_SRC%%/*}\/\(.*\)/\1/p" build.md | xargs) - echo "current patches version: $cur_patches" - echo "latest patches version: $last_patches" - if [ -z "$cur_patches" ] || [ -z "$last_patches" ]; then return 1; fi - [ "$cur_patches" != "$last_patches" ] # test success=>build, fail=>dont build + declare -A sources + sources["ReVanced/revanced-patches"]=1 + for table_name in $(toml_get_table_names); do + if [ -z "$table_name" ]; then continue; fi + t=$(toml_get_table "$table_name") + enabled=$(toml_get "$t" enabled) || enabled=true + if [ "$enabled" = false ]; then continue; fi + PATCHES_SRC=$(toml_get "$t" patches-source) + if [ "$PATCHES_SRC" ]; then sources[$PATCHES_SRC]=1; fi + done + for PATCHES_SRC in "${!sources[@]}"; do + echo "chk: '$PATCHES_SRC'" + last_patches_url=$(gh_req "https://api.github.com/repos/${PATCHES_SRC}/releases/latest" - | json_get 'browser_download_url' | grep 'jar') + last_patches=${last_patches_url##*/} + cur_patches=$(sed -n "s/.*Patches: ${PATCHES_SRC%%/*}\/\(.*\)/\1/p" build.md | xargs) + echo "current patches version: $cur_patches" + echo "latest patches version: $last_patches" + if [ -z "$cur_patches" ] || [ -z "$last_patches" ]; then continue; fi + if [ "$cur_patches" != "$last_patches" ]; then return 0; fi + done + return 1 } if ! git checkout update; then diff --git a/.gitmodules b/.gitmodules deleted file mode 100755 index 0019fb8..0000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "mindetach-magisk"] -path = mindetach-magisk -url = https://github.com/j-hc/mindetach-magisk -ignore = dirty diff --git a/README.md b/README.md index eb6ee4a..ea649db 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ #### ⚠️ Do not download modules from 3rd party sources like random websites you found on Google. There are many that uses my modules and impersonates ReVanced. # ReVanced eXtended -[![Build Modules](https://github.com/NoName-exe/revanced-extended/actions/workflows/build.yml/badge.svg)](https://github.com/NoName-exe/revanced-extended/actions/workflows/build.yml) [![CI](https://github.com/NoName-exe/revanced-extended/actions/workflows/ci.yml/badge.svg?event=schedule)](https://github.com/NoName-exe/revanced-extended/actions/workflows/ci.yml) Get the [latest CI release](https://github.com/NoName-exe/revanced-extended/releases/latest). diff --git a/build.sh b/build.sh index be26e8d..08c2f3b 100755 --- a/build.sh +++ b/build.sh @@ -22,11 +22,6 @@ if [ "$ENABLE_MAGISK_UPDATE" = true ] && [ -z "${GITHUB_REPOSITORY:-}" ]; then pr "You are building locally. Magisk updates will not be enabled." ENABLE_MAGISK_UPDATE=false fi -BUILD_MINDETACH_MODULE=$(toml_get "$main_config_t" build-mindetach-module) || BUILD_MINDETACH_MODULE=false -if [ "$BUILD_MINDETACH_MODULE" = true ] && [ ! -f "mindetach-magisk/mindetach/detach.txt" ]; then - pr "mindetach module was not found." - BUILD_MINDETACH_MODULE=false -fi if ! PARALLEL_JOBS=$(toml_get "$main_config_t" parallel-jobs); then if [ "$OS" = Android ]; then PARALLEL_JOBS=1; else PARALLEL_JOBS=$(nproc); fi fi @@ -42,7 +37,6 @@ DEF_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced" mkdir -p $TEMP_DIR $BUILD_DIR if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 0)); then abort "compression-level must be within 0-9"; fi -if [ "$BUILD_MINDETACH_MODULE" = true ]; then : >$PKGS_LIST; fi if [ "$LOGGING_F" = true ]; then mkdir -p logs; fi #check_deps @@ -93,11 +87,7 @@ for table_name in $(toml_get_table_names); do cli_src=$(toml_get "$t" cli-source) || cli_src=$DEF_CLI_SRC cli_ver=$(toml_get "$t" cli-version) || cli_ver=$DEF_CLI_VER - if [ "${SETPRE:-}" ]; then - if ! set_prebuilts "$integrations_src" "$patches_src" "$cli_src" "$integrations_ver" "$patches_ver" "$cli_ver"; then - abort "couldnt set prebuilts" - fi - else + if ! set_prebuilts "$integrations_src" "$patches_src" "$cli_src" "$integrations_ver" "$patches_ver" "$cli_ver"; then if ! RVP="$(get_rv_prebuilts "$integrations_src" "$patches_src" "$integrations_ver" "$patches_ver" "$cli_src" "$cli_ver")"; then abort "could not download rv prebuilts" fi @@ -173,21 +163,13 @@ wait rm -rf temp/tmp.* if [ -z "$(ls -A1 ${BUILD_DIR})" ]; then abort "All builds failed."; fi -if [ "$BUILD_MINDETACH_MODULE" = true ]; then - pr "Building mindetach module" - cp -f $PKGS_LIST mindetach-magisk/mindetach/detach.txt - pushd mindetach-magisk/mindetach/ - zip -qr ../../build/mindetach-"$(grep version= module.prop | cut -d= -f2)".zip . - popd -fi - if youtube_t=$(toml_get_table "YouTube"); then youtube_mode=$(toml_get "$youtube_t" "build-mode") || youtube_mode="apk"; else youtube_mode="module"; fi if music_t=$(toml_get_table "Music"); then music_mode=$(toml_get "$music_t" "build-mode") || music_mode="apk"; else music_mode="module"; fi if [ "$youtube_mode" != module ] || [ "$music_mode" != module ]; then log "\nInstall [Vanced MicroG](https://github.com/inotia00/VancedMicroG/releases) or [mMicroG](https://github.com/inotia00/mMicroG/releases) to be able to use non-root YouTube or YouTube-Music" fi log "\n[Main Repo](https://github.com/NoName-exe/revanced-extended)" -log "\n---\nChangelog:" +log "\nChangelog:" log "$(cat $TEMP_DIR/*-rv/changelog.md)" pr "Done" diff --git a/config.toml b/config.toml index 8e4d270..e11bc3b 100755 --- a/config.toml +++ b/config.toml @@ -1,6 +1,6 @@ +parallel-jobs = 1 logging-to-file = true # enables logging of every patch process to a seperate file enable-magisk-update = true # set this to false if you do not want to receive updates for the module in magisk app -build-mindetach-module = false patches-source = "inotia00/revanced-patches" integrations-source = "inotia00/revanced-integrations" rv-brand = "ReVanced eXtended" diff --git a/mindetach-magisk b/mindetach-magisk deleted file mode 160000 index 41adbd8..0000000 --- a/mindetach-magisk +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 41adbd8641c2b6e6476c42ebb86b64df634961e7 diff --git a/scripts/customize.sh b/scripts/customize.sh index 9f48114..11763be 100755 --- a/scripts/customize.sh +++ b/scripts/customize.sh @@ -14,11 +14,11 @@ else fi set_perm_recursive $MODPATH/bin 0 0 0755 0777 -su -M -c grep __PKGNAME /proc/mounts | while read -r line; do +nsenter -t1 -m -- grep __PKGNAME /proc/mounts | while read -r line; do ui_print "- Un-mount" mp=${line#* } mp=${mp%% *} - su -M -c umount -l "${mp%%\\*}" + nsenter -t1 -m -- umount -l "${mp%%\\*}" done am force-stop __PKGNAME @@ -97,7 +97,7 @@ mkdir -p $NVBASE/rvhc RVPATH=$NVBASE/rvhc/${MODPATH##*/}.apk mv -f $MODPATH/base.apk $RVPATH -if ! op=$(su -M -c mount -o bind $RVPATH $BASEPATH/base.apk 2>&1); then +if ! op=$(nsenter -t1 -m -- mount -o bind $RVPATH $BASEPATH/base.apk 2>&1); then ui_print "ERROR: Mount failed!" ui_print "$op" fi @@ -107,7 +107,6 @@ nohup cmd package compile --reset __PKGNAME >/dev/null 2>&1 & ui_print "- Cleanup" rm -rf $MODPATH/bin $MODPATH/__PKGNAME.apk -rm -rf $NVBASE/rvhc/__PKGNAME_rv.apk # rm this later for s in "uninstall.sh" "service.sh"; do sed -i "2 i\NVBASE=${NVBASE}" $MODPATH/$s diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 91c78eb..ab2372e 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -2,7 +2,7 @@ { MODDIR=${0%/*} rm "$NVBASE/rvhc/${MODDIR##*/}".apk - rmdir --ignore-fail-on-non-empty "$NVBASE/rvhc" + rmdir "$NVBASE/rvhc" # if __ISBNDL; then # until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done # sleep 15 diff --git a/utils.sh b/utils.sh index aa52dc4..7c35dfa 100755 --- a/utils.sh +++ b/utils.sh @@ -3,7 +3,7 @@ MODULE_TEMPLATE_DIR="revanced-magisk" TEMP_DIR="temp" BUILD_DIR="build" -PKGS_LIST="${TEMP_DIR}/module-pkgs" +# PKGS_LIST="${TEMP_DIR}/module-pkgs" if [ "${GITHUB_TOKEN:-}" ]; then GH_HEADER="Authorization: token ${GITHUB_TOKEN}"; else GH_HEADER=; fi NEXT_VER_CODE=${NEXT_VER_CODE:-$(date +'%Y%m%d')} @@ -53,7 +53,7 @@ get_rv_prebuilts() { mkdir -p "$patches_dir" "$integrations_dir" "$cli_dir" pr "Getting prebuilts (${patches_src%/*})" >&2 - local rv_cli_url rv_integrations_url rv_patches rv_patches_changelog rv_patches_dl rv_patches_url rv_patches_json + local rv_cli_url rv_integrations_url rv_patches rv_patches_dl rv_patches_url rv_patches_json local rv_cli_rel="https://api.github.com/repos/${cli_src}/releases/" if [ "$cli_ver" ]; then rv_cli_rel+="tags/${cli_ver}"; else rv_cli_rel+="latest"; fi @@ -70,19 +70,22 @@ get_rv_prebuilts() { echo "Integrations: $(cut -d/ -f4 <<<"$rv_integrations_url")/$(cut -d/ -f9 <<<"$rv_integrations_url") " >>"$patches_dir/changelog.md" rv_patches=$(gh_req "$rv_patches_rel" -) || return 1 - rv_patches_changelog=$(json_get 'body' <<<"$rv_patches" | sed 's/\(\\n\)\+/\\n/g') + # 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") local rv_patches_jar="${patches_dir}/${rv_patches_url##*/}" [ -f "$rv_patches_jar" ] || REBUILD=true - echo "Patches: $(cut -d/ -f4 <<<"$rv_patches_url")/$(cut -d/ -f9 <<<"$rv_patches_url") " >>"$patches_dir/changelog.md" - echo -e "\n${rv_patches_changelog//# [/### [}\n---" >>"$patches_dir/changelog.md" + local nm + nm=$(cut -d/ -f9 <<<"$rv_patches_url") + echo "Patches: $(cut -d/ -f4 <<<"$rv_patches_url")/$nm " >>"$patches_dir/changelog.md" + echo -e "[Changelog](https://github.com/${patches_src}/releases/tag/v$(sed 's/.*-\(.*\)\..*/\1/' <<<$nm))\n" >>"$patches_dir/changelog.md" + # echo -e "\n${rv_patches_changelog//# [/### [}\n---" >>"$patches_dir/changelog.md" - dl_if_dne "$rv_cli_jar" "$rv_cli_url" >&2 - dl_if_dne "$rv_integrations_apk" "$rv_integrations_url" >&2 - dl_if_dne "$rv_patches_jar" "$rv_patches_url" >&2 - dl_if_dne "$rv_patches_json" "$(grep 'json' <<<"$rv_patches_dl")" >&2 + dl_if_dne "$rv_cli_jar" "$rv_cli_url" >&2 || return 1 + dl_if_dne "$rv_integrations_apk" "$rv_integrations_url" >&2 || return 1 + dl_if_dne "$rv_patches_jar" "$rv_patches_url" >&2 || return 1 + dl_if_dne "$rv_patches_json" "$(grep 'json' <<<"$rv_patches_dl")" >&2 || return 1 echo "$rv_cli_jar" "$rv_integrations_apk" "$rv_patches_jar" "$rv_patches_json" } @@ -188,6 +191,10 @@ dl_apkmirror() { local resp node app_table dlurl="" if [ "$arch" = universal ]; then apparch=(universal noarch 'arm64-v8a + armeabi-v7a') + elif [ "$arch" = "arm64-v8a" ]; then + apparch=(arm64-v8a universal) + elif [ "$arch" = "armeabi-v7a" ]; then + apparch=(armeabi-v7a universal) else apparch=("$arch"); fi url="${url}/${url##*/}-${version//./-}-release/" resp=$(req "$url" -) || return 1 @@ -203,9 +210,9 @@ dl_apkmirror() { fi done [ -z "$dlurl" ] && return 1 - url=$(req "$dlurl" - | $HTMLQ --base https://www.apkmirror.com --attribute href "a.btn") + url=$(req "$dlurl" - | $HTMLQ --base https://www.apkmirror.com --attribute href "a.btn") || return 1 if [ "$apkorbundle" = BUNDLE ] && [[ "$url" != *"&forcebaseapk=true" ]]; then url="${url}&forcebaseapk=true"; fi - url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]") + url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]") || return 1 req "$url" "$output" } get_apkmirror_vers() { @@ -231,15 +238,21 @@ get_apkmirror_pkg_name() { req "$1" - | sed -n 's;.*id=\(.*\)" class="accent_col # -------------------- uptodown -------------------- get_uptodown_resp() { req "${1}/versions" -; } -get_uptodown_vers() { sed -n 's;.*version">\(.*\)$;\1;p' <<<"$1"; } +get_uptodown_vers() { $HTMLQ --text ".version" <<<"$1"; } +dl_uptodown_last() { + local uptwod_resp=$1 output=$2 + local url + url=$($HTMLQ -a data-url "#detail-download-button" <<<"$uptwod_resp") || return 1 + req "$url" "$output" +} dl_uptodown() { local uptwod_resp=$1 version=$2 output=$3 - local url + local url r url=$(grep -F "${version}" -B 2 <<<"$uptwod_resp" | head -1 | sed -n 's;.*data-url="\(.*\)".*;\1;p') || return 1 - url=$(req "$url" - | sed -n 's;.*data-url="\(.*\)".*;\1;p') || return 1 - req "$url" "$output" + r=$(req "$url" -) || return 1 + dl_uptodown_last "$r" "$output" } -get_uptodown_pkg_name() { req "${1}/download" - | $HTMLQ --text "tr.full:nth-child(1) > td:nth-child(3)"; } +get_uptodown_pkg_name() { $HTMLQ --text "tr.full:nth-child(1) > td:nth-child(3)" <<<"$1"; } # -------------------------------------------------- # -------------------- apkmonk --------------------- @@ -289,8 +302,9 @@ build_rv() { if [ "$dl_from" = apkmirror ]; then pkg_name=$(get_apkmirror_pkg_name "${args[apkmirror_dlurl]}") elif [ "$dl_from" = uptodown ]; then + uptwod_resp_dl=$(req "${args[uptodown_dlurl]}/download" -) uptwod_resp=$(get_uptodown_resp "${args[uptodown_dlurl]}") - pkg_name=$(get_uptodown_pkg_name "${args[uptodown_dlurl]}") + pkg_name=$(get_uptodown_pkg_name "$uptwod_resp_dl") elif [ "$dl_from" = apkmonk ]; then pkg_name=$(get_apkmonk_pkg_name "${args[apkmonk_dlurl]}") apkmonk_resp=$(get_apkmonk_resp "${args[apkmonk_dlurl]}") @@ -310,14 +324,14 @@ build_rv() { p_patcher_args+=("-f") fi if [ $get_latest_ver = true ]; then - local apkmvers uptwodvers aav if [ "$dl_from" = apkmirror ]; then + local apkmvers aav if [ "$version_mode" = beta ]; then aav="true"; else aav="false"; fi apkmvers=$(get_apkmirror_vers "${args[apkmirror_dlurl]##*/}" "$aav") version=$(get_largest_ver <<<"$apkmvers") || version=$(head -1 <<<"$apkmvers") elif [ "$dl_from" = uptodown ]; then uptwodvers=$(get_uptodown_vers "$uptwod_resp") - version=$(get_largest_ver <<<"$uptwodvers") || version=$(head -1 <<<"$uptwodvers") + version=$(head -1 <<<"$uptwodvers") elif [ "$dl_from" = apkmonk ]; then apkmonkvers=$(get_apkmonk_vers "$apkmonk_resp") version=$(get_largest_ver <<<"$apkmonkvers") || version=$(head -1 <<<"$apkmonkvers") @@ -353,11 +367,18 @@ build_rv() { break elif [ "$dl_p" = uptodown ]; then if [ -z "${args[uptodown_dlurl]}" ]; then continue; fi - if [ -z "${uptwod_resp:-}" ]; then uptwod_resp=$(get_uptodown_resp "${args[uptodown_dlurl]}"); fi pr "Downloading '${table}' from Uptodown" - if ! dl_uptodown "$uptwod_resp" "$version" "$stock_apk"; then - epr "ERROR: Could not download ${table} from Uptodown" - continue + if [ $get_latest_ver = true ]; then + if ! dl_uptodown_last "$uptwod_resp_dl" "$stock_apk"; then + epr "ERROR: Could not download ${table} from Uptodown (last)" + continue + fi + else + if [ -z "${uptwod_resp:-}" ]; then uptwod_resp=$(get_uptodown_resp "${args[uptodown_dlurl]}"); fi + if ! dl_uptodown "$uptwod_resp" "$version" "$stock_apk"; then + epr "ERROR: Could not download ${table} from Uptodown" + continue + fi fi break elif [ "$dl_p" = apkmonk ]; then @@ -448,7 +469,6 @@ build_rv() { local base_template base_template=$(mktemp -d -p $TEMP_DIR) cp -a $MODULE_TEMPLATE_DIR/. "$base_template" - if [ "$BUILD_MINDETACH_MODULE" = true ] && ! grep -q "$pkg_name" $PKGS_LIST; then echo "$pkg_name" >>$PKGS_LIST; fi local upj="${table,,}-update.json" local isbndl extrct stock_apk_module