mirror of
https://github.com/RGBCube/Site
synced 2025-08-01 13:37:49 +00:00
Make 404 page status code actually 404
This commit is contained in:
parent
69320fe0b8
commit
6a71b16208
2 changed files with 30 additions and 21 deletions
|
@ -1,29 +1,33 @@
|
||||||
use std::array;
|
use std::array;
|
||||||
|
|
||||||
use maud::{
|
use axum::{
|
||||||
html,
|
http::StatusCode,
|
||||||
Markup,
|
response::IntoResponse,
|
||||||
};
|
};
|
||||||
|
use maud::html;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
asset,
|
asset,
|
||||||
page::cube,
|
page::cube,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub async fn handler() -> Markup {
|
pub async fn handler() -> impl IntoResponse {
|
||||||
cube::create(
|
(
|
||||||
Some("404"),
|
StatusCode::NOT_FOUND,
|
||||||
asset::Css::Shared("cube-grid.css"),
|
cube::create(
|
||||||
array::from_fn(|_| {
|
Some("404"),
|
||||||
html! {
|
asset::Css::Shared("cube-grid.css"),
|
||||||
.frame {
|
array::from_fn(|_| {
|
||||||
a href="/" { "404" }
|
html! {
|
||||||
|
.frame {
|
||||||
|
a href="/" { "404" }
|
||||||
|
}
|
||||||
|
.square .black {}
|
||||||
|
.square .magenta {}
|
||||||
|
.square .magenta {}
|
||||||
|
.square .black {}
|
||||||
}
|
}
|
||||||
.square .black {}
|
}),
|
||||||
.square .magenta {}
|
),
|
||||||
.square .magenta {}
|
|
||||||
.square .black {}
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
use std::sync::LazyLock;
|
use std::sync::LazyLock;
|
||||||
|
|
||||||
use axum::extract::Path;
|
use axum::{
|
||||||
|
body::Body,
|
||||||
|
extract::Path,
|
||||||
|
http::Response,
|
||||||
|
response::IntoResponse,
|
||||||
|
};
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use maud::{
|
use maud::{
|
||||||
|
@ -70,10 +75,10 @@ pub async fn index_handler() -> Markup {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn entry_handler(Path(entry): Path<String>) -> Markup {
|
pub async fn entry_handler(Path(entry): Path<String>) -> Response<Body> {
|
||||||
if let Some((metadata, body)) = ENTRIES.get(entry.as_str()) {
|
if let Some((metadata, body)) = ENTRIES.get(entry.as_str()) {
|
||||||
text::create(Some(&metadata.title), Page::Other, body)
|
text::create(Some(&metadata.title), Page::Other, body).into_response()
|
||||||
} else {
|
} else {
|
||||||
not_found::handler().await
|
not_found::handler().await.into_response()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue