mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-12-01 00:02:55 +01:00
fix(YouTube - Client spoof): Fix toast shown for live streams (#489)
This commit is contained in:
parent
da923a38a0
commit
27f49dfd1e
@ -128,23 +128,26 @@ public class SpoofSignaturePatch {
|
||||
*/
|
||||
@Nullable
|
||||
public static String getStoryboardRendererSpec(String originalStoryboardRendererSpec) {
|
||||
if (!SettingsEnum.SPOOF_SIGNATURE.getBoolean()) return originalStoryboardRendererSpec;
|
||||
if (SettingsEnum.SPOOF_SIGNATURE.getBoolean()) {
|
||||
StoryboardRenderer renderer = getRenderer();
|
||||
if (renderer != null) return renderer.getSpec();
|
||||
}
|
||||
|
||||
StoryboardRenderer renderer = getRenderer();
|
||||
if (renderer == null) return originalStoryboardRendererSpec;
|
||||
|
||||
return renderer.getSpec();
|
||||
return originalStoryboardRendererSpec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
public static int getRecommendedLevel(int originalLevel) {
|
||||
if (!SettingsEnum.SPOOF_SIGNATURE.getBoolean()) return originalLevel;
|
||||
if (SettingsEnum.SPOOF_SIGNATURE.getBoolean()) {
|
||||
StoryboardRenderer renderer = getRenderer();
|
||||
if (renderer != null) {
|
||||
Integer recommendedLevel = renderer.getRecommendedLevel();
|
||||
if (recommendedLevel != null) return recommendedLevel;
|
||||
}
|
||||
}
|
||||
|
||||
StoryboardRenderer renderer = getRenderer();
|
||||
if (renderer == null) return originalLevel;
|
||||
|
||||
return renderer.getRecommendedLevel();
|
||||
return originalLevel;
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,16 @@
|
||||
package app.revanced.integrations.patches.spoof;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class StoryboardRenderer {
|
||||
private final String spec;
|
||||
private final int recommendedLevel;
|
||||
@Nullable
|
||||
private final Integer recommendedLevel;
|
||||
|
||||
public StoryboardRenderer(String spec, int recommendedLevel) {
|
||||
public StoryboardRenderer(String spec, @Nullable Integer recommendedLevel) {
|
||||
this.spec = spec;
|
||||
this.recommendedLevel = recommendedLevel;
|
||||
}
|
||||
@ -17,7 +20,11 @@ public final class StoryboardRenderer {
|
||||
return spec;
|
||||
}
|
||||
|
||||
public int getRecommendedLevel() {
|
||||
/**
|
||||
* @return Recommended image quality level, or NULL if no recommendation exists.
|
||||
*/
|
||||
@Nullable
|
||||
public Integer getRecommendedLevel() {
|
||||
return recommendedLevel;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class StoryboardRendererRequester {
|
||||
try {
|
||||
return playerResponse.getJSONObject("playabilityStatus").getString("status").equals("OK");
|
||||
} catch (JSONException e) {
|
||||
LogHelper.printException(() -> "Failed to get playabilityStatus", e);
|
||||
LogHelper.printDebug(() -> "Failed to get playabilityStatus for response: " + playerResponse);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -80,7 +80,9 @@ public class StoryboardRendererRequester {
|
||||
final var rendererElement = storyboards.getJSONObject(storyboardsRendererTag);
|
||||
StoryboardRenderer renderer = new StoryboardRenderer(
|
||||
rendererElement.getString("spec"),
|
||||
rendererElement.getInt("recommendedLevel")
|
||||
rendererElement.has("recommendedLevel")
|
||||
? rendererElement.getInt("recommendedLevel")
|
||||
: null
|
||||
);
|
||||
|
||||
LogHelper.printDebug(() -> "Fetched: " + renderer);
|
||||
|
Loading…
Reference in New Issue
Block a user