Index: Add option to remove /client help
fixes #7 Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
parent
78f8398382
commit
c8637b04dd
|
@ -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"] }
|
||||
|
|
11
readme.md
11
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>
|
||||
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_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
|
||||
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -24,10 +24,10 @@ WEB USAGE
|
|||
Paste an image from your clipboard using Ctrl + v, or
|
||||
After typing, press the big yellow button to paste, or
|
||||
Just press Ctrl + Enter once done typing.
|
||||
|
||||
{% if client_desc %}
|
||||
CLI USAGE
|
||||
Client available at /client
|
||||
|
||||
{% endif %}
|
||||
SEE ALSO
|
||||
github.com/wantguns/bin
|
||||
" autofocus autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
|
||||
|
@ -206,4 +206,4 @@ SEE ALSO
|
|||
</form>
|
||||
|
||||
<script src="/static/js/index.js"></script>
|
||||
{% endblock body %}
|
||||
{% endblock body %}
|
||||
|
|
Loading…
Reference in New Issue