mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-12-02 16:52:55 +01:00
feat(YouTube): Add Bypass URL redirects
patch
This commit is contained in:
parent
444b80026d
commit
91096532ee
@ -0,0 +1,29 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.net.Uri;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
|
||||
public class BypassURLRedirectsPatch {
|
||||
private static final String YOUTUBE_REDIRECT_PATH = "/redirect";
|
||||
|
||||
/**
|
||||
* Convert the YouTube redirect URI string to the redirect query URI.
|
||||
*
|
||||
* @param uri The YouTube redirect URI string.
|
||||
* @return The redirect query URI.
|
||||
*/
|
||||
public static Uri parseRedirectUri(String uri) {
|
||||
final var parsed = Uri.parse(uri);
|
||||
|
||||
if (SettingsEnum.BYPASS_URL_REDIRECTS.getBoolean() && parsed.getPath().equals(YOUTUBE_REDIRECT_PATH)) {
|
||||
var query = Uri.parse(Uri.decode(parsed.getQueryParameter("q")));
|
||||
|
||||
LogHelper.printDebug(() -> "Bypassing YouTube redirect URI: " + query);
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
}
|
@ -169,6 +169,7 @@ 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)),
|
||||
BYPASS_URL_REDIRECTS("revanced_bypass_url_redirects", BOOLEAN, TRUE),
|
||||
|
||||
// Swipe controls
|
||||
SWIPE_BRIGHTNESS("revanced_swipe_brightness", BOOLEAN, TRUE),
|
||||
|
Loading…
Reference in New Issue
Block a user