diff --git a/app/src/main/java/app/revanced/integrations/patches/RemoveTrackingQueryParameterPatch.java b/app/src/main/java/app/revanced/integrations/patches/RemoveTrackingQueryParameterPatch.java new file mode 100644 index 00000000..4910f586 --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/patches/RemoveTrackingQueryParameterPatch.java @@ -0,0 +1,16 @@ +package app.revanced.integrations.patches; + +import app.revanced.integrations.settings.SettingsEnum; + +public final class RemoveTrackingQueryParameterPatch { + private static final String NEW_TRACKING_PARAMETER_REGEX = ".si=.+"; + private static final String OLD_TRACKING_PARAMETER_REGEX = ".feature=.+"; + + public static String sanitize(String url) { + if (!SettingsEnum.REMOVE_TRACKING_QUERY_PARAMETER.getBoolean()) return url; + + return url + .replaceAll(NEW_TRACKING_PARAMETER_REGEX, "") + .replaceAll(OLD_TRACKING_PARAMETER_REGEX, ""); + } +} diff --git a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java index 105bea54..937fa02a 100644 --- a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java +++ b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java @@ -190,6 +190,7 @@ public enum SettingsEnum { ANNOUNCEMENTS("revanced_announcements", BOOLEAN, TRUE), ANNOUNCEMENT_CONSUMER("revanced_announcement_consumer", STRING, ""), ANNOUNCEMENT_LAST_HASH("revanced_announcement_last_hash", STRING, ""), + REMOVE_TRACKING_QUERY_PARAMETER("revanced_remove_tracking_query_parameter", BOOLEAN, TRUE), // Swipe controls SWIPE_BRIGHTNESS("revanced_swipe_brightness", BOOLEAN, TRUE),