Skip to content

Commit

Permalink
update ReVanced
Browse files Browse the repository at this point in the history
* revanced-cli `v5.0.0`
* revanced-patches `v5.0.2`
* implement all required changes introduced by revanced-cli v5
  • Loading branch information
programminghoch10 committed Nov 18, 2024
1 parent 2df771c commit a67c819
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 106 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.apk
*.zip
*.jar
*.rvp

magiskmodule/README.md
magiskmodule/module.prop
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 3 additions & 18 deletions compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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"
Expand All @@ -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

Expand Down
22 changes: 6 additions & 16 deletions magiskmodule/customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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! $?"
Expand Down
33 changes: 17 additions & 16 deletions revanced-cli-patches/Add-list-packages-command.patch
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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<File>
+ private lateinit var patchesFiles: Set<File>
+
+ override fun run() {
+ val supportedVersions: HashMap<String, HashSet<String>> = 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") {
Expand All @@ -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

30 changes: 19 additions & 11 deletions revanced-cli-patches/Load-classes-in-dex-mode.patch
Original file line number Diff line number Diff line change
@@ -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

24 changes: 0 additions & 24 deletions revanced-options/com.google.android.youtube.json

This file was deleted.

9 changes: 0 additions & 9 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
(
Expand All @@ -47,5 +39,4 @@ update ReVanced
* revanced-cli \`$REVANCED_CLI\`
* revanced-patches \`$REVANCED_PATCHES\`
* revanced-integrations \`$REVANCED_INTEGRATIONS\`
EOF
5 changes: 2 additions & 3 deletions version.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit a67c819

Please sign in to comment.