add: image proxy
add: mentions in posts TODO: audit log, reports, user mod panel
This commit is contained in:
parent
e183a01887
commit
3a8af17154
14 changed files with 308 additions and 33 deletions
|
@ -7,6 +7,7 @@ use assets::{init_dirs, write_assets};
|
|||
pub use tetratto_core::*;
|
||||
|
||||
use axum::{Extension, Router};
|
||||
use reqwest::Client;
|
||||
use tera::{Tera, Value};
|
||||
use tower_http::trace::{self, TraceLayer};
|
||||
use tracing::{Level, info};
|
||||
|
@ -14,7 +15,7 @@ use tracing::{Level, info};
|
|||
use std::{collections::HashMap, sync::Arc};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
pub(crate) type State = Arc<RwLock<(DataManager, Tera)>>;
|
||||
pub(crate) type State = Arc<RwLock<(DataManager, Tera, Client)>>;
|
||||
|
||||
fn render_markdown(value: &Value, _: &HashMap<String, Value>) -> tera::Result<Value> {
|
||||
Ok(tetratto_shared::markdown::render_markdown(value.as_str().unwrap()).into())
|
||||
|
@ -40,9 +41,11 @@ async fn main() {
|
|||
let mut tera = Tera::new(&format!("{html_path}/**/*")).unwrap();
|
||||
tera.register_filter("markdown", render_markdown);
|
||||
|
||||
let client = Client::new();
|
||||
|
||||
let app = Router::new()
|
||||
.merge(routes::routes(&config))
|
||||
.layer(Extension(Arc::new(RwLock::new((database, tera)))))
|
||||
.layer(Extension(Arc::new(RwLock::new((database, tera, client)))))
|
||||
.layer(
|
||||
TraceLayer::new_for_http()
|
||||
.make_span_with(trace::DefaultMakeSpan::new().level(Level::INFO))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue