This commit is contained in:
2023-11-26 18:40:12 +01:00
parent 7934c5bfaa
commit b65b1a7a54
10 changed files with 399 additions and 47 deletions

1
src/tools/mod.rs Normal file
View File

@@ -0,0 +1 @@
pub mod tera;

12
src/tools/tera.rs Normal file
View File

@@ -0,0 +1,12 @@
use std::collections::HashMap;
use rocket_dyn_templates::tera::{Value, Error};
pub fn static_filter(
value: &Value,
args: &HashMap<String, rocket_dyn_templates::tera::Value>
) -> Result<Value, Error> {
let host = args.get("static_host");
return Ok(rocket_dyn_templates::tera::Value::String(format!("{}/{}", host.unwrap().as_str().unwrap(), value.as_str().unwrap()))); // TODO: fix-me here!
}