1
mirror of https://github.com/revanced/revanced-integrations synced 2024-11-22 05:02:19 +01:00

feat(YouTube): Add Remove tracking query parameter patch

Implementation references taken from github.com/inotia00/revanced-patches/commit/4037d9c85b7e37f8635f8fdcc1efea85dcddb5e2.
This commit is contained in:
oSumAtrIX 2023-11-12 01:27:19 +01:00
parent db0fb46a39
commit e84b7b328e
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 17 additions and 0 deletions

View File

@ -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, "");
}
}

View File

@ -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),