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

View File

@@ -1,7 +1,6 @@
use std::collections::HashMap;
use std::path;
use askama::Template;
use salvo::http::HeaderValue;
use salvo::logging::Logger;
@@ -48,22 +47,6 @@ fn search(buf: &[u8], pattern: &[u8], start_index: usize) -> Option<usize> {
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]
async fn download(depot: &mut Depot, req: &mut Request, res: &mut Response) {
let article_id = req.param::<String>("id").unwrap();
@@ -160,7 +143,6 @@ async fn main() {
let router = Router::new()
.hoop(affix_state::inject(state))
.push(Router::with_path("download/<id>").get(download))
.push(Router::new().get(index))
.push(Router::with_path("<**path>").get(StaticDir::new(["./public"])));
let service = Service::new(router).hoop(Logger::new());