generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(YouTube): Add
Check watch history domain name resolution
patch (…
…#3537) Co-authored-by: oSumAtrIX <[email protected]>
- Loading branch information
1 parent
c314744
commit 2af1425
Showing
5 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...otlin/app/revanced/patches/youtube/misc/dns/CheckWatchHistoryDomainNameResolutionPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package app.revanced.patches.youtube.misc.dns | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.all.misc.resources.AddResourcesPatch | ||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch | ||
import app.revanced.patches.youtube.shared.fingerprints.MainActivityOnCreateFingerprint | ||
import app.revanced.util.resultOrThrow | ||
|
||
@Patch( | ||
name = "Check watch history domain name resolution", | ||
description = "Checks if the device DNS server is preventing user watch history from being saved.", | ||
dependencies = [IntegrationsPatch::class], | ||
) | ||
@Suppress("unused") | ||
internal object CheckWatchHistoryDomainNameResolutionPatch : BytecodePatch( | ||
setOf(MainActivityOnCreateFingerprint), | ||
) { | ||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = | ||
"Lapp/revanced/integrations/youtube/patches/CheckWatchHistoryDomainNameResolutionPatch;" | ||
|
||
override fun execute(context: BytecodeContext) { | ||
AddResourcesPatch(this::class) | ||
|
||
MainActivityOnCreateFingerprint.resultOrThrow().mutableMethod.addInstructions( | ||
// FIXME: Insert index must be greater than the insert index used by GmsCoreSupport, | ||
// as both patch the same method and GmsCoreSupport check should be first, | ||
// but the patch does not depend on GmsCoreSupport, so it should not be possible to enforce this | ||
// unless a third patch is added that this patch and GmsCoreSupport depend on to manage | ||
// the order of the patches. | ||
1, | ||
"invoke-static/range { p0 .. p0 }, $INTEGRATIONS_CLASS_DESCRIPTOR->checkDnsResolver(Landroid/app/Activity;)V", | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters