feat: add PATCH /federation/me/also-known-as endpoint
Adds alsoKnownAs column to users table (migration 013), reads it in the AP actor JSON, and exposes PATCH /federation/me/also-known-as to set or clear it. Required pre-condition for broadcast_move.
This commit is contained in:
@@ -126,3 +126,17 @@ pub async fn post_move_account(
|
||||
.map_err(ApiError::from)?;
|
||||
Ok(StatusCode::NO_CONTENT)
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct AlsoKnownAsBody {
|
||||
pub also_known_as: Option<String>,
|
||||
}
|
||||
|
||||
pub async fn patch_also_known_as(
|
||||
Deps(d): Deps<FederationManagementDeps>,
|
||||
AuthUser(uid): AuthUser,
|
||||
Json(body): Json<AlsoKnownAsBody>,
|
||||
) -> Result<StatusCode, ApiError> {
|
||||
d.users.set_also_known_as(&uid, body.also_known_as).await?;
|
||||
Ok(StatusCode::NO_CONTENT)
|
||||
}
|
||||
|
||||
@@ -108,6 +108,10 @@ pub fn router() -> Router<AppState> {
|
||||
"/federation/me/move",
|
||||
post(federation_management::post_move_account),
|
||||
)
|
||||
.route(
|
||||
"/federation/me/also-known-as",
|
||||
patch(federation_management::patch_also_known_as),
|
||||
)
|
||||
.route("/tags/popular", get(feed::get_popular_tags))
|
||||
.route("/tags/{name}", get(feed::tag_thoughts_handler))
|
||||
// notifications
|
||||
|
||||
Reference in New Issue
Block a user