fix: rename --no-auth-read to --no-auth-access
parent
0a3d9c391f
commit
7c2449cb1a
14
src/args.rs
14
src/args.rs
|
@ -76,14 +76,14 @@ fn app() -> clap::Command<'static> {
|
||||||
.short('a')
|
.short('a')
|
||||||
.display_order(1)
|
.display_order(1)
|
||||||
.long("auth")
|
.long("auth")
|
||||||
.help("Use HTTP authentication to restrict write")
|
.help("Use HTTP authentication")
|
||||||
.value_name("user:pass"),
|
.value_name("user:pass"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("auth-access")
|
Arg::new("no-auth-access")
|
||||||
.display_order(1)
|
.display_order(1)
|
||||||
.long("auth-access")
|
.long("no-auth-access")
|
||||||
.help("Enhance authentication to restrict access"),
|
.help("Not required auth when access static files"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("cors")
|
Arg::new("cors")
|
||||||
|
@ -115,7 +115,7 @@ pub struct Args {
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
pub path_prefix: Option<String>,
|
pub path_prefix: Option<String>,
|
||||||
pub auth: Option<String>,
|
pub auth: Option<String>,
|
||||||
pub auth_access: bool,
|
pub no_auth_access: bool,
|
||||||
pub allow_upload: bool,
|
pub allow_upload: bool,
|
||||||
pub allow_delete: bool,
|
pub allow_delete: bool,
|
||||||
pub allow_symlink: bool,
|
pub allow_symlink: bool,
|
||||||
|
@ -137,7 +137,7 @@ impl Args {
|
||||||
let path_prefix = matches.value_of("path-prefix").map(|v| v.to_owned());
|
let path_prefix = matches.value_of("path-prefix").map(|v| v.to_owned());
|
||||||
let cors = matches.is_present("cors");
|
let cors = matches.is_present("cors");
|
||||||
let auth = matches.value_of("auth").map(|v| v.to_owned());
|
let auth = matches.value_of("auth").map(|v| v.to_owned());
|
||||||
let auth_access = matches.is_present("auth-access");
|
let no_auth_access = matches.is_present("no-auth-access");
|
||||||
let allow_upload = matches.is_present("allow-all") || matches.is_present("allow-upload");
|
let allow_upload = matches.is_present("allow-all") || matches.is_present("allow-upload");
|
||||||
let allow_delete = matches.is_present("allow-all") || matches.is_present("allow-delete");
|
let allow_delete = matches.is_present("allow-all") || matches.is_present("allow-delete");
|
||||||
let allow_symlink = matches.is_present("allow-all") || matches.is_present("allow-symlink");
|
let allow_symlink = matches.is_present("allow-all") || matches.is_present("allow-symlink");
|
||||||
|
@ -158,7 +158,7 @@ impl Args {
|
||||||
path,
|
path,
|
||||||
path_prefix,
|
path_prefix,
|
||||||
auth,
|
auth,
|
||||||
auth_access,
|
no_auth_access,
|
||||||
cors,
|
cors,
|
||||||
allow_delete,
|
allow_delete,
|
||||||
allow_upload,
|
allow_upload,
|
||||||
|
|
|
@ -501,7 +501,7 @@ impl InnerService {
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
_ => false,
|
_ => false,
|
||||||
},
|
},
|
||||||
None => !self.args.auth_access && req.method() == Method::GET,
|
None => self.args.no_auth_access && req.method() == Method::GET,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -733,8 +733,8 @@ fn print_listening(address: &str, port: u16, tls: bool) {
|
||||||
for addr in addrs {
|
for addr in addrs {
|
||||||
eprintln!(" {}://{}:{}", protocol, addr, port);
|
eprintln!(" {}://{}:{}", protocol, addr, port);
|
||||||
}
|
}
|
||||||
|
eprintln!();
|
||||||
}
|
}
|
||||||
eprintln!();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn retrive_listening_addrs(address: &str) -> Vec<String> {
|
fn retrive_listening_addrs(address: &str) -> Vec<String> {
|
||||||
|
|
Loading…
Reference in New Issue