From b079e7021e44e422bf8ee9beab73b006eacce181 Mon Sep 17 00:00:00 2001
From: garry-ut99 <72945564+garry-ut99@users.noreply.github.com>
Date: Mon, 14 Oct 2024 08:07:54 +0000
Subject: [PATCH] Updated "urlskip"
---
Static-filter-syntax.md | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/Static-filter-syntax.md b/Static-filter-syntax.md
index d014028..e8693a9 100644
--- a/Static-filter-syntax.md
+++ b/Static-filter-syntax.md
@@ -1019,7 +1019,7 @@ New in 1.60.0.
Can only be used in a trusted-source origin.
-The main purpose is to bypass URLs designed to track whether a user visited a specific URL, typically used in click-tracking links.
+Extracts a URL from another URL according to one or more transformation steps, thereby skipping over intermediate network request(s) to remote servers. The main purpose is to bypass URLs designed to track whether a user visited a specific URL, typically used in click-tracking links.
The `urlskip=` option ...
- ... is valid only when used in a trusted filter list
@@ -1028,18 +1028,26 @@ The `urlskip=` option ...
- ... is a modifier, i.e. it cannot be used along with other
modifier options in a single filter
-The syntax is `urlskip=[steps]`, where steps is a space-separated list of extraction directives detailing what action to perform on the current URL.
+The syntax is `urlskip=[steps]`, where steps is a serie of space-separated directives representing the transformation steps to perform to extract the final URL to which a network request should be redirected.
Valid directives:
-- `?name`: the value of parameter named `name` will be extracted and replace the current URL as the new URL
-- `&i` ([dev build 1.60.1b6+](https://github.com/gorhill/uBlock/commit/64b2086ba4)): meant to lookup a parameter's name at position `i` (1-based).
- The parameter name will be used as the URL (whereas `?` is meant to lookup a parameter's value)
-- `+https`: the protocol of the current URL will be forced to `https:`
- This directive will succeed only if the protocol of the current URL is either absent or matches `http:` or `https:`
-- `-base64` ([dev build 1.61.1+](https://github.com/gorhill/uBlock/commit/e81e70937f5b6f8f98bdd8e6f71af030486efab8)): decode as a base64-encoded string
+- `?name`: extracts the value of parameter `name`
+- `&i`: extracts the name of the parameter at position `i` (1-based) (New in [dev build 1.60.1b6+](https://github.com/gorhill/uBlock/commit/64b2086ba4))
+- `/.../`: extracts the first capture group of a regex (New in [dev build 1.60.1b11+](https://github.com/gorhill/uBlock/commit/c86ed5287b))
+- `+https`:
+ - prepends the current string with `https://` protocol in case it lacks a leading protocol
+ - or replaces already existing leading `http://` protocol with `https://`
+- `-base64`: performs base64-decoding on the current string (New in [dev build 1.60.1b1+](https://github.com/gorhill/uBlock/commit/e81e70937f5b6f8f98bdd8e6f71af030486efab8))
+- `-uricomponent`: performs URI component-decoding on the current string (New in [dev build 1.60.1b12+](https://github.com/gorhill/uBlock/commit/01eebffc1f))
-The final computed URL must be a valid URL as per [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL_API), otherwise the filter will be ignored.
+At any given step, the currently extracted string may not necessarily be a valid URL, and more transformation steps may be needed to obtain a valid URL once all the steps are applied.
+
+An unsupported step or a failed step will abort the transformation and no redirection will be performed.
+
+The final computed URL must be a valid URL as per [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL_API), otherwise the filter will be ignored and no redirection will be performed.
+
+Examples:
```adb
||example.com/path/to/tracker$urlskip=?url
@@ -1083,6 +1091,16 @@ The above filter will cause navigation to `https://shrinkearn.com/full?api=3dd1f
The above filter will cause navigation to: `https://www.pixiv.net/jump.php?https%3A%2F%2Fx.com%2FExample_Username` to automatically bypass navigation to `pixiv.net` and navigate directly to `https://x.com/Example_Username` (which was `%` decoded from `https%3A%2F%2Fx.com%2FExample_Username`).
+```adb
+||click.redditmail.com/CL0/$urlskip=/CL0\/.*?(www\.reddit\.com.+?)(?:\?|%3F)/ -uricomponent +https
+```
+
+The above filter will cause navigation to:
+- `https://click.redditmail.com/CL0/https://www.reddit.com/r/natureisfuckinglit/comments/1f7l41z/orca_pod_saying_hi_to_paddle_boarder/?%24deep_link=true&correlation_id=21bc5fa3-f0f4-43b5-92e4-6d2deb135b8a&post_fullname=t3_1f7l41z&post_index=2&ref=email_digest&ref_campaign=email_digest&ref_source=email&utm_content=post_author/1/01000191bd393638-90cd632e-f420-45fd-a732-27dc3e441ee2-000000/aBs5XoGsoLNHwf95BGM6JzVs4iNSldLNZ9hOBaWN_HA=369`
+- `https://click.redditmail.com/CL0/https:%2F%2Fwww.reddit.com/r/natureisfuckinglit/comments/1f7l41z/orca_pod_saying_hi_to_paddle_boarder/%3F%2524deep_link=true&correlation_id=21bc5fa3-f0f4-43b5-92e4-6d2deb135b8a&post_fullname=t3_1f7l41z&post_index=2&ref=email_digest&ref_campaign=email_digest&ref_source=email&utm_content=post_author/1/01000191bd393638-90cd632e-f420-45fd-a732-27dc3e441ee2-000000/aBs5XoGsoLNHwf95BGM6JzVs4iNSldLNZ9hOBaWN_HA=369%5D`
+
+to automatically bypass navigation to `click.redditmail.com` and navigate directly to `https://` + `www.reddit.com/r/natureisfuckinglit/comments/1f7l41z/orca_pod_saying_hi_to_paddle_boarder/` (after it previously was `URI component` decoded).
+
Technical notes