Skip to content

Commit

Permalink
replace askama
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Nov 30, 2024
1 parent a645fdc commit 7e12bac
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 80 deletions.
129 changes: 71 additions & 58 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ members = [
resolver = "2"

[workspace.dependencies]
askama = { version = "0.12.1", default-features = false }
asynk-strim = "0.1.2"
clap = { version = "4.5.21", features = ["derive", "wrap_help"] }
diesel = { version = "2.2.5", default-features = false, features = [
Expand Down Expand Up @@ -116,6 +115,10 @@ iso8601-timestamp = "0.3.1"
itertools = { version = "0.13.0", default-features = false }
minijinja = { version = "2.5.0", features = ["loader"] }
moka = { version = "=0.12.7", features = ["sync"] }
sailfish = { version = "0.9.0", default-features = false, features = [
"derive",
"perf-inline",
] }
simdutf8 = { version = "0.1.5", features = ["aarch64_neon"] }
sonic-rs = "=0.3.14"
tokio = "1.41.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-email/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ version.workspace = true
license.workspace = true

[dependencies]
askama.workspace = true
diesel.workspace = true
diesel-async.workspace = true
kitsune-db.workspace = true
Expand All @@ -26,6 +25,7 @@ mrml = { version = "4.0.1", default-features = false, features = [
"parse",
"render",
] }
sailfish.workspace = true
speedy-uuid.workspace = true
triomphe.workspace = true
typed-builder = "0.20.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/kitsune-email/src/mails/confirm_account.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::traits::{RenderableEmail, RenderedEmail};
use askama::Template;
use kitsune_error::Result;
use mrml::{mjml::Mjml, prelude::render::RenderOptions};
use sailfish::Template;
use typed_builder::TypedBuilder;

#[derive(Template, TypedBuilder)]
#[template(escape = "html", path = "verify.mjml")]
#[template(path = "verify.mjml")]
pub struct ConfirmAccount<'a> {
domain: &'a str,
username: &'a str,
Expand Down
29 changes: 14 additions & 15 deletions crates/kitsune-email/templates/verify.mjml
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
<mjml>
<mj-head>
<mj-title>Confirm your {{domain}} account</mj-title>
<mj-title>Confirm your <%= self.domain %> account</mj-title>
<mj-attributes>
<mj-all font-family="monospace" line-height="17px" />
</mj-attributes>
</mj-head>
<mj-body>
<mj-section>
<mj-column>

<mj-text align="center" font-size="30px">
Kitsune
</mj-text>
<mj-text align="center" font-size="30px"> Kitsune </mj-text>

<mj-divider></mj-divider>

<mj-text font-size="25px">
Confirm your account
</mj-text>
<mj-text font-size="25px"> Confirm your account </mj-text>

<mj-text>
Congratulations to your new account on {{domain}}!
<p>Click the button below to unlock your account (@{{username}})!</p>
Congratulations to your new account on <%= self.domain %>!
<p>
Click the button below to unlock your account (@<%= self.username
%>)!
</p>
</mj-text>

<mj-button href="{{verify_link}}">
Confirm my account!
</mj-button>
<mj-button href="{{verify_link}}"> Confirm my account! </mj-button>

<mj-text>
You didn't register an account? Feel free to just ignore this email!
</mj-text>

<mj-text align="center" font-size="10px">
{{domain}} powered by <a style="text-decoration:none;" href="https://joinkitsune.org">Kitsune</a>
<%= self.domain %> powered by
<a style="text-decoration: none" href="https://joinkitsune.org"
>Kitsune</a
>
</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>
</mjml>
2 changes: 1 addition & 1 deletion crates/kitsune-language/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ isolang = { version = "2.4.0", features = [
"list_languages",
"serde",
] }
rustc-hash = "2.0.0"
rustc-hash = "2.1.0"
whatlang = "0.16.4"
whichlang = "0.1.0"

Expand Down
4 changes: 2 additions & 2 deletions kitsune/src/template.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use arc_swap::ArcSwapAny;
use core::str;
use notify_debouncer_full::notify;
use notify_debouncer_full::{notify, DebounceEventResult};
use rust_embed::RustEmbed;
use std::{mem::ManuallyDrop, path::Path, sync::OnceLock, time::Duration};
use triomphe::Arc;
Expand Down Expand Up @@ -33,7 +33,7 @@ fn spawn_watcher() {
let watcher = notify_debouncer_full::new_debouncer(
Duration::from_secs(1),
None,
|events: notify_debouncer_full::DebounceEventResult| {
|events: DebounceEventResult| {
let Ok(events) = events else {
return;
};
Expand Down

0 comments on commit 7e12bac

Please sign in to comment.