mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
feat: Implement a web-based account management dashboard
This commit is contained in:
+23
-1
@@ -1,10 +1,18 @@
|
||||
use axum::{response::Response, routing::MethodFilter};
|
||||
|
||||
use crate::WebError;
|
||||
|
||||
pub(super) mod account;
|
||||
mod components;
|
||||
pub(super) mod debug;
|
||||
pub(super) mod index;
|
||||
pub(super) mod password_reset;
|
||||
pub(super) mod resources;
|
||||
pub(super) mod threepid;
|
||||
|
||||
type Result<T = Response, E = WebError> = std::result::Result<T, E>;
|
||||
|
||||
const GET_POST: MethodFilter = MethodFilter::GET.or(MethodFilter::POST);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct TemplateContext {
|
||||
pub allow_indexing: bool,
|
||||
@@ -27,6 +35,7 @@ macro_rules! template {
|
||||
) => {
|
||||
#[derive(Debug, askama::Template)]
|
||||
#[template(path = $path)]
|
||||
#[allow(clippy::useless_let_if_seq)]
|
||||
struct $name$(<$lifetime>)? {
|
||||
context: $crate::pages::TemplateContext,
|
||||
$($field_name: $field_type,)*
|
||||
@@ -54,3 +63,16 @@ macro_rules! template {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! response {
|
||||
(BadRequest($body:expr)) => {
|
||||
response!((axum::http::StatusCode::BAD_REQUEST, $body))
|
||||
};
|
||||
|
||||
($body:expr) => {{
|
||||
use axum::response::IntoResponse;
|
||||
|
||||
Ok($body.into_response())
|
||||
}};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user