From 460ccc8e5a37159b54f736b2c330815ea2658301 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Wed, 18 Dec 2024 11:11:31 +0100 Subject: [PATCH] move sitemap to top level, not in api --- src/api_routes_v3.rs | 6 ------ src/api_routes_v4.rs | 2 -- src/lib.rs | 8 +++++++- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/api_routes_v3.rs b/src/api_routes_v3.rs index 59b7de610..738299cda 100644 --- a/src/api_routes_v3.rs +++ b/src/api_routes_v3.rs @@ -87,7 +87,6 @@ use lemmy_api::{ unread_count::get_unread_registration_application_count, }, }, - sitemap::get_sitemap, }; use lemmy_api_crud::{ comment::{ @@ -395,9 +394,4 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) { .route("/delete", post().to(delete_custom_emoji)), ), ); - cfg.service( - scope("/sitemap.xml") - .wrap(rate_limit.message()) - .route("", get().to(get_sitemap)), - ); } diff --git a/src/api_routes_v4.rs b/src/api_routes_v4.rs index 4bfe06a6a..f8dabd062 100644 --- a/src/api_routes_v4.rs +++ b/src/api_routes_v4.rs @@ -96,7 +96,6 @@ use lemmy_api::{ unread_count::get_unread_registration_application_count, }, }, - sitemap::get_sitemap, }; use lemmy_api_crud::{ comment::{ @@ -392,7 +391,6 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) { .wrap(rate_limit.register()) .route("/authenticate", post().to(authenticate_with_oauth)), ) - .route("/sitemap.xml", get().to(get_sitemap)) .service( scope("/image") .service( diff --git a/src/lib.rs b/src/lib.rs index ae060ec75..03dc78300 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,13 +11,14 @@ use actix_cors::Cors; use actix_web::{ dev::{ServerHandle, ServiceResponse}, middleware::{self, Condition, ErrorHandlerResponse, ErrorHandlers}, - web::Data, + web::{get, scope, Data}, App, HttpResponse, HttpServer, }; use actix_web_prom::PrometheusMetricsBuilder; use clap::Parser; +use lemmy_api::sitemap::get_sitemap; use lemmy_api_common::{ context::LemmyContext, lemmy_db_views::structs::SiteView, @@ -324,6 +325,11 @@ fn create_http_server( }) .configure(feeds::config) .configure(nodeinfo::config) + .service( + scope("/sitemap.xml") + .wrap(rate_limit_cell.message()) + .route("", get().to(get_sitemap)), + ) }) .disable_signals() .bind(bind)?