mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-08 23:57:46 +00:00
Fix HTML encoding in templating (#404)
This commit is contained in:
parent
7e07ca3df1
commit
322aa97a18
12 changed files with 33 additions and 47 deletions
|
@ -1,6 +1,5 @@
|
|||
// CRATES
|
||||
use crate::client::json;
|
||||
use crate::esc;
|
||||
use crate::server::RequestExt;
|
||||
use crate::utils::{error, filter_posts, format_url, get_filters, param, template, Post, Preferences, User};
|
||||
use askama::Template;
|
||||
|
@ -9,7 +8,7 @@ use time::{macros::format_description, OffsetDateTime};
|
|||
|
||||
// STRUCTS
|
||||
#[derive(Template)]
|
||||
#[template(path = "user.html", escape = "none")]
|
||||
#[template(path = "user.html")]
|
||||
struct UserTemplate {
|
||||
user: User,
|
||||
posts: Vec<Post>,
|
||||
|
@ -102,11 +101,11 @@ async fn user(name: &str) -> Result<User, String> {
|
|||
// Parse the JSON output into a User struct
|
||||
User {
|
||||
name: res["data"]["name"].as_str().unwrap_or(name).to_owned(),
|
||||
title: esc!(about("title")),
|
||||
title: about("title"),
|
||||
icon: format_url(&about("icon_img")),
|
||||
karma: res["data"]["total_karma"].as_i64().unwrap_or(0),
|
||||
created: created.format(format_description!("[month repr:short] [day] '[year repr:last_two]")).unwrap_or_default(),
|
||||
banner: esc!(about("banner_img")),
|
||||
banner: about("banner_img"),
|
||||
description: about("public_description"),
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue