diff --git a/src/activitypub/mod.rs b/src/activitypub/mod.rs index f8d347c0..0233549a 100644 --- a/src/activitypub/mod.rs +++ b/src/activitypub/mod.rs @@ -6,7 +6,7 @@ pub mod activity; use axum::{extract::State, http::StatusCode, Json}; use sea_orm::{EntityTrait, IntoActiveModel}; -use crate::{activitystream::{object::{activity::{Activity, ActivityType}, ObjectType}, Base, BaseType, Node}, model, server::Context}; +use crate::{activitystream::{self, object::{activity::{Activity, ActivityType}, actor::{ActorMut, ActorType}, ObjectMut, ObjectType}, Base, BaseMut, BaseType, Node}, model, server::Context, url}; #[derive(Debug, serde::Deserialize)] @@ -16,6 +16,19 @@ pub struct Page { pub max_id: Option, } +pub async fn view(State(ctx): State) -> Result, StatusCode> { + let mut base = activitystream::object(); + base + .set_actor_type(Some(ActorType::Application)) + .set_id(Some(&url!(ctx, ""))) + .set_name(Some("μpub")) + .set_summary(Some("micro social network, federated")) + .set_inbox(Node::link(&url!(ctx, "/inbox"))) + .set_outbox(Node::link(&url!(ctx, "/outbox"))); + + Ok(Json(base)) +} + pub async fn inbox(State(ctx) : State, Json(object): Json) -> Result, StatusCode> { match object.base_type() { None => { Err(StatusCode::BAD_REQUEST) },