diff --git a/src/main.rs b/src/main.rs
index 98d5f0d..9b13a10 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -48,6 +48,7 @@ async fn main() -> Result<()> {
.service(gaming::page)
.service(memorial::page)
.service(contact::page)
+ .service(contact::service_redirection)
.service(portfolio::page)
.service(setup::page)
.service(web3::page)
diff --git a/src/routes/contact.rs b/src/routes/contact.rs
index 0636a1d..20187ff 100644
--- a/src/routes/contact.rs
+++ b/src/routes/contact.rs
@@ -1,4 +1,4 @@
-use actix_web::{get, web, HttpRequest, HttpResponse, Responder};
+use actix_web::{get, routes, web, HttpRequest, HttpResponse, Responder};
use cached::proc_macro::once;
use ramhorns::Content;
@@ -16,6 +16,49 @@ async fn page(req: HttpRequest, config: web::Data) -> impl Responder {
))
}
+#[routes]
+#[get("/contact/{service}")]
+#[get("/contact/{service}/{scope}")]
+async fn service_redirection(req: HttpRequest) -> impl Responder {
+ let info = req.match_info();
+ let find_redirection = match info.query("service") {
+ /* Socials links */
+ "twitter" => Some("https://twitter.com/Mylloon".to_owned()),
+ "mastodon" => Some("https://piaille.fr/@mylloon".to_owned()),
+ "discord" => match info.get("scope") {
+ Some("user") => Some("https://discord.com/users/158260864623968257/".to_owned()),
+ Some("guild") => Some("https://discord.gg/Z5ePxH4".to_owned()),
+ _ => None,
+ },
+ "reddit" => Some("https://www.reddit.com/user/mylloon".to_owned()),
+ "instagram" => Some("https://www.instagram.com/mylloon/".to_owned()),
+ "kitsu" => Some("https://kitsu.io/users/Mylloon/library?status=completed".to_owned()),
+ "steam" => Some("https://steamcommunity.com/id/mylloon/".to_owned()),
+ "youtube" => Some("https://www.youtube.com/c/Mylloon".to_owned()),
+ "twitch" => Some("https://www.twitch.tv/mylloon".to_owned()),
+
+ /* Forges */
+ "github" => Some("https://github.com/Mylloon".to_owned()),
+ "gitlab" => Some("https://gitlab.com/Mylloon".to_owned()),
+ "codeberg" => Some("https://codeberg.org/Mylloon".to_owned()),
+ "forgejo" => Some("https://git.mylloon.fr/Anri".to_owned()),
+
+ /* Others */
+ "keyoxide" => {
+ Some("https://keyoxide.org/27024A99057E58B8087A5022A82D63DFF8D1317F".to_owned())
+ }
+ _ => None,
+ };
+
+ if let Some(redirection) = find_redirection {
+ // Redirect to the desired service
+ actix_web::web::Redirect::to(redirection)
+ } else {
+ // By default, returns to the contact page
+ actix_web::web::Redirect::to("/contact")
+ }
+}
+
#[derive(Content, Debug)]
struct NetworksTemplate {
navbar: NavBar,
diff --git a/templates/contact.html b/templates/contact.html
index f6c50a6..33e1e20 100644
--- a/templates/contact.html
+++ b/templates/contact.html
@@ -15,7 +15,7 @@
@Mylloon
@@ -27,7 +27,7 @@
target="_blank"
rel="noopener noreferrer me"
title="Alternative à Twitter"
- href="https://piaille.fr/@mylloon"
+ href="/contact/mastodon"
>Mylloon@piaille.fr
@@ -38,14 +38,14 @@
mylloon
et
mon serveur
@@ -56,7 +56,7 @@
mylloon
@@ -67,7 +67,7 @@
mylloon
@@ -79,7 +79,7 @@
target="_blank"
rel="noopener noreferrer me"
title="Anime tracker"
- href="https://kitsu.io/users/Mylloon/library?status=completed"
+ href="/contact/kitsu"
>Mylloon
@@ -90,7 +90,7 @@
Mylloon
@@ -101,7 +101,7 @@
Mylloon
@@ -112,7 +112,7 @@
mylloon
@@ -127,7 +127,7 @@
Mylloon
@@ -138,7 +138,7 @@
Mylloon
@@ -149,7 +149,7 @@
Mylloon
@@ -160,7 +160,7 @@
Anri
@@ -186,7 +186,7 @@
27024A99057E58B8087A5022A82D63DFF8D1317F