Skip to content

Commit

Permalink
out.reddit.com, cargo upgrade+update, e.emailalerts.cnn.com now no lo…
Browse files Browse the repository at this point in the history
…nger uses HTTP
  • Loading branch information
Scripter17 committed Aug 3, 2024
1 parent 1f95210 commit 42d7c20
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 45 deletions.
54 changes: 28 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ license = "AGPL-3.0-or-later"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "4.5.11", features = ["derive", "unstable-v5"] }
clap = { version = "4.5.13", features = ["derive", "unstable-v5"] }
serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.120"
serde_json = "1.0.122"
url = { version = "2.5.2", features = ["serde"] }
reqwest = { version = "0.12.5", features = ["blocking", "socks"], optional = true }
const-str = { version = "0.5.7", optional = true }
atty = { version = "0.2.14", optional = true }
thiserror = "1.0.63"
regex = { version = "1.10.5", optional = true }
regex = { version = "1.10.6", optional = true }
glob = { version = "0.3.1", optional = true }
psl = "2.1.55"
form_urlencoded = "1.2.1"
regex-syntax = { version = "0.8.4", optional = true }
percent-encoding = "2.3.1"
which = { version = "6.0.1", optional = true }
which = { version = "6.0.2", optional = true }
base64 = "0.22.1"
diesel = { version = "2.2.2", features = ["sqlite", "returning_clauses_for_sqlite_3_35"], optional = true }

