mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-06-02 13:39:21 +00:00
c9f1407429
* Initial commit to bump diesel to 2.0.0-rc.0 and see what happens * Add chrono feature from diesel * db_schema crate is close to building? * Upgrade diesel-derive-newtype * Mostly modifying references to connections to be mutable ones; also used new way to do migrations as suggested by the migration guide; a lot more compiles now, though I can't figure out this tricky ToSql issue at the moment * Running clippy --fix * Trying to fix drone clippy 1 * Fix clippy * Upgrade clux-musl * Trying to fix drone clippy 2 * Trying to fix drone clippy 3 * Trying to fix drone clippy 5 * Adding diesel table aliases, removing sql view hack. Fixes #2101 Co-authored-by: Steven Chu <stevenc1@gmail.com> Co-authored-by: Nutomic <me@nutomic.com>
48 lines
1.4 KiB
Rust
48 lines
1.4 KiB
Rust
use crate::{
|
|
objects::instance::ApubSite,
|
|
protocol::{ImageObject, Source},
|
|
};
|
|
use activitypub_federation::{
|
|
core::{object_id::ObjectId, signatures::PublicKey},
|
|
deser::{helpers::deserialize_skip_error, values::MediaTypeHtml},
|
|
};
|
|
use chrono::{DateTime, FixedOffset};
|
|
use serde::{Deserialize, Serialize};
|
|
use serde_with::skip_serializing_none;
|
|
use url::Url;
|
|
|
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
|
pub enum InstanceType {
|
|
Application,
|
|
Service,
|
|
}
|
|
|
|
#[skip_serializing_none]
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct Instance {
|
|
#[serde(rename = "type")]
|
|
pub(crate) kind: InstanceType,
|
|
pub(crate) id: ObjectId<ApubSite>,
|
|
// site name
|
|
pub(crate) name: String,
|
|
pub(crate) inbox: Url,
|
|
/// mandatory field in activitypub, lemmy currently serves an empty outbox
|
|
pub(crate) outbox: Url,
|
|
pub(crate) public_key: PublicKey,
|
|
|
|
// sidebar
|
|
pub(crate) content: Option<String>,
|
|
#[serde(deserialize_with = "deserialize_skip_error", default)]
|
|
pub(crate) source: Option<Source>,
|
|
// 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>,
|
|
pub(crate) published: DateTime<FixedOffset>,
|
|
pub(crate) updated: Option<DateTime<FixedOffset>>,
|
|
}
|