diff --git a/upub/routes/src/activitypub/mod.rs b/upub/routes/src/activitypub/mod.rs index ed401d9..ee2cfc2 100644 --- a/upub/routes/src/activitypub/mod.rs +++ b/upub/routes/src/activitypub/mod.rs @@ -36,6 +36,7 @@ impl ActivityPubRouter for Router { .route("/auth", post(ap::auth::login)) .route("/auth", patch(ap::auth::refresh)) // .well-known and discovery + .route("/manifest.json", get(ap::well_known::manifest)) .route("/.well-known/webfinger", get(ap::well_known::webfinger)) .route("/.well-known/host-meta", get(ap::well_known::host_meta)) .route("/.well-known/nodeinfo", get(ap::well_known::nodeinfo_discovery)) diff --git a/upub/routes/src/activitypub/well_known.rs b/upub/routes/src/activitypub/well_known.rs index fcb83f6..f8a7d59 100644 --- a/upub/routes/src/activitypub/well_known.rs +++ b/upub/routes/src/activitypub/well_known.rs @@ -156,6 +156,41 @@ pub async fn webfinger( })) } +pub async fn manifest(State(ctx): State) -> Json { + axum::Json(ManifestResponse { + id: ctx.cfg().instance.domain.clone(), + name: ctx.cfg().instance.name.clone(), + short_name: ctx.cfg().instance.name.clone(), + description: ctx.cfg().instance.description.clone(), + start_url: "/web".to_string(), + scope: format!("https://{}/web", ctx.cfg().instance.domain), + display: "standalone".to_string(), + background_color: "#201f29".to_string(), + theme_color: "#bf616a".to_string(), + orientation: "portrait-primary".to_string(), + icons: vec![], + shortcuts: vec![], + categories: vec!["social".to_string()] + }) +} + +#[derive(Debug, Clone, serde::Serialize)] +pub struct ManifestResponse { + background_color: String, + categories: Vec, + description: String, + display: String, // "fullscreen", "standalone", "minima-ui", "browser" + icons: Vec, // TODO Vec of objects: {stc: string, sizes: string, type: string? } + id: String, + name: String, + orientation: String, // "any", "natural", "landscape", "landscape-primary", "landscape-secondary", "portrait", "portrait-primary", "portrait-secondary" + scope: String, + short_name: String, + shortcuts: Vec, // TODO Vec of objects: {name: string, url: string, description: string?} + start_url: String, + theme_color: String, +} + // i don't even want to bother with XML, im just returning a formatted xml string pub async fn host_meta(State(ctx): State) -> Response { (