mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-07 09:53:55 +01:00
Compare commits
34 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 | ||
|
|
40f0a8cd0d | ||
|
|
47c858ef4e | ||
|
|
b17cd14d7d | ||
|
|
c7383bdf67 | ||
|
|
01e36428a0 | ||
|
|
187c1eb14a | ||
|
|
acadac3049 | ||
|
|
bf5c197eb8 | ||
|
|
73e8b3f81b | ||
|
|
1c2f499b1c | ||
|
|
32599ab13d | ||
|
|
19519d1d06 | ||
|
|
2ff70e8b8f | ||
|
|
1e21b0b572 | ||
|
|
18180745bc | ||
|
|
aa89b8d20c | ||
|
|
287648cf1e |
2
.github/workflows/pull_request.yml
vendored
2
.github/workflows/pull_request.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Open pull request
|
||||
uses: repo-sync/pull-request@v2
|
||||
with:
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Make sure the release step uses its own credentials:
|
||||
# https://github.com/cycjimmy/semantic-release-action#private-packages
|
||||
|
||||
100
CHANGELOG.md
100
CHANGELOG.md
@@ -1,3 +1,103 @@
|
||||
# [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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Video Id:** Fix video id not showing the currently playing video ([#3038](https://github.com/ReVanced/revanced-patches/issues/3038)) ([f6f226b](https://github.com/ReVanced/revanced-patches/commit/f6f226ba281823cb5d2d468c32f6e48551971726))
|
||||
|
||||
# [2.191.0-dev.19](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.18...v2.191.0-dev.19) (2023-09-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube:** Add `Bypass URL redirects` patch ([125cac5](https://github.com/ReVanced/revanced-patches/commit/125cac5928c9b71d35253f1fd7651f4a30e15529))
|
||||
|
||||
# [2.191.0-dev.18](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.17...v2.191.0-dev.18) (2023-09-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - Premium heading:** Allow using default heading ([#3029](https://github.com/ReVanced/revanced-patches/issues/3029)) ([d5ab35a](https://github.com/ReVanced/revanced-patches/commit/d5ab35a444523baa0586fcb9513d6ae4f2518946))
|
||||
|
||||
# [2.191.0-dev.17](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.16...v2.191.0-dev.17) (2023-09-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube:** Bump compatibility to `18.37.36` ([#3028](https://github.com/ReVanced/revanced-patches/issues/3028)) ([eda28e5](https://github.com/ReVanced/revanced-patches/commit/eda28e507e7fb5171eeb15a5a0532929ee611211))
|
||||
|
||||
# [2.191.0-dev.16](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.15...v2.191.0-dev.16) (2023-09-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Hide info cards:** Fix info cards not hiding for some users ([#3039](https://github.com/ReVanced/revanced-patches/issues/3039)) ([cb38637](https://github.com/ReVanced/revanced-patches/commit/cb38637e6be968d54561a1e0466b9259dbf0b4ee))
|
||||
|
||||
# [2.191.0-dev.15](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.14...v2.191.0-dev.15) (2023-09-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Client spoof:** adjust settings text ([#3035](https://github.com/ReVanced/revanced-patches/issues/3035)) ([59a2e96](https://github.com/ReVanced/revanced-patches/commit/59a2e9617fc4f898e87cefeb3d2c6996b925fa90))
|
||||
|
||||
# [2.191.0-dev.14](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.13...v2.191.0-dev.14) (2023-09-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Client spoof:** Show seekbar thumbnail for age restricted and paid videos ([1a79300](https://github.com/ReVanced/revanced-patches/commit/1a793007c919753a8c31ab2382d86c0546eefe20))
|
||||
|
||||
# [2.191.0-dev.13](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.12...v2.191.0-dev.13) (2023-09-25)
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 2.191.0-dev.13
|
||||
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,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,
|
||||
),
|
||||
)
|
||||
@@ -12,8 +12,8 @@ import app.revanced.util.microg.MicroGBytecodeHelper
|
||||
|
||||
|
||||
@Patch(
|
||||
name = "MicroG support",
|
||||
description = "Allows YouTube Music ReVanced to run without root and under a different package name.",
|
||||
name = "Vanced MicroG support",
|
||||
description = "Allows YouTube Music to run without root and under a different package name.",
|
||||
dependencies = [MicroGResourcePatch::class],
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -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(^)
|
||||
)
|
||||
)
|
||||
@@ -31,7 +31,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -18,7 +18,17 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
name = "Hide get premium",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.google.android.youtube", ["18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"])
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
object HideGetPremiumPatch : BytecodePatch(setOf(GetPremiumViewFingerprint)) {
|
||||
@@ -29,7 +29,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -24,7 +24,8 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -24,7 +24,8 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
),
|
||||
]
|
||||
|
||||
@@ -31,7 +31,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -31,7 +31,8 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.autocaptions
|
||||
|
||||
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
|
||||
@@ -28,7 +29,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
],
|
||||
@@ -47,38 +49,32 @@ object AutoCaptionsPatch : BytecodePatch(
|
||||
)
|
||||
)
|
||||
|
||||
val startVideoInformerMethod = StartVideoInformerFingerprint.result!!.mutableMethod
|
||||
mapOf(
|
||||
StartVideoInformerFingerprint to 0,
|
||||
SubtitleButtonControllerFingerprint to 1
|
||||
).forEach { (fingerprint, enabled) ->
|
||||
fingerprint.result?.mutableMethod?.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x$enabled
|
||||
sput-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
|
||||
"""
|
||||
) ?: throw fingerprint.exception
|
||||
}
|
||||
|
||||
startVideoInformerMethod.addInstructions(
|
||||
0, """
|
||||
const/4 v0, 0x0
|
||||
sput-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
|
||||
"""
|
||||
)
|
||||
|
||||
val subtitleButtonControllerMethod = SubtitleButtonControllerFingerprint.result!!.mutableMethod
|
||||
|
||||
subtitleButtonControllerMethod.addInstructions(
|
||||
0, """
|
||||
const/4 v0, 0x1
|
||||
sput-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
|
||||
"""
|
||||
)
|
||||
|
||||
val subtitleTrackMethod = SubtitleTrackFingerprint.result!!.mutableMethod
|
||||
|
||||
subtitleTrackMethod.addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->autoCaptionsEnabled()Z
|
||||
move-result v0
|
||||
if-eqz v0, :auto_captions_enabled
|
||||
sget-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
|
||||
if-nez v0, :auto_captions_enabled
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
:auto_captions_enabled
|
||||
nop
|
||||
"""
|
||||
SubtitleTrackFingerprint.result?.mutableMethod?.addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->autoCaptionsEnabled()Z
|
||||
move-result v0
|
||||
if-eqz v0, :auto_captions_enabled
|
||||
sget-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
|
||||
if-nez v0, :auto_captions_enabled
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
:auto_captions_enabled
|
||||
nop
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,25 +6,11 @@ import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object StartVideoInformerFingerprint : MethodFingerprint(
|
||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L", "L", "L"), listOf(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.INVOKE_DIRECT,
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.CONST_STRING,
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.CONST_4,
|
||||
Opcode.IF_EQ,
|
||||
Opcode.GOTO,
|
||||
)
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
strings = listOf("pc")
|
||||
)
|
||||
@@ -5,39 +5,57 @@ import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardCopyOption
|
||||
import kotlin.io.path.exists
|
||||
import app.revanced.patcher.patch.options.types.BooleanPatchOption.Companion.booleanPatchOption
|
||||
import kotlin.io.path.copyTo
|
||||
|
||||
@Patch(
|
||||
name = "Premium heading",
|
||||
description = "Shows premium branding on the home screen.",
|
||||
description = "Show or hide the premium heading.",
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.google.android.youtube")
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object PremiumHeadingPatch : ResourcePatch() {
|
||||
private const val DEFAULT_HEADING_RES = "yt_wordmark_header"
|
||||
private const val PREMIUM_HEADING_RES = "yt_premium_wordmark_header"
|
||||
|
||||
private val usePremiumHeading by booleanPatchOption(
|
||||
key = "usePremiumHeading",
|
||||
default = true,
|
||||
title = "Use premium heading",
|
||||
description = "Whether to use the premium heading.",
|
||||
required = true,
|
||||
)
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
val resDirectory = context["res"]
|
||||
if (!resDirectory.isDirectory) throw PatchException("The res folder can not be found.")
|
||||
|
||||
val (original, replacement) = "yt_premium_wordmark_header" to "yt_wordmark_header"
|
||||
val modes = arrayOf("light", "dark")
|
||||
val (original, replacement) = if (usePremiumHeading!!)
|
||||
PREMIUM_HEADING_RES to DEFAULT_HEADING_RES
|
||||
else
|
||||
DEFAULT_HEADING_RES to PREMIUM_HEADING_RES
|
||||
|
||||
arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi").forEach { size ->
|
||||
val headingDirectory = resDirectory.resolve("drawable-$size")
|
||||
modes.forEach { mode ->
|
||||
val fromPath = headingDirectory.resolve("${original}_$mode.png").toPath()
|
||||
val toPath = headingDirectory.resolve("${replacement}_$mode.png").toPath()
|
||||
val variants = arrayOf("light", "dark")
|
||||
|
||||
if (!fromPath.exists())
|
||||
throw PatchException("The file $fromPath does not exist in the resources. Therefore, this patch can not succeed.")
|
||||
Files.copy(
|
||||
fromPath,
|
||||
toPath,
|
||||
StandardCopyOption.REPLACE_EXISTING
|
||||
)
|
||||
arrayOf(
|
||||
"xxxhdpi",
|
||||
"xxhdpi",
|
||||
"xhdpi",
|
||||
"hdpi",
|
||||
"mdpi"
|
||||
).mapNotNull { dpi ->
|
||||
resDirectory.resolve("drawable-$dpi").takeIf { it.exists() }?.toPath()
|
||||
}.also {
|
||||
if (it.isEmpty())
|
||||
throw PatchException("The drawable folder can not be found. Therefore, the patch can not be applied.")
|
||||
}.forEach { path ->
|
||||
|
||||
variants.forEach { mode ->
|
||||
val fromPath = path.resolve("${original}_$mode.png")
|
||||
val toPath = path.resolve("${replacement}_$mode.png")
|
||||
|
||||
fromPath.copyTo(toPath, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -37,7 +37,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -28,7 +28,8 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -36,7 +36,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -32,7 +32,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -27,7 +27,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -27,7 +27,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -26,7 +26,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -27,7 +27,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -30,7 +30,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -7,8 +7,6 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||
object LayoutIconFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Landroid/view/View;",
|
||||
opcodes = listOf(
|
||||
Opcode.CONST_4,
|
||||
Opcode.CONST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
|
||||
@@ -27,7 +27,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -23,7 +23,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -27,7 +27,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
LithoFilterPatch::class,
|
||||
SettingsPatch::class
|
||||
],
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.youtube", ["18.32.39"])]
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideLayoutComponentsPatch : BytecodePatch(
|
||||
@@ -44,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"),
|
||||
|
||||
@@ -13,6 +13,7 @@ import app.revanced.patches.youtube.layout.hide.infocards.fingerprints.Infocards
|
||||
import app.revanced.patches.youtube.layout.hide.infocards.fingerprints.InfocardsIncognitoParentFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.infocards.fingerprints.InfocardsMethodCallFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@@ -22,6 +23,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
description = "Hides info cards in videos.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
LithoFilterPatch::class,
|
||||
HideInfocardsResourcePatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
@@ -33,7 +35,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
@@ -45,6 +48,9 @@ object HideInfoCardsPatch : BytecodePatch(
|
||||
InfocardsMethodCallFingerprint,
|
||||
)
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/HideInfoCardsFilterPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
InfocardsIncognitoFingerprint.also {
|
||||
it.resolve(context, InfocardsIncognitoParentFingerprint.result!!.classDef)
|
||||
@@ -79,5 +85,8 @@ object HideInfoCardsPatch : BytecodePatch(
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// Info cards can also appear as litho components.
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -23,7 +23,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -24,7 +24,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
])
|
||||
]
|
||||
)
|
||||
|
||||
@@ -32,7 +32,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -36,7 +36,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
@@ -54,8 +55,6 @@ object HideShortsComponentsPatch : BytecodePatch(
|
||||
private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/components/ShortsFilter;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
// region Hide the Shorts shelf.
|
||||
|
||||
ReelConstructorFingerprint.result?.let {
|
||||
@@ -74,13 +73,20 @@ object HideShortsComponentsPatch : BytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
// region Hide the Shorts buttons.
|
||||
// region Hide the Shorts buttons in older versions of YouTube.
|
||||
|
||||
// Some Shorts buttons are views, hide them by setting their visibility to GONE.
|
||||
CreateShortsButtonsFingerprint.result?.let {
|
||||
ShortsButtons.values().forEach { button -> button.injectHideCall(it.mutableMethod) }
|
||||
ShortsButtons.entries.forEach { button -> button.injectHideCall(it.mutableMethod) }
|
||||
} ?: throw CreateShortsButtonsFingerprint.exception
|
||||
|
||||
|
||||
// endregion
|
||||
|
||||
// region Hide the Shorts buttons in newer versions of YouTube.
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
// endregion
|
||||
|
||||
// region Hide the navigation bar.
|
||||
|
||||
@@ -24,7 +24,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -28,7 +28,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -24,7 +24,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -18,7 +18,8 @@ import org.w3c.dom.Element
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
],
|
||||
|
||||
@@ -51,9 +51,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// region Inject newVideoLoaded event handler to update dislikes when a new video is loaded.
|
||||
|
||||
// This patch needs a few adjustments and lots of testing before it can change to the new video id hook.
|
||||
// There's a few corner cases and some weirdness when loading new videos (specifically with detecting shorts).
|
||||
VideoIdPatch.legacyInjectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->newVideoLoaded(Ljava/lang/String;)V")
|
||||
VideoIdPatch.hookVideoId("$INTEGRATIONS_CLASS_DESCRIPTOR->newVideoLoaded(Ljava/lang/String;)V")
|
||||
|
||||
// endregion
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package app.revanced.patches.youtube.layout.returnyoutubedislike.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 ShortsTextViewFingerprint : MethodFingerprint(
|
||||
// 18.29.38 method is public final visibility, but in 18.23.35 and older it's protected final.
|
||||
// If 18.23.35 is dropped then accessFlags should be specified here.
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
returnType = "V",
|
||||
parameters = listOf("L", "L"),
|
||||
opcodes = listOf(
|
||||
|
||||
@@ -27,7 +27,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -44,7 +44,8 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
],
|
||||
@@ -95,11 +96,8 @@ object SponsorBlockBytecodePatch : BytecodePatch(
|
||||
|
||||
/*
|
||||
* Set current video id.
|
||||
*
|
||||
* The new video id hook seems to work without issues,
|
||||
* but it's easier to keep using this hook as it's well tested and has no known problems.
|
||||
*/
|
||||
VideoIdPatch.legacyInjectCallBackgroundPlay("$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
|
||||
VideoIdPatch.hookBackgroundPlayVideoId("$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
|
||||
|
||||
/*
|
||||
* Seekbar drawing
|
||||
|
||||
@@ -28,7 +28,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -23,7 +23,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -33,7 +33,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
)
|
||||
)
|
||||
]
|
||||
|
||||
@@ -25,7 +25,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -29,7 +29,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -24,7 +24,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -56,7 +56,7 @@ object SpoofSignaturePatch : BytecodePatch(
|
||||
+ "Side effects include:\\n"
|
||||
+ "• Enhanced bitrate is not available\\n"
|
||||
+ "• Videos cannot be downloaded\\n"
|
||||
+ "• No seekbar thumbnails for paid or age restricted videos"
|
||||
+ "• No seekbar thumbnails for paid videos"
|
||||
),
|
||||
StringResource(
|
||||
"revanced_spoof_signature_verification_enabled_summary_off",
|
||||
@@ -79,7 +79,7 @@ object SpoofSignaturePatch : BytecodePatch(
|
||||
),
|
||||
StringResource(
|
||||
"revanced_spoof_signature_in_feed_enabled_summary_off",
|
||||
"App signature not spoofed for feed videos\n\n"
|
||||
"App signature not spoofed for feed videos\\n\\n"
|
||||
+ "Feed videos will play for less than 1 minute before encountering playback issues"
|
||||
)
|
||||
)
|
||||
@@ -88,11 +88,12 @@ object SpoofSignaturePatch : BytecodePatch(
|
||||
)
|
||||
|
||||
// Hook the player parameters.
|
||||
PlayerResponseMethodHookPatch.injectProtoBufferHook("$INTEGRATIONS_CLASS_DESCRIPTOR->spoofParameter(Ljava/lang/String;)Ljava/lang/String;")
|
||||
PlayerResponseMethodHookPatch + PlayerResponseMethodHookPatch.Hook.ProtoBufferParameter(
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->spoofParameter(Ljava/lang/String;)Ljava/lang/String;"
|
||||
)
|
||||
|
||||
// Force the seekbar thumbnails to show up.
|
||||
// This is only required to show the seekbar time and chapters
|
||||
// if the storyboard spec fetch fails.
|
||||
// Force the seekbar time and chapters to always show up.
|
||||
// This is used only if the storyboard spec fetch fails, or when viewing paid videos.
|
||||
StoryboardThumbnailParentFingerprint.result?.classDef?.let { classDef ->
|
||||
StoryboardThumbnailFingerprint.also {
|
||||
it.resolve(
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package app.revanced.patches.youtube.misc.links
|
||||
|
||||
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.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.links.fingerprints.OpenLinksDirectlyPrimaryFingerprint
|
||||
import app.revanced.patches.youtube.misc.links.fingerprints.OpenLinksDirectlySecondaryFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Bypass URL redirects",
|
||||
description = "Bypass URL redirects and open the original URL directly.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
object BypassURLRedirectsPatch : BytecodePatch(
|
||||
setOf(OpenLinksDirectlyPrimaryFingerprint, OpenLinksDirectlySecondaryFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_bypass_url_redirects",
|
||||
StringResource("revanced_bypass_url_redirects_title", "Bypass URL redirects"),
|
||||
StringResource("revanced_bypass_url_redirects_summary_on", "URL redirects are bypassed"),
|
||||
StringResource("revanced_bypass_url_redirects_summary_off", "URL redirects are not bypassed"),
|
||||
)
|
||||
)
|
||||
|
||||
arrayOf(
|
||||
OpenLinksDirectlyPrimaryFingerprint,
|
||||
OpenLinksDirectlySecondaryFingerprint
|
||||
).map {
|
||||
it.result ?: throw it.exception
|
||||
}.forEach { result ->
|
||||
result.mutableMethod.apply {
|
||||
val insertIndex = result.scanResult.patternScanResult!!.startIndex
|
||||
val uriStringRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerC
|
||||
|
||||
replaceInstruction(
|
||||
insertIndex,
|
||||
"invoke-static {v$uriStringRegister}," +
|
||||
"Lapp/revanced/integrations/patches/BypassURLRedirectsPatch;" +
|
||||
"->" +
|
||||
"parseRedirectUri(Ljava/lang/String;)Landroid/net/Uri;"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,20 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
@Patch(
|
||||
name = "Open links externally",
|
||||
description = "Open links outside of the app directly in your browser.",
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.youtube", ["18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"])]
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object OpenLinksExternallyPatch : AbstractTransformInstructionsPatch<Pair<Int, Int>>(
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
package app.revanced.patches.duolingo.unlocksuper.fingerprints
|
||||
package app.revanced.patches.youtube.misc.links.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(
|
||||
object OpenLinksDirectlyPrimaryFingerprint : MethodFingerprint(
|
||||
returnType = "Ljava/lang/Object",
|
||||
parameters = listOf("Ljava/lang/Object"),
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
strings = listOf("user"),
|
||||
opcodes = listOf(Opcode.IGET_BOOLEAN),
|
||||
parameters = listOf("Ljava/lang/Object"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.RETURN_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.SGET,
|
||||
Opcode.SGET_OBJECT
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.revanced.patches.youtube.misc.links.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 OpenLinksDirectlySecondaryFingerprint : MethodFingerprint(
|
||||
returnType = "Landroid/net/Uri",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
parameters = listOf("Ljava/lang/String"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
strings = listOf("://")
|
||||
)
|
||||
@@ -103,7 +103,7 @@ object LithoFilterPatch : BytecodePatch(
|
||||
val emptyComponentFieldIndex = builderMethodIndex + 2
|
||||
|
||||
bytesToComponentContextMethod.mutableMethod.apply {
|
||||
val insertHookIndex = bytesToComponentContextMethod.scanResult.patternScanResult!!.endIndex
|
||||
val insertHookIndex = bytesToComponentContextMethod.scanResult.patternScanResult!!.endIndex + 1
|
||||
|
||||
// region Get free registers that this patch uses.
|
||||
// Registers are overwritten right after they are used in this patch, therefore free to clobber.
|
||||
|
||||
@@ -5,9 +5,9 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object ComponentContextParserFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.NEW_INSTANCE
|
||||
),
|
||||
strings = listOf("Component was not found %s because it was removed due to duplicate converter bindings.")
|
||||
)
|
||||
@@ -14,7 +14,7 @@ import app.revanced.util.microg.MicroGBytecodeHelper
|
||||
|
||||
@Patch(
|
||||
name = "Vanced MicroG support",
|
||||
description = "Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG.",
|
||||
description = "Allows YouTube to run without root and under a different package name with Vanced MicroG.",
|
||||
dependencies = [
|
||||
MicroGResourcePatch::class,
|
||||
HideCastButtonPatch::class,
|
||||
@@ -28,7 +28,8 @@ import app.revanced.util.microg.MicroGBytecodeHelper
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -34,7 +34,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -26,7 +26,8 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -109,9 +109,13 @@ object VideoInformationPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
/*
|
||||
* Inject call for video id
|
||||
* Inject call for video ids
|
||||
*/
|
||||
VideoIdPatch.injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->setVideoId(Ljava/lang/String;)V")
|
||||
val videoIdMethodDescriptor = "$INTEGRATIONS_CLASS_DESCRIPTOR->setVideoId(Ljava/lang/String;)V"
|
||||
VideoIdPatch.hookVideoId(videoIdMethodDescriptor)
|
||||
VideoIdPatch.hookBackgroundPlayVideoId(videoIdMethodDescriptor)
|
||||
VideoIdPatch.hookPlayerResponseVideoId(
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerResponseVideoId(Ljava/lang/String;)V")
|
||||
|
||||
/*
|
||||
* Set the video time method
|
||||
|
||||
@@ -7,66 +7,58 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.youtube.misc.fix.playback.SpoofSignaturePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.video.playerresponse.fingerprint.PlayerParameterBuilderFingerprint
|
||||
import app.revanced.patches.youtube.video.videoid.VideoIdPatch
|
||||
import java.io.Closeable
|
||||
|
||||
@Patch(
|
||||
dependencies = [IntegrationsPatch::class],
|
||||
)
|
||||
object PlayerResponseMethodHookPatch : BytecodePatch(
|
||||
setOf(
|
||||
PlayerParameterBuilderFingerprint,
|
||||
)
|
||||
) {
|
||||
private const val playerResponseVideoIdParameter = 1
|
||||
private const val playerResponseProtoBufferParameter = 3
|
||||
/**
|
||||
* Insert index when adding a video id hook.
|
||||
*/
|
||||
private var playerResponseVideoIdInsertIndex = 0
|
||||
/**
|
||||
* Insert index when adding a proto buffer override.
|
||||
* Must be after all video id hooks in the same method.
|
||||
*/
|
||||
private var playerResponseProtoBufferInsertIndex = 0
|
||||
object PlayerResponseMethodHookPatch :
|
||||
BytecodePatch(setOf(PlayerParameterBuilderFingerprint)),
|
||||
Closeable,
|
||||
MutableSet<PlayerResponseMethodHookPatch.Hook> by mutableSetOf() {
|
||||
private const val VIDEO_ID_PARAMETER = 1
|
||||
private const val PROTO_BUFFER_PARAMETER_PARAMETER = 3
|
||||
|
||||
private lateinit var playerResponseMethod: MutableMethod
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
// Hook player parameter.
|
||||
PlayerParameterBuilderFingerprint.result?.let {
|
||||
playerResponseMethod = it.mutableMethod
|
||||
} ?: throw PlayerParameterBuilderFingerprint.exception
|
||||
playerResponseMethod = PlayerParameterBuilderFingerprint.result?.mutableMethod
|
||||
?: throw PlayerParameterBuilderFingerprint.exception
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the player parameter proto buffer value.
|
||||
* Used exclusively by [SpoofSignaturePatch].
|
||||
*/
|
||||
fun injectProtoBufferHook(methodDescriptor: String) {
|
||||
playerResponseMethod.addInstructions(
|
||||
playerResponseProtoBufferInsertIndex,
|
||||
override fun close() {
|
||||
fun hookVideoId(hook: Hook) = playerResponseMethod.addInstruction(
|
||||
0, "invoke-static {p$VIDEO_ID_PARAMETER}, $hook"
|
||||
)
|
||||
|
||||
fun hookProtoBufferParameter(hook: Hook) = playerResponseMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
invoke-static {p$playerResponseProtoBufferParameter}, $methodDescriptor
|
||||
move-result-object p$playerResponseProtoBufferParameter
|
||||
invoke-static {p$PROTO_BUFFER_PARAMETER_PARAMETER}, $hook
|
||||
move-result-object p$PROTO_BUFFER_PARAMETER_PARAMETER
|
||||
"""
|
||||
)
|
||||
playerResponseProtoBufferInsertIndex += 2
|
||||
|
||||
// Reverse the order in order to preserve insertion order of the hooks.
|
||||
val beforeVideoIdHooks = filterIsInstance<Hook.ProtoBufferParameterBeforeVideoId>().asReversed()
|
||||
val videoIdHooks = filterIsInstance<Hook.VideoId>().asReversed()
|
||||
val afterVideoIdHooks = filterIsInstance<Hook.ProtoBufferParameter>().asReversed()
|
||||
|
||||
// Add the hooks in this specific order as they insert instructions at the beginning of the method.
|
||||
afterVideoIdHooks.forEach(::hookProtoBufferParameter)
|
||||
videoIdHooks.forEach(::hookVideoId)
|
||||
beforeVideoIdHooks.forEach(::hookProtoBufferParameter)
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by [VideoIdPatch].
|
||||
*/
|
||||
internal fun injectVideoIdHook(methodDescriptor: String) {
|
||||
playerResponseMethod.addInstruction(
|
||||
// Keep injection calls in the order they're added,
|
||||
// and all video id hooks run before proto buffer hooks.
|
||||
playerResponseVideoIdInsertIndex++,
|
||||
"invoke-static {p$playerResponseVideoIdParameter}, $methodDescriptor"
|
||||
)
|
||||
playerResponseProtoBufferInsertIndex++
|
||||
internal abstract class Hook(private val methodDescriptor: String) {
|
||||
internal class VideoId(methodDescriptor: String) : Hook(methodDescriptor)
|
||||
|
||||
internal class ProtoBufferParameter(methodDescriptor: String) : Hook(methodDescriptor)
|
||||
internal class ProtoBufferParameterBeforeVideoId(methodDescriptor: String) : Hook(methodDescriptor)
|
||||
|
||||
override fun toString() = methodDescriptor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,8 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -11,7 +11,7 @@ object SetQualityByIndexMethodClassFieldReferenceFingerprint : MethodFingerprint
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.RETURN_VOID
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
)
|
||||
)
|
||||
@@ -18,7 +18,8 @@ import app.revanced.patches.youtube.video.speed.remember.RememberPlaybackSpeedPa
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -26,8 +26,8 @@ object VideoIdPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
private var videoIdRegister = 0
|
||||
private var insertIndex = 0
|
||||
private lateinit var insertMethod: MutableMethod
|
||||
private var videoIdInsertIndex = 0
|
||||
private lateinit var videoIdMethod: MutableMethod
|
||||
|
||||
private var backgroundPlaybackVideoIdRegister = 0
|
||||
private var backgroundPlaybackInsertIndex = 0
|
||||
@@ -52,8 +52,8 @@ object VideoIdPatch : BytecodePatch(
|
||||
} ?: throw VideoIdFingerprint.exception
|
||||
|
||||
VideoIdFingerprint.setFields { method, index, register ->
|
||||
insertMethod = method
|
||||
insertIndex = index
|
||||
videoIdMethod = method
|
||||
videoIdInsertIndex = index
|
||||
videoIdRegister = register
|
||||
}
|
||||
|
||||
@@ -65,21 +65,7 @@ object VideoIdPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an invoke-static instruction, called with the new id when the video changes.
|
||||
*
|
||||
* Called as soon as the player response is parsed, and called before many other hooks are
|
||||
* updated such as [PlayerTypeHookPatch].
|
||||
*
|
||||
* Supports all videos and functions in all situations.
|
||||
*
|
||||
* Be aware, this can be called multiple times for the same video id.
|
||||
*
|
||||
* @param methodDescriptor which method to call. Params have to be `Ljava/lang/String;`
|
||||
*/
|
||||
fun injectCall(methodDescriptor: String) = PlayerResponseMethodHookPatch.injectVideoIdHook(methodDescriptor)
|
||||
|
||||
/**
|
||||
* Adds an invoke-static instruction, called with the new id when the video changes.
|
||||
* Hooks the new video id when the video changes.
|
||||
*
|
||||
* Supports all videos (regular videos and Shorts).
|
||||
*
|
||||
@@ -89,10 +75,10 @@ object VideoIdPatch : BytecodePatch(
|
||||
*
|
||||
* @param methodDescriptor which method to call. Params have to be `Ljava/lang/String;`
|
||||
*/
|
||||
fun legacyInjectCall(
|
||||
fun hookVideoId(
|
||||
methodDescriptor: String
|
||||
) = insertMethod.addInstruction(
|
||||
insertIndex++,
|
||||
) = videoIdMethod.addInstruction(
|
||||
videoIdInsertIndex++,
|
||||
"invoke-static {v$videoIdRegister}, $methodDescriptor"
|
||||
)
|
||||
|
||||
@@ -106,11 +92,37 @@ object VideoIdPatch : BytecodePatch(
|
||||
*
|
||||
* @param methodDescriptor which method to call. Params have to be `Ljava/lang/String;`
|
||||
*/
|
||||
fun legacyInjectCallBackgroundPlay(
|
||||
fun hookBackgroundPlayVideoId(
|
||||
methodDescriptor: String
|
||||
) = backgroundPlaybackMethod.addInstruction(
|
||||
backgroundPlaybackInsertIndex++, // move-result-object offset
|
||||
"invoke-static {v$backgroundPlaybackVideoIdRegister}, $methodDescriptor"
|
||||
)
|
||||
|
||||
/**
|
||||
* Hooks the video id of every video when loaded.
|
||||
* Supports all videos and functions in all situations.
|
||||
*
|
||||
* Hook is always called off the main thread.
|
||||
*
|
||||
* This hook is called as soon as the player response is parsed,
|
||||
* and called before many other hooks are updated such as [PlayerTypeHookPatch].
|
||||
*
|
||||
* Note: The video id returned here may not be the current video that's being played.
|
||||
* It's common for multiple Shorts to load at once in preparation
|
||||
* for the user swiping to the next Short.
|
||||
*
|
||||
* For most use cases, you probably want to use
|
||||
* [hookVideoId] or [hookBackgroundPlayVideoId] instead.
|
||||
*
|
||||
* Be aware, this can be called multiple times for the same video id.
|
||||
*
|
||||
* @param methodDescriptor which method to call. Params have to be `Ljava/lang/String;`
|
||||
*/
|
||||
fun hookPlayerResponseVideoId(methodDescriptor: String) {
|
||||
PlayerResponseMethodHookPatch + PlayerResponseMethodHookPatch.Hook.VideoId(
|
||||
methodDescriptor
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
"18.32.39",
|
||||
"18.37.36"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user