mirror of
https://github.com/astro/buzzrelay.git
synced 2024-11-28 23:01:03 +00:00
actor: set name and icon
This commit is contained in:
parent
db98712691
commit
2d464cd5f0
2 changed files with 22 additions and 0 deletions
|
@ -8,6 +8,8 @@ pub struct Actor {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub actor_type: String,
|
pub actor_type: String,
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
pub name: Option<String>,
|
||||||
|
pub icon: Option<Media>,
|
||||||
pub inbox: String,
|
pub inbox: String,
|
||||||
#[serde(rename = "publicKey")]
|
#[serde(rename = "publicKey")]
|
||||||
pub public_key: ActorPublicKey,
|
pub public_key: ActorPublicKey,
|
||||||
|
@ -42,3 +44,12 @@ impl IntoResponse for Actor {
|
||||||
Json(self)).into_response()
|
Json(self)).into_response()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct Media {
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
pub media_type: String,
|
||||||
|
#[serde(rename = "mediaType")]
|
||||||
|
pub content_type: String,
|
||||||
|
pub url: String,
|
||||||
|
}
|
||||||
|
|
11
src/actor.rs
11
src/actor.rs
|
@ -34,6 +34,17 @@ impl Actor {
|
||||||
jsonld_context: serde_json::Value::String("https://www.w3.org/ns/activitystreams".to_string()),
|
jsonld_context: serde_json::Value::String("https://www.w3.org/ns/activitystreams".to_string()),
|
||||||
actor_type: "Service".to_string(),
|
actor_type: "Service".to_string(),
|
||||||
id: self.uri(),
|
id: self.uri(),
|
||||||
|
name: Some(match &self.kind {
|
||||||
|
ActorKind::TagRelay(tag) =>
|
||||||
|
format!("#{}", tag),
|
||||||
|
ActorKind::InstanceRelay(instance) =>
|
||||||
|
instance.to_string(),
|
||||||
|
}),
|
||||||
|
icon: Some(activitypub::Media {
|
||||||
|
media_type: "Image".to_string(),
|
||||||
|
content_type: "image/jpeg".to_string(),
|
||||||
|
url: "https://fedi.buzz/assets/favicon48.png".to_string(),
|
||||||
|
}),
|
||||||
inbox: self.uri(),
|
inbox: self.uri(),
|
||||||
public_key: activitypub::ActorPublicKey {
|
public_key: activitypub::ActorPublicKey {
|
||||||
id: self.key_id(),
|
id: self.key_id(),
|
||||||
|
|
Loading…
Reference in a new issue