mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-11-07 20:57:02 +01:00
feat(youtube): open-links-directly
patch (#201)
This commit is contained in:
parent
302b57d8f0
commit
c3c16563ea
@ -0,0 +1,18 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class OpenLinksDirectlyPatch {
|
||||
|
||||
public static String parseRedirectUri(String uri) {
|
||||
if (SettingsEnum.OPEN_LINKS_DIRECTLY.getBoolean()) {
|
||||
Matcher matcher = Pattern.compile("&q=(http.+?)&v=").matcher(uri);
|
||||
return matcher.find() ? URLDecoder.decode(matcher.group(1)) : uri;
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
}
|
@ -87,6 +87,7 @@ public enum SettingsEnum {
|
||||
USE_HDR_AUTO_BRIGHTNESS("revanced_pref_hdr_autobrightness", true, ReturnType.BOOLEAN),
|
||||
TAP_SEEKING_ENABLED("revanced_enable_tap_seeking", true, ReturnType.BOOLEAN),
|
||||
ENABLE_MINIMIZED_PLAYBACK("revanced_enable_minimized_playback", true, ReturnType.BOOLEAN),
|
||||
OPEN_LINKS_DIRECTLY("revanced_uri_redirect", true, ReturnType.BOOLEAN, true),
|
||||
|
||||
// Swipe controls
|
||||
ENABLE_SWIPE_BRIGHTNESS("revanced_enable_swipe_brightness", true, ReturnType.BOOLEAN),
|
||||
|
Loading…
Reference in New Issue
Block a user