Expand Down
38 changes: 25 additions & 13 deletions default-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
"shortlink-hosts": [
"a.co", "abc7.la", "adobe.ly", "aje.io", "amzn.asia", "amzn.to", "apple.co", "bbc.in", "bit.ly", "bitly.com", "bitly.com", "bityl.co",
"blizz.ly", "bloom.bg", "boxd.it", "buff.ly", "cbsn.ws", "cfl.re", "chn.ge", "chng.it", "cnb.cx", "cnn.it", "cos.lv", "cutt.ly",
"db.tt", "dcdr.me", "dis.gd", "dlvr.it", "e.emailalerts.cnn.com", "etsy.me", "fal.cn", "fb.me", "flip.it", "forms.gle", "g.co",
"db.tt", "dcdr.me", "dis.gd", "dlvr.it", "etsy.me", "fal.cn", "fb.me", "flip.it", "forms.gle", "g.co",
"glo.bo", "go.forbes.com", "go.nasa.gov", "gofund.me", "goo.gl", "goo.su", "gum.co", "hulu.tv", "ift.tt", "iwe.one", "j.mp", "k00.fr",
"katy.to", "kck.st", "l.leparisien.fr", "link.animaapp.com", "linkr.it", "lnk.to", "loom.ly", "mzl.la", "n.pr", "nas.cr", "ninten.do",
"ntdo.co.uk", "ny.ti", "nyer.cm", "nyti.ms", "nyto.ms", "on.forbes.com", "on.ft.com", "on.msnbc.com", "onl.bz", "onl.la", "onl.sc",
"operagx.gg", "orlo.uk", "ow.ly", "pin.it", "pixiv.me", "play.st", "py.pl", "rb.gy", "rblx.co", "rdbl.co", "redd.it", "reurl.cc",
"reut.rs", "rzr.to", "s.goodsmile.link", "shorturl.at", "spoti.fi", "spr.ly", "sqex.to", "t.co", "t.ly", "thecutio", "thr.cm",
"tmz.me", "tr.ee", "trib.al", "wn.nr", "wwdc.io", "x.gd", "xbx.ly", "xhslink.com", "yrp.ca"
"katy.to", "kck.st", "l.leparisien.fr", "link.animaapp.com", "linkr.it", "lnk.to", "loom.ly", "msft.it", "mzl.la", "n.pr", "nas.cr",
"ninten.do", "ntdo.co.uk", "ny.ti", "nyer.cm", "nyti.ms", "nyto.ms", "on.forbes.com", "on.ft.com", "on.msnbc.com", "onl.bz", "onl.la",
"onl.sc", "operagx.gg", "orlo.uk", "ow.ly", "pin.it", "pixiv.me", "play.st", "py.pl", "rb.gy", "rblx.co", "rdbl.co", "redd.it",
"reurl.cc", "reut.rs", "rzr.to", "s.goodsmile.link", "shorturl.at", "spoti.fi", "spr.ly", "sqex.to", "t.co", "t.ly", "thecutio",
"thr.cm", "tmz.me", "tr.ee", "trib.al", "wn.nr", "wwdc.io", "x.gd", "xbx.ly", "xhslink.com", "yrp.ca"
],
"utps": [
"Tcsack", "__hsfp", "__hssc", "__hstc", "__io_lv", "__s", "_branch_match_id", "_branch_referrer", "_clde", "_cldee", "_ga",
Expand Down Expand Up @@ -160,11 +160,11 @@
{"InSet": "bypass.vip-hosts"},
{"IsOneOf": [
"allmylinks.com", "api.linkr.bio", "api.pinterest.com", "bfy.tw", "buymeacoff.ee", "buymeacoffee.com", "cach.me", "cash.app",
"deviantart.com", "duckduckgo.com", "duckduckgo.com", "duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion", "gf.me",
"gofundme.com", "gofundme.com", "google.com", "gprivate.com", "href.li", "instagr.am", "instagram.com", "l.instagram.com",
"l.threads.com", "lmddgtfy.net", "lnk.bio", "out.reddit.com", "pawoo.net", "pixiv.net", "preview.tinyurl.com", "sketchfab.com",
"sketchfab.com", "skfb.ly", "smarturl.it", "steamcommunity.com", "subscribestar.adult", "t.umblr.com", "tinyurl.com", "toyhou.se",
"youtube.com"
"deviantart.com", "duckduckgo.com", "duckduckgo.com", "duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion",
"e.emailalerts.cnn.com", "gf.me", "gofundme.com", "gofundme.com", "google.com", "gprivate.com", "href.li", "instagr.am", "instagram.com",
"l.instagram.com", "l.threads.com", "lmddgtfy.net", "lnk.bio", "out.reddit.com", "pawoo.net", "pixiv.net", "preview.tinyurl.com",
"sketchfab.com", "sketchfab.com", "skfb.ly", "smarturl.it", "steamcommunity.com", "subscribestar.adult", "t.umblr.com", "tinyurl.com",
"toyhou.se", "youtube.com"
]},
{"InSet": "lmgtfy-hosts"},
{"LengthIs": 4},
Expand Down Expand Up @@ -465,7 +465,19 @@
}}
]}
}},
"out.reddit.com": {"GetUrlFromQueryParam": "url"}
"out.reddit.com": {"GetUrlFromQueryParam": "url"},
"e.emailalerts.cnn.com": {"SetPart": {
"part": "Whole",
"value": {"Modified": {
"source": {"Part": "Query"},
"modification": {"All": [
{"KeepNthSegment": {"split": "/", "n": 2}},
{"Remove": 0},
"Base64DecodeStandardNoPad",
{"KeepNthSegment": {"split": ",", "n": -1}}
]}
}}
}}
}
}
},
Expand Down Expand Up @@ -1045,7 +1057,7 @@
"PartMap": {
"part": "Path",
"map": {
"/search": {"AllowQueryParams": ["hl", "q", "tbm", "p", "udm"]},
"/search": {"AllowQueryParams": ["hl", "q", "tbm", "p", "udm", "filter"]},
"/setprefs": {"RemoveQueryParams": ["sa", "ved"]}
}
}
Expand Down
26 changes: 24 additions & 2 deletions src/types/string_modification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ pub enum StringModification {
///
/// If the call to [`String::from_utf8`] returns an error, that error is returned.
Base64DecodeStandard,
/// Encode the string using [`base64::prelude::BASE64_STANDARD_NO_PAD`].
Base64EncodeStandardNoPad,
/// Decode the string using [`base64::prelude::BASE64_STANDARD_NO_PAD`].
/// # Errors
/// If the call to [`base64::engine::Engine::decode`] returns an error, that error is returned.
///
/// If the call to [`String::from_utf8`] returns an error, that error is returned.
Base64DecodeStandardNoPad,
/// Encode the string using [`base64::prelude::BASE64_URL_SAFE`].
Base64EncodeUrlSafe,
/// Encode the string using [`base64::prelude::BASE64_URL_SAFE`].
Expand All @@ -783,6 +791,14 @@ pub enum StringModification {
///
/// If the call to [`String::from_utf8`] returns an error, that error is returned.
Base64DecodeUrlSafe,
/// Encode the string using [`base64::prelude::BASE64_URL_SAFE_NO_PAD`].
Base64EncodeUrlSafeNoPad,
/// Encode the string using [`base64::prelude::BASE64_URL_SAFE_NO_PAD`].
/// # Errors
/// If the call to [`base64::engine::Engine::decode`] returns an error, that error is returned.
///
/// If the call to [`String::from_utf8`] returns an error, that error is returned.
Base64DecodeUrlSafeNoPad,
/// [`serde_json::Value::pointer`].
/// Does not do any string conversions. I should probably add an option for that.
/// # Errors
Expand Down Expand Up @@ -1111,8 +1127,12 @@ impl StringModification {
Self::UrlDecode => *to=percent_decode_str(to).decode_utf8()?.into_owned(),
Self::Base64EncodeStandard => *to = BASE64_STANDARD.encode(to.as_bytes()),
Self::Base64DecodeStandard => *to = String::from_utf8(BASE64_STANDARD.decode(to.as_bytes())?)?,
Self::Base64EncodeStandardNoPad => *to = BASE64_STANDARD_NO_PAD.encode(to.as_bytes()),
Self::Base64DecodeStandardNoPad => *to = String::from_utf8(BASE64_STANDARD_NO_PAD.decode(to.as_bytes())?)?,
Self::Base64EncodeUrlSafe => *to = BASE64_URL_SAFE.encode(to.as_bytes()),
Self::Base64DecodeUrlSafe => *to = String::from_utf8(BASE64_URL_SAFE.decode(to.as_bytes())?)?,
Self::Base64EncodeUrlSafeNoPad => *to = BASE64_URL_SAFE_NO_PAD.encode(to.as_bytes()),
Self::Base64DecodeUrlSafeNoPad => *to = String::from_utf8(BASE64_URL_SAFE_NO_PAD.decode(to.as_bytes())?)?,
Self::JsonPointer(pointer) => *to = serde_json::from_str::<serde_json::Value>(to)?.pointer(get_str!(pointer, job_state, StringModificationError)).ok_or(StringModificationError::JsonValueNotFound)?.as_str().ok_or(StringModificationError::JsonValueIsNotAString)?.to_string(),
// fixed_n is guaranteed to be in bounds.
#[allow(clippy::indexing_slicing)]
Expand Down Expand Up @@ -1183,8 +1203,10 @@ impl StringModification {
Self::Debug(_) => false,
Self::None | Self::Error | Self::Lowercase | Self::Uppercase | Self::Remove(_) |
Self::KeepRange {..} | Self::UrlEncode | Self::UrlDecode |
Self::Base64EncodeStandard | Self::Base64DecodeStandard | Self::Base64EncodeUrlSafe |
Self::Base64DecodeUrlSafe => true,
Self::Base64EncodeStandard | Self::Base64DecodeStandard |
Self::Base64EncodeStandardNoPad | Self::Base64DecodeStandardNoPad |
Self::Base64EncodeUrlSafe | Self::Base64DecodeUrlSafe |
Self::Base64EncodeUrlSafeNoPad | Self::Base64DecodeUrlSafeNoPad => true,
#[cfg(feature = "regex")]
Self::RegexFind(_) => true
}
Expand Down

0 comments on commit 42d7c20

Please sign in to comment.