mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 20:09:48 -05:00
style(server): make the default landing page fancier
This commit is contained in:
parent
607f07b6e1
commit
4a4301ee72
2 changed files with 16 additions and 7 deletions
19
config.toml
19
config.toml
|
@ -8,9 +8,14 @@ max_content_length = "10MB"
|
||||||
upload_path = "./upload"
|
upload_path = "./upload"
|
||||||
timeout = "30s"
|
timeout = "30s"
|
||||||
expose_version = false
|
expose_version = false
|
||||||
landing_page = """Submit files via HTTP POST here:
|
landing_page = """
|
||||||
curl -F 'file=@example.txt' <server>"
|
┬─┐┬ ┬┌─┐┌┬┐┬ ┬┌─┐┌─┐┌─┐┌┬┐┌─┐
|
||||||
This will return the finished URL.
|
├┬┘│ │└─┐ │ └┬┘├─┘├─┤└─┐ │ ├┤
|
||||||
|
┴└─└─┘└─┘ ┴ ┴ ┴ ┴ ┴└─┘ ┴ └─┘
|
||||||
|
|
||||||
|
Submit files via HTTP POST here:
|
||||||
|
curl -F 'file=@example.txt' <server>
|
||||||
|
This will return the URL of the uploaded file.
|
||||||
|
|
||||||
The server administrator might remove any pastes that they do not personally
|
The server administrator might remove any pastes that they do not personally
|
||||||
want to host.
|
want to host.
|
||||||
|
@ -19,10 +24,12 @@ If you are the server administrator and want to change this page, just go
|
||||||
into your config file and change it! If you change the expiry time, it is
|
into your config file and change it! If you change the expiry time, it is
|
||||||
recommended that you do.
|
recommended that you do.
|
||||||
|
|
||||||
Check out the GitHub repository at https://github.com/orhun/rustypaste
|
|
||||||
|
|
||||||
By default, pastes expire every hour. The server admin may or may not have
|
By default, pastes expire every hour. The server admin may or may not have
|
||||||
changed this."""
|
changed this.
|
||||||
|
|
||||||
|
Check out the GitHub repository at https://github.com/orhun/rustypaste
|
||||||
|
Command line tool is available at https://github.com/orhun/rustypaste-cli
|
||||||
|
"""
|
||||||
|
|
||||||
[paste]
|
[paste]
|
||||||
random_url = { enabled = true, type = "petname", words = 2, separator = "-" }
|
random_url = { enabled = true, type = "petname", words = 2, separator = "-" }
|
||||||
|
|
|
@ -25,7 +25,9 @@ async fn index(config: web::Data<RwLock<Config>>) -> Result<HttpResponse, Error>
|
||||||
.read()
|
.read()
|
||||||
.map_err(|_| error::ErrorInternalServerError("cannot acquire config"))?;
|
.map_err(|_| error::ErrorInternalServerError("cannot acquire config"))?;
|
||||||
match &config.server.landing_page {
|
match &config.server.landing_page {
|
||||||
Some(page) => Ok(HttpResponse::Ok().body(page.clone())),
|
Some(page) => Ok(HttpResponse::Ok()
|
||||||
|
.content_type("text/plain; charset=\"UTF-8\"")
|
||||||
|
.body(page.clone())),
|
||||||
None => Ok(HttpResponse::Found()
|
None => Ok(HttpResponse::Found()
|
||||||
.append_header(("Location", env!("CARGO_PKG_HOMEPAGE")))
|
.append_header(("Location", env!("CARGO_PKG_HOMEPAGE")))
|
||||||
.finish()),
|
.finish()),
|
||||||
|
|
Loading…
Reference in a new issue