Remove templating

This commit is contained in:
2024-12-22 01:11:15 -06:00
parent 81c3087462
commit 0a45ae1dd9
4 changed files with 0 additions and 115 deletions

95
Cargo.lock generated
View File

@@ -61,50 +61,6 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "askama"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28"
dependencies = [
"askama_derive",
"askama_escape",
"humansize",
"num-traits",
"percent-encoding",
]
[[package]]
name = "askama_derive"
version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83"
dependencies = [
"askama_parser",
"basic-toml",
"mime",
"mime_guess",
"proc-macro2",
"quote",
"serde",
"syn",
]
[[package]]
name = "askama_escape"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"
[[package]]
name = "askama_parser"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0"
dependencies = [
"nom",
]
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.83" version = "0.1.83"
@@ -155,15 +111,6 @@ version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "basic-toml"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.6.0" version = "2.6.0"
@@ -336,7 +283,6 @@ dependencies = [
name = "dynamic-preauth" name = "dynamic-preauth"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"askama",
"salvo", "salvo",
"tokio", "tokio",
"tracing", "tracing",
@@ -644,15 +590,6 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "humansize"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7"
dependencies = [
"libm",
]
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "1.5.2" version = "1.5.2"
@@ -935,12 +872,6 @@ version = "0.2.169"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
[[package]]
name = "libm"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa"
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
version = "0.4.14" version = "0.4.14"
@@ -991,22 +922,6 @@ dependencies = [
"unicase", "unicase",
] ]
[[package]]
name = "mime_guess"
version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
dependencies = [
"mime",
"unicase",
]
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.8.2" version = "0.8.2"
@@ -1082,16 +997,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]] [[package]]
name = "nu-ansi-term" name = "nu-ansi-term"
version = "0.46.0" version = "0.46.0"

View File

@@ -4,7 +4,6 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
askama = "0.12.1"
salvo = { version = "0.74.3", features = ["affix-state", "logging", "serve-static"] } salvo = { version = "0.74.3", features = ["affix-state", "logging", "serve-static"] }
tokio = { version = "1", features = ["macros"] } tokio = { version = "1", features = ["macros"] }
tracing = "0.1" tracing = "0.1"

View File

@@ -1,7 +1,6 @@
use std::collections::HashMap; use std::collections::HashMap;
use std::path; use std::path;
use askama::Template;
use salvo::http::HeaderValue; use salvo::http::HeaderValue;
use salvo::logging::Logger; use salvo::logging::Logger;
@@ -48,22 +47,6 @@ fn search(buf: &[u8], pattern: &[u8], start_index: usize) -> Option<usize> {
None None
} }
#[derive(Template)]
#[template(path = "index.html")]
struct IndexTemplate<'a> {
available: Vec<&'a str>,
}
#[handler]
async fn index(res: &mut Response, depot: &Depot) {
let state = depot.obtain::<State>().unwrap();
let index_tmpl = IndexTemplate {
available: state.executables.keys().map(|x| *x).collect(),
};
res.render(Text::Html(index_tmpl.render().unwrap()));
}
#[handler] #[handler]
async fn download(depot: &mut Depot, req: &mut Request, res: &mut Response) { async fn download(depot: &mut Depot, req: &mut Request, res: &mut Response) {
let article_id = req.param::<String>("id").unwrap(); let article_id = req.param::<String>("id").unwrap();
@@ -160,7 +143,6 @@ async fn main() {
let router = Router::new() let router = Router::new()
.hoop(affix_state::inject(state)) .hoop(affix_state::inject(state))
.push(Router::with_path("download/<id>").get(download)) .push(Router::with_path("download/<id>").get(download))
.push(Router::new().get(index))
.push(Router::with_path("<**path>").get(StaticDir::new(["./public"]))); .push(Router::with_path("<**path>").get(StaticDir::new(["./public"])));
let service = Service::new(router).hoop(Logger::new()); let service = Service::new(router).hoop(Logger::new());

View File

@@ -1 +0,0 @@
Available for download: {{ available|join(", ") }}