diff --git a/Cargo.toml b/Cargo.toml index 04af297..784d3a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ rocket = "0.5.0-rc.1" tree_magic = "0.2.3" syntect = "4.6.0" rust-embed="6.3.0" -clap = { version = "3.0.9", features = ["derive"] } +clap = { version = "3.0.9", features = ["derive", "env"] } once_cell = "1" sha256 = "1" time = { version = "0.3", features = ["formatting"] } diff --git a/readme.md b/readme.md index 72c7ab1..725407d 100644 --- a/readme.md +++ b/readme.md @@ -55,6 +55,11 @@ PASTELINK="$URL$RESPONSE" echo "$PASTELINK.$EXTENSION" ``` +You have the option to remove the `/client` description / help in the +landing page. To show the `/client` description, run the `bin` binary +with either `BIN_CLIENT_DESC` env variable or a `-c` flag. More on +arguments later + #### Usage It just works. @@ -110,6 +115,7 @@ services: environment: - BIN_PORT=6163 # Defaults to 6162 - BIN_LIMITS={form="16 MiB"} + - BIN_CLIENT_DESC=placeholder volumes: - ./upload:/upload # upload folder will have your pastes ``` @@ -137,11 +143,14 @@ USAGE: OPTIONS: -a, --address
- Address on which the webserver runs [default: 0.0.0.0] + Address on which the webserver runs [default: 127.0.0.1] -b, --binary-upload-limit Binary uploads file size limit (in MiB) [default: 100] + -c, --client-desc + Include client description [env: CLIENT_DESC=] + -h, --help Print help information diff --git a/src/main.rs b/src/main.rs index 280e2c4..f4b856e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 { diff --git a/src/routes/index.rs b/src/routes/index.rs index 2fa7a6e..e9cf64f 100644 --- a/src/routes/index.rs +++ b/src/routes/index.rs @@ -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