mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-08 18:33:57 +01:00
Compare commits
17 Commits
v2.191.0-d
...
v2.191.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7422617dc5 | ||
|
|
b07887800b | ||
|
|
0c5d846192 | ||
|
|
ff6daf55e0 | ||
|
|
2d33ba68b3 | ||
|
|
f703c9ab81 | ||
|
|
9546d12218 | ||
|
|
b2b5594f6a | ||
|
|
bf628dc0ea | ||
|
|
5f2536814d | ||
|
|
99bc87909e | ||
|
|
928df2428d | ||
|
|
3e9e1e2577 | ||
|
|
5ebec9b424 | ||
|
|
0204ff67a9 | ||
|
|
7d2a707030 | ||
|
|
26e0e4cd1d |
51
CHANGELOG.md
51
CHANGELOG.md
@@ -1,3 +1,54 @@
|
|||||||
|
# [2.191.0-dev.27](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.26...v2.191.0-dev.27) (2023-10-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **Tumblr:** Add `Disable in-app update` patch ([#3058](https://github.com/ReVanced/revanced-patches/issues/3058)) ([5e8076b](https://github.com/ReVanced/revanced-patches/commit/5e8076b330cabe57130233adacdf84b56f010217))
|
||||||
|
|
||||||
|
# [2.191.0-dev.26](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.25...v2.191.0-dev.26) (2023-10-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Use correct instruction ([246cf2c](https://github.com/ReVanced/revanced-patches/commit/246cf2cc92624e43bc7405cb32be9b560bb648c5))
|
||||||
|
|
||||||
|
# [2.191.0-dev.25](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.24...v2.191.0-dev.25) (2023-10-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **YouTube - Hide layout components:** Hide "Join" button ([1b71f89](https://github.com/ReVanced/revanced-patches/commit/1b71f893bb9fd8511833b8895031c8d8122a6efb))
|
||||||
|
* **YouTube - Hide layout components:** Hide "Notify me" button ([3027c15](https://github.com/ReVanced/revanced-patches/commit/3027c1575717588f43f4b95be6ba97dac2b94069))
|
||||||
|
* **YouTube - Hide layout components:** Hide timed reactions ([d0a775d](https://github.com/ReVanced/revanced-patches/commit/d0a775d685b1e0564804d564d1cbcbb8d0a04b03))
|
||||||
|
|
||||||
|
# [2.191.0-dev.24](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.23...v2.191.0-dev.24) (2023-09-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **Duolingo:** Remove `Unlock Duolingo Super` patch ([b4b9746](https://github.com/ReVanced/revanced-patches/commit/b4b9746361b5435b9d9429ad065e53364c51904a))
|
||||||
|
|
||||||
|
# [2.191.0-dev.23](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.22...v2.191.0-dev.23) (2023-09-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **SPB Serviceportal Bund:** Add `Remove root detection` patch ([#3049](https://github.com/ReVanced/revanced-patches/issues/3049)) ([481bf58](https://github.com/ReVanced/revanced-patches/commit/481bf583afbf954bef1c4e5349a62ea1c623115a))
|
||||||
|
|
||||||
|
# [2.191.0-dev.22](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.21...v2.191.0-dev.22) (2023-09-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **YouTube - Premium heading:** Correct inverted logic ([#3042](https://github.com/ReVanced/revanced-patches/issues/3042)) ([b33ed75](https://github.com/ReVanced/revanced-patches/commit/b33ed757370653b8eb0002b0977eedfbc73dbe5e))
|
||||||
|
|
||||||
|
# [2.191.0-dev.21](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.20...v2.191.0-dev.21) (2023-09-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **YouTube - ReturnYouTubeDislike:** Revert support for 18.37.36 ([#3041](https://github.com/ReVanced/revanced-patches/issues/3041)) ([3761073](https://github.com/ReVanced/revanced-patches/commit/37610732da87549c22a430bb62d10793dfa2e696))
|
||||||
|
|
||||||
# [2.191.0-dev.20](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.19...v2.191.0-dev.20) (2023-09-28)
|
# [2.191.0-dev.20](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.19...v2.191.0-dev.20) (2023-09-28)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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 = 2.191.0-dev.20
|
version = 2.191.0-dev.27
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,62 +0,0 @@
|
|||||||
package app.revanced.patches.duolingo.unlocksuper
|
|
||||||
|
|
||||||
import app.revanced.extensions.exception
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchException
|
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
|
||||||
import app.revanced.patches.duolingo.unlocksuper.fingerprints.IsUserSuperMethodFingerprint
|
|
||||||
import app.revanced.patches.duolingo.unlocksuper.fingerprints.UserSerializationMethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22c
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.Reference
|
|
||||||
|
|
||||||
@Patch(
|
|
||||||
name = "Unlock Duolingo Super",
|
|
||||||
compatiblePackages = [CompatiblePackage("com.duolingo")]
|
|
||||||
)
|
|
||||||
@Suppress("unused")
|
|
||||||
object UnlockDuolingoSuperPatch : BytecodePatch(
|
|
||||||
setOf(
|
|
||||||
UserSerializationMethodFingerprint,
|
|
||||||
IsUserSuperMethodFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
/* First find the reference to the isUserSuper field, then patch the instruction that assigns it to false.
|
|
||||||
* This strategy is used because the method that sets the isUserSuper field is difficult to fingerprint reliably.
|
|
||||||
*/
|
|
||||||
override fun execute(context: BytecodeContext) {
|
|
||||||
// Find the reference to the isUserSuper field.
|
|
||||||
val isUserSuperReference = IsUserSuperMethodFingerprint
|
|
||||||
.result
|
|
||||||
?.mutableMethod
|
|
||||||
?.getInstructions()
|
|
||||||
?.filterIsInstance<BuilderInstruction22c>()
|
|
||||||
?.firstOrNull { it.opcode == Opcode.IGET_BOOLEAN }
|
|
||||||
?.reference
|
|
||||||
?: throw IsUserSuperMethodFingerprint.exception
|
|
||||||
|
|
||||||
// Patch the instruction that assigns isUserSuper to true.
|
|
||||||
UserSerializationMethodFingerprint
|
|
||||||
.result
|
|
||||||
?.mutableMethod
|
|
||||||
?.apply {
|
|
||||||
replaceInstructions(
|
|
||||||
indexOfReference(isUserSuperReference) - 1,
|
|
||||||
"const/4 v2, 0x1"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
?: throw UserSerializationMethodFingerprint.exception
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun MutableMethod.indexOfReference(reference: Reference) = getInstructions()
|
|
||||||
.indexOfFirst { it is BuilderInstruction22c && it.opcode == Opcode.IPUT_BOOLEAN && it.reference == reference }
|
|
||||||
.let {
|
|
||||||
if (it == -1) throw PatchException("Could not find index of instruction with supplied reference.")
|
|
||||||
else it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package app.revanced.patches.duolingo.unlocksuper.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
object IsUserSuperMethodFingerprint : MethodFingerprint(
|
|
||||||
returnType = "Ljava/lang/Object",
|
|
||||||
parameters = listOf("Ljava/lang/Object"),
|
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
strings = listOf("user"),
|
|
||||||
opcodes = listOf(Opcode.IGET_BOOLEAN),
|
|
||||||
)
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package app.revanced.patches.duolingo.unlocksuper.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
object UserSerializationMethodFingerprint : MethodFingerprint(
|
|
||||||
returnType = "V",
|
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
|
||||||
strings = listOf(
|
|
||||||
"betaStatus",
|
|
||||||
"coachOutfit",
|
|
||||||
"globalAmbassadorStatus",
|
|
||||||
),
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.MOVE_FROM16,
|
|
||||||
Opcode.IPUT_BOOLEAN,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package app.revanced.patches.serviceportalbund.detection.root
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.serviceportalbund.detection.root.fingerprints.RootDetectionFingerprint
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Remove root detection",
|
||||||
|
description = "Removes the check for root permissions and unlocked bootloader.",
|
||||||
|
compatiblePackages = [CompatiblePackage("at.gv.bka.serviceportal")]
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object RootDetectionPatch : BytecodePatch(
|
||||||
|
setOf(RootDetectionFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) =
|
||||||
|
RootDetectionFingerprint.result!!.mutableMethod.addInstruction(0, "return-void")
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patches.serviceportalbund.detection.root.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object RootDetectionFingerprint : MethodFingerprint(
|
||||||
|
"V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC.value,
|
||||||
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.definingClass.endsWith("/DeviceIntegrityCheck;")
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -1,33 +1,37 @@
|
|||||||
package app.revanced.patches.tumblr.ads
|
package app.revanced.patches.tumblr.ads
|
||||||
|
|
||||||
import app.revanced.extensions.exception
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
|
||||||
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.tumblr.ads.fingerprints.AdWaterfallFingerprint
|
import app.revanced.patches.tumblr.timelinefilter.TimelineFilterPatch
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Disable dashboard ads",
|
name = "Disable dashboard ads",
|
||||||
description = "Disables ads in the dashboard.",
|
description = "Disables ads in the dashboard.",
|
||||||
compatiblePackages = [CompatiblePackage("com.tumblr")]
|
compatiblePackages = [CompatiblePackage("com.tumblr")],
|
||||||
|
dependencies = [TimelineFilterPatch::class]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object DisableDashboardAds : BytecodePatch(
|
object DisableDashboardAds : BytecodePatch() {
|
||||||
setOf(AdWaterfallFingerprint)
|
override fun execute(context: BytecodeContext) {
|
||||||
) {
|
// The timeline object types are filtered by their name in the TimelineObjectType enum.
|
||||||
override fun execute(context: BytecodeContext) = AdWaterfallFingerprint.result?.let {
|
// This is often different from the "object_type" returned in the api (noted in comments here)
|
||||||
it.scanResult.stringsScanResult!!.matches.forEach { match ->
|
arrayOf(
|
||||||
// We just replace all occurrences of "client_side_ad_waterfall" with anything else
|
"CLIENT_SIDE_MEDIATION", // "client_side_ad_waterfall"
|
||||||
// so the app fails to handle ads in the timeline elements array and just skips them.
|
"GEMINI_AD", // "backfill_ad"
|
||||||
// See AdWaterfallFingerprint for more info.
|
|
||||||
val stringRegister = it.mutableMethod.getInstruction<OneRegisterInstruction>(match.index).registerA
|
// The object types below weren't actually spotted in the wild in testing, but they are valid Object types
|
||||||
it.mutableMethod.replaceInstruction(
|
// and their names clearly indicate that they are ads, so we just block them anyway,
|
||||||
match.index, "const-string v$stringRegister, \"dummy\""
|
// just in case they will be used in the future.
|
||||||
)
|
"NIMBUS_AD", // "nimbus_ad"
|
||||||
|
"CLIENT_SIDE_AD", // "client_side_ad"
|
||||||
|
"DISPLAY_IO_INTERSCROLLER_AD", // "display_io_interscroller"
|
||||||
|
"DISPLAY_IO_HEADLINE_VIDEO_AD", // "display_io_headline_video"
|
||||||
|
"FACEBOOK_BIDDAABLE", // "facebook_biddable_sdk_ad"
|
||||||
|
"GOOGLE_NATIVE" // "google_native_ad"
|
||||||
|
).forEach {
|
||||||
|
TimelineFilterPatch.addObjectTypeFilter(it)
|
||||||
}
|
}
|
||||||
} ?: throw AdWaterfallFingerprint.exception
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package app.revanced.patches.tumblr.ads.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
// The Tumblr app sends a request to /v2/timeline/dashboard which replies with an array of elements
|
|
||||||
// to show in the user dashboard. These element have different type ids (post, title, carousel, etc.)
|
|
||||||
// The standard dashboard Ad has the id client_side_ad_waterfall, and this string has to be in the code
|
|
||||||
// to handle ads and provide their appearance.
|
|
||||||
// If we just replace this string in the tumblr code with anything else, it will fail to recognize the
|
|
||||||
// dashboard object type and just skip it. This is a bit weird, but it shouldn't break
|
|
||||||
// unless they change the api (unlikely) or explicitly Change the tumblr code to prevent this.
|
|
||||||
object AdWaterfallFingerprint : MethodFingerprint(strings = listOf("client_side_ad_waterfall"))
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patches.tumblr.annoyances.inappupdate
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.tumblr.featureflags.OverrideFeatureFlagsPatch
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Disable in-app update",
|
||||||
|
description = "Disables the in-app update check and update prompt.",
|
||||||
|
dependencies = [OverrideFeatureFlagsPatch::class],
|
||||||
|
compatiblePackages = [CompatiblePackage("com.tumblr")]
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object DisableInAppUpdatePatch : BytecodePatch() {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
// Before checking for updates using Google Play core AppUpdateManager, the value of this feature flag is checked.
|
||||||
|
// If this flag is false or the last update check was today and no update check is performed.
|
||||||
|
OverrideFeatureFlagsPatch.addOverride("inAppUpdate", "false")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,37 +1,26 @@
|
|||||||
package app.revanced.patches.tumblr.live
|
package app.revanced.patches.tumblr.live
|
||||||
|
|
||||||
import app.revanced.extensions.exception
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
|
||||||
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.tumblr.featureflags.OverrideFeatureFlagsPatch
|
import app.revanced.patches.tumblr.featureflags.OverrideFeatureFlagsPatch
|
||||||
import app.revanced.patches.tumblr.live.fingerprints.LiveMarqueeFingerprint
|
import app.revanced.patches.tumblr.timelinefilter.TimelineFilterPatch
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Disable Tumblr Live",
|
name = "Disable Tumblr Live",
|
||||||
description = "Disable the Tumblr Live tab button and dashboard carousel.",
|
description = "Disable the Tumblr Live tab button and dashboard carousel.",
|
||||||
dependencies = [OverrideFeatureFlagsPatch::class],
|
dependencies = [OverrideFeatureFlagsPatch::class, TimelineFilterPatch::class],
|
||||||
compatiblePackages = [CompatiblePackage("com.tumblr")]
|
compatiblePackages = [CompatiblePackage("com.tumblr")]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object DisableTumblrLivePatch : BytecodePatch(
|
object DisableTumblrLivePatch : BytecodePatch() {
|
||||||
setOf(LiveMarqueeFingerprint)
|
override fun execute(context: BytecodeContext) {
|
||||||
) {
|
// Hide the LIVE_MARQUEE timeline element that appears in the feed
|
||||||
override fun execute(context: BytecodeContext) = LiveMarqueeFingerprint.result?.let {
|
// Called "live_marquee" in api response
|
||||||
it.scanResult.stringsScanResult!!.matches.forEach { match ->
|
TimelineFilterPatch.addObjectTypeFilter("LIVE_MARQUEE")
|
||||||
// Replace the string constant "live_marquee"
|
|
||||||
// with a dummy so the app doesn't recognize this type of element in the Dashboard and skips it
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val stringRegister = getInstruction<OneRegisterInstruction>(match.index).registerA
|
|
||||||
replaceInstruction(match.index, "const-string v$stringRegister, \"dummy2\"")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We hide the Tab button for Tumblr Live by forcing the feature flag to false
|
// Hide the Tab button for Tumblr Live by forcing the feature flag to false
|
||||||
OverrideFeatureFlagsPatch.addOverride("liveStreaming", "false")
|
OverrideFeatureFlagsPatch.addOverride("liveStreaming", "false")
|
||||||
} ?: throw LiveMarqueeFingerprint.exception
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package app.revanced.patches.tumblr.live.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
// This works identically to the Tumblr AdWaterfallFingerprint, see comments there
|
|
||||||
object LiveMarqueeFingerprint : MethodFingerprint(strings = listOf("live_marquee"))
|
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package app.revanced.patches.tumblr.timelinefilter
|
||||||
|
|
||||||
|
import app.revanced.extensions.exception
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.tumblr.timelinefilter.fingerprints.PostsResponseConstructorFingerprint
|
||||||
|
import app.revanced.patches.tumblr.timelinefilter.fingerprints.TimelineConstructorFingerprint
|
||||||
|
import app.revanced.patches.tumblr.timelinefilter.fingerprints.TimelineFilterIntegrationFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction35c
|
||||||
|
|
||||||
|
@Patch(description = "Filter timeline objects.", requiresIntegrations = true)
|
||||||
|
object TimelineFilterPatch : BytecodePatch(
|
||||||
|
setOf(TimelineConstructorFingerprint, TimelineFilterIntegrationFingerprint, PostsResponseConstructorFingerprint)
|
||||||
|
) {
|
||||||
|
/**
|
||||||
|
* Add a filter to hide the given timeline object type.
|
||||||
|
* The list of all Timeline object types is found in the TimelineObjectType class,
|
||||||
|
* where they are mapped from their api name (returned by tumblr via the HTTP API) to the enum value name.
|
||||||
|
*
|
||||||
|
* @param typeName The enum name of the timeline object type to hide.
|
||||||
|
*/
|
||||||
|
@Suppress("KDocUnresolvedReference")
|
||||||
|
internal lateinit var addObjectTypeFilter: (typeName: String) -> Unit private set
|
||||||
|
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
TimelineFilterIntegrationFingerprint.result?.let { integration ->
|
||||||
|
val filterInsertIndex = integration.scanResult.patternScanResult!!.startIndex
|
||||||
|
|
||||||
|
integration.mutableMethod.apply {
|
||||||
|
val addInstruction = getInstruction<BuilderInstruction35c>(filterInsertIndex + 1)
|
||||||
|
if (addInstruction.registerCount != 2) throw TimelineFilterIntegrationFingerprint.exception
|
||||||
|
|
||||||
|
val filterListRegister = addInstruction.registerC
|
||||||
|
val stringRegister = addInstruction.registerD
|
||||||
|
|
||||||
|
// Remove "BLOCKED_OBJECT_DUMMY"
|
||||||
|
removeInstructions(filterInsertIndex, 2)
|
||||||
|
|
||||||
|
addObjectTypeFilter = { typeName ->
|
||||||
|
// blockedObjectTypes.add({typeName})
|
||||||
|
addInstructionsWithLabels(
|
||||||
|
filterInsertIndex, """
|
||||||
|
const-string v$stringRegister, "$typeName"
|
||||||
|
invoke-virtual { v$filterListRegister, v$stringRegister }, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ?: throw TimelineFilterIntegrationFingerprint.exception
|
||||||
|
|
||||||
|
mapOf(
|
||||||
|
TimelineConstructorFingerprint to 1,
|
||||||
|
PostsResponseConstructorFingerprint to 2
|
||||||
|
).forEach { (fingerprint, timelineObjectsRegister) ->
|
||||||
|
fingerprint.result?.mutableMethod?.addInstructions(
|
||||||
|
0,
|
||||||
|
"invoke-static {p$timelineObjectsRegister}, " +
|
||||||
|
"Lapp/revanced/tumblr/patches/TimelineFilterPatch;->" +
|
||||||
|
"filterTimeline(Ljava/util/List;)V"
|
||||||
|
) ?: throw fingerprint.exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patches.tumblr.timelinefilter.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
// This is the constructor of the PostsResponse class.
|
||||||
|
// The same applies here as with the TimelineConstructorFingerprint.
|
||||||
|
object PostsResponseConstructorFingerprint : MethodFingerprint(
|
||||||
|
accessFlags = AccessFlags.CONSTRUCTOR or AccessFlags.PUBLIC,
|
||||||
|
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/PostsResponse;") && methodDef.parameters.size == 4 },
|
||||||
|
)
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patches.tumblr.timelinefilter.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
// This is the constructor of the Timeline class.
|
||||||
|
// It receives the List<TimelineObject> as an argument with a @Json annotation, so this should be the first time
|
||||||
|
// that the List<TimelineObject> is exposed in non-library code.
|
||||||
|
object TimelineConstructorFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.definingClass.endsWith("/Timeline;") && methodDef.parameters[0].type == "Ljava/util/List;"
|
||||||
|
}, strings = listOf("timelineObjectsList")
|
||||||
|
)
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package app.revanced.patches.tumblr.timelinefilter.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
// This fingerprints the Integration TimelineFilterPatch.filterTimeline method.
|
||||||
|
// The opcode fingerprint is searching for
|
||||||
|
// if ("BLOCKED_OBJECT_DUMMY".equals(elementType)) iterator.remove();
|
||||||
|
object TimelineFilterIntegrationFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/TimelineFilterPatch;") },
|
||||||
|
strings = listOf("BLOCKED_OBJECT_DUMMY"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST_STRING, // "BLOCKED_OBJECT_DUMMY"
|
||||||
|
Opcode.INVOKE_VIRTUAL // HashSet.add(^)
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -32,9 +32,9 @@ object PremiumHeadingPatch : ResourcePatch() {
|
|||||||
val resDirectory = context["res"]
|
val resDirectory = context["res"]
|
||||||
|
|
||||||
val (original, replacement) = if (usePremiumHeading!!)
|
val (original, replacement) = if (usePremiumHeading!!)
|
||||||
DEFAULT_HEADING_RES to PREMIUM_HEADING_RES
|
|
||||||
else
|
|
||||||
PREMIUM_HEADING_RES to DEFAULT_HEADING_RES
|
PREMIUM_HEADING_RES to DEFAULT_HEADING_RES
|
||||||
|
else
|
||||||
|
DEFAULT_HEADING_RES to PREMIUM_HEADING_RES
|
||||||
|
|
||||||
val variants = arrayOf("light", "dark")
|
val variants = arrayOf("light", "dark")
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,25 @@ object HideLayoutComponentsPatch : BytecodePatch(
|
|||||||
StringResource("revanced_hide_gray_separator_summary_on", "Gray separators are hidden"),
|
StringResource("revanced_hide_gray_separator_summary_on", "Gray separators are hidden"),
|
||||||
StringResource("revanced_hide_gray_separator_summary_off", "Gray separators are shown")
|
StringResource("revanced_hide_gray_separator_summary_off", "Gray separators are shown")
|
||||||
),
|
),
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_join_membership_button",
|
||||||
|
StringResource("revanced_hide_join_membership_button_title", "Hide \"Join\" button"),
|
||||||
|
StringResource("revanced_hide_join_membership_button_summary_on", "Button is hidden"),
|
||||||
|
StringResource("revanced_hide_join_membership_button_summary_off", "Button is shown")
|
||||||
|
),
|
||||||
|
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_notify_me_button",
|
||||||
|
StringResource("revanced_hide_notify_me_button_title", "Hide \"Notify me\" button"),
|
||||||
|
StringResource("revanced_hide_notify_me_button_summary_on", "Button is hidden"),
|
||||||
|
StringResource("revanced_hide_notify_me_button_summary_off", "Button is shown")
|
||||||
|
),
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_timed_reactions",
|
||||||
|
StringResource("revanced_hide_timed_reactions_title", "Hide timed reactions"),
|
||||||
|
StringResource("revanced_hide_timed_reactions_summary_on", "Timed reactions are hidden"),
|
||||||
|
StringResource("revanced_hide_timed_reactions_summary_off", "Timed reactions are shown")
|
||||||
|
),
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
"revanced_hide_channel_guidelines",
|
"revanced_hide_channel_guidelines",
|
||||||
StringResource("revanced_hide_channel_guidelines_title", "Hide channel guidelines"),
|
StringResource("revanced_hide_channel_guidelines_title", "Hide channel guidelines"),
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
|||||||
PlayerTypeHookPatch::class,
|
PlayerTypeHookPatch::class,
|
||||||
],
|
],
|
||||||
compatiblePackages = [
|
compatiblePackages = [
|
||||||
CompatiblePackage("com.google.android.youtube", ["18.37.36"])
|
CompatiblePackage("com.google.android.youtube", ["18.32.39"])
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
@@ -89,40 +89,49 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
throw TextComponentAtomicReferenceFingerprint.exception
|
throw TextComponentAtomicReferenceFingerprint.exception
|
||||||
}?.let { textComponentContextFingerprintResult ->
|
}?.let { textComponentContextFingerprintResult ->
|
||||||
val conversionContextIndex = textComponentContextFingerprintResult
|
val conversionContextIndex = textComponentContextFingerprintResult
|
||||||
.scanResult.patternScanResult!!.endIndex
|
.scanResult.patternScanResult!!.startIndex
|
||||||
val atomicReferenceStartIndex = TextComponentAtomicReferenceFingerprint.result!!
|
val atomicReferenceStartIndex = TextComponentAtomicReferenceFingerprint.result!!
|
||||||
.scanResult.patternScanResult!!.startIndex
|
.scanResult.patternScanResult!!.startIndex
|
||||||
|
|
||||||
val insertIndex = atomicReferenceStartIndex + 9
|
val insertIndex = atomicReferenceStartIndex + 6
|
||||||
|
|
||||||
textComponentContextFingerprintResult.mutableMethod.apply {
|
textComponentContextFingerprintResult.mutableMethod.apply {
|
||||||
// Get the conversion context obfuscated field name
|
// Get the conversion context obfuscated field name, and the registers for the AtomicReference and CharSequence
|
||||||
val conversionContextFieldReference =
|
val conversionContextFieldReference =
|
||||||
getInstruction<ReferenceInstruction>(conversionContextIndex).reference
|
getInstruction<ReferenceInstruction>(conversionContextIndex).reference
|
||||||
|
|
||||||
// Free register to hold the conversion context
|
// Reuse the free register to make room for the atomic reference register.
|
||||||
val freeRegister =
|
val freeRegister =
|
||||||
getInstruction<TwoRegisterInstruction>(atomicReferenceStartIndex).registerB
|
getInstruction<TwoRegisterInstruction>(atomicReferenceStartIndex).registerB
|
||||||
|
|
||||||
val atomicReferenceRegister =
|
val atomicReferenceRegister =
|
||||||
getInstruction<FiveRegisterInstruction>(atomicReferenceStartIndex + 6).registerC
|
getInstruction<FiveRegisterInstruction>(atomicReferenceStartIndex + 1).registerC
|
||||||
|
|
||||||
// Instruction that is replaced, and also has the CharacterSequence register.
|
val moveCharSequenceInstruction = getInstruction<TwoRegisterInstruction>(insertIndex - 1)
|
||||||
val moveCharSequenceInstruction = getInstruction<TwoRegisterInstruction>(insertIndex)
|
|
||||||
val charSequenceSourceRegister = moveCharSequenceInstruction.registerB
|
val charSequenceSourceRegister = moveCharSequenceInstruction.registerB
|
||||||
val charSequenceTargetRegister = moveCharSequenceInstruction.registerA
|
val charSequenceTargetRegister = moveCharSequenceInstruction.registerA
|
||||||
|
|
||||||
|
// In order to preserve the atomic reference register, because it is overwritten,
|
||||||
|
// use another free register to store it.
|
||||||
|
replaceInstruction(
|
||||||
|
atomicReferenceStartIndex + 2,
|
||||||
|
"move-result-object v$freeRegister"
|
||||||
|
)
|
||||||
|
replaceInstruction(
|
||||||
|
atomicReferenceStartIndex + 3,
|
||||||
|
"move-object v$charSequenceSourceRegister, v$freeRegister"
|
||||||
|
)
|
||||||
|
|
||||||
// Move the current instance to the free register, and get the conversion context from it.
|
// Move the current instance to the free register, and get the conversion context from it.
|
||||||
// Must replace the instruction to preserve the control flow label.
|
replaceInstruction(insertIndex - 1, "move-object/from16 v$freeRegister, p0")
|
||||||
replaceInstruction(insertIndex, "move-object/from16 v$freeRegister, p0")
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex + 1,
|
insertIndex,
|
||||||
"""
|
"""
|
||||||
# Move context to free register
|
# Move context to free register
|
||||||
iget-object v$freeRegister, v$freeRegister, $conversionContextFieldReference
|
iget-object v$freeRegister, v$freeRegister, $conversionContextFieldReference
|
||||||
invoke-static {v$freeRegister, v$atomicReferenceRegister, v$charSequenceSourceRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onLithoTextLoaded(Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReference;Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
|
invoke-static {v$freeRegister, v$atomicReferenceRegister, v$charSequenceSourceRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onLithoTextLoaded(Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReference;Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
|
||||||
move-result-object v$freeRegister
|
move-result-object v$freeRegister
|
||||||
# Replace the original instruction
|
# Replace the original char sequence with the modified one.
|
||||||
move-object v${charSequenceTargetRegister}, v${freeRegister}
|
move-object v${charSequenceTargetRegister}, v${freeRegister}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
@@ -141,7 +150,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
val isDisLikesBooleanReference = getInstruction<ReferenceInstruction>(patternResult.endIndex).reference
|
val isDisLikesBooleanReference = getInstruction<ReferenceInstruction>(patternResult.endIndex).reference
|
||||||
|
|
||||||
val textViewFieldReference = // Like/Dislike button TextView field
|
val textViewFieldReference = // Like/Dislike button TextView field
|
||||||
getInstruction<ReferenceInstruction>(patternResult.endIndex - 1).reference
|
getInstruction<ReferenceInstruction>(patternResult.endIndex - 2).reference
|
||||||
|
|
||||||
// Check if the hooked TextView object is that of the dislike button.
|
// Check if the hooked TextView object is that of the dislike button.
|
||||||
// If RYD is disabled, or the TextView object is not that of the dislike button, the execution flow is not interrupted.
|
// If RYD is disabled, or the TextView object is not that of the dislike button, the execution flow is not interrupted.
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ object ShortsTextViewFingerprint : MethodFingerprint(
|
|||||||
Opcode.IF_EQ,
|
Opcode.IF_EQ,
|
||||||
Opcode.RETURN_VOID,
|
Opcode.RETURN_VOID,
|
||||||
Opcode.IGET_OBJECT, // TextView field
|
Opcode.IGET_OBJECT, // TextView field
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
Opcode.IGET_BOOLEAN, // boolean field
|
Opcode.IGET_BOOLEAN, // boolean field
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -13,17 +13,13 @@ object TextComponentAtomicReferenceFingerprint : MethodFingerprint(
|
|||||||
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.MOVE_OBJECT, // Register B is free register
|
Opcode.MOVE_OBJECT, // Register A and B is context, use B as context, reuse A as free register
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.INVOKE_VIRTUAL, // Register C is atomic reference
|
Opcode.INVOKE_VIRTUAL, // Register C is atomic reference
|
||||||
Opcode.MOVE_RESULT_OBJECT, // Register A is char sequence
|
Opcode.MOVE_RESULT_OBJECT, // Register A is char sequence
|
||||||
|
Opcode.MOVE_OBJECT,
|
||||||
Opcode.CHECK_CAST,
|
Opcode.CHECK_CAST,
|
||||||
Opcode.MOVE_OBJECT, // Replace this instruction with patch code
|
Opcode.MOVE_OBJECT,
|
||||||
Opcode.INVOKE_INTERFACE,
|
Opcode.INVOKE_INTERFACE, // Insert hook here
|
||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
Opcode.IF_EQZ,
|
Opcode.IF_EQZ,
|
||||||
Opcode.INVOKE_INTERFACE,
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
|||||||
@@ -13,14 +13,12 @@ object TextComponentContextFingerprint : MethodFingerprint(
|
|||||||
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.INVOKE_STATIC_RANGE,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IGET_OBJECT, // conversion context field name
|
Opcode.IGET_OBJECT, // conversion context field name
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IGET_BOOLEAN,
|
||||||
|
Opcode.IGET,
|
||||||
|
Opcode.IGET,
|
||||||
|
Opcode.IGET,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user