1
mirror of https://github.com/revanced/revanced-cli synced 2025-11-19 15:33:27 +01:00

Compare commits

...

18 Commits

Author SHA1 Message Date
semantic-release-bot
cb554c8bdf chore(release): 2.15.1 [skip ci]
## [2.15.1](https://github.com/revanced/revanced-cli/compare/v2.15.0...v2.15.1) (2022-11-18)
2022-11-18 01:37:14 +00:00
oSumAtrIX
269c753dfa build: bump picocli dependency version 2022-11-18 02:34:28 +01:00
oSumAtrIX
6403e34712 build: bump patcher dependency version 2022-11-18 02:27:33 +01:00
Nico Mexis
f68e7697ff build: update workflow actions (#161) [skip ci] 2022-11-05 15:28:42 +01:00
semantic-release-bot
64b7e86252 chore(release): 2.15.0 [skip ci]
# [2.15.0](https://github.com/revanced/revanced-cli/compare/v2.14.0...v2.15.0) (2022-10-31)

### Bug Fixes

* **gitignore:** ignore `options.toml` ([#158](https://github.com/revanced/revanced-cli/issues/158)) ([7be9af0](7be9af0942))

### Features

* use `am` instead of `monkey` to launch the app ([#159](https://github.com/revanced/revanced-cli/issues/159)) ([6a35cf7](6a35cf7ea4))
2022-10-31 13:19:05 +00:00
OxrxL
7be9af0942 fix(gitignore): ignore options.toml (#158) 2022-10-31 14:16:00 +01:00
decipher
6a35cf7ea4 feat: use am instead of monkey to launch the app (#159) 2022-10-31 14:15:34 +01:00
SriBalaji
4914fd37bc build: update checkout actions to v3 [skip ci] (#155) 2022-10-13 17:35:24 +02:00
semantic-release-bot
38052b6ecf chore(release): 2.14.0 [skip ci]
# [2.14.0](https://github.com/revanced/revanced-cli/compare/v2.13.0...v2.14.0) (2022-10-05)

### Bug Fixes

* escape quotation mark in string ([6e21d81](6e21d81964))

### Features

* handle unmounting deleted files ([#148](https://github.com/revanced/revanced-cli/issues/148)) ([3a733e5](3a733e5137))
* unmount all occurrences in `/proc/mounts` ([#131](https://github.com/revanced/revanced-cli/issues/131)) ([4f4e1f9](4f4e1f9834))
2022-10-05 18:27:53 +00:00
oSumAtrIX
6e21d81964 fix: escape quotation mark in string 2022-10-05 20:26:15 +02:00
decipher
3a733e5137 feat: handle unmounting deleted files (#148) 2022-10-05 14:47:23 +02:00
decipher
4f4e1f9834 feat: unmount all occurrences in /proc/mounts (#131) 2022-10-05 14:20:41 +02:00
oSumAtrIX
e035d93d2c chore: migrate to new changes from the patcher 2022-10-05 04:12:46 +02:00
oSumAtrIX
839854d890 refactor: remove unused variable 2022-10-04 08:30:53 +02:00
semantic-release-bot
43c772c98d chore(release): 2.13.0 [skip ci]
# [2.13.0](https://github.com/revanced/revanced-cli/compare/v2.12.0...v2.13.0) (2022-10-01)

### Features

* check, if input file exists ([b6dff6d](b6dff6d832))
2022-10-01 03:21:30 +00:00
oSumAtrIX
b6dff6d832 feat: check, if input file exists 2022-10-01 05:19:42 +02:00
OxrxL
29b057dead chore: do not commit revanced-cache (#144) 2022-09-30 00:33:17 +02:00
oSumAtrIX
7df4a7e7da chore: bump patcher dependency version 2022-09-29 21:32:39 +02:00
12 changed files with 72 additions and 32 deletions

View File

@@ -15,17 +15,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
distribution: 'temurin'
cache: gradle
- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Build with Gradle

4
.gitignore vendored
View File

@@ -111,4 +111,6 @@ gradle-app.setting
.gradletasknamecache
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
# gradle/wrapper/gradle-wrapper.properties
revanced-cache/
options.toml

4
.idea/misc.xml generated
View File

@@ -4,6 +4,10 @@
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="PWA">
<option name="enabled" value="true" />
<option name="wasEnabledAtLeastOnce" value="true" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="azul-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>

View File

@@ -1,3 +1,37 @@
## [2.15.1](https://github.com/revanced/revanced-cli/compare/v2.15.0...v2.15.1) (2022-11-18)
# [2.15.0](https://github.com/revanced/revanced-cli/compare/v2.14.0...v2.15.0) (2022-10-31)
### Bug Fixes
* **gitignore:** ignore `options.toml` ([#158](https://github.com/revanced/revanced-cli/issues/158)) ([7be9af0](https://github.com/revanced/revanced-cli/commit/7be9af0942de2a834b9e57403d46263b65f1a422))
### Features
* use `am` instead of `monkey` to launch the app ([#159](https://github.com/revanced/revanced-cli/issues/159)) ([6a35cf7](https://github.com/revanced/revanced-cli/commit/6a35cf7ea46a4474120626ce03d28490cc96bf07))
# [2.14.0](https://github.com/revanced/revanced-cli/compare/v2.13.0...v2.14.0) (2022-10-05)
### Bug Fixes
* escape quotation mark in string ([6e21d81](https://github.com/revanced/revanced-cli/commit/6e21d81964e8160e06ffda7051dd484e4aaaa432))
### Features
* handle unmounting deleted files ([#148](https://github.com/revanced/revanced-cli/issues/148)) ([3a733e5](https://github.com/revanced/revanced-cli/commit/3a733e513717799ca0e32327e5b8be043680c556))
* unmount all occurrences in `/proc/mounts` ([#131](https://github.com/revanced/revanced-cli/issues/131)) ([4f4e1f9](https://github.com/revanced/revanced-cli/commit/4f4e1f9834bf28d9be2efd4fd7bae19951b85258))
# [2.13.0](https://github.com/revanced/revanced-cli/compare/v2.12.0...v2.13.0) (2022-10-01)
### Features
* check, if input file exists ([b6dff6d](https://github.com/revanced/revanced-cli/commit/b6dff6d832de4a513a6d86b0a59b2458eddd23c2))
# [2.12.0](https://github.com/revanced/revanced-cli/compare/v2.11.2...v2.12.0) (2022-09-26)

View File

@@ -25,8 +25,8 @@ repositories {
dependencies {
implementation(kotlin("reflect"))
implementation("app.revanced:revanced-patcher:5.1.1")
implementation("info.picocli:picocli:4.6.3")
implementation("app.revanced:revanced-patcher:6.0.2")
implementation("info.picocli:picocli:4.7.0")
implementation("com.android.tools.build:apksig:7.2.1")
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.12.0
version = 2.15.1

View File

@@ -10,7 +10,7 @@ import app.revanced.patcher.PatcherOptions
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
import app.revanced.patcher.extensions.PatchExtensions.description
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.util.patch.impl.JarPatchBundle
import app.revanced.patcher.util.patch.PatchBundle
import app.revanced.utils.OptionsLoader
import app.revanced.utils.adb.Adb
import picocli.CommandLine.*
@@ -131,14 +131,14 @@ internal object MainCommand : Runnable {
val outputFile = File(pArgs.outputPath) // the file to write to
val allPatches = args.patchArgs!!.patchBundles.flatMap { bundle ->
JarPatchBundle(bundle).loadPatches()
PatchBundle.Jar(bundle).loadPatches()
}
OptionsLoader.init(args.patchArgs!!.options, allPatches)
val patcher = app.revanced.patcher.Patcher(
PatcherOptions(
args.inputFile,
args.inputFile.also { if (!it.exists()) return logger.error("Input file ${args.inputFile} does not exist.") },
pArgs.cacheDirectory,
pArgs.aaptPath,
pArgs.cacheDirectory,
@@ -148,7 +148,7 @@ internal object MainCommand : Runnable {
// prepare adb
val adb: Adb? = args.deploy?.let {
Adb(outputFile, patcher.data.packageMetadata.packageName, args.deploy!!, !pArgs.mount)
Adb(outputFile, patcher.context.packageMetadata.packageName, args.deploy!!, !pArgs.mount)
}
val patchedFile = File(pArgs.cacheDirectory).resolve("${outputFile.nameWithoutExtension}_raw.apk")
@@ -209,7 +209,7 @@ internal object MainCommand : Runnable {
val adb: Adb? = args.deploy?.let {
Adb(
File("placeholder_file"),
app.revanced.patcher.Patcher(PatcherOptions(args.inputFile, "")).data.packageMetadata.packageName,
app.revanced.patcher.Patcher(PatcherOptions(args.inputFile, "")).context.packageMetadata.packageName,
args.deploy!!,
false
)
@@ -219,7 +219,8 @@ internal object MainCommand : Runnable {
private fun printListOfPatches() {
val logged = mutableListOf<String>()
for (patchBundlePath in args.patchArgs?.patchBundles!!) for (patch in JarPatchBundle(patchBundlePath).loadPatches()) {
for (patchBundlePath in args.patchArgs?.patchBundles!!) for (patch in PatchBundle.Jar(patchBundlePath)
.loadPatches()) {
if (patch.patchName in logged) continue
for (compatiblePackage in patch.compatiblePackages!!) {
val packageEntryStr = buildString {

View File

@@ -2,7 +2,7 @@ package app.revanced.cli.patcher
import app.revanced.cli.command.MainCommand.args
import app.revanced.cli.command.MainCommand.logger
import app.revanced.patcher.data.Data
import app.revanced.patcher.data.Context
import app.revanced.patcher.patch.Patch
import app.revanced.utils.filesystem.ZipFileSystemUtils
import app.revanced.utils.patcher.addPatchesFiltered
@@ -12,9 +12,12 @@ import java.io.File
import java.nio.file.Files
internal object Patcher {
internal fun start(patcher: app.revanced.patcher.Patcher, output: File, allPatches: List<Class<out Patch<Data>>>) {
internal fun start(
patcher: app.revanced.patcher.Patcher,
output: File,
allPatches: List<Class<out Patch<Context>>>
) {
val inputFile = args.inputFile
val args = args.patchArgs?.patchingArgs!!
// merge files like necessary integrations
patcher.mergeFiles()

View File

@@ -2,7 +2,7 @@ package app.revanced.utils
import app.revanced.cli.command.MainCommand.logger
import app.revanced.patcher.Patcher
import app.revanced.patcher.data.Data
import app.revanced.patcher.data.Context
import app.revanced.patcher.extensions.PatchExtensions.options
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.patch.Patch
@@ -12,7 +12,7 @@ import cc.ekblad.toml.serialization.from
import cc.ekblad.toml.tomlMapper
import java.io.File
private typealias PatchList = List<Class<out Patch<Data>>>
private typealias PatchList = List<Class<out Patch<Context>>>
private typealias OptionsMap = MutableMap<String, MutableMap<String, Any>>
object OptionsLoader {

View File

@@ -9,7 +9,7 @@ internal object Constants {
internal const val COMMAND_PID_OF = "pidof -s"
internal const val COMMAND_CREATE_DIR = "mkdir -p"
internal const val COMMAND_LOGCAT = "logcat -c && logcat | grep AndroidRuntime"
internal const val COMMAND_RESTART = "monkey -p $PLACEHOLDER 1 && kill ${'$'}($COMMAND_PID_OF $PLACEHOLDER)"
internal const val COMMAND_RESTART = "pm resolve-activity --brief $PLACEHOLDER | tail -n 1 | xargs am start -n && kill ${'$'}($COMMAND_PID_OF $PLACEHOLDER)"
// default mount file name
private const val NAME_MOUNT_SCRIPT = "mount_revanced_$PLACEHOLDER.sh"
@@ -35,7 +35,7 @@ internal object Constants {
// unmount command
internal const val COMMAND_UMOUNT =
"stock_path=${'$'}( pm path $PLACEHOLDER | grep base | sed 's/package://g' ) && umount -l ${'$'}stock_path"
"grep $PLACEHOLDER /proc/mounts | while read -r line; do echo ${'$'}line | cut -d \" \" -f 2 | sed 's/apk.*/apk/' | xargs -r umount -l; done"
// install mount script & set permissions
internal const val COMMAND_INSTALL_MOUNT = "mv $PATH_INIT_PUSH $PATH_MOUNT && $COMMAND_CHMOD_MOUNT $PATH_MOUNT"

View File

@@ -4,18 +4,18 @@ import app.revanced.cli.command.MainCommand
import app.revanced.cli.command.MainCommand.args
import app.revanced.cli.command.MainCommand.logger
import app.revanced.patcher.Patcher
import app.revanced.patcher.data.Data
import app.revanced.patcher.data.Context
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
import app.revanced.patcher.extensions.PatchExtensions.deprecated
import app.revanced.patcher.extensions.PatchExtensions.include
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.patch.Patch
fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Data>>>) {
val packageName = this.data.packageMetadata.packageName
val packageVersion = this.data.packageMetadata.packageVersion
fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Context>>>) {
val packageName = this.context.packageMetadata.packageName
val packageVersion = this.context.packageMetadata.packageVersion
val includedPatches = mutableListOf<Class<out Patch<Data>>>()
val includedPatches = mutableListOf<Class<out Patch<Context>>>()
allPatches.forEach patchLoop@{ patch ->
val compatiblePackages = patch.compatiblePackages
val patchName = patch.patchName
@@ -66,7 +66,7 @@ fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Data>>>) {
}
fun Patcher.applyPatchesVerbose() {
this.applyPatches().forEach { (patch, result) ->
this.executePatches().forEach { (patch, result) ->
if (result.isSuccess) {
logger.info("$patch succeeded")
return@forEach

View File

@@ -1,10 +1,6 @@
package app.revanced.utils.signing.align.zip.structures
import app.revanced.utils.signing.align.zip.getUShort
import app.revanced.utils.signing.align.zip.putUInt
import app.revanced.utils.signing.align.zip.putUShort
import app.revanced.utils.signing.align.zip.readUIntLE
import app.revanced.utils.signing.align.zip.readUShortLE
import app.revanced.utils.signing.align.zip.*
import java.io.DataInput
import java.nio.ByteBuffer
import java.nio.ByteOrder