Skip to content

Commit

Permalink
Merge branch 'j-hc:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilbadyal authored Oct 23, 2024
2 parents f6677ca + ec00cc9 commit 5a1d728
Show file tree
Hide file tree
Showing 10 changed files with 356 additions and 213 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ jobs:
cp -f build.tmp build.md
get_update_json() {
echo "{
\"version\": \"$1\",
\"versionCode\": ${{ steps.next_ver_code.outputs.NEXT_VER_CODE}},
\"version\": \"$1 (${{ steps.next_ver_code.outputs.NEXT_VER_CODE }})\",
\"versionCode\": ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }},
\"zipUrl\": \"$2\",
\"changelog\": \"https://raw.githubusercontent.com/$GITHUB_REPOSITORY/update/build.md\"
}"
Expand Down
9 changes: 6 additions & 3 deletions CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@ There exists an example below with all defaults shown and all the keys explicitl

```toml
parallel-jobs = 1 # amount of cores to use for parallel patching, if not set nproc is used
compression-level = 9 # module zip compression level
remove-rv-integrations-checks = true # remove checks from the revanced integrations

patches-source = "revanced/revanced-patches" # where to fetch patches bundle from. default: "revanced/revanced-patches"
integrations-source = "revanced/revanced-integrations" # where to fetch integrations from. default: "revanced/revanced-integrations"
cli-source = "j-hc/revanced-cli" # where to fetch cli from. default: "j-hc/revanced-cli"
# options like cli-source can also set per app
rv-brand = "ReVanced Extended" # rebrand from 'ReVanced' to something different. default: "ReVanced"

patches-version = "v2.160.0" # locks the patches version. default: latest available
integrations-version = "v0.95.0" # locks the integrations version. default: latest available
patches-version = "v2.160.0" # 'latest', 'dev', or a version number. default: "latest"
# integrations-version and cli-version can be also configured

[Some-App]
app-name = "SomeApp" # if set, release name becomes SomeApp instead of Some-App. default is same as table name, which is 'Some-App' here.
enabled = true # whether to build the app. default: true
version = "auto" # 'auto', 'latest', 'beta' or a custom one e.g. '17.40.41'. default: auto
version = "auto" # 'auto', 'latest', 'beta' or a version number (e.g. '17.40.41'). default: auto
# 'auto' option gets the latest possible version supported by all the included patches
# 'latest' gets the latest stable without checking patches support. 'beta' gets the latest beta/alpha
include-stock = true # includes stock apk in the module. default: true
Expand Down
Binary file added bin/dexlib2.jar
Binary file not shown.
Binary file added bin/paccer.jar
Binary file not shown.
54 changes: 22 additions & 32 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -euo pipefail
shopt -s nullglob
trap "rm -rf temp/*tmp.* temp/*/*tmp.*; exit 130" INT
trap "rm -rf temp/*tmp.* temp/*/*tmp.* temp/*-temporary-files; exit 130" INT

if [ "${1-}" = "clean" ]; then
rm -rf temp build logs build.md
Expand All @@ -20,14 +20,16 @@ COMPRESSION_LEVEL=$(toml_get "$main_config_t" compression-level) || COMPRESSION_
if ! PARALLEL_JOBS=$(toml_get "$main_config_t" parallel-jobs); then
if [ "$OS" = Android ]; then PARALLEL_JOBS=1; else PARALLEL_JOBS=$(nproc); fi
fi
DEF_PATCHES_VER=$(toml_get "$main_config_t" patches-version) || DEF_PATCHES_VER=""
DEF_INTEGRATIONS_VER=$(toml_get "$main_config_t" integrations-version) || DEF_INTEGRATIONS_VER=""
DEF_CLI_VER=$(toml_get "$main_config_t" cli-version) || DEF_CLI_VER=""
REMOVE_RV_INTEGRATIONS_CHECKS=$(toml_get "$main_config_t" remove-rv-integrations-checks) || REMOVE_RV_INTEGRATIONS_CHECKS="true"

DEF_PATCHES_VER=$(toml_get "$main_config_t" patches-version) || DEF_PATCHES_VER="latest"
DEF_INTEGRATIONS_VER=$(toml_get "$main_config_t" integrations-version) || DEF_INTEGRATIONS_VER="latest"
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_INTEGRATIONS_SRC=$(toml_get "$main_config_t" integrations-source) || DEF_INTEGRATIONS_SRC="ReVanced/revanced-integrations"
DEF_CLI_SRC=$(toml_get "$main_config_t" cli-source) || DEF_CLI_SRC="j-hc/revanced-cli"
DEF_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced"
mkdir -p $TEMP_DIR $BUILD_DIR
mkdir -p "$TEMP_DIR" "$BUILD_DIR"

if [ "${2-}" = "--config-update" ]; then
config_update
Expand All @@ -50,21 +52,11 @@ java --version >/dev/null || abort "\`openjdk 17\` is not installed. install it
zip --version >/dev/null || abort "\`zip\` is not installed. install it with 'apt install zip' or equivalent"
# ----------------
rm -rf revanced-magisk/bin/*/tmp.*
get_prebuilts
if [ "$(echo "$TEMP_DIR"/*-rv/changelog.md)" ]; then
: >"$TEMP_DIR"/*-rv/changelog.md || :
fi

set_prebuilts() {
local integrations_src=$1 patches_src=$2 cli_src=$3 integrations_ver=$4 patches_ver=$5 cli_ver=$6
local patches_dir=${patches_src%/*}
local integrations_dir=${integrations_src%/*}
local cli_dir=${cli_src%/*}
cli_ver=${cli_ver#v}
integrations_ver="${integrations_ver#v}"
patches_ver="${patches_ver#v}"
app_args[cli]=$(find "${TEMP_DIR}/${cli_dir,,}-rv" -name "revanced-cli-${cli_ver:-*}-all.jar" -type f -print -quit 2>/dev/null) && [ "${app_args[cli]}" ] || return 1
app_args[integ]=$(find "${TEMP_DIR}/${integrations_dir,,}-rv" -name "revanced-integrations-${integrations_ver:-*}.apk" -type f -print -quit 2>/dev/null) && [ "${app_args[integ]}" ] || return 1
app_args[ptjar]=$(find "${TEMP_DIR}/${patches_dir,,}-rv" -name "revanced-patches-${patches_ver:-*}.jar" -type f -print -quit 2>/dev/null) && [ "${app_args[ptjar]}" ] || return 1
app_args[ptjs]=$(find "${TEMP_DIR}/${patches_dir,,}-rv" -name "patches-${patches_ver:-*}.json" -type f -print -quit 2>/dev/null) && [ "${app_args[ptjs]}" ] || return 1
}
get_prebuilts

declare -A cliriplib
idx=0
Expand All @@ -86,16 +78,14 @@ 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 ! set_prebuilts "$integrations_src" "$patches_src" "$cli_src" "$integrations_ver" "$patches_ver" "$cli_ver"; then
if ! RVP="$(get_rv_prebuilts "$cli_src" "$cli_ver" "$integrations_src" "$integrations_ver" "$patches_src" "$patches_ver")"; then
abort "could not download rv prebuilts"
fi
read -r rv_cli_jar rv_integrations_apk rv_patches_jar rv_patches_json <<<"$RVP"
app_args[cli]=$rv_cli_jar
app_args[integ]=$rv_integrations_apk
app_args[ptjar]=$rv_patches_jar
app_args[ptjs]=$rv_patches_json
if ! RVP="$(get_rv_prebuilts "$cli_src" "$cli_ver" "$integrations_src" "$integrations_ver" "$patches_src" "$patches_ver")"; then
abort "could not download rv prebuilts"
fi
read -r rv_cli_jar rv_integrations_apk rv_patches_jar rv_patches_json <<<"$RVP"
app_args[cli]=$rv_cli_jar
app_args[integ]=$rv_integrations_apk
app_args[ptjar]=$rv_patches_jar
app_args[ptjs]=$rv_patches_json
if [[ -v cliriplib[${app_args[cli]}] ]]; then app_args[riplib]=${cliriplib[${app_args[cli]}]}; else
if [[ $(java -jar "${app_args[cli]}" patch 2>&1) == *rip-lib* ]]; then
cliriplib[${app_args[cli]}]=true
Expand All @@ -106,7 +96,7 @@ for table_name in $(toml_get_table_names); do
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[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]=""
if [ -n "${app_args[excluded_patches]}" ] && [[ ${app_args[excluded_patches]} != *'"'* ]]; then abort "patch names inside excluded-patches must be quoted"; fi
Expand Down Expand Up @@ -176,14 +166,14 @@ for table_name in $(toml_get_table_names); do
done
wait
rm -rf temp/tmp.*
if [ -z "$(ls -A1 ${BUILD_DIR})" ]; then abort "All builds failed."; fi
if [ -z "$(ls -A1 "${BUILD_DIR}")" ]; then abort "All builds failed."; fi

log "\nInstall [Microg](https://github.com/ReVanced/GmsCore/releases) for non-root YouTube and YT Music APKs"
log "Use [zygisk-detach](https://github.com/j-hc/zygisk-detach) to detach root ReVanced YouTube and YT Music from Play Store"
log "\n[revanced-magisk-module](https://github.com/j-hc/revanced-magisk-module)\n"
log "$(cat $TEMP_DIR/*-rv/changelog.md)"
log "$(cat "$TEMP_DIR"/*-rv/changelog.md)"

SKIPPED=$(cat $TEMP_DIR/skipped 2>/dev/null || :)
SKIPPED=$(cat "$TEMP_DIR"/skipped 2>/dev/null || :)
if [ -n "$SKIPPED" ]; then
log "\nSkipped:"
log "$SKIPPED"
Expand Down
37 changes: 22 additions & 15 deletions config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
enable-magisk-update = true # set this to false if you do not want to receive updates for the module in magisk app
parallel-jobs = 1

# add 'enabled = false' for not patching a specific app or remove it from the config
# see https://github.com/j-hc/revanced-magisk-module/blob/main/CONFIG.md for more detailed explanations
Expand All @@ -10,14 +11,14 @@ build-mode = "both"
excluded-patches = ""
included-patches = ""
version = "auto"
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube" # fallback
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"

[Music]
build-mode = "both"
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
arch = "both"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"

[Music-Extended]
app-name = "Music"
Expand All @@ -26,9 +27,9 @@ 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"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
arch = "both"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"

[YouTube-Extended]
app-name = "YouTube"
Expand All @@ -37,26 +38,32 @@ 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"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"

[Twitter]
enabled = false
apkmirror-dlurl = "https://www.apkmirror.com/apk/x-corp/twitter"
build-mode = "apk"
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.twitter.android"

[Twitch]
archive-dlurl = "https://archive.org/download/jhc-apks/apks/tv.twitch.android.app"

[TikTok]
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.zhiliaoapp.musically"
included-patches = "'SIM spoof'"
dpi = "120-640dpi"
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.twitter.android"

[Reddit-Extended]
patches-source = "inotia00/revanced-patches"
integrations-source = "inotia00/revanced-integrations"
cli-source = "inotia00/revanced-cli"
rv-brand = "ReVanced Extended"
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.reddit.frontpage"
apkmirror-dlurl = "https://www.apkmirror.com/apk/redditinc/reddit/"
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.reddit.frontpage"

[Twitch]
enabled = false
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/tv.twitch.android.app"

[TikTok]
enabled = false
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.zhiliaoapp.musically"
included-patches = "'SIM spoof'"

[Messenger]
enabled = false
Expand Down
Loading

0 comments on commit 5a1d728

Please sign in to comment.