Compare commits

...

17 Commits

Author SHA1 Message Date
semantic-release-bot
7422617dc5 chore(release): 2.191.0-dev.27 [skip ci]
# [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)) ([b078878](b07887800b))
2023-10-01 17:36:51 +00:00
Temm
b07887800b feat(Tumblr): Add Disable in-app update patch (#3058)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-10-01 19:34:03 +02:00
semantic-release-bot
0c5d846192 chore(release): 2.191.0-dev.26 [skip ci]
# [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 ([ff6daf5](ff6daf55e0))
2023-10-01 04:18:55 +00:00
oSumAtrIX
ff6daf55e0 fix: Use correct instruction 2023-10-01 06:15:56 +02:00
Temm
2d33ba68b3 refactor(Tumblr): Use a common filter patch (#3018)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-10-01 05:11:48 +02:00
semantic-release-bot
f703c9ab81 chore(release): 2.191.0-dev.25 [skip ci]
# [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 ([9546d12](9546d12218))
* **YouTube - Hide layout components:** Hide "Notify me" button ([b2b5594](b2b5594f6a))
* **YouTube - Hide layout components:** Hide timed reactions ([bf628dc](bf628dc0ea))
2023-10-01 03:10:26 +00:00
oSumAtrIX
9546d12218 feat(YouTube - Hide layout components): Hide "Join" button 2023-10-01 05:07:30 +02:00
oSumAtrIX
b2b5594f6a feat(YouTube - Hide layout components): Hide "Notify me" button 2023-10-01 05:04:44 +02:00
oSumAtrIX
bf628dc0ea feat(YouTube - Hide layout components): Hide timed reactions 2023-10-01 05:02:36 +02:00
semantic-release-bot
5f2536814d chore(release): 2.191.0-dev.24 [skip ci]
# [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 ([99bc879](99bc87909e))
2023-09-30 20:04:23 +00:00
oSumAtrIX
99bc87909e feat(Duolingo): Remove Unlock Duolingo Super patch
The patch is not functional anymore, and is being removed according to the contribution guidelines
2023-09-30 22:00:50 +02:00
semantic-release-bot
928df2428d chore(release): 2.191.0-dev.23 [skip ci]
# [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)) ([3e9e1e2](3e9e1e2577))
2023-09-30 17:25:56 +00:00
David Gnedt
3e9e1e2577 feat(SPB Serviceportal Bund): Add Remove root detection patch (#3049) 2023-09-30 19:22:03 +02:00
semantic-release-bot
5ebec9b424 chore(release): 2.191.0-dev.22 [skip ci]
# [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)) ([0204ff6](0204ff67a9))
2023-09-28 16:10:57 +00:00
aliernfrog
0204ff67a9 fix(YouTube - Premium heading): Correct inverted logic (#3042) 2023-09-28 18:07:55 +02:00
semantic-release-bot
7d2a707030 chore(release): 2.191.0-dev.21 [skip ci]
# [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)) ([26e0e4c](26e0e4cd1d))
2023-09-28 13:42:22 +00:00
LisoUseInAIKyrios
26e0e4cd1d fix(YouTube - ReturnYouTubeDislike): Revert support for 18.37.36 (#3041) 2023-09-28 17:39:29 +04:00
23 changed files with 303 additions and 187 deletions

View File

@@ -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)

View File

@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
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

View File

@@ -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
}
}

View File

@@ -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),
)

View File

@@ -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,
),
)

View File

@@ -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")
}

View File

@@ -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;")
}
)

View File

@@ -1,33 +1,37 @@
package app.revanced.patches.tumblr.ads
import app.revanced.extensions.exception
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.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.tumblr.ads.fingerprints.AdWaterfallFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import app.revanced.patches.tumblr.timelinefilter.TimelineFilterPatch
@Patch(
name = "Disable dashboard ads",
description = "Disables ads in the dashboard.",
compatiblePackages = [CompatiblePackage("com.tumblr")]
compatiblePackages = [CompatiblePackage("com.tumblr")],
dependencies = [TimelineFilterPatch::class]
)
@Suppress("unused")
object DisableDashboardAds : BytecodePatch(
setOf(AdWaterfallFingerprint)
) {
override fun execute(context: BytecodeContext) = AdWaterfallFingerprint.result?.let {
it.scanResult.stringsScanResult!!.matches.forEach { match ->
// We just replace all occurrences of "client_side_ad_waterfall" with anything else
// so the app fails to handle ads in the timeline elements array and just skips them.
// See AdWaterfallFingerprint for more info.
val stringRegister = it.mutableMethod.getInstruction<OneRegisterInstruction>(match.index).registerA
it.mutableMethod.replaceInstruction(
match.index, "const-string v$stringRegister, \"dummy\""
)
object DisableDashboardAds : BytecodePatch() {
override fun execute(context: BytecodeContext) {
// The timeline object types are filtered by their name in the TimelineObjectType enum.
// This is often different from the "object_type" returned in the api (noted in comments here)
arrayOf(
"CLIENT_SIDE_MEDIATION", // "client_side_ad_waterfall"
"GEMINI_AD", // "backfill_ad"
// The object types below weren't actually spotted in the wild in testing, but they are valid Object types
// and their names clearly indicate that they are ads, so we just block them anyway,
// 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
}
}

View File

@@ -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"))

View File

@@ -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")
}
}

View File

@@ -1,37 +1,26 @@
package app.revanced.patches.tumblr.live
import app.revanced.extensions.exception
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.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.tumblr.featureflags.OverrideFeatureFlagsPatch
import app.revanced.patches.tumblr.live.fingerprints.LiveMarqueeFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import app.revanced.patches.tumblr.timelinefilter.TimelineFilterPatch
@Patch(
name = "Disable Tumblr Live",
description = "Disable the Tumblr Live tab button and dashboard carousel.",
dependencies = [OverrideFeatureFlagsPatch::class],
dependencies = [OverrideFeatureFlagsPatch::class, TimelineFilterPatch::class],
compatiblePackages = [CompatiblePackage("com.tumblr")]
)
@Suppress("unused")
object DisableTumblrLivePatch : BytecodePatch(
setOf(LiveMarqueeFingerprint)
) {
override fun execute(context: BytecodeContext) = LiveMarqueeFingerprint.result?.let {
it.scanResult.stringsScanResult!!.matches.forEach { match ->
// 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\"")
}
}
object DisableTumblrLivePatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
// Hide the LIVE_MARQUEE timeline element that appears in the feed
// Called "live_marquee" in api response
TimelineFilterPatch.addObjectTypeFilter("LIVE_MARQUEE")
// 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")
} ?: throw LiveMarqueeFingerprint.exception
}
}

