2022-02-07 19:23:12 +00:00
|
|
|
use crate::{
|
|
|
|
objects::instance::ApubSite,
|
2022-10-06 18:27:58 +00:00
|
|
|
protocol::{objects::LanguageTag, ImageObject, Source},
|
2022-02-07 19:23:12 +00:00
|
|
|
};
|
2022-06-02 14:33:41 +00:00
|
|
|
use activitypub_federation::{
|
2023-03-21 15:03:05 +00:00
|
|
|
fetch::object_id::ObjectId,
|
|
|
|
kinds::actor::ApplicationType,
|
|
|
|
protocol::{helpers::deserialize_skip_error, public_key::PublicKey, values::MediaTypeHtml},
|
2022-06-02 14:33:41 +00:00
|
|
|
};
|
2022-02-07 19:23:12 +00:00
|
|
|
use chrono::{DateTime, FixedOffset};
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use serde_with::skip_serializing_none;
|
|
|
|
use url::Url;
|
|
|
|
|
|
|
|
#[skip_serializing_none]
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
pub struct Instance {
|
|
|
|
#[serde(rename = "type")]
|
2022-12-09 16:21:17 +00:00
|
|
|
pub(crate) kind: ApplicationType,
|
2022-02-07 19:23:12 +00:00
|
|
|
pub(crate) id: ObjectId<ApubSite>,
|
|
|
|
// site name
|
|
|
|
pub(crate) name: String,
|
2022-02-17 22:04:01 +00:00
|
|
|
pub(crate) inbox: Url,
|
|
|
|
/// mandatory field in activitypub, lemmy currently serves an empty outbox
|
|
|
|
pub(crate) outbox: Url,
|
|
|
|
pub(crate) public_key: PublicKey,
|
|
|
|
|
2022-02-07 19:23:12 +00:00
|
|
|
// sidebar
|
|
|
|
pub(crate) content: Option<String>,
|
2022-06-02 14:33:41 +00:00
|
|
|
#[serde(deserialize_with = "deserialize_skip_error", default)]
|
2022-04-01 18:25:19 +00:00
|
|
|
pub(crate) source: Option<Source>,
|
2022-02-07 19:23:12 +00:00
|
|
|
// short instance description
|
|
|
|
pub(crate) summary: Option<String>,
|
|
|
|
pub(crate) media_type: Option<MediaTypeHtml>,
|
|
|
|
/// instance icon
|
|
|
|
pub(crate) icon: Option<ImageObject>,
|
|
|
|
/// instance banner
|
|
|
|
pub(crate) image: Option<ImageObject>,
|
2022-10-06 18:27:58 +00:00
|
|
|
#[serde(default)]
|
|
|
|
pub(crate) language: Vec<LanguageTag>,
|
2022-02-07 19:23:12 +00:00
|
|
|
pub(crate) published: DateTime<FixedOffset>,
|
|
|
|
pub(crate) updated: Option<DateTime<FixedOffset>>,
|
|
|
|
}
|