Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(YouTube): Add Check watch history domain name resolution patch #3537

Merged
merged 11 commits into from
Aug 15, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import app.revanced.util.exception

@Patch(
name = "Hide ads",
description = "Hides ads in stories, discover, profile, etc." +
description = "Hides ads in stories, discover, profile, etc. " +
"An ad can still appear once when refreshing the home feed.",
compatiblePackages = [CompatiblePackage("com.instagram.android")],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import app.revanced.util.exception

@Patch(
name = "Spoof Android device ID",
description = "Spoofs the Android device ID used by the app for account authentication." +
description = "Spoofs the Android device ID used by the app for account authentication. " +
"This can be used to copy the account to another device.",
compatiblePackages = [
CompatiblePackage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch

@Patch(
name = "Bypass image region restrictions",
description = "Adds an option to use a different host for user avatar and channel images," +
description = "Adds an option to use a different host for user avatar and channel images " +
"and can fix missing images that are blocked in some countries.",
dependencies = [
IntegrationsPatch::class,
Expand Down
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",
)
}
}
7 changes: 6 additions & 1 deletion src/main/resources/addresources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,11 @@ This is because Crowdin requires temporarily flattening this file and removing t
<string name="revanced_announcements_connection_failed">Failed connecting to announcements provider</string>
<string name="revanced_announcements_dialog_dismiss">Dismiss</string>
</patch>
<patch id="misc.dns.CheckWatchHistoryDomainNameResolutionPatch">
<string name="revanced_check_watch_history_domain_name_dialog_title">Warning</string>
<string name="revanced_check_watch_history_domain_name_dialog_message">Your watch history is not being saved.&lt;br>&lt;br>This most likely is caused by a DNS ad blocker or network proxy.&lt;br>&lt;br>To fix this, whitelist &lt;b>s.youtube.com&lt;/b> or turn off all DNS blockers and proxies.</string>
<string name="revanced_check_watch_history_domain_name_dialog_ignore">Do not show again</string>
</patch>
<patch id="misc.autorepeat.AutoRepeatPatch">
<string name="revanced_auto_repeat_title">Enable auto-repeat</string>
<string name="revanced_auto_repeat_summary_on">Auto-repeat is enabled</string>
Expand Down Expand Up @@ -1135,7 +1140,7 @@ This is because Crowdin requires temporarily flattening this file and removing t
<string name="revanced_spoof_client_summary_off">Client is not spoofed\n\nVideo playback may not work</string>
<string name="revanced_spoof_client_user_dialog_message">Turning off this setting may cause video playback issues.</string>
<string name="revanced_spoof_client_use_ios_title">Spoof client to iOS</string>
<string name="revanced_spoof_client_use_ios_summary_on">Client is currently spoofed to iOS\n\nSide effects include:\n• HDR video may not be available\n• Watch history may not work</string>
<string name="revanced_spoof_client_use_ios_summary_on">Client is currently spoofed to iOS\n\nSide effects include:\n• HDR video may not be available\n• Watch history does not work with a brand account</string>
<string name="revanced_spoof_client_use_ios_summary_off">Client is currently spoofed to Android VR\n\nSide effects include:\n• No HDR video\n• Kids videos do not playback\n• Paused videos can randomly resume\n• Low quality Shorts seekbar thumbnails\n• Download action button is hidden\n• End screen cards are hidden</string>
<string name="revanced_spoof_client_storyboard_timeout">Spoof client thumbnails not available (API timed out)</string>
<string name="revanced_spoof_client_storyboard_io_exception">Spoof client thumbnails temporarily not available: %s</string>
Expand Down