implemented redirecting from / to /index.html

This commit is contained in:
clowzed 2023-11-02 02:19:23 +03:00
parent b64e68412c
commit be0816d22b
2 changed files with 13 additions and 0 deletions

View file

@ -99,6 +99,18 @@ pub async fn download(
}
}
pub async fn index_redirect(
State(state): State<Arc<AppState>>,
SubdomainModelExtractor(subdomain): SubdomainModelExtractor,
) -> Response {
file(
State(state),
SubdomainModelExtractor(subdomain),
Path(String::from("index.html")),
)
.await
}
pub async fn file(
State(state): State<Arc<AppState>>,
SubdomainModelExtractor(subdomain): SubdomainModelExtractor,

View file

@ -57,6 +57,7 @@ async fn main() {
let mut app = Router::new()
.nest("/api", api_router)
.route("/*path", get(handlers::sites::file))
.route("/", get(handlers::sites::index_redirect))
.with_state(state.clone());
if config.max_body_limit_size.is_some() {