You've already forked revanced-patcher
mirror of
https://github.com/revanced/revanced-patcher
synced 2025-09-13 18:30:49 +02:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
109b8a296d | ||
![]() |
e2faf4ca9b | ||
![]() |
2134182a0e | ||
![]() |
d8b5b8bb7c | ||
![]() |
49970b5926 | ||
![]() |
c1fbd8cf8c | ||
![]() |
a467fbb704 | ||
![]() |
5a4bd7a76e | ||
![]() |
e5ca86fac6 | ||
![]() |
68d9e9f02c | ||
![]() |
494a9a09ac | ||
![]() |
06a88839de | ||
![]() |
4c41b955df | ||
![]() |
614e555f4c |
@@ -7,7 +7,11 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@semantic-release/commit-analyzer",
|
["@semantic-release/commit-analyzer", {
|
||||||
|
"releaseRules": [
|
||||||
|
{"type": "build", "release": "patch"}
|
||||||
|
]
|
||||||
|
}],
|
||||||
"@semantic-release/release-notes-generator",
|
"@semantic-release/release-notes-generator",
|
||||||
"@semantic-release/changelog",
|
"@semantic-release/changelog",
|
||||||
"gradle-semantic-release-plugin",
|
"gradle-semantic-release-plugin",
|
||||||
|
22
CHANGELOG.md
22
CHANGELOG.md
@@ -1,3 +1,25 @@
|
|||||||
|
## [2.1.2](https://github.com/revanced/revanced-patcher/compare/v2.1.1...v2.1.2) (2022-06-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* invert fingerprint resolution condition of `customFingerprint` ([e2faf4c](https://github.com/revanced/revanced-patcher/commit/e2faf4ca9b6de23300b20ab471ee9dc365b04339))
|
||||||
|
|
||||||
|
## [2.1.1](https://github.com/revanced/revanced-patcher/compare/v2.1.0...v2.1.1) (2022-06-28)
|
||||||
|
|
||||||
|
# [2.1.0](https://github.com/revanced/revanced-patcher/compare/v2.0.4...v2.1.0) (2022-06-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* log failed patches due to failed dependencies ([a467fbb](https://github.com/revanced/revanced-patcher/commit/a467fbb704eebe812cdec14025398dab2af43959))
|
||||||
|
|
||||||
|
## [2.0.4](https://github.com/revanced/revanced-patcher/compare/v2.0.3...v2.0.4) (2022-06-27)
|
||||||
|
|
||||||
|
## [2.0.3](https://github.com/revanced/revanced-patcher/compare/v2.0.2...v2.0.3) (2022-06-27)
|
||||||
|
|
||||||
|
## [2.0.2](https://github.com/revanced/revanced-patcher/compare/v2.0.1...v2.0.2) (2022-06-27)
|
||||||
|
|
||||||
## [2.0.1](https://github.com/revanced/revanced-patcher/compare/v2.0.0...v2.0.1) (2022-06-26)
|
## [2.0.1](https://github.com/revanced/revanced-patcher/compare/v2.0.0...v2.0.1) (2022-06-26)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -21,11 +21,10 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
|
||||||
|
|
||||||
implementation("xpp3:xpp3:1.1.4c")
|
implementation("xpp3:xpp3:1.1.4c")
|
||||||
implementation("org.smali:smali:2.5.2")
|
implementation("org.smali:smali:2.5.2")
|
||||||
implementation("org.apktool:apktool-lib:2.6.5-SNAPSHOT")
|
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||||
|
implementation("org.apktool:apktool-lib:2.6.9-SNAPSHOT")
|
||||||
|
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
}
|
}
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.0.1
|
version = 2.1.2
|
||||||
|
@@ -241,31 +241,35 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
/**
|
/**
|
||||||
* Apply a [patch] and its dependencies recursively.
|
* Apply a [patch] and its dependencies recursively.
|
||||||
* @param patch The [patch] to apply.
|
* @param patch The [patch] to apply.
|
||||||
* @param appliedPatches A list of [patch] names, to prevent applying [patch]es twice.
|
* @param appliedPatches A map of [patch]es paired to a boolean indicating their success, to prevent infinite recursion.
|
||||||
* @return The result of executing the [patch].
|
* @return The result of executing the [patch].
|
||||||
*/
|
*/
|
||||||
private fun applyPatch(
|
private fun applyPatch(
|
||||||
patch: Class<out Patch<Data>>, appliedPatches: MutableList<String>
|
patch: Class<out Patch<Data>>,
|
||||||
|
appliedPatches: MutableMap<String, Boolean>
|
||||||
): PatchResult {
|
): PatchResult {
|
||||||
val patchName = patch.patchName
|
val patchName = patch.patchName
|
||||||
|
|
||||||
// if the patch has already applied silently skip it
|
// if the patch has already applied silently skip it
|
||||||
if (appliedPatches.contains(patchName)) {
|
if (appliedPatches.contains(patchName)) {
|
||||||
logger.trace("Skipping patch $patchName because it has already been applied")
|
if (!appliedPatches[patchName]!!)
|
||||||
|
return PatchResultError("'$patchName' did not succeed previously")
|
||||||
|
|
||||||
|
logger.trace("Skipping '$patchName' because it has already been applied")
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
appliedPatches.add(patchName)
|
|
||||||
|
|
||||||
// recursively apply all dependency patches
|
// recursively apply all dependency patches
|
||||||
patch.dependencies?.forEach {
|
patch.dependencies?.forEach {
|
||||||
val patchDependency = it.java
|
val patchDependency = it.java
|
||||||
|
|
||||||
val result = applyPatch(patchDependency, appliedPatches)
|
val result = applyPatch(patchDependency, appliedPatches)
|
||||||
|
|
||||||
if (result.isSuccess()) return@forEach
|
if (result.isSuccess()) return@forEach
|
||||||
|
|
||||||
val errorMessage = result.error()!!.message
|
val errorMessage = result.error()!!.message
|
||||||
return PatchResultError("$patchName depends on ${patchDependency.patchName} but the following error was raised: $errorMessage")
|
return PatchResultError("'$patchName' depends on '${patchDependency.patchName}' but the following error was raised: $errorMessage")
|
||||||
}
|
}
|
||||||
|
|
||||||
val patchInstance = patch.getDeclaredConstructor().newInstance()
|
val patchInstance = patch.getDeclaredConstructor().newInstance()
|
||||||
@@ -273,7 +277,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
// if the current patch is a resource patch but resource patching is disabled, return an error
|
// if the current patch is a resource patch but resource patching is disabled, return an error
|
||||||
val isResourcePatch = patchInstance is ResourcePatch
|
val isResourcePatch = patchInstance is ResourcePatch
|
||||||
if (!options.patchResources && isResourcePatch) {
|
if (!options.patchResources && isResourcePatch) {
|
||||||
return PatchResultError("$patchName is a resource patch, but resource patching is disabled.")
|
return PatchResultError("'$patchName' is a resource patch, but resource patching is disabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: find a solution for this
|
// TODO: find a solution for this
|
||||||
@@ -285,11 +289,14 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
bytecodeData
|
bytecodeData
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("Executing patch $patchName of type: ${if (isResourcePatch) "resource" else "bytecode"}")
|
logger.trace("Executing '$patchName' of type: ${if (isResourcePatch) "resource" else "bytecode"}")
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
patchInstance.execute(data)
|
val result = patchInstance.execute(data)
|
||||||
|
appliedPatches[patchName] = result.isSuccess()
|
||||||
|
result
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
appliedPatches[patchName] = false
|
||||||
PatchResultError(e)
|
PatchResultError(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,7 +308,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
*/
|
*/
|
||||||
fun applyPatches(stopOnError: Boolean = false) = sequence {
|
fun applyPatches(stopOnError: Boolean = false) = sequence {
|
||||||
logger.trace("Applying all patches")
|
logger.trace("Applying all patches")
|
||||||
val appliedPatches = mutableListOf<String>()
|
val appliedPatches = mutableMapOf<String, Boolean>() // first is success, second is name
|
||||||
|
|
||||||
for (patch in data.patches) {
|
for (patch in data.patches) {
|
||||||
val patchResult = applyPatch(patch, appliedPatches)
|
val patchResult = applyPatch(patch, appliedPatches)
|
||||||
|
@@ -48,7 +48,7 @@ data class MethodFingerprintResult(
|
|||||||
val method: Method,
|
val method: Method,
|
||||||
val classDef: ClassDef,
|
val classDef: ClassDef,
|
||||||
val patternScanResult: PatternScanResult?,
|
val patternScanResult: PatternScanResult?,
|
||||||
val data: BytecodeData
|
internal val data: BytecodeData
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* Returns a mutable clone of [classDef]
|
* Returns a mutable clone of [classDef]
|
||||||
|
@@ -68,7 +68,7 @@ object MethodFingerprintUtils {
|
|||||||
)
|
)
|
||||||
) return false
|
) return false
|
||||||
|
|
||||||
if (methodFingerprint.customFingerprint != null && methodFingerprint.customFingerprint!!(context))
|
if (methodFingerprint.customFingerprint != null && !methodFingerprint.customFingerprint!!(context))
|
||||||
return false
|
return false
|
||||||
|
|
||||||
if (methodFingerprint.strings != null) {
|
if (methodFingerprint.strings != null) {
|
||||||
|
Reference in New Issue
Block a user