Reviewed-on: #3 Co-authored-by: CatAClock <CatAClock@proton.me> Co-committed-by: CatAClock <CatAClock@proton.me>
116 lines
5.6 KiB
Rust
116 lines
5.6 KiB
Rust
#![allow(non_snake_case)]
|
|
#![allow(unused_braces)]
|
|
use rouille::{router, Response};
|
|
use std::fs::File;
|
|
|
|
fn main() {
|
|
// Never leave the server. CTRL + C if you have issues.
|
|
rouille::start_server("127.0.0.1:5000", move |Request| {
|
|
// Router. Go to the correct pages, else hit the sack.
|
|
router!(Request,
|
|
// Images.
|
|
(GET) ["/Icons/BlueskyIcon.svg"] => {
|
|
Response::from_file("image/svg+xml", File::open("src/HTTP/Images/Icons/BlueskyIcon.svg").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/BoostyIcon.svg"] => {
|
|
Response::from_file("image/svg+xml", File::open("src/HTTP/Images/Icons/BoostyIcon.svg").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/CodebergIcon.svg"] => {
|
|
Response::from_file("image/svg+xml", File::open("src/HTTP/Images/Icons/CodebergIcon.svg").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/DogeIcon.png"] => {
|
|
Response::from_file("image/png", File::open("src/HTTP/Images/Icons/DogeIcon.png").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/EmailIcon.svg"] => {
|
|
Response::from_file("image/svg+xml", File::open("src/HTTP/Images/Icons/EmailIcon.svg").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/Favicon32.png"] => {
|
|
Response::from_file("image/png", File::open("src/HTTP/Images/Icons/Favicon32.png").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/FediverseIcon.png"] => {
|
|
Response::from_file("image/png", File::open("src/HTTP/Images/Icons/FediverseIcon.png").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/ForgejoIcon.png"] => {
|
|
Response::from_file("image/png", File::open("src/HTTP/Images/Icons/ForgejoIcon.png").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/ItchIOIcon.svg"] => {
|
|
Response::from_file("image/svg+xml", File::open("src/HTTP/Images/Icons/ItchIOIcon.svg").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/KnowledgeIcon.png"] => {
|
|
Response::from_file("image/png", File::open("src/HTTP/Images/Icons/KnowledgeIcon.png").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/MastodonIcon.svg"] => {
|
|
Response::from_file("image/svg+xml", File::open("src/HTTP/Images/Icons/MastodonIcon.svg").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/SteamIcon.svg"] => {
|
|
Response::from_file("image/svg+xml", File::open("src/HTTP/Images/Icons/SteamIcon.svg").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/TiktokIcon.svg"] => {
|
|
Response::from_file("image/svg+xml", File::open("src/HTTP/Images/Icons/TiktokIcon.svg").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Icons/YoutubeIcon.png"] => {
|
|
Response::from_file("image/png", File::open("src/HTTP/Images/Icons/YoutubeIcon.png").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Buttons/BoyKissNow3.gif"] => {
|
|
Response::from_file("image/gif", File::open("src/HTTP/Images/Buttons/BoyKissNow3.gif").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Buttons/Catboys.webp"] => {
|
|
Response::from_file("image/webp", File::open("src/HTTP/Images/Buttons/Catboys.webp").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Buttons/CatscapeMeow3.gif"] => {
|
|
Response::from_file("image/gif", File::open("src/HTTP/Images/Buttons/CatscapeMeow3.gif").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Buttons/CrowdedGamesGroup.gif"] => {
|
|
Response::from_file("image/gif", File::open("src/HTTP/Images/Buttons/CrowdedGamesGroup.gif").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Buttons/FontsNowGo.gif"] => {
|
|
Response::from_file("image/gif", File::open("src/HTTP/Images/Buttons/FontsNowGo.gif").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Buttons/NekkoScape98Nyan.gif"] => {
|
|
Response::from_file("image/gif", File::open("src/HTTP/Images/Buttons/NekkoScape98Nyan.gif").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Buttons/NetscapeNow3.gif"] => {
|
|
Response::from_file("image/gif", File::open("src/HTTP/Images/Buttons/NetscapeNow3.gif").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/CatPolygon.svg"] => {
|
|
Response::from_file("image/svg+xml", File::open("src/HTTP/Images/CatPolygon.svg").unwrap()).with_status_code(200)
|
|
},
|
|
// Audio. These can be found in the script.
|
|
(GET) ["/Audio/KeyboardTyping.mp3"] => {
|
|
Response::from_file("audio/mpeg", File::open("src/HTTP/Audio/KeyboardTyping.mp3").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Audio/Glow.mp3"] => {
|
|
Response::from_file("audio/mpeg", File::open("src/HTTP/Audio/Glow.mp3").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/Audio/Meow.mp3"] => {
|
|
Response::from_file("audio/mpeg", File::open("src/HTTP/Audio/Meow.mp3").unwrap()).with_status_code(200)
|
|
},
|
|
// CSS.
|
|
(GET) ["/Animations.css"] => {
|
|
Response::from_file("text/css", File::open("src/HTTP/CSS/Animations.css").unwrap()).with_status_code(200)
|
|
},
|
|
(GET) ["/style.css"] => {
|
|
Response::from_file("text/css", File::open("src/HTTP/CSS/style.css").unwrap()).with_status_code(200)
|
|
},
|
|
// JavaScript.
|
|
(GET) ["/script.js"] => {
|
|
Response::from_file("text/javascript", File::open("src/HTTP/JS/script.js").unwrap()).with_status_code(200)
|
|
},
|
|
// WOFF.
|
|
(GET) ["/Perfect%20DOS%20VGA%20437.woff"] => {
|
|
Response::from_file("font/woff", File::open("src/HTTP/Perfect DOS VGA 437.woff").unwrap()).with_status_code(200)
|
|
},
|
|
// Robots.
|
|
(GET) ["robots.txt"] => {
|
|
Response::from_file("text/plain", File::open("src/HTTP/robots.txt").unwrap()).with_status_code(200)
|
|
},
|
|
// Actual Web Pages.
|
|
(GET) ["/"] => {
|
|
Response::from_file("text/html", File::open("src/HTTP/HTML/index.html").unwrap()).with_status_code(200)
|
|
},
|
|
_ => {
|
|
Response::from_file("text/html", File::open("src/HTTP/HTML/404.html").unwrap()).with_status_code(404)
|
|
},
|
|
)
|
|
});
|
|
}
|