aboutsummaryrefslogtreecommitdiff
path: root/src/nitrous.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-08-21 06:14:16 +0000
committerFuwn <[email protected]>2021-08-21 06:14:16 +0000
commit192745305bf5afe1a07bf504b3dd44eb83ffbf0e (patch)
tree218493e35aab514289f8d2ec08dd20600a11fc20 /src/nitrous.rs
parentfix(nitrous): socks4h being used instead of socks4 (diff)
downloadnitrous-192745305bf5afe1a07bf504b3dd44eb83ffbf0e.tar.xz
nitrous-192745305bf5afe1a07bf504b3dd44eb83ffbf0e.zip
fix(check): use http if http
Diffstat (limited to 'src/nitrous.rs')
-rw-r--r--src/nitrous.rs37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/nitrous.rs b/src/nitrous.rs
index f8d22e9..d589db9 100644
--- a/src/nitrous.rs
+++ b/src/nitrous.rs
@@ -77,19 +77,34 @@ impl Nitrous {
let code = code.unwrap();
let status = reqwest::Client::builder()
- .proxy(reqwest::Proxy::all(format!("{}://{}", {
- match proxy_type {
- ProxyType::Http => "http",
- ProxyType::Socks4 => "socks4",
- ProxyType::Socks5 | ProxyType::Tor => "socks5h",
- }
- }, proxy_addr)).unwrap())
+ .proxy(
+ reqwest::Proxy::all(format!(
+ "{}://{}",
+ {
+ match proxy_type {
+ ProxyType::Http => "http",
+ ProxyType::Socks4 => "socks4",
+ ProxyType::Socks5 | ProxyType::Tor => "socks5h",
+ }
+ },
+ proxy_addr
+ ))
+ .unwrap(),
+ )
.build()
.unwrap()
- .get(
- format!("https://discordapp.com/api/v6/entitlements/gift-codes/{}?with_application=false&\
- with_subscription_plan=true", code),
- )
+ .get(format!(
+ "{}://discordapp.com/api/v6/entitlements/gift-codes/{}?with_application=false&\
+ with_subscription_plan=true",
+ {
+ if proxy_type == ProxyType::Http {
+ "http"
+ } else {
+ "https"
+ }
+ },
+ code
+ ))
.send()
.await
.unwrap()