Change path of user's Atom feed to /feeds/users/{username}

This commit is contained in:
silverpill 2023-02-25 21:12:31 +00:00
parent ca2e541ff5
commit 971b541826
4 changed files with 15 additions and 7 deletions

View file

@ -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

View file

@ -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(

View file

@ -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<Config>,
db_pool: web::Data<DbPool>,
username: web::Path<String>,
@ -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))
}

View file

@ -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())