diff --git a/.gitignore b/.gitignore index d8e58f9..f409224 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.apk *.zip *.jar +*.rvp magiskmodule/README.md magiskmodule/module.prop diff --git a/README.md b/README.md index 68d4bcf..3d86371 100644 --- a/README.md +++ b/README.md @@ -76,14 +76,6 @@ If you want to exclude certain apps from being patched, add their packagename into a config file called `revancedrepackaged-blacklist.txt` and place it into the configuration directory. -### Patch Options - -If you want to supply an `options.json` for patching, -rename it to `revancedrepackaged-options.json` -and place it into the configuration directory. - -A default `options.json` for your reference can be found inside the module zip. - ## Issues and Support You are welcome to diff --git a/compile.sh b/compile.sh index b4b361b..dab092b 100755 --- a/compile.sh +++ b/compile.sh @@ -10,8 +10,7 @@ done [ -z "$GITHUB_TOKEN" ] && echo "missing GITHUB_TOKEN" && exit 1 declare -x GITHUB_ACTOR GITHUB_TOKEN -REVANCED_INTEGRATIONS_URL="https://github.com/revanced/revanced-integrations/releases/download/v%s/revanced-integrations-%s.apk" -REVANCED_PATCHES_URL="https://github.com/revanced/revanced-patches/releases/download/v%s/revanced-patches-%s.jar" +REVANCED_PATCHES_URL="https://github.com/revanced/revanced-patches/releases/download/v%s/patches-%s.rvp" git submodule update --checkout git clean -fdx magiskmodule/ @@ -41,15 +40,9 @@ git submodule update --checkout source version.sh -REVANCED_INTEGRATIONS=${REVANCED_INTEGRATIONS#v} -printf -v REVANCED_INTEGRATIONS_DL "$REVANCED_INTEGRATIONS_URL" "$REVANCED_INTEGRATIONS" "$REVANCED_INTEGRATIONS" REVANCED_PATCHES=${REVANCED_PATCHES#v} printf -v REVANCED_PATCHES_DL "$REVANCED_PATCHES_URL" "$REVANCED_PATCHES" "$REVANCED_PATCHES" - -for dlurl in "$REVANCED_INTEGRATIONS_DL" "$REVANCED_PATCHES_DL"; do - dlfile="$(basename "$dlurl")" - [ ! -f "$dlfile" ] && wget -c -O "$dlfile" "$dlurl" -done +[ ! -f "$(basename "$REVANCED_PATCHES_DL")" ] && wget -c -O "$(basename "$REVANCED_PATCHES_DL")" "$REVANCED_PATCHES_DL" REVANCED_CLI=${REVANCED_CLI#v} ln -v -s -f "revanced-cli/build/libs/revancedcli-$REVANCED_CLI-all.jar" "revanced-cli.jar" @@ -69,19 +62,11 @@ cut -d$'\t' -f1 <<< "$PATCHES_LIST" | sort -u | while IFS= read -r package; do [ "$(wc -l < magiskmodule/packageversions/"$package")" -gt 0 ] && echo >> magiskmodule/supportedversions.md done -java -jar revanced-cli.jar \ - options \ - --path=magiskmodule/options.json \ - --overwrite \ - "$(basename "$REVANCED_PATCHES_DL")" - logo/convert.sh cp -v revanced-android/revancedcliwrapper/build/outputs/apk/release/revancedcliwrapper-release.apk magiskmodule/revancedandroidcli.apk -cp -v "$(basename "$REVANCED_INTEGRATIONS_DL")" magiskmodule/integrations.apk -cp -v "$(basename "$REVANCED_PATCHES_DL")" magiskmodule/patches.jar +cp -v "$(basename "$REVANCED_PATCHES_DL")" magiskmodule/patches.rvp cp -r -v --no-target-directory aapt2 magiskmodule/aapt2lib -cp -r -v --no-target-directory revanced-options magiskmodule/options cp -r --no-target-directory logo/assets magiskmodule/logo cp README.md magiskmodule/README.md diff --git a/magiskmodule/customize.sh b/magiskmodule/customize.sh index f47644d..537ab6e 100644 --- a/magiskmodule/customize.sh +++ b/magiskmodule/customize.sh @@ -80,27 +80,17 @@ patchAPK() { denylist_run cat "$apkpath" > app.apk ui_print "- Patching $packagename" - - cp "$MODPATH"/options.json options.json - - [ -f "$MODPATH"/options/"$packagename".json ] \ - && cp "$MODPATH"/options/"$packagename".json options.json - - optionsconfigfile="$(findConfigFile revancedrepackaged-options.json)" - [ -f "$optionsconfigfile" ] \ - && cp "$optionsconfigfile" options.json - - sed -i "s|\$MODPATH|$MODPATH|g" options.json export MODPATH "$MODPATH"/system/bin/revancedcli \ patch \ - --patch-bundle="$MODPATH"/patches.jar \ - --merge="$MODPATH"/integrations.apk \ + --patches="$MODPATH"/patches.rvp \ --out=out.apk \ - --exclude='GmsCore support' \ - --include='Custom branding' \ - --options=options.json \ + --disable='GmsCore support' \ + --enable='Custom branding' \ + --options=usePremiumHeading=false \ + --options=appName=YouTube \ + --options=iconPath="$MODPATH/logo" \ --purge \ app.apk \ 2>&1 || abort "Patching failed! $?" diff --git a/revanced-cli b/revanced-cli index 1496e82..63b6350 160000 --- a/revanced-cli +++ b/revanced-cli @@ -1 +1 @@ -Subproject commit 1496e824d696c2d4d8d63efbf3f3e8ed2ae5ae5d +Subproject commit 63b6350afcd14a63d1b9976c66067af80c18f261 diff --git a/revanced-cli-patches/Add-list-packages-command.patch b/revanced-cli-patches/Add-list-packages-command.patch index f0daa1d..215f835 100644 --- a/revanced-cli-patches/Add-list-packages-command.patch +++ b/revanced-cli-patches/Add-list-packages-command.patch @@ -1,23 +1,23 @@ -From 3f81a5fc02129d13a873fbcdb43ab665a234a821 Mon Sep 17 00:00:00 2001 +From feedf61f73fa43fa162a2f72baee1204d3d9bb43 Mon Sep 17 00:00:00 2001 From: programminghoch10 <16062290+programminghoch10@users.noreply.github.com> Date: Mon, 28 Aug 2023 13:02:03 +0200 Subject: [PATCH] Add list packages command --- - .../cli/command/ListPackagesCommand.kt | 37 +++++++++++++++++++ + .../cli/command/ListPackagesCommand.kt | 38 +++++++++++++++++++ .../app/revanced/cli/command/MainCommand.kt | 1 + - 2 files changed, 38 insertions(+) + 2 files changed, 39 insertions(+) create mode 100644 src/main/kotlin/app/revanced/cli/command/ListPackagesCommand.kt diff --git a/src/main/kotlin/app/revanced/cli/command/ListPackagesCommand.kt b/src/main/kotlin/app/revanced/cli/command/ListPackagesCommand.kt new file mode 100644 -index 0000000..2b5477f +index 0000000..d2dae8f --- /dev/null +++ b/src/main/kotlin/app/revanced/cli/command/ListPackagesCommand.kt -@@ -0,0 +1,37 @@ +@@ -0,0 +1,38 @@ +package app.revanced.cli.command + -+import app.revanced.patcher.PatchBundleLoader ++import app.revanced.patcher.patch.loadPatchesFromJar +import picocli.CommandLine.Command +import picocli.CommandLine.Parameters +import java.io.File @@ -30,20 +30,21 @@ index 0000000..2b5477f + private val logger = Logger.getLogger(ListPackagesCommand::class.java.name) + + @Parameters( -+ description = ["Paths to patch bundles"], arity = "1..*" ++ description = ["Paths to RVP files."], ++ arity = "1..*", + ) -+ private lateinit var patchBundles: Array ++ private lateinit var patchesFiles: Set + + override fun run() { + val supportedVersions: HashMap> = HashMap() -+ val patchBundle = PatchBundleLoader.Jar(*patchBundles) ++ val patchBundle = loadPatchesFromJar(patchesFiles) + patchBundle + .filter { it.compatiblePackages != null } + .flatMap { it.compatiblePackages!!.toList() } + .forEach { -+ if (!supportedVersions.containsKey(it.name)) -+ supportedVersions[it.name] = HashSet() -+ it.versions?.let { versions -> supportedVersions[it.name]!!.addAll(versions) } ++ if (!supportedVersions.containsKey(it.first)) ++ supportedVersions[it.first] = HashSet() ++ it.second?.let { versions -> supportedVersions[it.first]!!.addAll(versions) } + } + logger.info( + supportedVersions.keys.joinToString("\n") { @@ -54,17 +55,17 @@ index 0000000..2b5477f +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/cli/command/MainCommand.kt b/src/main/kotlin/app/revanced/cli/command/MainCommand.kt -index 4d33a4d..eb754a2 100644 +index 5ceeef1..50ca16c 100644 --- a/src/main/kotlin/app/revanced/cli/command/MainCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/MainCommand.kt -@@ -36,6 +36,7 @@ private object CLIVersionProvider : IVersionProvider { +@@ -35,6 +35,7 @@ private object CLIVersionProvider : IVersionProvider { + subcommands = [ PatchCommand::class, - OptionsCommand::class, ListPatchesCommand::class, + ListPackagesCommand::class, ListCompatibleVersions::class, UtilityCommand::class, ], -- -2.43.0 +2.45.2 diff --git a/revanced-cli-patches/Load-classes-in-dex-mode.patch b/revanced-cli-patches/Load-classes-in-dex-mode.patch index 1f2a762..9dafe66 100644 --- a/revanced-cli-patches/Load-classes-in-dex-mode.patch +++ b/revanced-cli-patches/Load-classes-in-dex-mode.patch @@ -1,31 +1,39 @@ -From 61c466539d43ec65b241d319dd7089fa949c3a9b Mon Sep 17 00:00:00 2001 +From 56ba7c0783104ea04c54992a5b4ec730e9c185bf Mon Sep 17 00:00:00 2001 From: programminghoch10 <16062290+programminghoch10@users.noreply.github.com> Date: Mon, 28 Aug 2023 11:25:11 +0200 Subject: [PATCH] Load classes in dex mode Required for patching on android --- - src/main/kotlin/app/revanced/cli/command/PatchCommand.kt | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) + src/main/kotlin/app/revanced/cli/command/PatchCommand.kt | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt -index 410c94a..cf780a1 100644 +index efbc755..8bb6f68 100644 --- a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt -@@ -244,7 +244,12 @@ internal object PatchCommand : Runnable { +@@ -7,6 +7,7 @@ import app.revanced.library.setOptions + import app.revanced.patcher.Patcher + import app.revanced.patcher.PatcherConfig + import app.revanced.patcher.patch.Patch ++import app.revanced.patcher.patch.loadPatchesFromDex + import app.revanced.patcher.patch.loadPatchesFromJar + import kotlinx.coroutines.runBlocking + import picocli.CommandLine +@@ -279,7 +280,12 @@ internal object PatchCommand : Runnable { logger.info("Loading patches") -- val patches = PatchBundleLoader.Jar(*patchBundles.toTypedArray()) +- val patches = loadPatchesFromJar(patchesFiles) + val patches = try { + val DexClassLoaderClass = Class.forName("dalvik.system.DexClassLoader") -+ PatchBundleLoader.Dex(*patchBundles.toTypedArray()) ++ loadPatchesFromDex(patchesFiles) + } catch (_: ClassNotFoundException) { -+ PatchBundleLoader.Jar(*patchBundles.toTypedArray()) ++ loadPatchesFromJar(patchesFiles) + } - // Warn if a patch can not be found in the supplied patch bundles. - if (warn) { + // endregion + -- -2.43.0 +2.45.2 diff --git a/revanced-options/com.google.android.youtube.json b/revanced-options/com.google.android.youtube.json deleted file mode 100644 index cf62eeb..0000000 --- a/revanced-options/com.google.android.youtube.json +++ /dev/null @@ -1,24 +0,0 @@ -[ - { - "patchName": "Custom branding", - "options": [ - { - "key": "appName", - "value": "YouTube" - }, - { - "key": "iconPath", - "value": "$MODPATH/logo" - } - ] - }, - { - "patchName": "Premium heading", - "options": [ - { - "key": "usePremiumHeading", - "value": false - } - ] - } -] \ No newline at end of file diff --git a/update.sh b/update.sh index 409e4da..129ba59 100755 --- a/update.sh +++ b/update.sh @@ -18,14 +18,6 @@ else echo "No update for REVANCED_PATCHES $REVANCED_PATCHES found" fi -REVANCED_INTEGRATIONS_TAG=$(curl -s https://api.github.com/repos/revanced/revanced-integrations/releases/latest | jq -r '.tag_name') -if [ "$REVANCED_INTEGRATIONS" != "$REVANCED_INTEGRATIONS_TAG" ]; then - sed -i "s/^REVANCED_INTEGRATIONS=.*$/REVANCED_INTEGRATIONS=\"$REVANCED_INTEGRATIONS_TAG\"/" version.sh - echo "Updated REVANCED_INTEGRATIONS from $REVANCED_INTEGRATIONS to $REVANCED_INTEGRATIONS_TAG" -else - echo "No update for REVANCED_INTEGRATIONS $REVANCED_INTEGRATIONS found" -fi - REVANCED_CLI_TAG=$(curl -s https://api.github.com/repos/revanced/revanced-cli/releases/latest | jq -r '.tag_name') if [ "$REVANCED_CLI" != "$REVANCED_CLI_TAG" ]; then ( @@ -47,5 +39,4 @@ update ReVanced * revanced-cli \`$REVANCED_CLI\` * revanced-patches \`$REVANCED_PATCHES\` -* revanced-integrations \`$REVANCED_INTEGRATIONS\` EOF diff --git a/version.sh b/version.sh index 4b70030..717b78c 100644 --- a/version.sh +++ b/version.sh @@ -1,5 +1,4 @@ #!/bin/bash -REVANCED_INTEGRATIONS="v1.16.0" -REVANCED_PATCHES="v4.17.0" -REVANCED_CLI="v4.6.0" +REVANCED_PATCHES="v5.0.2" +REVANCED_CLI="v5.0.0"