aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cli.rs1
-rw-r--r--src/nitrous.rs37
2 files changed, 27 insertions, 11 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 4214a13..b25df83 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -10,6 +10,7 @@ use structopt::{
use crate::nitrous::Nitrous;
+#[derive(PartialEq)]
pub enum ProxyType {
Http,
Socks4,
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()