Index: Add option to remove /client help

fixes #7

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
Gunwant Jain
2022-04-23 04:39:52 +05:30
parent 78f8398382
commit c8637b04dd
5 changed files with 28 additions and 5 deletions

View File

@@ -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 {

View File

@@ -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))
}