Skip to content

Commit

Permalink
[Feature] Remove ref=* for Amazon links.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanghai committed Dec 16, 2023
1 parent 48a88c4 commit 316d589
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ val BuiltinRuleList =
script =
"""
if ($.matches(url, '.+\\.amazon\\.(ae|ca|cn|co\\.jp|co\\.uk|com|com\\.au|com\\.be|com\\.br|com\\.mx|com\\.tr|de|eg|es|fr|in|it|nl|pl|sa|se|sg)')) {
return $.setEncodedQuery(url, null);
url = $.setEncodedQuery(url, null);
const path = $.getEncodedPath(url);
const newPath = path.replace(/\/ref=.+$/i, '');
if (newPath !== path) {
url = $.setEncodedPath(url, newPath);
}
return url;
}
"""
.trimIndent()
Expand Down

0 comments on commit 316d589

Please sign in to comment.