forked from neri/datatrash
no compression, better http caching, better css
This commit is contained in:
parent
07db070107
commit
941c07bdaf
|
@ -69,14 +69,12 @@ dependencies = [
|
||||||
"actix-utils",
|
"actix-utils",
|
||||||
"base64 0.11.0",
|
"base64 0.11.0",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"brotli2",
|
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
"copyless",
|
"copyless",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"either",
|
"either",
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"flate2",
|
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
@ -508,26 +506,6 @@ dependencies = [
|
||||||
"waker-fn",
|
"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]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.4.0"
|
version = "3.4.0"
|
||||||
|
@ -633,15 +611,6 @@ version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
|
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]]
|
[[package]]
|
||||||
name = "crossbeam-queue"
|
name = "crossbeam-queue"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
|
@ -799,18 +768,6 @@ version = "1.3.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "36a9cb09840f81cd211e435d00a4e487edd263dc3c8ff815c32dd76ad668ebed"
|
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]]
|
[[package]]
|
||||||
name = "fnv"
|
name = "fnv"
|
||||||
version = "1.0.7"
|
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
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[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" ] }
|
sqlx = { version = "0.3.5", default-features = false, features = [ "runtime-async-std", "postgres", "chrono" ] }
|
||||||
actix-rt = "1.1.1"
|
actix-rt = "1.1.1"
|
||||||
env_logger = "0.7.1"
|
env_logger = "0.7.1"
|
||||||
|
|
|
@ -25,6 +25,8 @@ docker-compose up -d --build
|
||||||
|
|
||||||
## running & config
|
## running & config
|
||||||
|
|
||||||
|
The static files directory needs to be next to the binary.
|
||||||
|
|
||||||
| environment variable | default value |
|
| environment variable | default value |
|
||||||
| -------------------- | --------------------- |
|
| -------------------- | --------------------- |
|
||||||
| DATABASE_URL | postresql://localhost |
|
| DATABASE_URL | postresql://localhost |
|
||||||
|
|
|
@ -24,14 +24,11 @@ use sqlx::{
|
||||||
};
|
};
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
const INDEX_HTML: &str = include_str!("../template/index.html");
|
|
||||||
const UPLOAD_HTML: &str = include_str!("../template/upload.html");
|
const UPLOAD_HTML: &str = include_str!("../template/upload.html");
|
||||||
const VIEW_HTML: &str = include_str!("../template/view.html");
|
const VIEW_HTML: &str = include_str!("../template/view.html");
|
||||||
|
|
||||||
async fn index() -> Result<HttpResponse, Error> {
|
async fn index() -> Result<NamedFile, Error> {
|
||||||
Ok(HttpResponse::Ok()
|
Ok(NamedFile::open("static/index.html").map_err(|_| error::ErrorNotFound(""))?)
|
||||||
.content_type("text/html")
|
|
||||||
.body(INDEX_HTML))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn upload(
|
async fn upload(
|
||||||
|
|
|
@ -31,8 +31,7 @@ label {
|
||||||
input,
|
input,
|
||||||
select,
|
select,
|
||||||
textarea,
|
textarea,
|
||||||
.button,
|
.button {
|
||||||
.button:visited {
|
|
||||||
background-color: #222222;
|
background-color: #222222;
|
||||||
color: #dddddd;
|
color: #dddddd;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
|
@ -44,9 +43,16 @@ textarea,
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.button {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.button:visited {
|
||||||
|
color: #dddddd;
|
||||||
|
}
|
||||||
|
|
||||||
.button:hover {
|
.button:hover {
|
||||||
background-color: #444444;
|
background-color: #444444;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue