mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 06:58:27 +03:00
Decode some Copernica link tracking
This commit is contained in:
parent
974350ebee
commit
cfcc8c73af
1 changed files with 5 additions and 2 deletions
|
|
@ -31,15 +31,18 @@ const
|
|||
* https://github.com/M66B/FairEmail/blob/master/app/src/main/java/eu/faircode/email/UriHelper.java
|
||||
*/
|
||||
// eslint-disable-next-line max-len
|
||||
stripParams = /^(utm_|ec_|fbclid|mc_eid|mkt_tok|_hsenc|vero_id|oly_enc_id|oly_anon_id|__s|Referrer|mailing|elq|bch|trc|ref|correlation_id|pd_|pf_)/i,
|
||||
stripParams = /^(utm_|ec_|fbclid|mc_eid|mkt_tok|_hsenc|vero_id|oly_enc_id|oly_anon_id|__s|Referrer|mailing|elq|bch|trc|ref|correlation_id|pd_|pf_|email_hash)/i,
|
||||
urlGetParam = (url, name) => new URL(url).searchParams.get(name) || url,
|
||||
base64Url = data => atob(data.replace(/_/g,'/').replace(/-/g,'+')),
|
||||
decode = decodeURIComponent,
|
||||
stripTracking = url => {
|
||||
try {
|
||||
let nurl = url
|
||||
// Copernica
|
||||
.replace(/^.+\/(https%253A[^/?&]+).*$/i, (...m) => decode(decode(m[1])))
|
||||
.replace(/tracking\.(printabout\.nl[^?]+)\?.*/i, (...m) => m[1])
|
||||
.replace(/(zalando\.nl[^?]+)\?.*/i, (...m) => m[1])
|
||||
.replace(/^.+(awstrack\.me|redditmail\.com)\/.+(https:%2F%2F[^/]+).*/i, (...m) => decodeURIComponent(m[2]))
|
||||
.replace(/^.+(awstrack\.me|redditmail\.com)\/.+(https:%2F%2F[^/]+).*/i, (...m) => decode(m[2]))
|
||||
.replace(/^.+(www\.google|safelinks\.protection\.outlook\.com|mailchimp\.com).+url=.+$/i,
|
||||
() => urlGetParam(url, 'url'))
|
||||
.replace(/^.+click\.godaddy\.com.+$/i, () => urlGetParam(url, 'redir'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue