mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-03 08:04:36 +02:00
feat(YouTube/Spoof client): add Show in Stats for nerds
settings
This commit is contained in:
parent
375092b691
commit
d304a6d758
@ -14,6 +14,7 @@ import app.revanced.patches.youtube.utils.compatibility.Constants
|
||||
import app.revanced.patches.youtube.utils.fix.client.fingerprints.BuildInitPlaybackRequestFingerprint
|
||||
import app.revanced.patches.youtube.utils.fix.client.fingerprints.BuildPlayerRequestURIFingerprint
|
||||
import app.revanced.patches.youtube.utils.fix.client.fingerprints.CreatePlayerRequestBodyFingerprint
|
||||
import app.revanced.patches.youtube.utils.fix.client.fingerprints.NerdsStatsVideoFormatBuilderFingerprint
|
||||
import app.revanced.patches.youtube.utils.fix.client.fingerprints.PlayerGestureConfigSyntheticFingerprint
|
||||
import app.revanced.patches.youtube.utils.fix.client.fingerprints.SetPlayerRequestClientTypeFingerprint
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.MISC_PATH
|
||||
@ -58,6 +59,9 @@ object SpoofClientPatch : BaseBytecodePatch(
|
||||
|
||||
// Player gesture config.
|
||||
PlayerGestureConfigSyntheticFingerprint,
|
||||
|
||||
// Nerds stats video format.
|
||||
NerdsStatsVideoFormatBuilderFingerprint,
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
@ -251,6 +255,27 @@ object SpoofClientPatch : BaseBytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
// region append spoof info
|
||||
|
||||
NerdsStatsVideoFormatBuilderFingerprint.resultOrThrow().mutableMethod.apply {
|
||||
for (index in implementation!!.instructions.size - 1 downTo 0) {
|
||||
val instruction = getInstruction(index)
|
||||
if (instruction.opcode != Opcode.RETURN_OBJECT)
|
||||
continue
|
||||
|
||||
val register = (instruction as OneRegisterInstruction).registerA
|
||||
|
||||
addInstructions(
|
||||
index, """
|
||||
invoke-static {v$register}, $INTEGRATIONS_CLASS_DESCRIPTOR->appendSpoofedClient(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
|
@ -0,0 +1,12 @@
|
||||
package app.revanced.patches.youtube.utils.fix.client.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object NerdsStatsVideoFormatBuilderFingerprint : MethodFingerprint(
|
||||
returnType = "Ljava/lang/String;",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
parameters = listOf("Lcom/google/android/libraries/youtube/innertube/model/media/FormatStreamModel;"),
|
||||
strings = listOf("codecs=\""),
|
||||
)
|
@ -115,7 +115,7 @@
|
||||
<string-array name="revanced_spoof_client_general_options_entries">
|
||||
<item>@string/revanced_spoof_client_options_entry_ios</item>
|
||||
<item>@string/revanced_spoof_client_options_entry_android_testsuite</item>
|
||||
<item>@string/revanced_spoof_client_options_entry_android_tv</item>
|
||||
<item>@string/revanced_spoof_client_options_entry_android_unplugged</item>
|
||||
<item>@string/revanced_spoof_client_options_entry_android_vr</item>
|
||||
</string-array>
|
||||
<string-array name="revanced_spoof_client_general_options_entry_values">
|
||||
@ -126,7 +126,7 @@
|
||||
</string-array>
|
||||
<string-array name="revanced_spoof_client_livestream_options_entries">
|
||||
<item>@string/revanced_spoof_client_options_entry_ios</item>
|
||||
<item>@string/revanced_spoof_client_options_entry_android_tv</item>
|
||||
<item>@string/revanced_spoof_client_options_entry_android_unplugged</item>
|
||||
<item>@string/revanced_spoof_client_options_entry_android_vr</item>
|
||||
</string-array>
|
||||
<string-array name="revanced_spoof_client_livestream_options_entry_values">
|
||||
|
@ -1459,17 +1459,24 @@ Limitation: Feed videos will play for less than 1 minute before encountering pla
|
||||
<string name="revanced_spoof_client_title">Spoof client</string>
|
||||
<string name="revanced_spoof_client_summary_on">Client is spoofed.</string>
|
||||
<string name="revanced_spoof_client_summary_off">"Client is not spoofed. Video playback may not work."</string>
|
||||
<string name="revanced_spoof_client_stats_for_nerds_title">Show in Stats for nerds</string>
|
||||
<string name="revanced_spoof_client_stats_for_nerds_summary_on">Spoofed client is shown in Stats for nerds.</string>
|
||||
<string name="revanced_spoof_client_stats_for_nerds_summary_off">Spoofed client is hidden in Stats for nerds.</string>
|
||||
|
||||
<!-- PreferenceScreen: Miscellaneous, PreferenceCategory: Miscellaneous, PreferenceScreen: Spoof client, PreferenceCategory: Spoof client options -->
|
||||
<string name="revanced_preference_category_spoof_client_options">Spoof client options</string>
|
||||
<string name="revanced_spoof_client_general_title">General</string>
|
||||
<string name="revanced_spoof_client_livestream_title">Live streams</string>
|
||||
<string name="revanced_spoof_client_shorts_title">Shorts, Clips</string>
|
||||
<string name="revanced_spoof_client_fallback_title">Fallback</string>
|
||||
<string name="revanced_spoof_client_fallback_title">Unplayable video</string>
|
||||
<string name="revanced_spoof_client_options_entry_ios">iOS</string>
|
||||
<string name="revanced_spoof_client_options_entry_android">Android</string>
|
||||
<string name="revanced_spoof_client_options_entry_android_embedded_player">Android Embedded Player</string>
|
||||
<string name="revanced_spoof_client_options_entry_android_testsuite">Android Testsuite</string>
|
||||
<string name="revanced_spoof_client_options_entry_android_tv">Android TV</string>
|
||||
<string name="revanced_spoof_client_options_entry_android_unplugged">Android TV</string>
|
||||
<string name="revanced_spoof_client_options_entry_android_vr">Android VR</string>
|
||||
<string name="revanced_spoof_client_options_entry_tvhtml5_simply_embedded_player">TV HTML5</string>
|
||||
<string name="revanced_spoof_client_options_entry_web">Web</string>
|
||||
|
||||
<!-- PreferenceScreen: Miscellaneous, PreferenceCategory: Miscellaneous, PreferenceScreen: Spoof client, PreferenceCategory: About -->
|
||||
<string name="revanced_preference_category_spoof_client_about">About</string>
|
||||
|
@ -540,6 +540,7 @@
|
||||
<!-- SETTINGS: SPOOF_CLIENT
|
||||
<PreferenceScreen android:title="@string/revanced_preference_screen_spoof_client_title" android:key="revanced_preference_screen_spoof_client" android:summary="@string/revanced_preference_screen_spoof_client_summary">
|
||||
<SwitchPreference android:title="@string/revanced_spoof_client_title" android:key="revanced_spoof_client" android:summaryOn="@string/revanced_spoof_client_summary_on" android:summaryOff="@string/revanced_spoof_client_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_spoof_client_stats_for_nerds_title" android:key="revanced_spoof_client_stats_for_nerds" android:summaryOn="@string/revanced_spoof_client_stats_for_nerds_summary_on" android:summaryOff="@string/revanced_spoof_client_stats_for_nerds_summary_off" />
|
||||
|
||||
<PreferenceCategory android:title="@string/revanced_preference_category_spoof_client_options" android:layout="@layout/revanced_settings_preferences_category" />
|
||||
<ListPreference android:entries="@array/revanced_spoof_client_general_options_entries" android:title="@string/revanced_spoof_client_general_title" android:key="revanced_spoof_client_general" android:entryValues="@array/revanced_spoof_client_general_options_entry_values" android:dependency="revanced_spoof_client" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user