summaryrefslogtreecommitdiff
path: root/src/public/pages.rs
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2023-02-01 20:34:22 -0500
committerTyler Murphy <tylermurphy534@gmail.com>2023-02-01 20:34:22 -0500
commit2026a8f4579b1db0f6e5e7b11ac33c13969adb6c (patch)
treedaa13419b7227462775e325a4f5f60f2ed33c1da /src/public/pages.rs
parentremove b64 imgs (diff)
downloadxssbook-2026a8f4579b1db0f6e5e7b11ac33c13969adb6c.tar.gz
xssbook-2026a8f4579b1db0f6e5e7b11ac33c13969adb6c.tar.bz2
xssbook-2026a8f4579b1db0f6e5e7b11ac33c13969adb6c.zip
static serve refactor
Diffstat (limited to '')
-rw-r--r--src/public/pages.rs (renamed from src/api/pages.rs)30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/api/pages.rs b/src/public/pages.rs
index 4ed2e49..1614d81 100644
--- a/src/api/pages.rs
+++ b/src/public/pages.rs
@@ -5,7 +5,7 @@ use axum::{
};
use crate::{
- console,
+ public::console,
types::{
extract::{AuthorizedUser, Log},
http::ResponseCode,
@@ -24,32 +24,20 @@ async fn login(user: Option<AuthorizedUser>, _: Log) -> Response {
if user.is_some() {
Redirect::to("/home").into_response()
} else {
- ResponseCode::Success.file("/login.html").await
+ super::serve("/login.html").await
}
}
-async fn home(user: Option<AuthorizedUser>, _: Log) -> Response {
- if user.is_none() {
- Redirect::to("/login").into_response()
- } else {
- ResponseCode::Success.file("/home.html").await
- }
+async fn home(_: Log) -> Response {
+ super::serve("/home.html").await
}
-async fn people(user: Option<AuthorizedUser>, _: Log) -> Response {
- if user.is_none() {
- Redirect::to("/login").into_response()
- } else {
- ResponseCode::Success.file("/people.html").await
- }
+async fn people(_: Log) -> Response {
+ super::serve("/people.html").await
}
-async fn profile(user: Option<AuthorizedUser>, _: Log) -> Response {
- if user.is_none() {
- Redirect::to("/login").into_response()
- } else {
- ResponseCode::Success.file("/profile.html").await
- }
+async fn profile(_: Log) -> Response {
+ super::serve("/profile.html").await
}
async fn console() -> Response {
@@ -57,7 +45,7 @@ async fn console() -> Response {
}
async fn admin() -> Response {
- ResponseCode::Success.file("/admin.html").await
+ super::serve("/admin.html").await
}
async fn wordpress(_: Log) -> Response {