add: "all" timeline

add: only show most popular posts from the past week
This commit is contained in:
trisua 2025-04-12 12:17:30 -04:00
parent fc9c0f294e
commit 24f67221ca
13 changed files with 143 additions and 27 deletions

View file

@ -5,6 +5,7 @@ mod routes;
mod sanitize;
use assets::{init_dirs, write_assets};
use tetratto_core::model::permissions::FinePermission;
pub use tetratto_core::*;
use axum::{Extension, Router};
@ -26,6 +27,13 @@ fn color_escape(value: &Value, _: &HashMap<String, Value>) -> tera::Result<Value
Ok(sanitize::color_escape(value.as_str().unwrap()).into())
}
fn check_supporter(value: &Value, _: &HashMap<String, Value>) -> tera::Result<Value> {
Ok(FinePermission::from_bits(value.as_u64().unwrap() as u32)
.unwrap()
.check(FinePermission::SUPPORTER)
.into())
}
#[tokio::main]
async fn main() {
tracing_subscriber::fmt()
@ -46,6 +54,7 @@ async fn main() {
let mut tera = Tera::new(&format!("{html_path}/**/*")).unwrap();
tera.register_filter("markdown", render_markdown);
tera.register_filter("color", color_escape);
tera.register_filter("has_supporter", check_supporter);
let client = Client::new();