Skip to content

Commit

Permalink
add redirect for old /listings/ route
Browse files Browse the repository at this point in the history
  • Loading branch information
akarras committed Jan 10, 2024
1 parent fa620d6 commit f4308b7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ultros/src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@ async fn detect_region(region: Option<Region>) -> Region {
region.unwrap_or(Region::NorthAmerica)
}

async fn listings_redirect(Path((world, id)): Path<(String, i32)>) -> Redirect {
Redirect::permanent(&format!("/item/{world}/{id}"))
}

pub(crate) async fn start_web(state: WebState) {
// build our application with a route
let app = Router::new()
Expand Down Expand Up @@ -884,6 +888,7 @@ pub(crate) async fn start_web(state: WebState) {
.route("/sitemap/items.xml", get(item_sitemap))
.route("/sitemap.xml", get(sitemap_index))
.route("/sitemap/pages.xml", get(generic_pages_sitemap))
.route("/listings/:world/:item", get(listings_redirect))
.nest(
"/",
create_leptos_app(state.world_helper.clone()).await.unwrap(),
Expand Down

0 comments on commit f4308b7

Please sign in to comment.