Added permanent redirects to socials
ci/woodpecker/push/lint Pipeline was successful Details
ci/woodpecker/push/deploy Pipeline was successful Details

pull/51/head
Jef Roosens 2022-05-24 08:58:25 +02:00
parent 4e1fc51c84
commit 97fbc65768
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
2 changed files with 17 additions and 2 deletions

View File

@ -1,2 +1,2 @@
[toolchain] [toolchain]
channel = "1.60" channel = "1.61"

View File

@ -4,7 +4,8 @@ use axum::{
extract::Extension, extract::Extension,
http::StatusCode, http::StatusCode,
middleware, middleware,
routing::{get, get_service}, response::Redirect,
routing::{any, get, get_service},
Router, Router,
}; };
use tower_http::{auth::RequireAuthorizationLayer, services::ServeDir, trace::TraceLayer}; use tower_http::{auth::RequireAuthorizationLayer, services::ServeDir, trace::TraceLayer};
@ -72,6 +73,20 @@ async fn main() {
); );
} }
// Define some redirects
let redirects = [
("/github", "https://github.com/ChewingBever"),
("/gitea", "https://git.rustybever.be/Chewing_Bever"),
("/gitlab", "https://gitlab.com/Chewing_Bever"),
("/codeberg", "https://codeberg.org/Chewing_Bever"),
("/matrix", "https://matrix.to/#/@jef:rustybever.be"),
("/aur", "https://aur.archlinux.org/account/Chewing_Bever"),
];
for (path, url) in redirects {
app = app.route(path, any(|| async { Redirect::permanent(url) }))
}
app = app app = app
// The fallback option is to serve the actual static files // The fallback option is to serve the actual static files
.fallback( .fallback(