From 07db0701074fd260dd3f07e19532f5dc13869edf Mon Sep 17 00:00:00 2001 From: neri Date: Tue, 14 Jul 2020 13:21:57 +0200 Subject: [PATCH] add asciitrash copy and download button --- src/main.rs | 2 +- static/index.css | 19 +++++++++++++++++-- template/index.html | 2 +- template/view.html | 21 ++++++++++++++++++++- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 83a50cf..304e26c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -110,7 +110,7 @@ async fn download( let mut path = config.files_dir.clone(); path.push(&file_id); - if kind == FileKind::TEXT.to_string() { + if kind == FileKind::TEXT.to_string() && !req.query_string().contains("raw") { let content = fs::read_to_string(path).await.map_err(|_| { error::ErrorInternalServerError("this file should be here but could not be found") })?; diff --git a/static/index.css b/static/index.css index d639a79..4aaa4a7 100644 --- a/static/index.css +++ b/static/index.css @@ -30,7 +30,9 @@ label { input, select, -textarea { +textarea, +.button, +.button:visited { background-color: #222222; color: #dddddd; padding: 0.5rem; @@ -40,6 +42,19 @@ textarea { max-width: calc(100vw - 3rem - 4px); } -input[type="submit"] { +.button { + cursor: pointer; + text-decoration: none; +} + +.button:hover { + background-color: #444444; +} + +.button.main { background-color: green; } + +.button.main:hover { + background-color: forestgreen; +} diff --git a/template/index.html b/template/index.html index b5a9fc0..ce2e145 100644 --- a/template/index.html +++ b/template/index.html @@ -29,7 +29,7 @@
- + diff --git a/template/view.html b/template/view.html index 18e26b8..0deb0a0 100644 --- a/template/view.html +++ b/template/view.html @@ -9,7 +9,26 @@

datatrash

- + +
+ Herunterladen +
+