mirror of
https://github.com/perstarkse/minne.git
synced 2026-03-27 03:41:32 +01:00
feat: privacy page and misc templates
This commit is contained in:
@@ -9,6 +9,7 @@ pub mod gdpr;
|
||||
pub mod index;
|
||||
pub mod ingress;
|
||||
pub mod ingress_tasks;
|
||||
pub mod privacy_policy;
|
||||
pub mod search_result;
|
||||
pub mod signin;
|
||||
pub mod signout;
|
||||
|
||||
31
src/server/routes/html/privacy_policy.rs
Normal file
31
src/server/routes/html/privacy_policy.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use axum::{extract::State, response::IntoResponse};
|
||||
use axum_session_auth::AuthSession;
|
||||
use axum_session_surreal::SessionSurrealPool;
|
||||
use surrealdb::{engine::any::Any, Surreal};
|
||||
|
||||
use crate::{
|
||||
error::HtmlError,
|
||||
page_data,
|
||||
server::{routes::html::render_template, AppState},
|
||||
storage::types::user::User,
|
||||
};
|
||||
|
||||
page_data!(PrivacyPolicyData, "privacy_policy.html", {
|
||||
user: Option<User>
|
||||
});
|
||||
|
||||
pub async fn show_privacy_policy(
|
||||
State(state): State<AppState>,
|
||||
auth: AuthSession<User, String, SessionSurrealPool<Any>, Surreal<Any>>,
|
||||
) -> Result<impl IntoResponse, HtmlError> {
|
||||
let output = render_template(
|
||||
PrivacyPolicyData::template_name(),
|
||||
PrivacyPolicyData {
|
||||
user: auth.current_user,
|
||||
},
|
||||
state.templates.clone(),
|
||||
)
|
||||
.map_err(|e| HtmlError::from_template_error(e, state.templates.clone()))?;
|
||||
|
||||
Ok(output.into_response())
|
||||
}
|
||||
Reference in New Issue
Block a user