-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tangxianyun
committed
Sep 8, 2024
1 parent
e070dbc
commit 4e7dee8
Showing
6 changed files
with
267 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod server; | ||
pub mod templates; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use askama::Template; | ||
use axum::http::StatusCode; | ||
use axum::response::{Html, IntoResponse, Response}; | ||
|
||
pub struct HtmlTemplate<T>(pub T); | ||
|
||
impl<T> IntoResponse for HtmlTemplate<T> | ||
where | ||
T: Template, | ||
{ | ||
fn into_response(self) -> Response { | ||
match self.0.render() { | ||
Ok(html) => Html(html).into_response(), | ||
Err(err) => ( | ||
StatusCode::INTERNAL_SERVER_ERROR, | ||
format!("Failed to render template. Error: {err}"), | ||
) | ||
.into_response(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>404 - Page Not Found</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
background: linear-gradient(135deg, #f39c12, #8e44ad); | ||
font-family: 'Arial', sans-serif; | ||
overflow: hidden; | ||
color: white; | ||
} | ||
|
||
.container { | ||
text-align: center; | ||
} | ||
|
||
h1 { | ||
font-size: 10em; | ||
margin: 0; | ||
animation: glow 1.5s ease-in-out infinite alternate; | ||
} | ||
|
||
h2 { | ||
font-size: 2em; | ||
margin-top: 20px; | ||
animation: fadeIn 2s ease-in-out infinite alternate; | ||
} | ||
|
||
a { | ||
display: inline-block; | ||
margin-top: 30px; | ||
padding: 15px 30px; | ||
font-size: 1.2em; | ||
color: white; | ||
text-decoration: none; | ||
border: 2px solid white; | ||
border-radius: 50px; | ||
transition: background 0.3s ease, transform 0.3s ease; | ||
} | ||
|
||
a:hover { | ||
background: white; | ||
color: #8e44ad; | ||
transform: scale(1.1); | ||
} | ||
|
||
@keyframes glow { | ||
0% { | ||
text-shadow: 0 0 20px #f39c12, 0 0 30px #f39c12, 0 0 40px #f39c12, 0 0 50px #f39c12, 0 0 60px #f39c12; | ||
} | ||
100% { | ||
text-shadow: 0 0 20px #8e44ad, 0 0 30px #8e44ad, 0 0 40px #8e44ad, 0 0 50px #8e44ad, 0 0 60px #8e44ad; | ||
} | ||
} | ||
|
||
@keyframes fadeIn { | ||
0% { | ||
opacity: 0.6; | ||
} | ||
100% { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
.background-arrows { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
overflow: hidden; | ||
} | ||
|
||
.arrow { | ||
position: absolute; | ||
font-size: 5em; | ||
color: rgba(255, 255, 255, 0.2); | ||
animation: move 20s infinite ease-in-out; | ||
} | ||
|
||
/* 隨機分佈箭頭 */ | ||
.arrow:nth-child(1) { | ||
top: 10%; | ||
left: 20%; | ||
} | ||
|
||
.arrow:nth-child(2) { | ||
top: 50%; | ||
left: 70%; | ||
} | ||
|
||
.arrow:nth-child(3) { | ||
top: 80%; | ||
left: 30%; | ||
} | ||
|
||
.arrow:nth-child(4) { | ||
top: 30%; | ||
left: 80%; | ||
} | ||
|
||
.arrow:nth-child(5) { | ||
top: 15%; | ||
left: 50%; | ||
} | ||
|
||
.arrow:nth-child(6) { | ||
top: 70%; | ||
left: 40%; | ||
} | ||
|
||
@keyframes move { | ||
0% { | ||
transform: translateY(0) translateX(0); | ||
} | ||
50% { | ||
transform: translateY(-50px) translateX(-50px); | ||
} | ||
100% { | ||
transform: translateY(0) translateX(0); | ||
} | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="background-arrows"> | ||
<div class="arrow">→</div> | ||
<div class="arrow">←</div> | ||
<div class="arrow">→</div> | ||
<div class="arrow">←</div> | ||
<div class="arrow">→</div> | ||
<div class="arrow">←</div> | ||
</div> | ||
|
||
<div class="container"> | ||
<h1>404</h1> | ||
<h2>It looks like you're lost.</h2> | ||
</div> | ||
</body> | ||
</html> |