Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Allow overriding safety limit without proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
imerr committed May 18, 2023
1 parent a19db83 commit 410a783
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 410a783

Please sign in to comment.