Replace Rinja by askama
This commit is contained in:
parent
3089ede6eb
commit
dc40a057ac
11 changed files with 67 additions and 79 deletions
125
Cargo.lock
generated
125
Cargo.lock
generated
|
|
@ -121,6 +121,48 @@ dependencies = [
|
|||
"password-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "askama"
|
||||
version = "0.13.0-pre.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e2034a9f5ce003854892404493ee3c6c7126b606fdc3b7f095b3de96bb91692"
|
||||
dependencies = [
|
||||
"askama_derive",
|
||||
"itoa",
|
||||
"percent-encoding",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "askama_derive"
|
||||
version = "0.13.0-pre.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4093a6764e6fcf280e6fadbcde60614fa0b49cdbf60d823696a68b05f8356a80"
|
||||
dependencies = [
|
||||
"askama_parser",
|
||||
"basic-toml",
|
||||
"memchr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustc-hash",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "askama_parser"
|
||||
version = "0.13.0-pre.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "035b5b741f7d44d37a6fef913426b15f3ad5a4afe63b35ce9fce44e6ce55d0d3"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"winnow 0.7.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.88"
|
||||
|
|
@ -1180,15 +1222,6 @@ version = "1.0.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "humansize"
|
||||
version = "2.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7"
|
||||
dependencies = [
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "1.6.0"
|
||||
|
|
@ -1455,7 +1488,7 @@ dependencies = [
|
|||
"httpdate",
|
||||
"idna",
|
||||
"mime",
|
||||
"nom 8.0.0",
|
||||
"nom",
|
||||
"percent-encoding",
|
||||
"quoted_printable",
|
||||
"rustls",
|
||||
|
|
@ -1564,12 +1597,6 @@ dependencies = [
|
|||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.5"
|
||||
|
|
@ -1590,16 +1617,6 @@ dependencies = [
|
|||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "8.0.0"
|
||||
|
|
@ -1953,6 +1970,7 @@ name = "recipes"
|
|||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"argon2",
|
||||
"askama",
|
||||
"axum",
|
||||
"axum-extra",
|
||||
"chrono",
|
||||
|
|
@ -1963,7 +1981,6 @@ dependencies = [
|
|||
"lettre",
|
||||
"rand 0.9.0",
|
||||
"rand_core 0.9.3",
|
||||
"rinja",
|
||||
"ron",
|
||||
"serde",
|
||||
"sqlx",
|
||||
|
|
@ -2044,47 +2061,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_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 7.1.3",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ron"
|
||||
version = "0.9.0"
|
||||
|
|
@ -2193,7 +2169,7 @@ version = "1.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0c9dc7fe5fe9f920a393e3c6f39e5c1830f078f33b03e110ac6b561c7dd04f8"
|
||||
dependencies = [
|
||||
"nom 8.0.0",
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2859,7 +2835,7 @@ checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
|
|||
dependencies = [
|
||||
"indexmap",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
"winnow 0.5.40",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3407,6 +3383,15 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rt"
|
||||
version = "0.39.0"
|
||||
|
|
|
|||
2
TODO.md
2
TODO.md
|
|
@ -21,7 +21,7 @@
|
|||
Use FTS5:
|
||||
https://sqlite.org/fts5.html
|
||||
https://www.sqlitetutorial.net/sqlite-full-text-search/
|
||||
* Use of markdown for some field (how to add markdown as rinja filter?)
|
||||
* Use of markdown for some field (how to add markdown as askama filter?)
|
||||
* Quick search left panel by tags ?
|
||||
* Make the home page: Define what to display to the user
|
||||
* Show existing tags when editing a recipe
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ clap = { version = "4", features = ["derive"] }
|
|||
|
||||
sqlx = { version = "0.8", features = ["sqlite", "runtime-tokio", "chrono"] }
|
||||
|
||||
rinja = { version = "0.3" }
|
||||
askama = "=0.13.0-pre.0"
|
||||
|
||||
argon2 = { version = "0.5", features = ["default", "std"] }
|
||||
rand_core = { version = "0.9", features = ["std"] }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use rinja::Template;
|
||||
use askama::Template;
|
||||
|
||||
use crate::{
|
||||
data::model,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ enum AppError {
|
|||
Database(#[from] db::DBError),
|
||||
|
||||
#[error("Template error: {0}")]
|
||||
Render(#[from] rinja::Error),
|
||||
Render(#[from] askama::Error),
|
||||
}
|
||||
|
||||
type Result<T> = std::result::Result<T, AppError>;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
use askama::Template;
|
||||
use axum::{
|
||||
debug_handler,
|
||||
extract::{Extension, Query, State},
|
||||
response::{Html, IntoResponse},
|
||||
};
|
||||
use rinja::Template;
|
||||
use serde::Deserialize;
|
||||
// use tracing::{event, Level};
|
||||
|
||||
use crate::{
|
||||
Result,
|
||||
data::{db, model},
|
||||
html_templates::*,
|
||||
translation, Result,
|
||||
translation,
|
||||
};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use askama::Template;
|
||||
use axum::{
|
||||
body, debug_handler,
|
||||
extract::{Extension, Request, State},
|
||||
|
|
@ -5,7 +6,6 @@ use axum::{
|
|||
middleware::Next,
|
||||
response::{Html, IntoResponse, Response},
|
||||
};
|
||||
use rinja::Template;
|
||||
|
||||
use crate::{
|
||||
Result,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use askama::Template;
|
||||
use axum::{
|
||||
debug_handler,
|
||||
extract::{Extension, Path, State},
|
||||
response::{Html, IntoResponse, Redirect, Response},
|
||||
};
|
||||
use rinja::Template;
|
||||
// use tracing::{event, Level};
|
||||
|
||||
use crate::{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use std::{collections::HashMap, net::SocketAddr};
|
||||
|
||||
use askama::Template;
|
||||
use axum::{
|
||||
Form,
|
||||
body::Body,
|
||||
|
|
@ -14,7 +15,6 @@ use axum_extra::extract::{
|
|||
};
|
||||
use chrono::Duration;
|
||||
use lettre::Address;
|
||||
use rinja::Template;
|
||||
use serde::Deserialize;
|
||||
use tracing::{Level, event};
|
||||
|
||||
|
|
|
|||
2
stress_tests/launch.nu
Normal file
2
stress_tests/launch.nu
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
oha https://recipes.gburri.org/en/ -n 10000 -c 30
|
||||
# oha https://recipes.gburri.org/signin -n 10000 -c 30 -m POST -T application/x-www-form-urlencoded -d email=paul%40atreides.com&password=12345678dasd
|
||||
Loading…
Add table
Add a link
Reference in a new issue