diff --git a/Cargo.lock b/Cargo.lock index 5049246..97d8ad9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,56 +65,6 @@ dependencies = [ "libc", ] -[[package]] -name = "askama" -version = "0.13.0" -source = "git+https://github.com/djc/askama.git#a7e108cd76a2a89dfdf0dfb87b1286ec3a523f08" -dependencies = [ - "askama_derive", - "askama_escape", - "humansize", - "num-traits", - "percent-encoding", -] - -[[package]] -name = "askama_axum" -version = "0.5.0" -source = "git+https://github.com/djc/askama.git#a7e108cd76a2a89dfdf0dfb87b1286ec3a523f08" -dependencies = [ - "askama", - "axum-core", - "http", -] - -[[package]] -name = "askama_derive" -version = "0.13.0" -source = "git+https://github.com/djc/askama.git#a7e108cd76a2a89dfdf0dfb87b1286ec3a523f08" -dependencies = [ - "askama_parser", - "basic-toml", - "mime", - "mime_guess", - "proc-macro2", - "quote", - "serde", - "syn", -] - -[[package]] -name = "askama_escape" -version = "0.11.0" -source = "git+https://github.com/djc/askama.git#a7e108cd76a2a89dfdf0dfb87b1286ec3a523f08" - -[[package]] -name = "askama_parser" -version = "0.3.1" -source = "git+https://github.com/djc/askama.git#a7e108cd76a2a89dfdf0dfb87b1286ec3a523f08" -dependencies = [ - "nom", -] - [[package]] name = "async-bincode" version = "0.7.2" @@ -1344,8 +1294,6 @@ dependencies = [ name = "nyazoom" version = "0.1.0" dependencies = [ - "askama", - "askama_axum", "async-bincode", "async-trait", "async_zip", @@ -1358,6 +1306,8 @@ dependencies = [ "http-body-util", "rand", "reqwest", + "rinja", + "rinja_axum", "sanitize-filename-reader-friendly", "serde", "serde_derive", @@ -1713,6 +1663,58 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rinja" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dc4940d00595430b3d7d5a01f6222b5e5b51395d1120bdb28d854bb8abb17a5" +dependencies = [ + "humansize", + "itoa", + "percent-encoding", + "rinja_derive", +] + +[[package]] +name = "rinja_axum" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc64d77bb950f6498d0fc64b028d168fcb4e56ac31b66a8ae05f64d3b0c218b6" +dependencies = [ + "axum-core", + "http", + "rinja", +] + +[[package]] +name = "rinja_derive" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d9ed0146aef6e2825f1b1515f074510549efba38d71f4554eec32eb36ba18b" +dependencies = [ + "basic-toml", + "memchr", + "mime", + "mime_guess", + "proc-macro2", + "quote", + "rinja_parser", + "rustc-hash", + "serde", + "syn", +] + +[[package]] +name = "rinja_parser" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f9a866e2e00a7a1fb27e46e9e324a6f7c0e7edc4543cae1d38f4e4a100c610" +dependencies = [ + "memchr", + "nom", + "serde", +] + [[package]] name = "rsa" version = "0.9.6" @@ -1739,6 +1741,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustix" version = "0.38.35" diff --git a/Cargo.toml b/Cargo.toml index 1890d2d..124defd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,9 +47,10 @@ features = ["runtime-tokio", "chrono", "sqlite"] [profile.dev.package.sqlx-macros] opt-level = 3 -[dependencies.askama] -git = "https://github.com/djc/askama.git" +[dependencies.rinja] +version = "0.3.5" features = ["with-axum"] -[dependencies.askama_axum] -git = "https://github.com/djc/askama.git" + +[dependencies.rinja_axum] +version = "0.3.5" diff --git a/src/main.rs b/src/main.rs index 89c8cc1..78c6b7e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ use axum::{ }; use axum_extra::TypedHeader; use tower_http::{services::ServeDir, trace::TraceLayer}; -use views::askama::WelcomeTemplate; +use views::templates::WelcomeTemplate; use std::{io, net::SocketAddr}; diff --git a/src/router/link.rs b/src/router/link.rs index 85ff8b3..33315e0 100644 --- a/src/router/link.rs +++ b/src/router/link.rs @@ -6,7 +6,7 @@ use axum::{ }; use reqwest::StatusCode; -use crate::{askama::DownloadLinkTemplate, AppState, AsyncRemoveRecord}; +use crate::{templates::DownloadLinkTemplate, AppState, AsyncRemoveRecord}; pub fn get_link_router() -> Router { // Link pages diff --git a/src/router/records.rs b/src/router/records.rs index 7a283d8..cebc18e 100644 --- a/src/router/records.rs +++ b/src/router/records.rs @@ -1,6 +1,6 @@ use axum::{extract::State, response::IntoResponse, routing::get, Json, Router}; -use crate::{askama::LinkListTemplate, AppState}; +use crate::{templates::LinkListTemplate, AppState}; pub fn get_records_router() -> Router { // Records views diff --git a/src/router/upload.rs b/src/router/upload.rs index 8a4b020..48305af 100644 --- a/src/router/upload.rs +++ b/src/router/upload.rs @@ -14,7 +14,7 @@ use tokio::io; use tokio_util::{compat::FuturesAsyncWriteCompatExt, io::StreamReader}; use tower_http::limit::RequestBodyLimitLayer; -use crate::{askama::DownloadLinkFragment, cache, util, AppState, UploadRecord}; +use crate::{cache, templates::DownloadLinkFragment, util, AppState, UploadRecord}; pub fn get_upload_router() -> Router { // Upload needs a subrouter to increase the body limit diff --git a/src/views/mod.rs b/src/views/mod.rs index 94897de..e029ea6 100644 --- a/src/views/mod.rs +++ b/src/views/mod.rs @@ -1,7 +1,7 @@ use futures::TryFutureExt; use serde::Deserialize; -pub mod askama; +pub mod templates; #[derive(Debug, Deserialize)] pub struct CatFact { diff --git a/src/views/askama.rs b/src/views/templates.rs similarity index 97% rename from src/views/askama.rs rename to src/views/templates.rs index 3702baa..4f4be69 100644 --- a/src/views/askama.rs +++ b/src/views/templates.rs @@ -1,4 +1,4 @@ -use askama_axum::Template; +use rinja_axum::Template; use crate::{link::get_remaining_text, UploadRecord}; @@ -47,4 +47,3 @@ impl DownloadLinkFragment { pub struct LinkListTemplate { pub record_keys: Vec, } -