mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-23 02:31:03 +00:00
Compare commits
10 Commits
v4.14.0-de
...
v4.14.0-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1322403698 | ||
|
|
a64270514f | ||
|
|
f5de555adf | ||
|
|
4c2ec2870c | ||
|
|
a73e2458e9 | ||
|
|
96e6f43ca0 | ||
|
|
f667d5a238 | ||
|
|
ff2c4564a0 | ||
|
|
b568207e49 | ||
|
|
70470a9162 |
35
CHANGELOG.md
35
CHANGELOG.md
@@ -1,3 +1,38 @@
|
|||||||
|
# [4.14.0-dev.8](https://github.com/ReVanced/revanced-patches/compare/v4.14.0-dev.7...v4.14.0-dev.8) (2024-09-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **YouTube - SponsorBlock:** Add summary text to 'view my segments' button ([df80b9f](https://github.com/ReVanced/revanced-patches/commit/df80b9f92f0d981b9a40b7756d74f8ccc3dcb1e9))
|
||||||
|
|
||||||
|
# [4.14.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v4.14.0-dev.6...v4.14.0-dev.7) (2024-09-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add `Check environment` patch ([#3610](https://github.com/ReVanced/revanced-patches/issues/3610)) ([fbcbdaf](https://github.com/ReVanced/revanced-patches/commit/fbcbdafa4938a35b5fdec46aae7b250a84b9c139))
|
||||||
|
|
||||||
|
# [4.14.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v4.14.0-dev.5...v4.14.0-dev.6) (2024-09-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add `Change data directory location` patch ([#3602](https://github.com/ReVanced/revanced-patches/issues/3602)) ([5998029](https://github.com/ReVanced/revanced-patches/commit/59980292809cc0626bf49a160eeb05a1523c4eda))
|
||||||
|
|
||||||
|
# [4.14.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v4.14.0-dev.4...v4.14.0-dev.5) (2024-09-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Pixiv - Hide ads:** Fix for latest version ([#3616](https://github.com/ReVanced/revanced-patches/issues/3616)) ([98956e8](https://github.com/ReVanced/revanced-patches/commit/98956e8f1a41347bb435720bbf984969469a7110))
|
||||||
|
|
||||||
|
# [4.14.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v4.14.0-dev.3...v4.14.0-dev.4) (2024-09-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **YouTube - ReturnYouTubeDislike:** Show estimated like count for videos with hidden likes ([#3601](https://github.com/ReVanced/revanced-patches/issues/3601)) ([005be82](https://github.com/ReVanced/revanced-patches/commit/005be82d71b2a42387b1b57035930b20f4663794))
|
||||||
|
|
||||||
# [4.14.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v4.14.0-dev.2...v4.14.0-dev.3) (2024-08-30)
|
# [4.14.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v4.14.0-dev.2...v4.14.0-dev.3) (2024-08-30)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,14 @@ public final class app/revanced/patches/all/connectivity/wifi/spoof/SpoofWifiPat
|
|||||||
public fun transform (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Lkotlin/Triple;)V
|
public fun transform (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Lkotlin/Triple;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/all/directory/ChangeDataDirectoryLocationPatch : app/revanced/patches/all/misc/transformation/BaseTransformInstructionsPatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/all/directory/ChangeDataDirectoryLocationPatch;
|
||||||
|
public fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Ljava/lang/Integer;
|
||||||
|
public synthetic fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Ljava/lang/Object;
|
||||||
|
public fun transform (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)V
|
||||||
|
public synthetic fun transform (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Ljava/lang/Object;)V
|
||||||
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/all/interaction/gestures/PredictiveBackGesturePatch : app/revanced/patcher/patch/ResourcePatch {
|
public final class app/revanced/patches/all/interaction/gestures/PredictiveBackGesturePatch : app/revanced/patcher/patch/ResourcePatch {
|
||||||
public static final field INSTANCE Lapp/revanced/patches/all/interaction/gestures/PredictiveBackGesturePatch;
|
public static final field INSTANCE Lapp/revanced/patches/all/interaction/gestures/PredictiveBackGesturePatch;
|
||||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
@@ -854,6 +862,12 @@ public final class app/revanced/patches/serviceportalbund/detection/root/RootDet
|
|||||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract class app/revanced/patches/shared/misc/checks/BaseCheckEnvironmentPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||||
|
public fun <init> (Lapp/revanced/patcher/fingerprint/MethodFingerprint;Ljava/util/Set;Lapp/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch;)V
|
||||||
|
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch : app/revanced/patcher/patch/BytecodePatch {
|
public final class app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||||
public static final field INSTANCE Lapp/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch;
|
public static final field INSTANCE Lapp/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch;
|
||||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
@@ -1862,6 +1876,10 @@ public final class app/revanced/patches/youtube/misc/backgroundplayback/Backgrou
|
|||||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/youtube/misc/check/CheckEnvironmentPatch : app/revanced/patches/shared/misc/checks/BaseCheckEnvironmentPatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/check/CheckEnvironmentPatch;
|
||||||
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/youtube/misc/debugging/DebuggingPatch : app/revanced/patcher/patch/ResourcePatch {
|
public final class app/revanced/patches/youtube/misc/debugging/DebuggingPatch : app/revanced/patcher/patch/ResourcePatch {
|
||||||
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/debugging/DebuggingPatch;
|
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/debugging/DebuggingPatch;
|
||||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ dependencies {
|
|||||||
implementation(libs.guava)
|
implementation(libs.guava)
|
||||||
// Used in JsonGenerator.
|
// Used in JsonGenerator.
|
||||||
implementation(libs.gson)
|
implementation(libs.gson)
|
||||||
|
// Android API stubs defined here.
|
||||||
|
compileOnly(project(":stub"))
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 4.14.0-dev.3
|
version = 4.14.0-dev.8
|
||||||
|
|||||||
@@ -5,3 +5,5 @@ buildCache {
|
|||||||
isEnabled = "CI" !in System.getenv()
|
isEnabled = "CI" !in System.getenv()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include(":stub")
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package app.revanced.patches.all.directory
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.all.misc.transformation.BaseTransformInstructionsPatch
|
||||||
|
import app.revanced.util.getReference
|
||||||
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
|
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
|
||||||
|
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Change data directory location",
|
||||||
|
description = "Changes the data directory in the application from " +
|
||||||
|
"the app internal storage directory to /sdcard/android/data accessible by root-less devices." +
|
||||||
|
"Using this patch can cause unexpected issues with some apps.",
|
||||||
|
use = false,
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object ChangeDataDirectoryLocationPatch : BaseTransformInstructionsPatch<Int>() {
|
||||||
|
override fun filterMap(
|
||||||
|
classDef: ClassDef,
|
||||||
|
method: Method,
|
||||||
|
instruction: Instruction,
|
||||||
|
instructionIndex: Int,
|
||||||
|
): Int? {
|
||||||
|
val reference = instruction.getReference<MethodReference>() ?: return null
|
||||||
|
|
||||||
|
if (!MethodUtil.methodSignaturesMatch(reference, MethodCall.GetDir.reference)) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return instructionIndex
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun transform(
|
||||||
|
mutableMethod: MutableMethod,
|
||||||
|
entry: Int,
|
||||||
|
) = transformMethodCall(entry, mutableMethod)
|
||||||
|
|
||||||
|
private fun transformMethodCall(
|
||||||
|
instructionIndex: Int,
|
||||||
|
mutableMethod: MutableMethod,
|
||||||
|
) {
|
||||||
|
val getDirInstruction = mutableMethod.getInstruction<Instruction35c>(instructionIndex)
|
||||||
|
val contextRegister = getDirInstruction.registerC
|
||||||
|
val dataRegister = getDirInstruction.registerD
|
||||||
|
|
||||||
|
mutableMethod.replaceInstruction(
|
||||||
|
instructionIndex,
|
||||||
|
"invoke-virtual { v$contextRegister, v$dataRegister }, " +
|
||||||
|
"Landroid/content/Context;->getExternalFilesDir(Ljava/lang/String;)Ljava/io/File;",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum class MethodCall(
|
||||||
|
val reference: MethodReference,
|
||||||
|
) {
|
||||||
|
GetDir(
|
||||||
|
ImmutableMethodReference(
|
||||||
|
"Landroid/content/Context;",
|
||||||
|
"getDir",
|
||||||
|
listOf("Ljava/lang/String;", "I"),
|
||||||
|
"Ljava/io/File;",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,28 +1,25 @@
|
|||||||
package app.revanced.patches.pixiv.ads
|
package app.revanced.patches.pixiv.ads
|
||||||
|
|
||||||
import app.revanced.util.exception
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.pixiv.ads.fingerprints.IsNotPremiumFingerprint
|
import app.revanced.patches.pixiv.ads.fingerprints.ShouldShowAdsFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Hide ads",
|
name = "Hide ads",
|
||||||
compatiblePackages = [CompatiblePackage("jp.pxv.android")]
|
compatiblePackages = [CompatiblePackage("jp.pxv.android")],
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object HideAdsPatch : BytecodePatch(setOf(IsNotPremiumFingerprint)) {
|
object HideAdsPatch : BytecodePatch(setOf(ShouldShowAdsFingerprint)) {
|
||||||
// Always return false in the "isNotPremium" method which normally returns !this.accountManager.isPremium.
|
|
||||||
// However, this is not the method that controls the user's premium status.
|
|
||||||
// Instead, this method is used to determine whether ads should be shown.
|
|
||||||
override fun execute(context: BytecodeContext) =
|
override fun execute(context: BytecodeContext) =
|
||||||
IsNotPremiumFingerprint.result?.mutableClass?.virtualMethods?.first()?.addInstructions(
|
ShouldShowAdsFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
const/4 v0, 0x0
|
const/4 v0, 0x0
|
||||||
return v0
|
return v0
|
||||||
"""
|
""",
|
||||||
) ?: throw IsNotPremiumFingerprint.exception
|
) ?: throw ShouldShowAdsFingerprint.exception
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package app.revanced.patches.pixiv.ads.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
|
|
||||||
internal object IsNotPremiumFingerprint : MethodFingerprint(
|
|
||||||
"V",
|
|
||||||
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
|
||||||
listOf("L"),
|
|
||||||
strings = listOf("pixivAccountManager"),
|
|
||||||
customFingerprint = custom@{ _, classDef ->
|
|
||||||
// The "isNotPremium" method is the only method in the class.
|
|
||||||
if (classDef.virtualMethods.count() != 1) return@custom false
|
|
||||||
|
|
||||||
classDef.virtualMethods.first().let { isNotPremiumMethod ->
|
|
||||||
isNotPremiumMethod.parameterTypes.size == 0 && isNotPremiumMethod.returnType == "Z"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.pixiv.ads.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
|
||||||
|
internal object ShouldShowAdsFingerprint : MethodFingerprint(
|
||||||
|
"Z",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
classDef.type.endsWith("AdUtils;") && methodDef.name == "shouldShowAds"
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package app.revanced.patches.shared.misc.checks
|
||||||
|
|
||||||
|
import android.os.Build.*
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableEncodedValue
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableLongEncodedValue
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableStringEncodedValue
|
||||||
|
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
||||||
|
import app.revanced.patches.shared.misc.checks.fingerprints.PatchInfoBuildFingerprint
|
||||||
|
import app.revanced.patches.shared.misc.checks.fingerprints.PatchInfoFingerprint
|
||||||
|
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch
|
||||||
|
import app.revanced.util.exception
|
||||||
|
import app.revanced.util.resultOrThrow
|
||||||
|
import com.android.tools.smali.dexlib2.immutable.value.ImmutableLongEncodedValue
|
||||||
|
import com.android.tools.smali.dexlib2.immutable.value.ImmutableStringEncodedValue
|
||||||
|
import java.nio.charset.StandardCharsets
|
||||||
|
import java.security.MessageDigest
|
||||||
|
import kotlin.io.encoding.Base64
|
||||||
|
import kotlin.io.encoding.ExperimentalEncodingApi
|
||||||
|
|
||||||
|
abstract class BaseCheckEnvironmentPatch(
|
||||||
|
private val mainActivityOnCreateFingerprint: MethodFingerprint,
|
||||||
|
compatiblePackages: Set<CompatiblePackage>,
|
||||||
|
integrationsPatch: BaseIntegrationsPatch,
|
||||||
|
) : BytecodePatch(
|
||||||
|
description = "Checks, if the application was patched by, otherwise warns the user.",
|
||||||
|
compatiblePackages = compatiblePackages,
|
||||||
|
dependencies = setOf(
|
||||||
|
AddResourcesPatch::class,
|
||||||
|
integrationsPatch::class,
|
||||||
|
),
|
||||||
|
fingerprints = setOf(
|
||||||
|
PatchInfoFingerprint,
|
||||||
|
PatchInfoBuildFingerprint,
|
||||||
|
mainActivityOnCreateFingerprint,
|
||||||
|
),
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
AddResourcesPatch(BaseCheckEnvironmentPatch::class)
|
||||||
|
|
||||||
|
setPatchInfo()
|
||||||
|
invokeCheck()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setPatchInfo() {
|
||||||
|
PatchInfoFingerprint.setClassFields(
|
||||||
|
"PATCH_TIME" to System.currentTimeMillis().encoded,
|
||||||
|
)
|
||||||
|
|
||||||
|
fun setBuildInfo() {
|
||||||
|
PatchInfoBuildFingerprint.setClassFields(
|
||||||
|
"PATCH_BOARD" to BOARD.encodedAndHashed,
|
||||||
|
"PATCH_BOOTLOADER" to BOOTLOADER.encodedAndHashed,
|
||||||
|
"PATCH_BRAND" to BRAND.encodedAndHashed,
|
||||||
|
"PATCH_CPU_ABI" to CPU_ABI.encodedAndHashed,
|
||||||
|
"PATCH_CPU_ABI2" to CPU_ABI2.encodedAndHashed,
|
||||||
|
"PATCH_DEVICE" to DEVICE.encodedAndHashed,
|
||||||
|
"PATCH_DISPLAY" to DISPLAY.encodedAndHashed,
|
||||||
|
"PATCH_FINGERPRINT" to FINGERPRINT.encodedAndHashed,
|
||||||
|
"PATCH_HARDWARE" to HARDWARE.encodedAndHashed,
|
||||||
|
"PATCH_HOST" to HOST.encodedAndHashed,
|
||||||
|
"PATCH_ID" to ID.encodedAndHashed,
|
||||||
|
"PATCH_MANUFACTURER" to MANUFACTURER.encodedAndHashed,
|
||||||
|
"PATCH_MODEL" to MODEL.encodedAndHashed,
|
||||||
|
"PATCH_ODM_SKU" to ODM_SKU.encodedAndHashed,
|
||||||
|
"PATCH_PRODUCT" to PRODUCT.encodedAndHashed,
|
||||||
|
"PATCH_RADIO" to RADIO.encodedAndHashed,
|
||||||
|
"PATCH_SKU" to SKU.encodedAndHashed,
|
||||||
|
"PATCH_SOC_MANUFACTURER" to SOC_MANUFACTURER.encodedAndHashed,
|
||||||
|
"PATCH_SOC_MODEL" to SOC_MODEL.encodedAndHashed,
|
||||||
|
"PATCH_TAGS" to TAGS.encodedAndHashed,
|
||||||
|
"PATCH_TYPE" to TYPE.encodedAndHashed,
|
||||||
|
"PATCH_USER" to USER.encodedAndHashed,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class.forName("android.os.Build")
|
||||||
|
// This only works on Android,
|
||||||
|
// because it uses Android APIs.
|
||||||
|
setBuildInfo()
|
||||||
|
} catch (_: ClassNotFoundException) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun invokeCheck() = mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
|
0,
|
||||||
|
"invoke-static/range { p0 .. p0 },$INTEGRATIONS_CLASS_DESCRIPTOR->check(Landroid/app/Activity;)V",
|
||||||
|
) ?: throw mainActivityOnCreateFingerprint.exception
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/shared/checks/CheckEnvironmentPatch;"
|
||||||
|
|
||||||
|
@OptIn(ExperimentalEncodingApi::class)
|
||||||
|
private val String.encodedAndHashed
|
||||||
|
get() = MutableStringEncodedValue(
|
||||||
|
ImmutableStringEncodedValue(
|
||||||
|
Base64.encode(MessageDigest.getInstance("SHA-1")
|
||||||
|
.digest(this.toByteArray(StandardCharsets.UTF_8))),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
private val Long.encoded get() = MutableLongEncodedValue(ImmutableLongEncodedValue(this))
|
||||||
|
|
||||||
|
private fun <T : MutableEncodedValue> MethodFingerprint.setClassFields(vararg fieldNameValues: Pair<String, T>) {
|
||||||
|
val fieldNameValueMap = mapOf(*fieldNameValues)
|
||||||
|
|
||||||
|
resultOrThrow().mutableClass.fields.forEach { field ->
|
||||||
|
field.initialValue = fieldNameValueMap[field.name] ?: return@forEach
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package app.revanced.patches.shared.misc.checks.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
|
||||||
|
internal object PatchInfoBuildFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { _, classDef -> classDef.type == "Lapp/revanced/integrations/shared/checks/PatchInfo\$Build;" },
|
||||||
|
)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.shared.misc.checks.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
|
||||||
|
internal object PatchInfoFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { _, classDef ->
|
||||||
|
classDef.type == "Lapp/revanced/integrations/shared/checks/PatchInfo;"
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -115,8 +115,8 @@ abstract class BaseGmsCoreSupportPatch(
|
|||||||
|
|
||||||
// Verify GmsCore is installed and whitelisted for power optimizations and background usage.
|
// Verify GmsCore is installed and whitelisted for power optimizations and background usage.
|
||||||
mainActivityOnCreateFingerprint.result?.mutableMethod?.apply {
|
mainActivityOnCreateFingerprint.result?.mutableMethod?.apply {
|
||||||
// Temporary fix for Google photos integration.
|
// Temporary fix for patches with an integrations patch that hook the onCreate method as well.
|
||||||
var setContextIndex = indexOfFirstInstruction {
|
val setContextIndex = indexOfFirstInstruction {
|
||||||
val reference = getReference<MethodReference>() ?: return@indexOfFirstInstruction false
|
val reference = getReference<MethodReference>() ?: return@indexOfFirstInstruction false
|
||||||
|
|
||||||
reference.toString() == "Lapp/revanced/integrations/shared/Utils;->setContext(Landroid/content/Context;)V"
|
reference.toString() == "Lapp/revanced/integrations/shared/Utils;->setContext(Landroid/content/Context;)V"
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.check
|
||||||
|
|
||||||
|
import app.revanced.patches.shared.misc.checks.BaseCheckEnvironmentPatch
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.shared.fingerprints.MainActivityOnCreateFingerprint
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
|
object CheckEnvironmentPatch :
|
||||||
|
BaseCheckEnvironmentPatch(
|
||||||
|
mainActivityOnCreateFingerprint = MainActivityOnCreateFingerprint,
|
||||||
|
integrationsPatch = IntegrationsPatch,
|
||||||
|
compatiblePackages = setOf(CompatiblePackage("com.google.android.youtube")),
|
||||||
|
)
|
||||||
@@ -15,6 +15,7 @@ import app.revanced.patches.shared.misc.settings.preference.IntentPreference
|
|||||||
import app.revanced.patches.shared.misc.settings.preference.NonInteractivePreference
|
import app.revanced.patches.shared.misc.settings.preference.NonInteractivePreference
|
||||||
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen.Sorting
|
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen.Sorting
|
||||||
import app.revanced.patches.shared.misc.settings.preference.TextPreference
|
import app.revanced.patches.shared.misc.settings.preference.TextPreference
|
||||||
|
import app.revanced.patches.youtube.misc.check.CheckEnvironmentPatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.fingerprints.LicenseActivityOnCreateFingerprint
|
import app.revanced.patches.youtube.misc.settings.fingerprints.LicenseActivityOnCreateFingerprint
|
||||||
import app.revanced.patches.youtube.misc.settings.fingerprints.SetThemeFingerprint
|
import app.revanced.patches.youtube.misc.settings.fingerprints.SetThemeFingerprint
|
||||||
@@ -30,6 +31,9 @@ import java.io.Closeable
|
|||||||
IntegrationsPatch::class,
|
IntegrationsPatch::class,
|
||||||
SettingsResourcePatch::class,
|
SettingsResourcePatch::class,
|
||||||
AddResourcesPatch::class,
|
AddResourcesPatch::class,
|
||||||
|
// Currently there is no easy way to make a mandatory patch,
|
||||||
|
// so for now this is a dependent of this patch.
|
||||||
|
CheckEnvironmentPatch::class,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
object SettingsPatch :
|
object SettingsPatch :
|
||||||
|
|||||||
@@ -31,6 +31,17 @@ This is because Crowdin requires temporarily flattening this file and removing t
|
|||||||
-->
|
-->
|
||||||
<resources>
|
<resources>
|
||||||
<app id="shared">
|
<app id="shared">
|
||||||
|
<patch id="misc.checks.BaseCheckEnvironmentPatch">
|
||||||
|
<string name="revanced_check_environment_failed_title">Checks failed</string>
|
||||||
|
<string name="revanced_check_environment_dialog_open_official_source_button">Open official website</string>
|
||||||
|
<string name="revanced_check_environment_dialog_ignore_button">Ignore</string>
|
||||||
|
<string name="revanced_check_environment_failed_message"><h5>This app does not appear to be patched by you.</h5><br>This app may not function correctly, <b>could be harmful or even dangerous to use</b>.<br><br>These checks imply this app is pre-patched or obtained from someone else:<br><br><small>%1$s</small><br>It is strongly recommended to <b>uninstall this app and patch it yourself</b> to ensure you are using a validated and secure app.<p><br>If ignored, this warning will only be shown twice.</string>
|
||||||
|
<string name="revanced_check_environment_not_same_patching_device">Patched on a different device</string>
|
||||||
|
<string name="revanced_check_environment_manager_not_expected_installer">Not installed by ReVanced Manager</string>
|
||||||
|
<string name="revanced_check_environment_not_near_patch_time">Patched more than 10 minutes ago</string>
|
||||||
|
<string name="revanced_check_environment_not_near_patch_time_days">Patched %s days ago</string>
|
||||||
|
<string name="revanced_check_environment_not_near_patch_time_invalid">APK build date is corrupted</string>
|
||||||
|
</patch>
|
||||||
<patch id="misc.settings.BaseSettingsResourcePatch">
|
<patch id="misc.settings.BaseSettingsResourcePatch">
|
||||||
<string name="revanced_settings_title">ReVanced</string>
|
<string name="revanced_settings_title">ReVanced</string>
|
||||||
<string name="revanced_settings_confirm_user_dialog_title">Do you wish to proceed?</string>
|
<string name="revanced_settings_confirm_user_dialog_title">Do you wish to proceed?</string>
|
||||||
@@ -685,7 +696,6 @@ This is because Crowdin requires temporarily flattening this file and removing t
|
|||||||
</patch>
|
</patch>
|
||||||
<patch id="layout.returnyoutubedislike.ReturnYouTubeDislikeResourcePatch">
|
<patch id="layout.returnyoutubedislike.ReturnYouTubeDislikeResourcePatch">
|
||||||
<string name="revanced_ryd_settings_title">Return YouTube Dislike</string>
|
<string name="revanced_ryd_settings_title">Return YouTube Dislike</string>
|
||||||
<string name="revanced_ryd_video_likes_hidden_by_video_owner">Hidden</string>
|
|
||||||
<!-- Toast shown if network connection times out. Translations of this should not be longer than the original English or the text can be clipped and not entirely shown. -->
|
<!-- Toast shown if network connection times out. Translations of this should not be longer than the original English or the text can be clipped and not entirely shown. -->
|
||||||
<string name="revanced_ryd_failure_connection_timeout">Dislikes temporarily not available (API timed out)</string>
|
<string name="revanced_ryd_failure_connection_timeout">Dislikes temporarily not available (API timed out)</string>
|
||||||
<string name="revanced_ryd_failure_connection_status_code">Dislikes not available (status %d)</string>
|
<string name="revanced_ryd_failure_connection_status_code">Dislikes not available (status %d)</string>
|
||||||
@@ -903,6 +913,7 @@ This is because Crowdin requires temporarily flattening this file and removing t
|
|||||||
<string name="revanced_sb_stats_username_changed">Username successfully changed</string>
|
<string name="revanced_sb_stats_username_changed">Username successfully changed</string>
|
||||||
<string name="revanced_sb_stats_reputation">Your reputation is <b>%.2f</b></string>
|
<string name="revanced_sb_stats_reputation">Your reputation is <b>%.2f</b></string>
|
||||||
<string name="revanced_sb_stats_submissions">You\'ve created <b>%s</b> segments</string>
|
<string name="revanced_sb_stats_submissions">You\'ve created <b>%s</b> segments</string>
|
||||||
|
<string name="revanced_sb_stats_submissions_sum">Tap here to view your segments</string>
|
||||||
<string name="revanced_sb_stats_saved_zero">SponsorBlock leaderboard</string>
|
<string name="revanced_sb_stats_saved_zero">SponsorBlock leaderboard</string>
|
||||||
<string name="revanced_sb_stats_saved">You\'ve saved people from <b>%s</b> segments</string>
|
<string name="revanced_sb_stats_saved">You\'ve saved people from <b>%s</b> segments</string>
|
||||||
<string name="revanced_sb_stats_saved_sum_zero">Tap here to see the global stats and top contributors</string>
|
<string name="revanced_sb_stats_saved_sum_zero">Tap here to see the global stats and top contributors</string>
|
||||||
|
|||||||
10
stub/build.gradle.kts
Normal file
10
stub/build.gradle.kts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
plugins {
|
||||||
|
`java-library`
|
||||||
|
}
|
||||||
|
|
||||||
|
description = "Provide Android API stubs for ReVanced Patches."
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
26
stub/src/main/java/android/os/Build.java
Normal file
26
stub/src/main/java/android/os/Build.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package android.os;
|
||||||
|
|
||||||
|
public class Build {
|
||||||
|
public static final String BOARD = null;
|
||||||
|
public static final String BOOTLOADER = null;
|
||||||
|
public static final String BRAND = null;
|
||||||
|
public static final String CPU_ABI = null;
|
||||||
|
public static final String CPU_ABI2 = null;
|
||||||
|
public static final String DEVICE = null;
|
||||||
|
public static final String DISPLAY = null;
|
||||||
|
public static final String FINGERPRINT = null;
|
||||||
|
public static final String HARDWARE = null;
|
||||||
|
public static final String HOST = null;
|
||||||
|
public static final String ID = null;
|
||||||
|
public static final String MANUFACTURER = null;
|
||||||
|
public static final String MODEL = null;
|
||||||
|
public static final String ODM_SKU = null;
|
||||||
|
public static final String PRODUCT = null;
|
||||||
|
public static final String RADIO = null;
|
||||||
|
public static final String SKU = null;
|
||||||
|
public static final String SOC_MANUFACTURER = null;
|
||||||
|
public static final String SOC_MODEL = null;
|
||||||
|
public static final String TAGS = null;
|
||||||
|
public static final String TYPE = null;
|
||||||
|
public static final String USER = null;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user