Compare commits

...

18 Commits

Author SHA1 Message Date
semantic-release-bot
aa89b8d20c chore(release): 2.191.0-dev.14 [skip ci]
# [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 ([287648c](287648cf1e))
2023-09-26 02:51:39 +00:00
oSumAtrIX
287648cf1e fix(YouTube - Client spoof): Show seekbar thumbnail for age restricted and paid videos 2023-09-26 04:48:37 +02:00
semantic-release-bot
c4554b3564 chore(release): 2.191.0-dev.13 [skip ci]
# [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)

### Bug Fixes

* **YouTube - Client spoof:** Removed unused code ([#3030](https://github.com/ReVanced/revanced-patches/issues/3030)) ([1532d89](1532d899b4))
2023-09-25 22:49:26 +00:00
LisoUseInAIKyrios
1532d899b4 fix(YouTube - Client spoof): Removed unused code (#3030)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-09-26 00:46:35 +02:00
semantic-release-bot
8ac18e6e23 chore(release): 2.191.0-dev.12 [skip ci]
# [2.191.0-dev.12](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.11...v2.191.0-dev.12) (2023-09-25)

### Bug Fixes

* **YouTube - Client spoof:** Display seekbar thumbnails in high quality ([54aa358](54aa358b9f))
2023-09-25 21:54:35 +00:00
oSumAtrIX
54aa358b9f fix(YouTube - Client spoof): Display seekbar thumbnails in high quality 2023-09-25 23:50:51 +02:00
semantic-release-bot
147d0eef34 chore(release): 2.191.0-dev.11 [skip ci]
# [2.191.0-dev.11](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.10...v2.191.0-dev.11) (2023-09-25)

### Features

* Add notice for thumbnails for age restricted or paid videos ([fb60603](fb60603782))
2023-09-25 18:12:05 +00:00
oSumAtrIX
fb60603782 feat: Add notice for thumbnails for age restricted or paid videos 2023-09-25 19:33:53 +02:00
semantic-release-bot
18a2a4ceb4 chore(release): 2.191.0-dev.10 [skip ci]
# [2.191.0-dev.10](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.9...v2.191.0-dev.10) (2023-09-25)

### Bug Fixes

* **YouTube - Client spoof:** Restore seekbar thumbnails ([7d822dd](7d822ddbec))
2023-09-25 14:37:23 +00:00
oSumAtrIX
7d822ddbec fix(YouTube - Client spoof): Restore seekbar thumbnails
This works around the issue, but causes seekbar thumbnails to be in low quality.
2023-09-25 16:34:08 +02:00
semantic-release-bot
e74e65364a chore(release): 2.191.0-dev.9 [skip ci]
# [2.191.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.8...v2.191.0-dev.9) (2023-09-25)

### Features

* **Strava:** Add `Disable subscription suggestions` patch ([#2997](https://github.com/ReVanced/revanced-patches/issues/2997)) ([ef24167](ef241671bd))
2023-09-25 14:32:01 +00:00
xehpuk
ef241671bd feat(Strava): Add Disable subscription suggestions patch (#2997)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-09-25 16:29:06 +02:00
LisoUseInAIKyrios
096fc12123 build: fix aapt compilation error 2023-09-25 14:03:48 +04:00
semantic-release-bot
f166bd7ea7 chore(release): 2.191.0-dev.8 [skip ci]
# [2.191.0-dev.8](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.7...v2.191.0-dev.8) (2023-09-24)

### Bug Fixes

* **Relay - Spoof client:** Restore OAuth login ([df43cea](df43cea4f8))
* **Slide - Spoof client:** Use correct patch name ([444b196](444b196f41))
2023-09-24 21:57:15 +00:00
oSumAtrIX
df43cea4f8 fix(Relay - Spoof client): Restore OAuth login 2023-09-24 23:54:26 +02:00
oSumAtrIX
444b196f41 fix(Slide - Spoof client): Use correct patch name 2023-09-24 23:52:46 +02:00
semantic-release-bot
884bf29804 chore(release): 2.191.0-dev.7 [skip ci]
# [2.191.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.6...v2.191.0-dev.7) (2023-09-24)

### Bug Fixes

* **Duolingo - Unlock Super:** Get correct instruction offset ([#3023](https://github.com/ReVanced/revanced-patches/issues/3023)) ([144fabe](144fabe571))
2023-09-24 15:10:12 +00:00
Oyssale
144fabe571 fix(Duolingo - Unlock Super): Get correct instruction offset (#3023) 2023-09-24 17:07:10 +02:00
27 changed files with 527 additions and 238 deletions

View File

@@ -1,3 +1,60 @@
# [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)
### Bug Fixes
* **YouTube - Client spoof:** Removed unused code ([#3030](https://github.com/ReVanced/revanced-patches/issues/3030)) ([15e27bf](https://github.com/ReVanced/revanced-patches/commit/15e27bf93e6366ba8a59091409c4271c8230edb6))
# [2.191.0-dev.12](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.11...v2.191.0-dev.12) (2023-09-25)
### Bug Fixes
* **YouTube - Client spoof:** Display seekbar thumbnails in high quality ([5e8a2d3](https://github.com/ReVanced/revanced-patches/commit/5e8a2d3fe77a4a08ea32e7dc22f2c8e4048b7a6b))
# [2.191.0-dev.11](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.10...v2.191.0-dev.11) (2023-09-25)
### Features
* Add notice for thumbnails for age restricted or paid videos ([f7cf70b](https://github.com/ReVanced/revanced-patches/commit/f7cf70b5d3f415411fa767931a33e84df9df6c16))
# [2.191.0-dev.10](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.9...v2.191.0-dev.10) (2023-09-25)
### Bug Fixes
* **YouTube - Client spoof:** Restore seekbar thumbnails ([bf4a115](https://github.com/ReVanced/revanced-patches/commit/bf4a1159ff745f8f91e11f30db4651d85769227b))
# [2.191.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.8...v2.191.0-dev.9) (2023-09-25)
### Features
* **Strava:** Add `Disable subscription suggestions` patch ([#2997](https://github.com/ReVanced/revanced-patches/issues/2997)) ([af02175](https://github.com/ReVanced/revanced-patches/commit/af0217594d9c7526f550fc7e6f09f8a9232e72cf))
# [2.191.0-dev.8](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.7...v2.191.0-dev.8) (2023-09-24)
### Bug Fixes
* **Relay - Spoof client:** Restore OAuth login ([96e01f7](https://github.com/ReVanced/revanced-patches/commit/96e01f7a7b87f468776fbde48e114a3f51630a46))
* **Slide - Spoof client:** Use correct patch name ([f355dbf](https://github.com/ReVanced/revanced-patches/commit/f355dbf1d2af3075c6a3f13d8bf5f8dca22e6005))
# [2.191.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.6...v2.191.0-dev.7) (2023-09-24)
### Bug Fixes
* **Duolingo - Unlock Super:** Get correct instruction offset ([#3023](https://github.com/ReVanced/revanced-patches/issues/3023)) ([5146de8](https://github.com/ReVanced/revanced-patches/commit/5146de872acb17d7c21019ac7ed531f27361038f))
# [2.191.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v2.191.0-dev.5...v2.191.0-dev.6) (2023-09-23)

View File

@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 2.191.0-dev.6
version = 2.191.0-dev.14

File diff suppressed because one or more lines are too long

View File

@@ -54,8 +54,8 @@ object UnlockDuolingoSuperPatch : BytecodePatch(
}
private fun MutableMethod.indexOfReference(reference: Reference) = getInstructions()
.filterIsInstance<BuilderInstruction22c>()
.filter { it.opcode == Opcode.IPUT_BOOLEAN }.indexOfFirst { it.reference == reference }.let {
.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

@@ -14,9 +14,11 @@ abstract class AbstractSpoofClientPatch(
private val redirectUri: String,
private val clientIdFingerprints: List<MethodFingerprint>,
private val userAgentFingerprints: List<MethodFingerprint>? = null,
private val miscellaneousFingerprints: List<MethodFingerprint>? = null
) : BytecodePatch(buildSet {
addAll(clientIdFingerprints)
userAgentFingerprints?.let(::addAll)
miscellaneousFingerprints?.let(::addAll)
}) {
var clientId by stringPatchOption(
"client-id",
@@ -56,10 +58,12 @@ abstract class AbstractSpoofClientPatch(
clientIdFingerprints.executePatch { patchClientId(context) }
userAgentFingerprints.executePatch { patchUserAgent(context) }
miscellaneousFingerprints.executePatch { patchMiscellaneous(context) }
}
/**
* Patch the client ID. The fingerprints are guaranteed to be in the same order as in [clientIdFingerprints].
* Patch the client ID.
* The fingerprints are guaranteed to be in the same order as in [clientIdFingerprints].
*
* @param context The current [BytecodeContext].
*
@@ -67,10 +71,19 @@ abstract class AbstractSpoofClientPatch(
abstract fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext)
/**
* Patch the user agent. The fingerprints are guaranteed to be in the same order as in [userAgentFingerprints].
* Patch the user agent.
* The fingerprints are guaranteed to be in the same order as in [userAgentFingerprints].
*
* @param context The current [BytecodeContext].
*/
// Not every client needs to patch the user agent.
open fun List<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext) {}
/**
* Patch miscellaneous things such as protection measures.
* The fingerprints are guaranteed to be in the same order as in [miscellaneousFingerprints].
*
* @param context The current [BytecodeContext].
*/
open fun List<MethodFingerprintResult>.patchMiscellaneous(context: BytecodeContext) { }
}

View File

@@ -1,16 +1,14 @@
package app.revanced.patches.reddit.customclients.relayforreddit.api
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.GetLoggedInBearerTokenFingerprint
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.GetLoggedOutBearerTokenFingerprint
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.GetRefreshTokenFingerprint
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.LoginActivityClientIdFingerprint
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.*
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch(
@@ -31,7 +29,8 @@ object SpoofClientPatch : AbstractSpoofClientPatch(
GetLoggedInBearerTokenFingerprint,
GetLoggedOutBearerTokenFingerprint,
GetRefreshTokenFingerprint
)
),
miscellaneousFingerprints = listOf(SetRemoteConfigFingerprint)
) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
forEach {
@@ -46,4 +45,8 @@ object SpoofClientPatch : AbstractSpoofClientPatch(
}
}
}
override fun List<MethodFingerprintResult>.patchMiscellaneous(context: BytecodeContext) =
// Do not load remote config which disables OAuth login remotely
first().mutableMethod.addInstructions(0, "return-void")
}

View File

@@ -0,0 +1,8 @@
package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object SetRemoteConfigFingerprint : MethodFingerprint(
strings = listOf("reddit_oauth_url"),
parameters = listOf("Lcom/google/firebase/remoteconfig/FirebaseRemoteConfig;")
)

View File

@@ -9,7 +9,7 @@ import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
@Patch(
name = "Slide client spoof",
name = "Spoof client",
description = "Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"http://www.ccrama.me\".",

View File

@@ -10,7 +10,7 @@ import app.revanced.patches.strava.subscription.fingerprints.GetSubscribedFinger
@Patch(
name = "Unlock subscription features",
description = "Unlocks \"Matched Runs\" and \"Segment Efforts\".",
description = "Unlocks \"Routes\", \"Matched Runs\" and \"Segment Efforts\".",
compatiblePackages = [CompatiblePackage("com.strava", ["320.12"])]
)
@Suppress("unused")
@@ -19,4 +19,4 @@ object UnlockSubscriptionPatch : BytecodePatch(setOf(GetSubscribedFingerprint))
val isSubscribedIndex = result.scanResult.patternScanResult!!.startIndex
result.mutableMethod.replaceInstruction(isSubscribedIndex, "const/4 v0, 0x1")
} ?: throw GetSubscribedFingerprint.exception
}
}

View File

@@ -6,6 +6,6 @@ import com.android.tools.smali.dexlib2.Opcode
object GetSubscribedFingerprint : MethodFingerprint(
opcodes = listOf(Opcode.IGET_BOOLEAN),
customFingerprint = { methodDef, classDef ->
classDef.type.endsWith("SubscriptionDetailResponse;") && methodDef.name == "getSubscribed"
classDef.type.endsWith("/SubscriptionDetailResponse;") && methodDef.name == "getSubscribed"
}
)

View File

@@ -0,0 +1,72 @@
package app.revanced.patches.strava.upselling
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patches.strava.upselling.fingerprints.GetModulesFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
@Patch(
name = "Disable subscription suggestions",
compatiblePackages = [CompatiblePackage("com.strava", ["320.12"])]
)
@Suppress("unused")
object DisableSubscriptionSuggestionsPatch : BytecodePatch(
setOf(GetModulesFingerprint)
) {
private const val HELPER_METHOD_NAME = "getModulesIfNotUpselling"
private const val PAGE_SUFFIX = "_upsell"
private const val LABEL = "original"
override fun execute(context: BytecodeContext) = GetModulesFingerprint.result?.let { result ->
val className = result.classDef.type
val originalMethod = result.mutableMethod
val returnType = originalMethod.returnType
result.mutableClass.methods.add(ImmutableMethod(
className,
HELPER_METHOD_NAME,
emptyList(),
returnType,
AccessFlags.PRIVATE.value,
null,
null,
MutableMethodImplementation(3)
).toMutable().apply {
addInstructions(
"""
iget-object v0, p0, $className->page:Ljava/lang/String;
const-string v1, "$PAGE_SUFFIX"
invoke-virtual {v0, v1}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
move-result v0
if-eqz v0, :$LABEL
invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
move-result-object v0
return-object v0
:$LABEL
iget-object v0, p0, $className->modules:Ljava/util/List;
return-object v0
"""
)
})
val getModulesIndex = result.scanResult.patternScanResult!!.startIndex
with(originalMethod) {
removeInstruction(getModulesIndex)
addInstructions(
getModulesIndex,
"""
invoke-direct {p0}, $className->$HELPER_METHOD_NAME()$returnType
move-result-object v0
"""
)
}
} ?: throw GetModulesFingerprint.exception
}

View File

@@ -0,0 +1,11 @@
package app.revanced.patches.strava.upselling.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
object GetModulesFingerprint : MethodFingerprint(
opcodes = listOf(Opcode.IGET_OBJECT),
customFingerprint = { methodDef, classDef ->
classDef.type.endsWith("/GenericLayoutEntry;") && methodDef.name == "getModules"
}
)

View File

@@ -14,8 +14,8 @@ import app.revanced.util.resources.ResourceUtils.mergeStrings
@Patch(
dependencies = [
BottomControlsResourcePatch::class,
SettingsPatch::class
SettingsPatch::class,
BottomControlsResourcePatch::class
]
)
object CopyVideoUrlResourcePatch : ResourcePatch() {

View File

@@ -51,7 +51,9 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
override fun execute(context: BytecodeContext) {
// region Inject newVideoLoaded event handler to update dislikes when a new video is loaded.
VideoIdPatch.injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->newVideoLoaded(Ljava/lang/String;)V")
// 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")
// endregion

View File

@@ -94,9 +94,12 @@ object SponsorBlockBytecodePatch : BytecodePatch(
}
/*
* Set current video id
* 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.injectCallBackgroundPlay("$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
VideoIdPatch.legacyInjectCallBackgroundPlay("$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
/*
* Seekbar drawing

View File

@@ -3,103 +3,174 @@ package app.revanced.patches.youtube.misc.fix.playback
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.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
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.fingerprints.ProtobufParameterBuilderFingerprint
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.ScrubbedPreviewLayoutFingerprint
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.StoryboardThumbnailFingerprint
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.StoryboardThumbnailParentFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.*
import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.patches.youtube.video.playerresponse.PlayerResponseMethodHookPatch
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch(
description = "Spoofs the signature to prevent playback issues.",
dependencies = [
SpoofSignatureResourcePatch::class,
IntegrationsPatch::class,
PlayerTypeHookPatch::class
SettingsPatch::class,
PlayerTypeHookPatch::class,
PlayerResponseMethodHookPatch::class,
]
)
object SpoofSignaturePatch : BytecodePatch(
setOf(
ProtobufParameterBuilderFingerprint,
PlayerResponseModelImplFingerprint,
StoryboardThumbnailParentFingerprint,
ScrubbedPreviewLayoutFingerprint
StoryboardRendererSpecFingerprint,
StoryboardRendererInitFingerprint
)
) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/patches/SpoofSignaturePatch;"
"Lapp/revanced/integrations/patches/spoof/SpoofSignaturePatch;"
override fun execute(context: BytecodeContext) {
// hook parameter
ProtobufParameterBuilderFingerprint.result?.let {
val setParamMethod = context
.toMethodWalker(it.method)
.nextMethod(it.scanResult.patternScanResult!!.startIndex, true).getMethod() as MutableMethod
SettingsPatch.PreferenceScreen.MISC.addPreferences(
PreferenceScreen(
key = "revanced_spoof_signature_verification",
title = StringResource(
"revanced_spoof_signature_verification_title",
"Spoof app signature"
),
preferences = listOf(
SwitchPreference(
"revanced_spoof_signature_verification_enabled",
StringResource("revanced_spoof_signature_verification_enabled_title", "Spoof app signature"),
StringResource(
"revanced_spoof_signature_verification_enabled_summary_on",
"App signature spoofed\\n\\n"
+ "Side effects include:\\n"
+ "• Enhanced bitrate is not available\\n"
+ "• Videos cannot be downloaded"
),
StringResource(
"revanced_spoof_signature_verification_enabled_summary_off",
"App signature not spoofed\\n\\nVideo playback may not work"
),
StringResource(
"revanced_spoof_signature_verification_enabled_user_dialog_message",
"Turning off this setting will cause video playback issues."
)
),
SwitchPreference(
"revanced_spoof_signature_in_feed_enabled",
StringResource("revanced_spoof_signature_in_feed_enabled_title", "Spoof app signature in feed"),
StringResource(
"revanced_spoof_signature_in_feed_enabled_summary_on",
"App signature spoofed\\n\\n"
+ "Side effects include:\\n"
+ "• Feed videos are missing subtitles\\n"
+ "• Automatically played feed videos will show up in your watch history"
),
StringResource(
"revanced_spoof_signature_in_feed_enabled_summary_off",
"App signature not spoofed for feed videos\n\n"
+ "Feed videos will play for less than 1 minute before encountering playback issues"
)
)
)
)
)
setParamMethod.apply {
val protobufParameterRegister = 3
// Hook the player parameters.
PlayerResponseMethodHookPatch.injectProtoBufferHook("$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.
StoryboardThumbnailParentFingerprint.result?.classDef?.let { classDef ->
StoryboardThumbnailFingerprint.also {
it.resolve(
context,
classDef
)
}.result?.let {
val endIndex = it.scanResult.patternScanResult!!.endIndex
// Replace existing instruction to preserve control flow label.
// The replaced return instruction always returns false
// (it is the 'no thumbnails found' control path),
// so there is no need to pass the existing return value to integrations.
it.mutableMethod.replaceInstruction(
endIndex,
"""
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarThumbnailOverrideValue()Z
"""
)
// Since this is end of the method must replace one line then add the rest.
it.mutableMethod.addInstructions(
endIndex + 1,
"""
move-result v0
return v0
"""
)
} ?: throw StoryboardThumbnailFingerprint.exception
}
/**
* Hook StoryBoard renderer url
*/
PlayerResponseModelImplFingerprint.result?.let {
it.mutableMethod.apply {
val getStoryBoardIndex = it.scanResult.patternScanResult!!.endIndex
val getStoryBoardRegister = getInstruction<OneRegisterInstruction>(getStoryBoardIndex).registerA
addInstructions(
getStoryBoardIndex,
"""
invoke-static { v$getStoryBoardRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getStoryboardRendererSpec(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$getStoryBoardRegister
"""
)
}
} ?: throw PlayerResponseModelImplFingerprint.exception
StoryboardRendererSpecFingerprint.result?.let {
it.mutableMethod.apply {
val storyBoardUrlParams = 0
addInstructionsWithLabels(
0,
"""
invoke-static {p$protobufParameterRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->spoofParameter(Ljava/lang/String;)Ljava/lang/String;
move-result-object p$protobufParameterRegister
"""
if-nez p$storyBoardUrlParams, :ignore
invoke-static { p$storyBoardUrlParams }, $INTEGRATIONS_CLASS_DESCRIPTOR->getStoryboardRendererSpec(Ljava/lang/String;)Ljava/lang/String;
move-result-object p$storyBoardUrlParams
""",
ExternalLabel("ignore", getInstruction(0))
)
}
} ?: throw ProtobufParameterBuilderFingerprint.exception
} ?: throw StoryboardRendererSpecFingerprint.exception
// Hook recommended value
StoryboardRendererInitFingerprint.result?.let {
val moveOriginalRecommendedValueIndex = it.scanResult.patternScanResult!!.endIndex
// When signature spoofing is enabled, the seekbar when tapped does not show
// the video time, chapter names, or the video thumbnail.
// Changing the value returned of this method forces all of these to show up,
// except the thumbnails are blank, which is handled with the patch below.
StoryboardThumbnailParentFingerprint.result ?: throw StoryboardThumbnailParentFingerprint.exception
StoryboardThumbnailFingerprint.resolve(context, StoryboardThumbnailParentFingerprint.result!!.classDef)
StoryboardThumbnailFingerprint.result?.apply {
val endIndex = scanResult.patternScanResult!!.endIndex
// Replace existing instruction to preserve control flow label.
// The replaced return instruction always returns false
// (it is the 'no thumbnails found' control path),
// so there is no need to pass the existing return value to integrations.
mutableMethod.replaceInstruction(
endIndex,
"""
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarThumbnailOverrideValue()Z
"""
)
// Since this is end of the method must replace one line then add the rest.
mutableMethod.addInstructions(
endIndex + 1,
"""
move-result v0
return v0
"""
)
} ?: throw StoryboardThumbnailFingerprint.exception
val originalValueRegister = it.mutableMethod
.getInstruction<OneRegisterInstruction>(moveOriginalRecommendedValueIndex).registerA
// Seekbar thumbnail now show up but are always a blank image.
// Additional changes are needed to force the client to generate the thumbnails (assuming it's possible),
// but for now hide the empty thumbnail.
ScrubbedPreviewLayoutFingerprint.result?.apply {
val endIndex = scanResult.patternScanResult!!.endIndex
mutableMethod.apply {
val imageViewFieldName = getInstruction<ReferenceInstruction>(endIndex).reference
it.mutableMethod.apply {
addInstructions(
implementation!!.instructions.lastIndex,
"""
iget-object v0, p0, $imageViewFieldName # copy imageview field to a register
invoke-static {v0}, $INTEGRATIONS_CLASS_DESCRIPTOR->seekbarImageViewCreated(Landroid/widget/ImageView;)V
moveOriginalRecommendedValueIndex + 1,
"""
invoke-static { v$originalValueRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getRecommendedLevel(I)I
move-result v$originalValueRegister
"""
)
}
} ?: throw ScrubbedPreviewLayoutFingerprint.exception
} ?: throw StoryboardRendererInitFingerprint.exception
}
}

View File

@@ -1,69 +0,0 @@
package app.revanced.patches.youtube.misc.fix.playback
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.misc.settings.SettingsPatch
@Patch(dependencies = [SettingsPatch::class, ResourceMappingPatch::class])
object SpoofSignatureResourcePatch : ResourcePatch() {
internal var scrubbedPreviewThumbnailResourceId: Long = -1
override fun execute(context: ResourceContext) {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
PreferenceScreen(
key = "revanced_spoof_signature_verification",
title = StringResource(
"revanced_spoof_signature_verification_title",
"Spoof app signature"
),
preferences = listOf(
SwitchPreference(
"revanced_spoof_signature_verification_enabled",
StringResource("revanced_spoof_signature_verification_enabled_title", "Spoof app signature"),
StringResource(
"revanced_spoof_signature_verification_enabled_summary_on",
"App signature spoofed\\n\\n"
+ "Side effects include:\\n"
+ "• No ambient mode\\n"
+ "• Videos can't be downloaded\\n"
+ "• Seekbar thumbnails are hidden"
),
StringResource(
"revanced_spoof_signature_verification_enabled_summary_off",
"App signature not spoofed\\n\\nVideo playback may not work"
),
StringResource(
"revanced_spoof_signature_verification_enabled_user_dialog_message",
"Turning off this setting will cause video playback issues."
)
),
SwitchPreference(
"revanced_spoof_signature_in_feed_enabled",
StringResource("revanced_spoof_signature_in_feed_enabled_title", "Spoof app signature in feed"),
StringResource(
"revanced_spoof_signature_in_feed_enabled_summary_on",
"App signature spoofed\\n\\n"
+ "Side effects include:\\n"
+ "• Feed videos are missing subtitles\\n"
+ "• Automatically played feed videos will show up in your watch history"
),
StringResource(
"revanced_spoof_signature_in_feed_enabled_summary_off",
"App signature not spoofed for feed videos\n\n"
+ "Feed videos will play for less than 1 minute before encountering playback issues"
)
)
)
)
)
scrubbedPreviewThumbnailResourceId = ResourceMappingPatch.resourceMappings.single {
it.type == "id" && it.name == "thumbnail"
}.id
}
}

View File

@@ -0,0 +1,23 @@
package app.revanced.patches.youtube.misc.fix.playback.fingerprints
import app.revanced.extensions.containsConstantInstructionValue
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 PlayerResponseModelImplFingerprint : MethodFingerprint(
returnType = "Ljava/lang/String;",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = emptyList(),
opcodes = listOf(
Opcode.RETURN_OBJECT,
Opcode.CONST_4,
Opcode.RETURN_OBJECT
),
customFingerprint = handler@{ methodDef, _ ->
if (!methodDef.definingClass.endsWith("/PlayerResponseModelImpl;")) return@handler false
methodDef.containsConstantInstructionValue(55735497)
}
)

View File

@@ -1,27 +0,0 @@
package app.revanced.patches.youtube.misc.fix.playback.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.youtube.misc.fix.playback.SpoofSignatureResourcePatch
import app.revanced.util.patch.LiteralValueFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
object ScrubbedPreviewLayoutFingerprint : LiteralValueFingerprint(
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
returnType = "V",
parameters = listOf("Landroid/content/Context;", "Landroid/util/AttributeSet;", "I", "I"),
opcodes = listOf(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.INVOKE_VIRTUAL,
Opcode.CONST,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.IPUT_OBJECT, // preview imageview
),
// This resource is used in ~ 40 different locations, but this method has a distinct list of parameters to match to.
literalSupplier = { SpoofSignatureResourcePatch.scrubbedPreviewThumbnailResourceId }
)

View File

@@ -3,11 +3,13 @@ package app.revanced.patches.youtube.misc.fix.playback.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
object ProtobufParameterBuilderFingerprint : MethodFingerprint(
object StoryboardRendererInitFingerprint : MethodFingerprint(
strings = listOf("#-1#"),
opcodes = listOf(
Opcode.INVOKE_VIRTUAL_RANGE,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IPUT_OBJECT
),
strings = listOf("Unexpected empty videoId.", "Prefetch request are disabled.")
)
Opcode.IPUT_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT
)
)

View File

@@ -0,0 +1,12 @@
package app.revanced.patches.youtube.misc.fix.playback.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
object StoryboardRendererSpecFingerprint : MethodFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
returnType = "L",
parameters = listOf("Ljava/lang/String;", "J"),
strings = listOf("\\|"),
)

View File

@@ -23,6 +23,7 @@ object PlayerControlsBytecodePatch : BytecodePatch(
private var moveToRegisterInstructionIndex: Int = 0
private var viewRegister: Int = 0
private lateinit var inflateFingerprintResult: MethodFingerprintResult
override fun execute(context: BytecodeContext) {
LayoutConstructorFingerprint.result?.let {
@@ -31,17 +32,13 @@ object PlayerControlsBytecodePatch : BytecodePatch(
} ?: throw LayoutConstructorFingerprint.exception
showPlayerControlsFingerprintResult = PlayerControlsVisibilityFingerprint.result!!
inflateFingerprintResult = BottomControlsInflateFingerprint.result!!
}
private var inflateFingerprintResult: MethodFingerprintResult? = null
set(fingerprint) {
field = fingerprint!!.also {
moveToRegisterInstructionIndex = it.scanResult.patternScanResult!!.endIndex
viewRegister =
(it.mutableMethod.implementation!!.instructions[moveToRegisterInstructionIndex] as OneRegisterInstruction).registerA
}
inflateFingerprintResult = BottomControlsInflateFingerprint.result!!.also {
moveToRegisterInstructionIndex = it.scanResult.patternScanResult!!.endIndex
viewRegister =
(it.mutableMethod.implementation!!.instructions[moveToRegisterInstructionIndex] as OneRegisterInstruction).registerA
}
}
/**
* Injects the code to change the visibility of controls.

View File

@@ -111,9 +111,7 @@ object VideoInformationPatch : BytecodePatch(
/*
* Inject call for video id
*/
val videoIdMethodDescriptor = "$INTEGRATIONS_CLASS_DESCRIPTOR->setVideoId(Ljava/lang/String;)V"
VideoIdPatch.injectCall(videoIdMethodDescriptor)
VideoIdPatch.injectCallBackgroundPlay(videoIdMethodDescriptor)
VideoIdPatch.injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->setVideoId(Ljava/lang/String;)V")
/*
* Set the video time method

View File

@@ -0,0 +1,72 @@
package app.revanced.patches.youtube.video.playerresponse
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
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
@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
private lateinit var playerResponseMethod: MutableMethod
override fun execute(context: BytecodeContext) {
// Hook player parameter.
PlayerParameterBuilderFingerprint.result?.let {
playerResponseMethod = it.mutableMethod
} ?: throw PlayerParameterBuilderFingerprint.exception
}
/**
* Modify the player parameter proto buffer value.
* Used exclusively by [SpoofSignaturePatch].
*/
fun injectProtoBufferHook(methodDescriptor: String) {
playerResponseMethod.addInstructions(
playerResponseProtoBufferInsertIndex,
"""
invoke-static {p$playerResponseProtoBufferParameter}, $methodDescriptor
move-result-object p$playerResponseProtoBufferParameter
"""
)
playerResponseProtoBufferInsertIndex += 2
}
/**
* 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++
}
}

View File

@@ -0,0 +1,25 @@
package app.revanced.patches.youtube.video.playerresponse.fingerprint
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
object PlayerParameterBuilderFingerprint : MethodFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
returnType = "L",
parameters = listOf(
"Ljava/lang/String;", // VideoId.
"[B",
"Ljava/lang/String;", // Player parameters proto buffer.
"Ljava/lang/String;",
"I",
"I",
"Ljava/util/Set;",
"Ljava/lang/String;",
"Ljava/lang/String;",
"L",
"Z",
"Z",
"Z"
)
)

View File

@@ -122,7 +122,6 @@ object RememberVideoQualityPatch : BytecodePatch(
* It also hooks the method which is called when the video quality to set is determined.
* Conveniently, at this point the video quality is overridden to the remembered playback speed.
*/
VideoInformationPatch.onCreateHook(INTEGRATIONS_CLASS_DESCRIPTOR, "newVideoStarted")

View File

@@ -9,16 +9,21 @@ 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.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch
import app.revanced.patches.youtube.video.playerresponse.PlayerResponseMethodHookPatch
import app.revanced.patches.youtube.video.videoid.fingerprint.VideoIdFingerprint
import app.revanced.patches.youtube.video.videoid.fingerprint.VideoIdFingerprintBackgroundPlay
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch(
description = "Hooks to detect when the video id changes",
dependencies = [IntegrationsPatch::class],
dependencies = [IntegrationsPatch::class, PlayerResponseMethodHookPatch::class],
)
object VideoIdPatch : BytecodePatch(
setOf(VideoIdFingerprint, VideoIdFingerprintBackgroundPlay)
setOf(
VideoIdFingerprint,
VideoIdFingerprintBackgroundPlay
)
) {
private var videoIdRegister = 0
private var insertIndex = 0
@@ -29,6 +34,7 @@ object VideoIdPatch : BytecodePatch(
private lateinit var backgroundPlaybackMethod: MutableMethod
override fun execute(context: BytecodeContext) {
/**
* Supplies the method and register index of the video id register.
*
@@ -45,10 +51,10 @@ object VideoIdPatch : BytecodePatch(
}
} ?: throw VideoIdFingerprint.exception
VideoIdFingerprint.setFields { method, insertIndex, videoIdRegister ->
VideoIdFingerprint.setFields { method, index, register ->
insertMethod = method
VideoIdPatch.insertIndex = insertIndex
VideoIdPatch.videoIdRegister = videoIdRegister
insertIndex = index
videoIdRegister = register
}
VideoIdFingerprintBackgroundPlay.setFields { method, insertIndex, videoIdRegister ->
@@ -58,42 +64,53 @@ 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.
*
* Supports all videos (regular videos, Shorts and Stories).
*
* _Does not function if playing in the background with no video visible_.
*
* 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
) = insertMethod.addInstruction(
// Keep injection calls in the order they're added:
// Increment index. So if additional injection calls are added, those calls run after this injection call.
insertIndex++,
"invoke-static {v$videoIdRegister}, $methodDescriptor"
)
* Adds an invoke-static instruction, called with the new id when the video changes.
*
* Supports all videos (regular videos and Shorts).
*
* _Does not function if playing in the background with no video visible_.
*
* 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 legacyInjectCall(
methodDescriptor: String
) = insertMethod.addInstruction(
insertIndex++,
"invoke-static {v$videoIdRegister}, $methodDescriptor"
)
/**
* Alternate hook that supports only regular videos, but hook supports changing to new video
* during background play when no video is visible.
*
* _Does not support Shorts or Stories_.
*
* Be aware, the hook can be called multiple times for the same video id.
*
* @param methodDescriptor which method to call. Params have to be `Ljava/lang/String;`
*/
fun injectCallBackgroundPlay(
methodDescriptor: String
) = backgroundPlaybackMethod.addInstruction(
backgroundPlaybackInsertIndex++, // move-result-object offset
"invoke-static {v$backgroundPlaybackVideoIdRegister}, $methodDescriptor"
)
/**
* Alternate hook that supports only regular videos, but hook supports changing to new video
* during background play when no video is visible.
*
* _Does not support Shorts_.
*
* Be aware, the hook can be called multiple times for the same video id.
*
* @param methodDescriptor which method to call. Params have to be `Ljava/lang/String;`
*/
fun legacyInjectCallBackgroundPlay(
methodDescriptor: String
) = backgroundPlaybackMethod.addInstruction(
backgroundPlaybackInsertIndex++, // move-result-object offset
"invoke-static {v$backgroundPlaybackVideoIdRegister}, $methodDescriptor"
)
}