Skip to content

Commit 87eb836

Browse files
LisoUseInAIKyriosoSumAtrIX
andauthored
feat(YouTube): Add Check watch history domain name resolution patch (#3537)
Co-authored-by: oSumAtrIX <[email protected]>
1 parent 567121d commit 87eb836

File tree

5 files changed

+46
-4
lines changed

5 files changed

+46
-4
lines changed

src/main/kotlin/app/revanced/patches/instagram/patches/ad/HideAdsPatch.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import app.revanced.util.exception
1010

1111
@Patch(
1212
name = "Hide ads",
13-
description = "Hides ads in stories, discover, profile, etc." +
13+
description = "Hides ads in stories, discover, profile, etc. " +
1414
"An ad can still appear once when refreshing the home feed.",
1515
compatiblePackages = [CompatiblePackage("com.instagram.android")],
1616
)

src/main/kotlin/app/revanced/patches/piccomafr/misc/SpoofAndroidDeviceIdPatch.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import app.revanced.util.exception
1111

1212
@Patch(
1313
name = "Spoof Android device ID",
14-
description = "Spoofs the Android device ID used by the app for account authentication." +
14+
description = "Spoofs the Android device ID used by the app for account authentication. " +
1515
"This can be used to copy the account to another device.",
1616
compatiblePackages = [
1717
CompatiblePackage(

src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/BypassImageRegionRestrictions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
1212

1313
@Patch(
1414
name = "Bypass image region restrictions",
15-
description = "Adds an option to use a different host for user avatar and channel images," +
15+
description = "Adds an option to use a different host for user avatar and channel images " +
1616
"and can fix missing images that are blocked in some countries.",
1717
dependencies = [
1818
IntegrationsPatch::class,
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package app.revanced.patches.youtube.misc.dns
2+
3+
import app.revanced.patcher.data.BytecodeContext
4+
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
5+
import app.revanced.patcher.patch.BytecodePatch
6+
import app.revanced.patcher.patch.annotation.Patch
7+
import app.revanced.patches.all.misc.resources.AddResourcesPatch
8+
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
9+
import app.revanced.patches.youtube.shared.fingerprints.MainActivityOnCreateFingerprint
10+
import app.revanced.util.resultOrThrow
11+
12+
@Patch(
13+
name = "Check watch history domain name resolution",
14+
description = "Checks if the device DNS server is preventing user watch history from being saved.",
15+
dependencies = [IntegrationsPatch::class],
16+
)
17+
@Suppress("unused")
18+
internal object CheckWatchHistoryDomainNameResolutionPatch : BytecodePatch(
19+
setOf(MainActivityOnCreateFingerprint),
20+
) {
21+
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
22+
"Lapp/revanced/integrations/youtube/patches/CheckWatchHistoryDomainNameResolutionPatch;"
23+
24+
override fun execute(context: BytecodeContext) {
25+
AddResourcesPatch(this::class)
26+
27+
MainActivityOnCreateFingerprint.resultOrThrow().mutableMethod.addInstructions(
28+
// FIXME: Insert index must be greater than the insert index used by GmsCoreSupport,
29+
// as both patch the same method and GmsCoreSupport check should be first,
30+
// but the patch does not depend on GmsCoreSupport, so it should not be possible to enforce this
31+
// unless a third patch is added that this patch and GmsCoreSupport depend on to manage
32+
// the order of the patches.
33+
1,
34+
"invoke-static/range { p0 .. p0 }, $INTEGRATIONS_CLASS_DESCRIPTOR->checkDnsResolver(Landroid/app/Activity;)V",
35+
)
36+
}
37+
}

src/main/resources/addresources/values/strings.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,11 @@ This is because Crowdin requires temporarily flattening this file and removing t
10451045
<string name="revanced_announcements_connection_failed">Failed connecting to announcements provider</string>
10461046
<string name="revanced_announcements_dialog_dismiss">Dismiss</string>
10471047
</patch>
1048+
<patch id="misc.dns.CheckWatchHistoryDomainNameResolutionPatch">
1049+
<string name="revanced_check_watch_history_domain_name_dialog_title">Warning</string>
1050+
<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>
1051+
<string name="revanced_check_watch_history_domain_name_dialog_ignore">Do not show again</string>
1052+
</patch>
10481053
<patch id="misc.autorepeat.AutoRepeatPatch">
10491054
<string name="revanced_auto_repeat_title">Enable auto-repeat</string>
10501055
<string name="revanced_auto_repeat_summary_on">Auto-repeat is enabled</string>
@@ -1135,7 +1140,7 @@ This is because Crowdin requires temporarily flattening this file and removing t
11351140
<string name="revanced_spoof_client_summary_off">Client is not spoofed\n\nVideo playback may not work</string>
11361141
<string name="revanced_spoof_client_user_dialog_message">Turning off this setting may cause video playback issues.</string>
11371142
<string name="revanced_spoof_client_use_ios_title">Spoof client to iOS</string>
1138-
<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>
1143+
<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>
11391144
<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>
11401145
<string name="revanced_spoof_client_storyboard_timeout">Spoof client thumbnails not available (API timed out)</string>
11411146
<string name="revanced_spoof_client_storyboard_io_exception">Spoof client thumbnails temporarily not available: %s</string>

0 commit comments

Comments
 (0)