Index: Add option to remove /client help
fixes #7 Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
@@ -67,6 +67,10 @@ pub struct Args {
|
||||
/// Binary uploads file size limit (in MiB)
|
||||
#[clap(short, long, default_value_t = 100)]
|
||||
binary_upload_limit: i32,
|
||||
|
||||
/// Include client description
|
||||
#[clap(short, long, env)]
|
||||
client_desc: bool,
|
||||
}
|
||||
|
||||
pub fn get_parsed_args() -> Args {
|
||||
|
||||
@@ -2,11 +2,21 @@ use rocket_dyn_templates::Template;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::get_parsed_args;
|
||||
use crate::models::response_wrapper::ResponseWrapper;
|
||||
|
||||
#[get("/")]
|
||||
pub async fn index() -> ResponseWrapper<Template> {
|
||||
let mut map = HashMap::new();
|
||||
|
||||
// whether to include `/client` info
|
||||
let client_desc = match get_parsed_args().client_desc {
|
||||
true => "placeholder",
|
||||
false => "",
|
||||
};
|
||||
|
||||
map.insert("title", "bin");
|
||||
map.insert("client_desc", client_desc);
|
||||
|
||||
ResponseWrapper::meta_response(Template::render("index.html", &map))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user