From 97fbc657682a2f676654024292fab7abf71be065 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Tue, 24 May 2022 08:58:25 +0200 Subject: [PATCH 1/2] Added permanent redirects to socials --- rust-toolchain.toml | 2 +- src/main.rs | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 271e97d..ecbe31f 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.60" +channel = "1.61" diff --git a/src/main.rs b/src/main.rs index 896f0be..2fd86bb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,8 @@ use axum::{ extract::Extension, http::StatusCode, middleware, - routing::{get, get_service}, + response::Redirect, + routing::{any, get, get_service}, Router, }; 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 // The fallback option is to serve the actual static files .fallback( From b891d91386459211f5b4832a919fdb21801599cf Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Sat, 13 Aug 2022 12:31:56 +0200 Subject: [PATCH 2/2] Bumped rust & docker versions --- Dockerfile | 4 ++-- rust-toolchain.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 98475a0..c14c76b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.61-alpine3.15 AS builder +FROM rust:1.63-alpine3.16 AS builder ARG DI_VER=1.2.5 @@ -18,7 +18,7 @@ COPY . ./ RUN cargo build --release -FROM alpine:3.15 +FROM alpine:3.16 COPY --from=builder /app/target/release/site /bin/site COPY --from=builder /app/dumb-init /bin/dumb-init diff --git a/rust-toolchain.toml b/rust-toolchain.toml index ecbe31f..6d73af9 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.61" +channel = "1.63"