Backend #3

Merged
CatAClock merged 3 commits from Development into main 2025-07-01 05:56:13 +00:00
36 changed files with 1947 additions and 4 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

1818
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

8
Cargo.toml Normal file
View file

@ -0,0 +1,8 @@
[package]
name = "CrowdedGames"
version = "1.1.0"
edition = "2024"
[dependencies]
rouille = "3.6.2"
postgres = "0.19.10"

View file

@ -25,10 +25,10 @@
<a href="https://www.youtube.com/@cataclock"><img class="HeaderLink" src="Icons/YoutubeIcon.png" alt="The logo for YouTube."/></a> <a href="https://www.youtube.com/@cataclock"><img class="HeaderLink" src="Icons/YoutubeIcon.png" alt="The logo for YouTube."/></a>
<a href="https://www.youtube.com/@doggeywoggey"><img class="HeaderLink" src="Icons/DogeIcon.png" alt="The logo for DoggeyWoggey."/></a> <a href="https://www.youtube.com/@doggeywoggey"><img class="HeaderLink" src="Icons/DogeIcon.png" alt="The logo for DoggeyWoggey."/></a>
<a href="mailto:cataclock@proton.me"><img class="HeaderLink" src="Icons/EmailIcon.svg" alt="The icon for Email."/></a> <a href="mailto:cataclock@proton.me"><img class="HeaderLink" src="Icons/EmailIcon.svg" alt="The icon for Email."/></a>
<a href="https://knowledge.crowdedgames.group">Knowledge</a> <a href="https://knowledge.crowdedgames.group"><img class="HeaderLink" src="Icons/KnowledgeIcon.png" alt="A book."/></a>
<a href="https://codeberg.org/CatAClock/"><img class="HeaderLink" src="Icons/CodebergIcon.svg" alt="The logo for Codeberg."/></a> <a href="https://codeberg.org/CatAClock/"><img class="HeaderLink" src="Icons/CodebergIcon.svg" alt="The logo for Codeberg."/></a>
<a href="https://git.crowdedgames.group"><img class="HeaderLink" src="Icons/ForgejoIcon.png" alt="The logo for Forgejo."/></a> <a href="https://git.crowdedgames.group"><img class="HeaderLink" src="Icons/ForgejoIcon.png" alt="The logo for Forgejo."/></a>
<a href="https://fedi.crowdedgames.group">Fediverse</a> <a href="https://fedi.crowdedgames.group"><img class="HeaderLink" src="Icons/FediverseIcon.png" alt="The logo for the Fediverse Frontent."/></a>
</section> </section>
</header> </header>
<p style="text-align: center;">You broke my website. How the <b>hell</b> did you do that!?</p> <p style="text-align: center;">You broke my website. How the <b>hell</b> did you do that!?</p>

View file

@ -24,10 +24,10 @@
<a href="https://www.youtube.com/@cataclock"><img class="HeaderLink" src="Icons/YoutubeIcon.png" alt="The logo for YouTube."/></a> <a href="https://www.youtube.com/@cataclock"><img class="HeaderLink" src="Icons/YoutubeIcon.png" alt="The logo for YouTube."/></a>
<a href="https://www.youtube.com/@doggeywoggey"><img class="HeaderLink" src="Icons/DogeIcon.png" alt="The logo for DoggeyWoggey."/></a> <a href="https://www.youtube.com/@doggeywoggey"><img class="HeaderLink" src="Icons/DogeIcon.png" alt="The logo for DoggeyWoggey."/></a>
<a href="mailto:cataclock@proton.me"><img class="HeaderLink" src="Icons/EmailIcon.svg" alt="The icon for Email."/></a> <a href="mailto:cataclock@proton.me"><img class="HeaderLink" src="Icons/EmailIcon.svg" alt="The icon for Email."/></a>
<a href="https://knowledge.crowdedgames.group">Knowledge</a> <a href="https://knowledge.crowdedgames.group"><img class="HeaderLink" src="Icons/KnowledgeIcon.png" alt="A book."/></a>
<a href="https://codeberg.org/CatAClock/"><img class="HeaderLink" src="Icons/CodebergIcon.svg" alt="The logo for Codeberg."/></a> <a href="https://codeberg.org/CatAClock/"><img class="HeaderLink" src="Icons/CodebergIcon.svg" alt="The logo for Codeberg."/></a>
<a href="https://git.crowdedgames.group"><img class="HeaderLink" src="Icons/ForgejoIcon.png" alt="The logo for Forgejo."/></a> <a href="https://git.crowdedgames.group"><img class="HeaderLink" src="Icons/ForgejoIcon.png" alt="The logo for Forgejo."/></a>
<a href="https://fedi.crowdedgames.group">Fediverse</a> <a href="https://fedi.crowdedgames.group"><img class="HeaderLink" src="Icons/FediverseIcon.png" alt="The logo for the Fediverse Frontent."/></a>
</section> </section>
</header> </header>
<!-- Sections for my links --> <!-- Sections for my links -->

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

Before

Width:  |  Height:  |  Size: 916 B

After

Width:  |  Height:  |  Size: 916 B

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

View file

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 179 KiB

After

Width:  |  Height:  |  Size: 179 KiB

View file

Before

Width:  |  Height:  |  Size: 660 B

After

Width:  |  Height:  |  Size: 660 B

View file

Before

Width:  |  Height:  |  Size: 968 B

After

Width:  |  Height:  |  Size: 968 B

View file

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View file

Before

Width:  |  Height:  |  Size: 677 B

After

Width:  |  Height:  |  Size: 677 B

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 534 B

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

116
src/main.rs Normal file
View file

@ -0,0 +1,116 @@
#![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)
},
)
});
}