Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
fix(YouTube - Client spoof): Allow turning off storyboard fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios committed Nov 10, 2023
1 parent 1de66b6 commit 3f0b15f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import static app.revanced.integrations.patches.spoof.requests.StoryboardRendererRequester.getStoryboardRenderer;
import static app.revanced.integrations.utils.ReVancedUtils.containsAny;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.Nullable;

import java.util.concurrent.ExecutionException;
Expand Down Expand Up @@ -53,6 +57,8 @@ public class SpoofSignaturePatch {

private static volatile boolean useOriginalStoryboardRenderer;

private static volatile boolean isPlayingShorts;

@Nullable
private static StoryboardRenderer getRenderer() {
if (rendererFuture != null) {
Expand Down Expand Up @@ -86,7 +92,10 @@ public static String spoofParameter(String parameters) {
if (useOriginalStoryboardRenderer = parameters.length() > 150) return parameters;

// Shorts do not need to be spoofed.
if (useOriginalStoryboardRenderer = parameters.startsWith(SHORTS_PLAYER_PARAMETERS)) return parameters;
if (useOriginalStoryboardRenderer = parameters.startsWith(SHORTS_PLAYER_PARAMETERS)) {
isPlayingShorts = true;
return parameters;
}

boolean isPlayingFeed = PlayerType.getCurrent() == PlayerType.INLINE_MINIMAL
&& containsAny(parameters, AUTOPLAY_PARAMETERS);
Expand Down Expand Up @@ -124,13 +133,6 @@ private static void fetchStoryboardRenderer() {
getRenderer();
}

/**
* Injection point.
*/
public static boolean getSeekbarThumbnailOverrideValue() {
return SettingsEnum.SPOOF_SIGNATURE.getBoolean();
}

private static String getStoryboardRendererSpec(String originalStoryboardRendererSpec,
boolean returnNullIfLiveStream) {
if (SettingsEnum.SPOOF_SIGNATURE.getBoolean() && !useOriginalStoryboardRenderer) {
Expand Down Expand Up @@ -177,4 +179,30 @@ public static int getRecommendedLevel(int originalLevel) {

return originalLevel;
}

/**
* Injection point. Forces seekbar to be shown for paid videos or
* if {@link SettingsEnum#SPOOF_STORYBOARD_RENDERER} is not enabled.
*/
public static boolean getSeekbarThumbnailOverrideValue() {
return SettingsEnum.SPOOF_SIGNATURE.getBoolean();
}

/**
* Injection point.
*
* @param view seekbar thumbnail view. Includes both shorts and regular videos.
*/
public static void seekbarImageViewCreated(ImageView view) {
if (!SettingsEnum.SPOOF_SIGNATURE.getBoolean()
|| SettingsEnum.SPOOF_STORYBOARD_RENDERER.getBoolean()) {
return;
}
if (isPlayingShorts) return;

view.setVisibility(View.GONE);
// Also hide the border around the thumbnail (otherwise a 1 pixel wide bordered frame is visible).
ViewGroup parentLayout = (ViewGroup) view.getParent();
parentLayout.setPadding(0, 0, 0, 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ public enum SettingsEnum {
"revanced_spoof_signature_verification_enabled_user_dialog_message"),
SPOOF_SIGNATURE_IN_FEED("revanced_spoof_signature_in_feed_enabled", BOOLEAN, FALSE, false,
parents(SPOOF_SIGNATURE)),
SPOOF_STORYBOARD_RENDERER("revanced_spoof_storyboard", BOOLEAN, TRUE, true,
parents(SPOOF_SIGNATURE)),

SPOOF_DEVICE_DIMENSIONS("revanced_spoof_device_dimensions", BOOLEAN, FALSE, true),
BYPASS_URL_REDIRECTS("revanced_bypass_url_redirects", BOOLEAN, TRUE),
ANNOUNCEMENTS("revanced_announcements", BOOLEAN, TRUE),
Expand Down

0 comments on commit 3f0b15f

Please sign in to comment.