This repository has been archived by the owner on Oct 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,069 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
app/src/main/java/app/revanced/integrations/patches/BypassURLRedirectsPatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.