From 410a783055de2e39093334583c65836f215a8b9c Mon Sep 17 00:00:00 2001 From: Robin Rolf Date: Thu, 18 May 2023 23:13:19 +0200 Subject: [PATCH] Allow overriding safety limit without proxy --- Cargo.toml | 2 +- src/main.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 80eaa0c..824c329 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "imgur_id7" -version = "0.1.5" +version = "0.1.6" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index aef3729..3d67643 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,10 +37,11 @@ async fn main() { // read proxies: let proxy_file_name = if args.len() == 3 { "--no-proxies" } else { args[3].as_str() }; let using_proxies = proxy_file_name != "--no-proxies"; - let concurrent: usize = args[2].parse().unwrap(); + + let concurrent: usize = args[2].as_str().trim_start_matches("!").parse().unwrap(); if !using_proxies { - if concurrent > NO_PROXY_CONC_LIMIT { - println!("Concurrency seems to be set too high for a single ip. (max. {NO_PROXY_CONC_LIMIT}), refusing to start"); + if !args[2].starts_with("!") && concurrent > NO_PROXY_CONC_LIMIT { + println!("Concurrency seems to be set too high for a single ip. (max. {NO_PROXY_CONC_LIMIT}), refusing to start.\nIf you're really sure you want this, prefix the number with ! and I'll do it."); exit(1); } for _ in 0..concurrent {