diff --git a/CHANGELOG.md b/CHANGELOG.md index d3eea3f..cd0b7f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,10 +16,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Put activities generated by CLI commands in a queue instead of immediately sending them. +- Changed path of user's Atom feed to `/feeds/users/{username}`. ### Deprecated - Deprecated `proxy_url` configuration parameter (replaced by `federation.proxy_url`). +- Deprecated Atom feeds at `/feeds/{username}`. ### Fixed diff --git a/src/atom/feeds.rs b/src/atom/feeds.rs index 8a2f630..bfe3e22 100644 --- a/src/atom/feeds.rs +++ b/src/atom/feeds.rs @@ -44,8 +44,8 @@ fn make_entry( ) } -pub fn get_feed_url(instance_url: &str, username: &str) -> String { - format!("{}/feeds/{}", instance_url, username) +fn get_feed_url(instance_url: &str, username: &str) -> String { + format!("{}/feeds/users/{}", instance_url, username) } pub fn make_feed( diff --git a/src/atom/views.rs b/src/atom/views.rs index bdde1a3..4afa970 100644 --- a/src/atom/views.rs +++ b/src/atom/views.rs @@ -1,4 +1,4 @@ -use actix_web::{get, web, HttpResponse}; +use actix_web::{web, HttpResponse, Scope}; use mitra_config::Config; @@ -12,8 +12,7 @@ use super::feeds::make_feed; const FEED_SIZE: u16 = 10; -#[get("/feeds/{username}")] -pub async fn get_atom_feed( +async fn get_atom_feed( config: web::Data, db_pool: web::Data, username: web::Path, @@ -40,3 +39,10 @@ pub async fn get_atom_feed( .body(feed); Ok(response) } + + +pub fn atom_scope() -> Scope { + web::scope("/feeds") + .route("/users/{username}", web::get().to(get_atom_feed)) + .route("/{username}", web::get().to(get_atom_feed)) +} diff --git a/src/main.rs b/src/main.rs index f52bf04..aa4102f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,7 @@ use actix_web::{ use tokio::sync::Mutex; use mitra::activitypub::views as activitypub; -use mitra::atom::views as atom; +use mitra::atom::views::atom_scope; use mitra::database::{get_database_client, create_pool}; use mitra::database::migrate::apply_migrations; use mitra::ethereum::contracts::get_contracts; @@ -168,7 +168,7 @@ async fn main() -> std::io::Result<()> { .service(activitypub::object_view) .service(activitypub::emoji_view) .service(activitypub::tag_view) - .service(atom::get_atom_feed) + .service(atom_scope()) .service(nodeinfo::get_nodeinfo) .service(nodeinfo::get_nodeinfo_2_0) .service(web_client::profile_page_redirect())