Index: Add option to remove /client help
fixes #7 Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
@@ -11,7 +11,7 @@ rocket = "0.5.0-rc.1"
|
|||||||
tree_magic = "0.2.3"
|
tree_magic = "0.2.3"
|
||||||
syntect = "4.6.0"
|
syntect = "4.6.0"
|
||||||
rust-embed="6.3.0"
|
rust-embed="6.3.0"
|
||||||
clap = { version = "3.0.9", features = ["derive"] }
|
clap = { version = "3.0.9", features = ["derive", "env"] }
|
||||||
once_cell = "1"
|
once_cell = "1"
|
||||||
sha256 = "1"
|
sha256 = "1"
|
||||||
time = { version = "0.3", features = ["formatting"] }
|
time = { version = "0.3", features = ["formatting"] }
|
||||||
|
|||||||
11
readme.md
11
readme.md
@@ -55,6 +55,11 @@ PASTELINK="$URL$RESPONSE"
|
|||||||
echo "$PASTELINK.$EXTENSION"
|
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
|
#### Usage
|
||||||
|
|
||||||
It just works.
|
It just works.
|
||||||
@@ -110,6 +115,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- BIN_PORT=6163 # Defaults to 6162
|
- BIN_PORT=6163 # Defaults to 6162
|
||||||
- BIN_LIMITS={form="16 MiB"}
|
- BIN_LIMITS={form="16 MiB"}
|
||||||
|
- BIN_CLIENT_DESC=placeholder
|
||||||
volumes:
|
volumes:
|
||||||
- ./upload:/upload # upload folder will have your pastes
|
- ./upload:/upload # upload folder will have your pastes
|
||||||
```
|
```
|
||||||
@@ -137,11 +143,14 @@ USAGE:
|
|||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-a, --address <ADDRESS>
|
-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>
|
-b, --binary-upload-limit <BINARY_UPLOAD_LIMIT>
|
||||||
Binary uploads file size limit (in MiB) [default: 100]
|
Binary uploads file size limit (in MiB) [default: 100]
|
||||||
|
|
||||||
|
-c, --client-desc
|
||||||
|
Include client description [env: CLIENT_DESC=]
|
||||||
|
|
||||||
-h, --help
|
-h, --help
|
||||||
Print help information
|
Print help information
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ pub struct Args {
|
|||||||
/// Binary uploads file size limit (in MiB)
|
/// Binary uploads file size limit (in MiB)
|
||||||
#[clap(short, long, default_value_t = 100)]
|
#[clap(short, long, default_value_t = 100)]
|
||||||
binary_upload_limit: i32,
|
binary_upload_limit: i32,
|
||||||
|
|
||||||
|
/// Include client description
|
||||||
|
#[clap(short, long, env)]
|
||||||
|
client_desc: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_parsed_args() -> Args {
|
pub fn get_parsed_args() -> Args {
|
||||||
|
|||||||
@@ -2,11 +2,21 @@ use rocket_dyn_templates::Template;
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use crate::get_parsed_args;
|
||||||
use crate::models::response_wrapper::ResponseWrapper;
|
use crate::models::response_wrapper::ResponseWrapper;
|
||||||
|
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
pub async fn index() -> ResponseWrapper<Template> {
|
pub async fn index() -> ResponseWrapper<Template> {
|
||||||
let mut map = HashMap::new();
|
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("title", "bin");
|
||||||
|
map.insert("client_desc", client_desc);
|
||||||
|
|
||||||
ResponseWrapper::meta_response(Template::render("index.html", &map))
|
ResponseWrapper::meta_response(Template::render("index.html", &map))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ WEB USAGE
|
|||||||
Paste an image from your clipboard using Ctrl + v, or
|
Paste an image from your clipboard using Ctrl + v, or
|
||||||
After typing, press the big yellow button to paste, or
|
After typing, press the big yellow button to paste, or
|
||||||
Just press Ctrl + Enter once done typing.
|
Just press Ctrl + Enter once done typing.
|
||||||
|
{% if client_desc %}
|
||||||
CLI USAGE
|
CLI USAGE
|
||||||
Client available at /client
|
Client available at /client
|
||||||
|
{% endif %}
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
github.com/wantguns/bin
|
github.com/wantguns/bin
|
||||||
" autofocus autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
|
" autofocus autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
|
||||||
@@ -206,4 +206,4 @@ SEE ALSO
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script src="/static/js/index.js"></script>
|
<script src="/static/js/index.js"></script>
|
||||||
{% endblock body %}
|
{% endblock body %}
|
||||||
|
|||||||
Reference in New Issue
Block a user