Compare commits

..

No commits in common. "88e1cd98f2aedb7244bb4d102d671a3f963f1a93" and "83c31d679d8a33bb45e01dcd70f381d49e80d008" have entirely different histories.

9 changed files with 63 additions and 83 deletions

View file

@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "INSERT INTO records (cache_name, max_downloads)\nVALUES (?, ?);\n",
"describe": {
"columns": [],
"parameters": {
"Right": 2
},
"nullable": []
},
"hash": "dcad7587b9bd5d84025db4e22c90d2ba0210edeaff5235a877e92235384f2c57"
}

112
Cargo.lock generated
View file

@ -65,6 +65,56 @@ 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"
@ -1294,6 +1344,8 @@ dependencies = [
name = "nyazoom"
version = "0.1.0"
dependencies = [
"askama",
"askama_axum",
"async-bincode",
"async-trait",
"async_zip",
@ -1306,8 +1358,6 @@ dependencies = [
"http-body-util",
"rand",
"reqwest",
"rinja",
"rinja_axum",
"sanitize-filename-reader-friendly",
"serde",
"serde_derive",
@ -1663,58 +1713,6 @@ 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"
@ -1741,12 +1739,6 @@ 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"

View file

@ -47,10 +47,9 @@ features = ["runtime-tokio", "chrono", "sqlite"]
[profile.dev.package.sqlx-macros]
opt-level = 3
[dependencies.rinja]
version = "0.3.5"
[dependencies.askama]
git = "https://github.com/djc/askama.git"
features = ["with-axum"]
[dependencies.rinja_axum]
version = "0.3.5"
[dependencies.askama_axum]
git = "https://github.com/djc/askama.git"

View file

@ -7,7 +7,7 @@ use axum::{
};
use axum_extra::TypedHeader;
use tower_http::{services::ServeDir, trace::TraceLayer};
use views::templates::WelcomeTemplate;
use views::askama::WelcomeTemplate;
use std::{io, net::SocketAddr};

View file

@ -6,7 +6,7 @@ use axum::{
};
use reqwest::StatusCode;
use crate::{templates::DownloadLinkTemplate, AppState, AsyncRemoveRecord};
use crate::{askama::DownloadLinkTemplate, AppState, AsyncRemoveRecord};
pub fn get_link_router() -> Router<AppState> {
// Link pages

View file

@ -1,6 +1,6 @@
use axum::{extract::State, response::IntoResponse, routing::get, Json, Router};
use crate::{templates::LinkListTemplate, AppState};
use crate::{askama::LinkListTemplate, AppState};
pub fn get_records_router() -> Router<AppState> {
// Records views

View file

@ -14,7 +14,7 @@ use tokio::io;
use tokio_util::{compat::FuturesAsyncWriteCompatExt, io::StreamReader};
use tower_http::limit::RequestBodyLimitLayer;
use crate::{cache, templates::DownloadLinkFragment, util, AppState, UploadRecord};
use crate::{askama::DownloadLinkFragment, cache, util, AppState, UploadRecord};
pub fn get_upload_router() -> Router<AppState> {
// Upload needs a subrouter to increase the body limit

View file

@ -1,4 +1,4 @@
use rinja_axum::Template;
use askama_axum::Template;
use crate::{link::get_remaining_text, UploadRecord};
@ -47,3 +47,4 @@ impl DownloadLinkFragment {
pub struct LinkListTemplate {
pub record_keys: Vec<String>,
}

View file

@ -1,7 +1,7 @@
use futures::TryFutureExt;
use serde::Deserialize;
pub mod templates;
pub mod askama;
#[derive(Debug, Deserialize)]
pub struct CatFact {