no compression, better http caching, better css

pull/3/head
neri 2 years ago
parent 07db070107
commit 941c07bdaf
  1. 43
      Cargo.lock
  2. 2
      Cargo.toml
  3. 2
      README.md
  4. 7
      src/main.rs
  5. 10
      static/index.css
  6. 0
      static/index.html

43
Cargo.lock generated

@ -69,14 +69,12 @@ dependencies = [
"actix-utils",
"base64 0.11.0",
"bitflags",
"brotli2",
"bytes",
"chrono",
"copyless",
"derive_more",
"either",
"encoding_rs",
"flate2",
"futures-channel",
"futures-core",
"futures-util",
@ -508,26 +506,6 @@ dependencies = [
"waker-fn",
]
[[package]]
name = "brotli-sys"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "brotli2"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e"
dependencies = [
"brotli-sys",
"libc",
]
[[package]]
name = "bumpalo"
version = "3.4.0"
@ -633,15 +611,6 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
[[package]]
name = "crc32fast"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-queue"
version = "0.2.3"
@ -799,18 +768,6 @@ version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36a9cb09840f81cd211e435d00a4e487edd263dc3c8ff815c32dd76ad668ebed"
[[package]]
name = "flate2"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68c90b0fc46cf89d227cc78b40e494ff81287a92dd07631e5af0d06fe3cf885e"
dependencies = [
"cfg-if",
"crc32fast",
"libc",
"miniz_oxide",
]
[[package]]
name = "fnv"
version = "1.0.7"

@ -7,7 +7,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-web = { version = "2.0.0", default-features = false, features = [ "compress" ] }
actix-web = { version = "2.0.0", default-features = false, features = [] }
sqlx = { version = "0.3.5", default-features = false, features = [ "runtime-async-std", "postgres", "chrono" ] }
actix-rt = "1.1.1"
env_logger = "0.7.1"

@ -25,6 +25,8 @@ docker-compose up -d --build
## running & config
The static files directory needs to be next to the binary.
| environment variable | default value |
| -------------------- | --------------------- |
| DATABASE_URL | postresql://localhost |

@ -24,14 +24,11 @@ use sqlx::{
};
use std::env;
const INDEX_HTML: &str = include_str!("../template/index.html");
const UPLOAD_HTML: &str = include_str!("../template/upload.html");
const VIEW_HTML: &str = include_str!("../template/view.html");
async fn index() -> Result<HttpResponse, Error> {
Ok(HttpResponse::Ok()
.content_type("text/html")
.body(INDEX_HTML))
async fn index() -> Result<NamedFile, Error> {
Ok(NamedFile::open("static/index.html").map_err(|_| error::ErrorNotFound(""))?)
}
async fn upload(

@ -31,8 +31,7 @@ label {
input,
select,
textarea,
.button,
.button:visited {
.button {
background-color: #222222;
color: #dddddd;
padding: 0.5rem;
@ -44,9 +43,16 @@ textarea,
.button {
cursor: pointer;
}
a.button {
text-decoration: none;
}
a.button:visited {
color: #dddddd;
}
.button:hover {
background-color: #444444;
}

Loading…
Cancel
Save