View File

@@ -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"))

View File

@@ -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
}
}
}

View File

@@ -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 },
)

View File

@@ -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")
)

View File

@@ -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(^)
)
)

View File

@@ -32,9 +32,9 @@ object PremiumHeadingPatch : ResourcePatch() {
val resDirectory = context["res"]
val (original, replacement) = if (usePremiumHeading!!)
DEFAULT_HEADING_RES to PREMIUM_HEADING_RES
else
PREMIUM_HEADING_RES to DEFAULT_HEADING_RES
else
DEFAULT_HEADING_RES to PREMIUM_HEADING_RES
val variants = arrayOf("light", "dark")

View File

@@ -51,6 +51,25 @@ object HideLayoutComponentsPatch : BytecodePatch(
StringResource("revanced_hide_gray_separator_summary_on", "Gray separators are hidden"),
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(
"revanced_hide_channel_guidelines",
StringResource("revanced_hide_channel_guidelines_title", "Hide channel guidelines"),

View File

@@ -31,7 +31,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
PlayerTypeHookPatch::class,
],
compatiblePackages = [
CompatiblePackage("com.google.android.youtube", ["18.37.36"])
CompatiblePackage("com.google.android.youtube", ["18.32.39"])
]
)
@Suppress("unused")
@@ -89,40 +89,49 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
throw TextComponentAtomicReferenceFingerprint.exception
}?.let { textComponentContextFingerprintResult ->
val conversionContextIndex = textComponentContextFingerprintResult
.scanResult.patternScanResult!!.endIndex
.scanResult.patternScanResult!!.startIndex
val atomicReferenceStartIndex = TextComponentAtomicReferenceFingerprint.result!!
.scanResult.patternScanResult!!.startIndex
val insertIndex = atomicReferenceStartIndex + 9
val insertIndex = atomicReferenceStartIndex + 6
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 =
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 =
getInstruction<TwoRegisterInstruction>(atomicReferenceStartIndex).registerB
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)
val moveCharSequenceInstruction = getInstruction<TwoRegisterInstruction>(insertIndex - 1)
val charSequenceSourceRegister = moveCharSequenceInstruction.registerB
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.
// Must replace the instruction to preserve the control flow label.
replaceInstruction(insertIndex, "move-object/from16 v$freeRegister, p0")
replaceInstruction(insertIndex - 1, "move-object/from16 v$freeRegister, p0")
addInstructions(
insertIndex + 1,
insertIndex,
"""
# 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;
move-result-object v$freeRegister
# Replace the original instruction
# Replace the original char sequence with the modified one.
move-object v${charSequenceTargetRegister}, v${freeRegister}
"""
)
@@ -141,7 +150,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
val isDisLikesBooleanReference = getInstruction<ReferenceInstruction>(patternResult.endIndex).reference
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.
// If RYD is disabled, or the TextView object is not that of the dislike button, the execution flow is not interrupted.

View File

@@ -27,6 +27,7 @@ object ShortsTextViewFingerprint : MethodFingerprint(
Opcode.IF_EQ,
Opcode.RETURN_VOID,
Opcode.IGET_OBJECT, // TextView field
Opcode.CHECK_CAST,
Opcode.IGET_BOOLEAN, // boolean field
)
)

View File

@@ -13,17 +13,13 @@ object TextComponentAtomicReferenceFingerprint : MethodFingerprint(
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.MOVE_OBJECT, // Register B is free register
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT, // Register A and B is context, use B as context, reuse A as free register
Opcode.INVOKE_VIRTUAL, // Register C is atomic reference
Opcode.MOVE_RESULT_OBJECT, // Register A is char sequence
Opcode.MOVE_OBJECT,
Opcode.CHECK_CAST,
Opcode.MOVE_OBJECT, // Replace this instruction with patch code
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_OBJECT,
Opcode.INVOKE_INTERFACE, // Insert hook here
Opcode.MOVE_RESULT,
Opcode.IF_EQZ,
Opcode.INVOKE_INTERFACE,

View File

@@ -13,14 +13,12 @@ object TextComponentContextFingerprint : MethodFingerprint(
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("L"),
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,
Opcode.IGET_OBJECT,
Opcode.IGET_BOOLEAN,
Opcode.IGET,
Opcode.IGET,
Opcode.IGET,
)
)