Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update patches information #126

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
public class OpenLinksDirectlyPatch {
private static final String YOUTUBE_REDIRECT_PATH = "/redirect";

public static Uri enableBypassRedirect(String uri) {
public static Uri parseRedirectUri(String uri) {
final Uri parsed = Uri.parse(uri);
if (!Settings.ENABLE_OPEN_LINKS_DIRECTLY.get())
if (!Settings.BYPASS_URL_REDIRECTS.get())
return parsed;

if (Objects.equals(parsed.getPath(), YOUTUBE_REDIRECT_PATH)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package app.revanced.extension.youtube.patches.misc;

import app.revanced.extension.youtube.settings.Settings;

@SuppressWarnings("unused")
public class OpenLinksExternallyPatch {

// renamed from 'enableExternalBrowser'
public static String openLinksExternally(final String original) {
if (!Settings.OPEN_LINKS_EXTERNALLY.get())
return original;

return "";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,8 @@ public class Settings extends BaseSettings {


// PreferenceScreen: Miscellaneous
public static final BooleanSetting ENABLE_OPEN_LINKS_DIRECTLY = new BooleanSetting("revanced_enable_open_links_directly", TRUE);
public static final BooleanSetting ENABLE_EXTERNAL_BROWSER = new BooleanSetting("revanced_enable_external_browser", TRUE, true);
public static final BooleanSetting BYPASS_URL_REDIRECTS = new BooleanSetting("revanced_bypass_url_redirects", TRUE);
public static final BooleanSetting OPEN_LINKS_EXTERNALLY = new BooleanSetting("revanced_open_links_externally", TRUE, true);

// Experimental Flags
public static final BooleanSetting CHANGE_SHARE_SHEET = new BooleanSetting("revanced_change_share_sheet", FALSE, true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.openlinksdirectly
package app.revanced.patches.youtube.misc.openlinks.directly

import app.revanced.util.fingerprint.legacyFingerprint
import app.revanced.util.or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package app.revanced.patches.youtube.misc.openlinksdirectly
package app.revanced.patches.youtube.misc.openlinks.directly

import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.extension.Constants.MISC_PATH
import app.revanced.patches.youtube.utils.patch.PatchList.ENABLE_OPEN_LINKS_DIRECTLY
import app.revanced.patches.youtube.utils.patch.PatchList.BYPASS_URL_REDIRECTS
import app.revanced.patches.youtube.utils.settings.ResourceUtils.addPreference
import app.revanced.patches.youtube.utils.settings.settingsPatch
import app.revanced.util.fingerprint.methodOrThrow
Expand All @@ -17,8 +17,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference

@Suppress("unused")
val openLinksDirectlyPatch = bytecodePatch(
ENABLE_OPEN_LINKS_DIRECTLY.title,
ENABLE_OPEN_LINKS_DIRECTLY.summary,
BYPASS_URL_REDIRECTS.title,
BYPASS_URL_REDIRECTS.summary,
) {
compatibleWith(COMPATIBLE_PACKAGE)

Expand All @@ -40,7 +40,7 @@ val openLinksDirectlyPatch = bytecodePatch(

replaceInstruction(
insertIndex,
"invoke-static {v$insertRegister}, $MISC_PATH/OpenLinksDirectlyPatch;->enableBypassRedirect(Ljava/lang/String;)Landroid/net/Uri;"
"invoke-static {v$insertRegister}, $MISC_PATH/OpenLinksDirectlyPatch;->parseRedirectUri(Ljava/lang/String;)Landroid/net/Uri;"
)
}
}
Expand All @@ -49,9 +49,9 @@ val openLinksDirectlyPatch = bytecodePatch(

addPreference(
arrayOf(
"SETTINGS: ENABLE_OPEN_LINKS_DIRECTLY"
"SETTINGS: BYPASS_URL_REDIRECTS"
),
ENABLE_OPEN_LINKS_DIRECTLY
BYPASS_URL_REDIRECTS
)

// endregion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package app.revanced.patches.youtube.misc.externalbrowser
package app.revanced.patches.youtube.misc.openlinks.externally

import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.shared.transformation.transformInstructionsPatch
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.extension.Constants.MISC_PATH
import app.revanced.patches.youtube.utils.patch.PatchList.ENABLE_EXTERNAL_BROWSER
import app.revanced.patches.youtube.utils.patch.PatchList.OPEN_LINKS_EXTERNALLY
import app.revanced.patches.youtube.utils.settings.ResourceUtils.addPreference
import app.revanced.patches.youtube.utils.settings.settingsPatch
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
Expand All @@ -14,8 +14,8 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference

@Suppress("unused")
val openLinksExternallyPatch = bytecodePatch(
ENABLE_EXTERNAL_BROWSER.title,
ENABLE_EXTERNAL_BROWSER.summary,
OPEN_LINKS_EXTERNALLY.title,
OPEN_LINKS_EXTERNALLY.summary,
) {
compatibleWith(COMPATIBLE_PACKAGE)

Expand All @@ -36,7 +36,7 @@ val openLinksExternallyPatch = bytecodePatch(
mutableMethod.addInstructions(
intentStringIndex + 1,
"""
invoke-static {v$register}, $MISC_PATH/ExternalBrowserPatch;->enableExternalBrowser(Ljava/lang/String;)Ljava/lang/String;
invoke-static {v$register}, $MISC_PATH/OpenLinksExternallyPatch;->openLinksExternally(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$register
""",
)
Expand All @@ -51,9 +51,9 @@ val openLinksExternallyPatch = bytecodePatch(

addPreference(
arrayOf(
"SETTINGS: ENABLE_EXTERNAL_BROWSER"
"SETTINGS: OPEN_LINKS_EXTERNALLY"
),
ENABLE_EXTERNAL_BROWSER
OPEN_LINKS_EXTERNALLY
)

// endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ internal enum class PatchList(
"Bypass image region restrictions",
"Adds an option to use a different host for static images, so that images blocked in some countries can be received."
),
ENABLE_OPEN_LINKS_DIRECTLY(
"Bypass link redirection",
"Adds an option to bypass redirection when opening external links."
BYPASS_URL_REDIRECTS(
"Bypass URL redirects",
"Adds an option to bypass URL redirects and open the original URL directly."
),
CHANGE_PLAYER_FLYOUT_MENU_TOGGLES(
"Change player flyout menu toggles",
Expand Down Expand Up @@ -169,8 +169,8 @@ internal enum class PatchList(
"Navigation bar components",
"Adds options to hide or change components related to the navigation bar."
),
ENABLE_EXTERNAL_BROWSER(
"Open links in browser",
OPEN_LINKS_EXTERNALLY(
"Open links externally",
"Adds an option to always open links in your browser instead of in the in-app-browser."
),
OVERLAY_BUTTONS(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1904,9 +1904,9 @@ Click to see how to issue an API key."</string>
<!-- PreferenceScreen: Miscellaneous -->
<string name="revanced_preference_screen_misc_title">Miscellaneous</string>

<string name="revanced_enable_open_links_directly_title">Bypass link redirection</string>
<string name="revanced_enable_open_links_directly_summary_on">Bypasses link redirection.</string>
<string name="revanced_enable_open_links_directly_summary_off">Follows default redirection policy.</string>
<string name="revanced_bypass_url_redirects_title">Bypass URL redirects</string>
<string name="revanced_bypass_url_redirects_summary_on">URL redirects are bypassed.</string>
<string name="revanced_bypass_url_redirects_summary_off">URL redirects are not bypassed.</string>
<string name="revanced_disable_quic_protocol_title">Disable QUIC protocol</string>
<string name="revanced_disable_quic_protocol_summary">"Disables CronetEngine's QUIC protocol."</string>
<string name="revanced_enable_debug_logging_title">Enable debug logging</string>
Expand All @@ -1915,9 +1915,9 @@ Click to see how to issue an API key."</string>
<string name="revanced_enable_debug_buffer_logging_title">Enable debug buffer logging</string>
<string name="revanced_enable_debug_buffer_logging_summary_on">Debug logs include the buffer.</string>
<string name="revanced_enable_debug_buffer_logging_summary_off">Debug logs do not include the buffer.</string>
<string name="revanced_enable_external_browser_title">Open links in browser</string>
<string name="revanced_enable_external_browser_summary_on">Opens links in the external browser.</string>
<string name="revanced_enable_external_browser_summary_off">Opens links in the in-app browser.</string>
<string name="revanced_open_links_externally_title">Open links in browser</string>
<string name="revanced_open_links_externally_summary_on">Opens links in the external browser.</string>
<string name="revanced_open_links_externally_summary_off">Opens links in the in-app browser.</string>
<string name="revanced_sanitize_sharing_links_title">Sanitize sharing links</string>
<string name="revanced_sanitize_sharing_links_summary">Sanitizes sharing links by removing tracking query parameters.</string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,8 +820,8 @@
<app.revanced.extension.youtube.settings.preference.WatchHistoryStatusPreference android:title="@string/revanced_watch_history_about_title" />
</PreferenceScreen>SETTINGS: WATCH_HISTORY -->

<!-- SETTINGS: ENABLE_OPEN_LINKS_DIRECTLY
<SwitchPreference android:title="@string/revanced_enable_open_links_directly_title" android:key="revanced_enable_open_links_directly" android:summaryOn="@string/revanced_enable_open_links_directly_summary_on" android:summaryOff="@string/revanced_enable_open_links_directly_summary_off" />SETTINGS: ENABLE_OPEN_LINKS_DIRECTLY -->
<!-- SETTINGS: BYPASS_URL_REDIRECTS
<SwitchPreference android:title="@string/revanced_bypass_url_redirects_title" android:key="revanced_bypass_url_redirects" android:summaryOn="@string/revanced_bypass_url_redirects_summary_on" android:summaryOff="@string/revanced_bypass_url_redirects_summary_off" />SETTINGS: BYPASS_URL_REDIRECTS -->

<!-- SETTINGS: DISABLE_QUIC_PROTOCOL
<SwitchPreference android:title="@string/revanced_disable_quic_protocol_title" android:key="revanced_disable_quic_protocol" android:summary="@string/revanced_disable_quic_protocol_summary" />SETTINGS: DISABLE_QUIC_PROTOCOL -->
Expand All @@ -830,8 +830,8 @@
<SwitchPreference android:title="@string/revanced_enable_debug_logging_title" android:key="revanced_enable_debug_logging" android:summaryOn="@string/revanced_enable_debug_logging_summary_on" android:summaryOff="@string/revanced_enable_debug_logging_summary_off" />
<SwitchPreference android:title="@string/revanced_enable_debug_buffer_logging_title" android:key="revanced_enable_debug_buffer_logging" android:summaryOn="@string/revanced_enable_debug_buffer_logging_summary_on" android:summaryOff="@string/revanced_enable_debug_buffer_logging_summary_off" android:dependency="revanced_enable_debug_logging" />SETTINGS: ENABLE_DEBUG_LOGGING -->

<!-- SETTINGS: ENABLE_EXTERNAL_BROWSER
<SwitchPreference android:title="@string/revanced_enable_external_browser_title" android:key="revanced_enable_external_browser" android:summaryOn="@string/revanced_enable_external_browser_summary_on" android:summaryOff="@string/revanced_enable_external_browser_summary_off" />SETTINGS: ENABLE_EXTERNAL_BROWSER -->
<!-- SETTINGS: OPEN_LINKS_EXTERNALLY
<SwitchPreference android:title="@string/revanced_open_links_externally_title" android:key="revanced_open_links_externally" android:summaryOn="@string/revanced_open_links_externally_summary_on" android:summaryOff="@string/revanced_open_links_externally_summary_off" />SETTINGS: OPEN_LINKS_EXTERNALLY -->

<!-- SETTINGS: SANITIZE_SHARING_LINKS
<SwitchPreference android:title="@string/revanced_sanitize_sharing_links_title" android:key="revanced_sanitize_sharing_links" android:summary="@string/revanced_sanitize_sharing_links_summary" />SETTINGS: SANITIZE_SHARING_LINKS -->
Expand Down Expand Up @@ -919,12 +919,12 @@
</PreferenceCategory>

<PreferenceCategory android:title="@string/revanced_preference_screen_misc_title" android:layout="@layout/revanced_settings_preferences_category">
<Preference android:title="Bypass URL redirects" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Change share sheet" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Disable QUIC protocol" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Enable debug logging" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Enable external browser" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Enable open links directly" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Enable OPUS codec" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Open links externally" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Remove background playback restrictions" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Sanitize sharing links" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Spoof streaming data" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
Expand Down