This commit is contained in:
parent
df7e9d068b
commit
56661ec436
3 changed files with 60 additions and 16 deletions
|
@ -48,6 +48,7 @@ async fn main() -> Result<()> {
|
||||||
.service(gaming::page)
|
.service(gaming::page)
|
||||||
.service(memorial::page)
|
.service(memorial::page)
|
||||||
.service(contact::page)
|
.service(contact::page)
|
||||||
|
.service(contact::service_redirection)
|
||||||
.service(portfolio::page)
|
.service(portfolio::page)
|
||||||
.service(setup::page)
|
.service(setup::page)
|
||||||
.service(web3::page)
|
.service(web3::page)
|
||||||
|
|
|
@ -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 cached::proc_macro::once;
|
||||||
use ramhorns::Content;
|
use ramhorns::Content;
|
||||||
|
|
||||||
|
@ -16,6 +16,49 @@ async fn page(req: HttpRequest, config: web::Data<Config>) -> 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)]
|
#[derive(Content, Debug)]
|
||||||
struct NetworksTemplate {
|
struct NetworksTemplate {
|
||||||
navbar: NavBar,
|
navbar: NavBar,
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://twitter.com/Mylloon"
|
href="/contact/twitter"
|
||||||
>@Mylloon</a
|
>@Mylloon</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
title="Alternative à Twitter"
|
title="Alternative à Twitter"
|
||||||
href="https://piaille.fr/@mylloon"
|
href="/contact/mastodon"
|
||||||
>Mylloon@piaille.fr</a
|
>Mylloon@piaille.fr</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -38,14 +38,14 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://discord.com/users/158260864623968257/"
|
href="/contact/discord/user"
|
||||||
>mylloon</a
|
>mylloon</a
|
||||||
>
|
>
|
||||||
et
|
et
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
href="https://discord.gg/Z5ePxH4"
|
href="/contact/discord/guild"
|
||||||
>mon serveur</a
|
>mon serveur</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://www.reddit.com/user/mylloon"
|
href="/contact/reddit"
|
||||||
>mylloon</a
|
>mylloon</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://www.instagram.com/mylloon/"
|
href="/contact/instagram"
|
||||||
>mylloon</a
|
>mylloon</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
title="Anime tracker"
|
title="Anime tracker"
|
||||||
href="https://kitsu.io/users/Mylloon/library?status=completed"
|
href="/contact/kitsu"
|
||||||
>Mylloon</a
|
>Mylloon</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://steamcommunity.com/id/mylloon/"
|
href="/contact/steam"
|
||||||
>Mylloon</a
|
>Mylloon</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://www.youtube.com/c/Mylloon"
|
href="/contact/youtube"
|
||||||
>Mylloon</a
|
>Mylloon</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://www.twitch.tv/mylloon"
|
href="/contact/twitch"
|
||||||
>mylloon</a
|
>mylloon</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://github.com/Mylloon"
|
href="/contact/github"
|
||||||
>Mylloon</a
|
>Mylloon</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://gitlab.com/Mylloon"
|
href="/contact/gitlab"
|
||||||
>Mylloon</a
|
>Mylloon</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -149,7 +149,7 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://codeberg.org/Mylloon"
|
href="/contact/codeberg"
|
||||||
>Mylloon</a
|
>Mylloon</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://git.mylloon.fr/Anri"
|
href="/contact/forgejo"
|
||||||
>Anri</a
|
>Anri</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -186,7 +186,7 @@
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer me"
|
rel="noopener noreferrer me"
|
||||||
href="https://keyoxide.org/27024A99057E58B8087A5022A82D63DFF8D1317F"
|
href="/contact/keyoxide"
|
||||||
>27024A99057E58B8087A5022A82D63DFF8D1317F</a
|
>27024A99057E58B8087A5022A82D63DFF8D1317F</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in a new issue