mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-16 09:24:00 +00:00
parent
1f29e91796
commit
91ae9a9d49
17 changed files with 5 additions and 2947 deletions
6
README.md
vendored
6
README.md
vendored
|
@ -165,9 +165,3 @@ ts-node translation_report.ts
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
Logo made by Andy Cuccaro (@andycuccaro) under the CC-BY-SA 4.0 license.
|
Logo made by Andy Cuccaro (@andycuccaro) under the CC-BY-SA 4.0 license.
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
All code is licensed under AGPLv3 unless otherwise indicated.
|
|
||||||
|
|
||||||
The code in `server/src/activitypub` is taken from the [Aardwolf/activitypub](https://crates.io/crates/activitypub) crate and licensed under GPLv3.
|
|
||||||
|
|
5
server/Cargo.lock
generated
vendored
5
server/Cargo.lock
generated
vendored
|
@ -1493,15 +1493,11 @@ name = "lemmy_server"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"activitypub 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"activitystreams-derive 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"activitystreams-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"activitystreams-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"actix-files 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"actix-files 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"actix-web-actors 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"actix-web-actors 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"bcrypt 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bcrypt 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1521,7 +1517,6 @@ dependencies = [
|
||||||
"reqwest 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
"reqwest 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rss 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rss 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"strum 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"strum 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
8
server/Cargo.toml
vendored
8
server/Cargo.toml
vendored
|
@ -13,7 +13,6 @@ activitypub = "0.2.0"
|
||||||
chrono = { version = "0.4.7", features = ["serde"] }
|
chrono = { version = "0.4.7", features = ["serde"] }
|
||||||
failure = "0.1.5"
|
failure = "0.1.5"
|
||||||
serde_json = { version = "1.0.45", features = ["preserve_order"]}
|
serde_json = { version = "1.0.45", features = ["preserve_order"]}
|
||||||
serde_derive = "1.0"
|
|
||||||
serde = { version = "1.0.94", features = ["derive"] }
|
serde = { version = "1.0.94", features = ["derive"] }
|
||||||
actix = "0.9.0"
|
actix = "0.9.0"
|
||||||
actix-web = "2.0.0"
|
actix-web = "2.0.0"
|
||||||
|
@ -35,10 +34,3 @@ htmlescape = "0.3.1"
|
||||||
config = "0.10.1"
|
config = "0.10.1"
|
||||||
hjson = "0.8.2"
|
hjson = "0.8.2"
|
||||||
reqwest = "0.9.24"
|
reqwest = "0.9.24"
|
||||||
activitystreams-derive = "0.2"
|
|
||||||
activitystreams-traits = "0.2"
|
|
||||||
activitystreams-types = "0.3"
|
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
anyhow = "1.0"
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,291 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of ActivityPub.
|
|
||||||
*
|
|
||||||
* Copyright © 2018 Riley Trautman
|
|
||||||
*
|
|
||||||
* ActivityPub is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* ActivityPub is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with ActivityPub. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//! Actor traits and types
|
|
||||||
|
|
||||||
use activitystreams_derive::Properties;
|
|
||||||
pub use activitystreams_traits::Actor;
|
|
||||||
pub use activitystreams_types::actor::kind;
|
|
||||||
use serde_derive::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
pub mod properties;
|
|
||||||
|
|
||||||
use self::{kind::*, properties::*};
|
|
||||||
use activitypub::object::{
|
|
||||||
properties::{ApObjectProperties, ObjectProperties},
|
|
||||||
ApObjectExt, Object, ObjectExt,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The ActivityPub Actor Extension Trait
|
|
||||||
///
|
|
||||||
/// This trait provides generic access to an activitypub actor's properties
|
|
||||||
pub trait ApActorExt: Actor {
|
|
||||||
fn props(&self) -> &ApActorProperties;
|
|
||||||
fn props_mut(&mut self) -> &mut ApActorProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Describes a software application.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Application {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: ApplicationType,
|
|
||||||
|
|
||||||
/// Adds all valid object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid activitypub object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid activitypub actor properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_actor_props: ApActorProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Application {}
|
|
||||||
impl ObjectExt for Application {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Application {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Actor for Application {}
|
|
||||||
impl ApActorExt for Application {
|
|
||||||
fn props(&self) -> &ApActorProperties {
|
|
||||||
&self.ap_actor_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApActorProperties {
|
|
||||||
&mut self.ap_actor_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Represents a formal or informal collective of Actors.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Group {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: GroupType,
|
|
||||||
|
|
||||||
/// Adds all valid object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid activitypub object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid activitypub actor properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_actor_props: ApActorProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Group {}
|
|
||||||
impl ObjectExt for Group {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Group {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Actor for Group {}
|
|
||||||
impl ApActorExt for Group {
|
|
||||||
fn props(&self) -> &ApActorProperties {
|
|
||||||
&self.ap_actor_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApActorProperties {
|
|
||||||
&mut self.ap_actor_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Represents an organization.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Organization {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: OrganizationType,
|
|
||||||
|
|
||||||
/// Adds all valid object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid activitypub object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid activitypub actor properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_actor_props: ApActorProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Organization {}
|
|
||||||
impl ObjectExt for Organization {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Organization {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Actor for Organization {}
|
|
||||||
impl ApActorExt for Organization {
|
|
||||||
fn props(&self) -> &ApActorProperties {
|
|
||||||
&self.ap_actor_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApActorProperties {
|
|
||||||
&mut self.ap_actor_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Represents an individual person.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Person {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: PersonType,
|
|
||||||
|
|
||||||
/// Adds all valid object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid activitypub object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid activitypub actor properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_actor_props: ApActorProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Person {}
|
|
||||||
impl ObjectExt for Person {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Person {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Actor for Person {}
|
|
||||||
impl ApActorExt for Person {
|
|
||||||
fn props(&self) -> &ApActorProperties {
|
|
||||||
&self.ap_actor_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApActorProperties {
|
|
||||||
&mut self.ap_actor_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Represents a service of any kind.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Service {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: ServiceType,
|
|
||||||
|
|
||||||
/// Adds all valid object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid activitypub object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid activitypub actor properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_actor_props: ApActorProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Service {}
|
|
||||||
impl ObjectExt for Service {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Service {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Actor for Service {}
|
|
||||||
impl ApActorExt for Service {
|
|
||||||
fn props(&self) -> &ApActorProperties {
|
|
||||||
&self.ap_actor_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApActorProperties {
|
|
||||||
&mut self.ap_actor_props
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,129 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of ActivityPub.
|
|
||||||
*
|
|
||||||
* Copyright © 2018 Riley Trautman
|
|
||||||
*
|
|
||||||
* ActivityPub is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* ActivityPub is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with ActivityPub. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//! Namespace for properties of standard Actor types
|
|
||||||
//!
|
|
||||||
//! To use these properties in your own types, you can flatten them into your struct with serde:
|
|
||||||
//!
|
|
||||||
//! ```rust
|
|
||||||
//! use activitypub::{Object, Actor, actor::properties::ApActorProperties};
|
|
||||||
//! use serde_derive::{Deserialize, Serialize};
|
|
||||||
//!
|
|
||||||
//! #[derive(Clone, Debug, Serialize, Deserialize)]
|
|
||||||
//! #[serde(rename_all = "camelCase")]
|
|
||||||
//! pub struct MyActor {
|
|
||||||
//! #[serde(rename = "type")]
|
|
||||||
//! pub kind: String,
|
|
||||||
//!
|
|
||||||
//! /// Define a require property for the MyActor type
|
|
||||||
//! pub my_property: String,
|
|
||||||
//!
|
|
||||||
//! #[serde(flatten)]
|
|
||||||
//! pub actor_props: ApActorProperties,
|
|
||||||
//! }
|
|
||||||
//!
|
|
||||||
//! impl Object for MyActor {}
|
|
||||||
//! impl Actor for MyActor {}
|
|
||||||
//! #
|
|
||||||
//! # fn main() {}
|
|
||||||
//! ```
|
|
||||||
|
|
||||||
use activitystreams_derive::Properties;
|
|
||||||
use serde_derive::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use crate::activitypub::endpoint::Endpoint;
|
|
||||||
|
|
||||||
/// Define activitypub properties for the Actor type as described by the Activity Pub vocabulary.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Properties, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct ApActorProperties {
|
|
||||||
// TODO: IRI
|
|
||||||
/// A reference to an [[ActivityStreams](https://www.w3.org/ns/activitystreams)]
|
|
||||||
/// OrderedCollection comprised of all the messages received by the actor.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[activitystreams(concrete(String), functional)]
|
|
||||||
pub inbox: serde_json::Value,
|
|
||||||
|
|
||||||
// TODO: IRI
|
|
||||||
/// An [ActivityStreams](https://www.w3.org/ns/activitystreams)] OrderedCollection comprised of
|
|
||||||
/// all the messages produced by the actor.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[activitystreams(concrete(String), functional)]
|
|
||||||
pub outbox: serde_json::Value,
|
|
||||||
|
|
||||||
// TODO: IRI
|
|
||||||
/// A link to an [[ActivityStreams](https://www.w3.org/ns/activitystreams)] collection of the
|
|
||||||
/// actors that this actor is following.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[activitystreams(concrete(String), functional)]
|
|
||||||
pub following: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
// TODO: IRI
|
|
||||||
/// A link to an [[ActivityStreams](https://www.w3.org/ns/activitystreams)] collection of the
|
|
||||||
/// actors that follow this actor.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[activitystreams(concrete(String), functional)]
|
|
||||||
pub followers: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
// TODO: IRI
|
|
||||||
/// A link to an [[ActivityStreams](https://www.w3.org/ns/activitystreams)] collection of
|
|
||||||
/// objects this actor has liked.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[activitystreams(concrete(String), functional)]
|
|
||||||
pub liked: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
// TODO: IRI
|
|
||||||
/// A list of supplementary Collections which may be of interest.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: false
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(String))]
|
|
||||||
pub streams: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
/// A short username which may be used to refer to the actor, with no uniqueness guarantees.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(String), functional)]
|
|
||||||
pub preferred_username: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
/// A json object which maps additional (typically server/domain-wide) endpoints which may be
|
|
||||||
/// useful either for this actor or someone referencing this actor.
|
|
||||||
///
|
|
||||||
/// This mapping may be nested inside the actor document as the value or may be a link to a
|
|
||||||
/// JSON-LD document with these properties.
|
|
||||||
///
|
|
||||||
/// - Range: `Endpoint`
|
|
||||||
/// - Functional: true
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(Endpoint), functional)]
|
|
||||||
pub endpoints: Option<serde_json::Value>,
|
|
||||||
}
|
|
|
@ -1,264 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of ActivityPub.
|
|
||||||
*
|
|
||||||
* Copyright © 2018 Riley Trautman
|
|
||||||
*
|
|
||||||
* ActivityPub is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* ActivityPub is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with ActivityPub. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//! Collection traits and types
|
|
||||||
|
|
||||||
use activitystreams_derive::Properties;
|
|
||||||
pub use activitystreams_traits::{Collection, CollectionPage};
|
|
||||||
pub use activitystreams_types::collection::{kind, properties, CollectionExt, CollectionPageExt};
|
|
||||||
use serde_derive::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use self::{kind::*, properties::*};
|
|
||||||
use activitypub::object::{
|
|
||||||
properties::{ApObjectProperties, ObjectProperties},
|
|
||||||
ApObjectExt, Object, ObjectExt,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The default `Collection` type.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct UnorderedCollection {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: CollectionType,
|
|
||||||
|
|
||||||
/// Adds all valid object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid ap object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid collection properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub collection_props: CollectionProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for UnorderedCollection {}
|
|
||||||
impl ObjectExt for UnorderedCollection {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for UnorderedCollection {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Collection for UnorderedCollection {}
|
|
||||||
impl CollectionExt for UnorderedCollection {
|
|
||||||
fn props(&self) -> &CollectionProperties {
|
|
||||||
&self.collection_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut CollectionProperties {
|
|
||||||
&mut self.collection_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Used to represent distinct subsets of items from a `Collection`.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct UnorderedCollectionPage {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: CollectionPageType,
|
|
||||||
|
|
||||||
/// Adds all valid object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid ap object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid collection properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub collection_props: CollectionProperties,
|
|
||||||
|
|
||||||
/// Adds all valid collection page properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub collection_page_props: CollectionPageProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for UnorderedCollectionPage {}
|
|
||||||
impl ObjectExt for UnorderedCollectionPage {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for UnorderedCollectionPage {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Collection for UnorderedCollectionPage {}
|
|
||||||
impl CollectionExt for UnorderedCollectionPage {
|
|
||||||
fn props(&self) -> &CollectionProperties {
|
|
||||||
&self.collection_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut CollectionProperties {
|
|
||||||
&mut self.collection_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl CollectionPage for UnorderedCollectionPage {}
|
|
||||||
impl CollectionPageExt for UnorderedCollectionPage {
|
|
||||||
fn props(&self) -> &CollectionPageProperties {
|
|
||||||
&self.collection_page_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut CollectionPageProperties {
|
|
||||||
&mut self.collection_page_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A subtype of `Collection` in which members of the logical collection are assumed to always be
|
|
||||||
/// strictly ordered.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct OrderedCollection {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: OrderedCollectionType,
|
|
||||||
|
|
||||||
/// Adds all valid object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid ap object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid collection properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub collection_props: CollectionProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for OrderedCollection {}
|
|
||||||
impl ObjectExt for OrderedCollection {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for OrderedCollection {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Collection for OrderedCollection {}
|
|
||||||
impl CollectionExt for OrderedCollection {
|
|
||||||
fn props(&self) -> &CollectionProperties {
|
|
||||||
&self.collection_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut CollectionProperties {
|
|
||||||
&mut self.collection_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Used to represent ordered subsets of items from an `OrderedCollection`.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct OrderedCollectionPage {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: OrderedCollectionPageType,
|
|
||||||
|
|
||||||
/// Adds all valid object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid ap object properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
/// Adds all valid collection properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub collection_props: CollectionProperties,
|
|
||||||
|
|
||||||
/// Adds all valid collection page properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub collection_page_props: CollectionPageProperties,
|
|
||||||
|
|
||||||
/// Adds all valid ordered collection page properties to this struct
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ordered_collection_page_props: OrderedCollectionPageProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for OrderedCollectionPage {}
|
|
||||||
impl ObjectExt for OrderedCollectionPage {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for OrderedCollectionPage {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Collection for OrderedCollectionPage {}
|
|
||||||
impl CollectionExt for OrderedCollectionPage {
|
|
||||||
fn props(&self) -> &CollectionProperties {
|
|
||||||
&self.collection_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut CollectionProperties {
|
|
||||||
&mut self.collection_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl CollectionPage for OrderedCollectionPage {}
|
|
||||||
impl CollectionPageExt for OrderedCollectionPage {
|
|
||||||
fn props(&self) -> &CollectionPageProperties {
|
|
||||||
&self.collection_page_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut CollectionPageProperties {
|
|
||||||
&mut self.collection_page_props
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,107 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of ActivityPub.
|
|
||||||
*
|
|
||||||
* Copyright © 2018 Riley Trautman
|
|
||||||
*
|
|
||||||
* ActivityPub is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* ActivityPub is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with ActivityPub. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//! Endpoint traits and types
|
|
||||||
|
|
||||||
use activitystreams_derive::Properties;
|
|
||||||
use serde_derive::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
/// A json object which maps additional (typically server/domain-wide) endpoints which may be
|
|
||||||
/// useful either for this actor or someone referencing this actor.
|
|
||||||
///
|
|
||||||
/// This mapping may be nested inside the actor document as the value or may be a link to a JSON-LD
|
|
||||||
/// document with these properties.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Properties, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Endpoint {
|
|
||||||
// TODO: IRI
|
|
||||||
/// Endpoint URI so this actor's clients may access remote ActivityStreams objects which
|
|
||||||
/// require authentication to access.
|
|
||||||
///
|
|
||||||
/// To use this endpoint, the client posts an x-www-form-urlencoded id parameter with the value
|
|
||||||
/// being the id of the requested ActivityStreams object.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(String))]
|
|
||||||
pub proxy_url: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
// TODO: IRI
|
|
||||||
/// If OAuth 2.0 bearer tokens [[RFC6749](https://tools.ietf.org/html/rfc6749)]
|
|
||||||
/// [[RFC6750](https://tools.ietf.org/html/rfc6750)] are being used for authenticating client
|
|
||||||
/// to server interactions, this endpoint specifies a URI at which a browser-authenticated user
|
|
||||||
/// may obtain a new authorization grant.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(String))]
|
|
||||||
pub oauth_authorization_endpoint: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
// TODO: IRI
|
|
||||||
/// If OAuth 2.0 bearer tokens [[RFC6749](https://tools.ietf.org/html/rfc6749)]
|
|
||||||
/// [[RFC6750](https://tools.ietf.org/html/rfc6750)] are being used for authenticating client
|
|
||||||
/// to server interactions, this endpoint specifies a URI at which a client may acquire an
|
|
||||||
/// access token.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(String))]
|
|
||||||
pub oauth_token_endpoint: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
// TODO: IRI
|
|
||||||
/// If Linked Data Signatures and HTTP Signatures are being used for authentication and
|
|
||||||
/// authorization, this endpoint specifies a URI at which browser-authenticated users may
|
|
||||||
/// authorize a client's public key for client to server interactions.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(String))]
|
|
||||||
pub provide_client_key: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
// TODO: IRI
|
|
||||||
/// If Linked Data Signatures and HTTP Signatures are being used for authentication and
|
|
||||||
/// authorization, this endpoint specifies a URI at which a client key may be signed by the
|
|
||||||
/// actor's key for a time window to act on behalf of the actor in interacting with foreign
|
|
||||||
/// servers.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(String))]
|
|
||||||
pub sign_client_key: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
// TODO: IRI
|
|
||||||
/// An optional endpoint used for wide delivery of publicly addressed activities and activities
|
|
||||||
/// sent to followers.
|
|
||||||
///
|
|
||||||
/// `shared_inbox`endpoints SHOULD also be publicly readable `OrderedCollection` objects
|
|
||||||
/// containing objects addressed to the Public special collection. Reading from the
|
|
||||||
/// `shared_inbox` endpoint MUST NOT present objects which are not addressed to the Public
|
|
||||||
/// endpoint.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(String))]
|
|
||||||
pub shared_inbox: Option<serde_json::Value>,
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of ActivityPub.
|
|
||||||
*
|
|
||||||
* Copyright © 2018 Riley Trautman
|
|
||||||
*
|
|
||||||
* ActivityPub is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* ActivityPub is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with ActivityPub. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//! Link traits and types
|
|
||||||
|
|
||||||
pub use activitystreams_traits::Link;
|
|
||||||
pub use activitystreams_types::link::{kind, properties, LinkExt, Mention};
|
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of ActivityPub.
|
|
||||||
*
|
|
||||||
* Copyright © 2018 Riley Trautman
|
|
||||||
*
|
|
||||||
* ActivityPub is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* ActivityPub is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with ActivityPub. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//! ActivityPub
|
|
||||||
//!
|
|
||||||
//! This crate defines the base set of types from the ActivityPub specification.
|
|
||||||
//!
|
|
||||||
//! ## Example Usage
|
|
||||||
//! ```rust
|
|
||||||
//! use activitypub::{context, object::Video};
|
|
||||||
//! use anyhow::Error;
|
|
||||||
//!
|
|
||||||
//! fn run() -> Result<(), Error> {
|
|
||||||
//! let mut video = Video::default();
|
|
||||||
//! video.object_props.set_context_object(context())?;
|
|
||||||
//! video.ap_object_props.set_likes_string("https://my-instance.com/likes".to_owned());
|
|
||||||
//!
|
|
||||||
//! let video_string = serde_json::to_string(&video)?;
|
|
||||||
//!
|
|
||||||
//! let video: Video = serde_json::from_str(&video_string)?;
|
|
||||||
//!
|
|
||||||
//! Ok(())
|
|
||||||
//! }
|
|
||||||
//! ```
|
|
||||||
pub mod activity;
|
|
||||||
pub mod actor;
|
|
||||||
pub mod collection;
|
|
||||||
mod endpoint;
|
|
||||||
pub mod link;
|
|
||||||
pub mod object;
|
|
||||||
|
|
||||||
pub use self::{
|
|
||||||
activity::{Activity, IntransitiveActivity},
|
|
||||||
actor::Actor,
|
|
||||||
collection::{Collection, CollectionPage},
|
|
||||||
endpoint::Endpoint,
|
|
||||||
link::Link,
|
|
||||||
object::Object,
|
|
||||||
};
|
|
||||||
pub use activitystreams_traits::{properties, Error, Result};
|
|
||||||
pub use activitystreams_types::{context, ContextObject, CustomLink, CustomObject};
|
|
|
@ -1,444 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of ActivityPub.
|
|
||||||
*
|
|
||||||
* Copyright © 2018 Riley Trautman
|
|
||||||
*
|
|
||||||
* ActivityPub is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* ActivityPub is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with ActivityPub. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//! Object traits and types
|
|
||||||
|
|
||||||
pub use activitystreams_traits::Object;
|
|
||||||
pub use activitystreams_types::object::{kind, ObjectExt};
|
|
||||||
use serde_derive::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
pub mod properties;
|
|
||||||
|
|
||||||
use self::{kind::*, properties::*};
|
|
||||||
|
|
||||||
/// The ActivityPub Object Extension Trait
|
|
||||||
///
|
|
||||||
/// This trait provides generic access to an activitypub object's properties
|
|
||||||
pub trait ApObjectExt: Object {
|
|
||||||
fn props(&self) -> &ApObjectProperties;
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Article {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: ArticleType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Article {}
|
|
||||||
impl ObjectExt for Article {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Article {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Audio {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: AudioType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Audio {}
|
|
||||||
impl ObjectExt for Audio {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Audio {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Document {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: DocumentType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Document {}
|
|
||||||
impl ObjectExt for Document {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Document {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Event {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: EventType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Event {}
|
|
||||||
impl ObjectExt for Event {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Event {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Image {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: ImageType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Image {}
|
|
||||||
impl ObjectExt for Image {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Image {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Note {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: NoteType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Note {}
|
|
||||||
impl ObjectExt for Note {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Note {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Page {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: PageType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Page {}
|
|
||||||
impl ObjectExt for Page {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Page {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Place {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: PlaceType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub place_props: PlaceProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Place {}
|
|
||||||
impl ObjectExt for Place {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Place {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Profile {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: ProfileType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub profile_props: ProfileProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Profile {}
|
|
||||||
impl ObjectExt for Profile {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Profile {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Relationship {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: RelationshipType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub relationship_props: RelationshipProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Relationship {}
|
|
||||||
impl ObjectExt for Relationship {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Relationship {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Tombstone {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: TombstoneType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub tombstone_props: TombstoneProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Tombstone {}
|
|
||||||
impl ObjectExt for Tombstone {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Tombstone {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Video {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
kind: VideoType,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub object_props: ObjectProperties,
|
|
||||||
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ap_object_props: ApObjectProperties,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Object for Video {}
|
|
||||||
impl ObjectExt for Video {
|
|
||||||
fn props(&self) -> &ObjectProperties {
|
|
||||||
&self.object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
|
||||||
&mut self.object_props
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ApObjectExt for Video {
|
|
||||||
fn props(&self) -> &ApObjectProperties {
|
|
||||||
&self.ap_object_props
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut ApObjectProperties {
|
|
||||||
&mut self.ap_object_props
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of ActivityPub.
|
|
||||||
*
|
|
||||||
* Copyright © 2018 Riley Trautman
|
|
||||||
*
|
|
||||||
* ActivityPub is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* ActivityPub is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with ActivityPub. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//! Namespace for properties of standard Object types
|
|
||||||
//!
|
|
||||||
//! To use these properties in your own types, you can flatten them into your struct with serde:
|
|
||||||
//!
|
|
||||||
//! ```rust
|
|
||||||
//! use activitypub::{Object, object::properties::ApObjectProperties};
|
|
||||||
//! use serde_derive::{Deserialize, Serialize};
|
|
||||||
//!
|
|
||||||
//! #[derive(Clone, Debug, Serialize, Deserialize)]
|
|
||||||
//! #[serde(rename_all = "camelCase")]
|
|
||||||
//! pub struct MyObject {
|
|
||||||
//! #[serde(rename = "type")]
|
|
||||||
//! pub kind: String,
|
|
||||||
//!
|
|
||||||
//! /// Define a require property for the MyObject type
|
|
||||||
//! pub my_property: String,
|
|
||||||
//!
|
|
||||||
//! #[serde(flatten)]
|
|
||||||
//! pub object_props: ApObjectProperties,
|
|
||||||
//! }
|
|
||||||
//!
|
|
||||||
//! impl Object for MyObject {}
|
|
||||||
//! #
|
|
||||||
//! # fn main() {}
|
|
||||||
//! ```
|
|
||||||
|
|
||||||
use super::Object;
|
|
||||||
|
|
||||||
use activitystreams_derive::Properties;
|
|
||||||
pub use activitystreams_types::object::properties::{
|
|
||||||
ObjectProperties, PlaceProperties, ProfileProperties, RelationshipProperties, TombstoneProperties,
|
|
||||||
};
|
|
||||||
use serde_derive::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
/// Define activitypub properties for the Object type as described by the Activity Pub vocabulary.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Properties, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct ApObjectProperties {
|
|
||||||
// TODO: IRI
|
|
||||||
/// This is a list of all Announce activities with this object as the object property, added as
|
|
||||||
/// a side effect.
|
|
||||||
///
|
|
||||||
/// The shares collection MUST be either an OrderedCollection or a Collection and MAY be
|
|
||||||
/// filtered on privileges of an authenticated user or as appropriate when no authentication is
|
|
||||||
/// given.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(String), functional)]
|
|
||||||
pub shares: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
/// This is a list of all Like activities with this object as the object property, added as a
|
|
||||||
/// side effect.
|
|
||||||
///
|
|
||||||
/// The likes collection MUST be either an OrderedCollection or a Collection and MAY be
|
|
||||||
/// filtered on privileges of an authenticated user or as appropriate when no authentication is
|
|
||||||
/// given.
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: true
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(String), functional)]
|
|
||||||
pub likes: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
/// The source property is intended to convey some sort of source from which the content markup
|
|
||||||
/// was derived, as a form of provenance, or to support future editing by clients.
|
|
||||||
///
|
|
||||||
/// In general, clients do the conversion from source to content, not the other way around.
|
|
||||||
///
|
|
||||||
/// The value of source is itself an object which uses its own content and mediaType fields to
|
|
||||||
/// supply source information.
|
|
||||||
///
|
|
||||||
/// - Range: `Object`
|
|
||||||
/// - Functional: true
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(ab(Object), concrete(String), functional)]
|
|
||||||
pub source: Option<serde_json::Value>,
|
|
||||||
|
|
||||||
/// Servers MAY support uploading document types to be referenced in activites, such as images,
|
|
||||||
/// video or other binary data, but the precise mechanism is out of scope for this version of
|
|
||||||
/// `ActivityPub`.
|
|
||||||
///
|
|
||||||
/// The Social Web Community Group is refining the protocol in the
|
|
||||||
/// [`ActivityPub` Media Upload report](https://www.w3.org/wiki/SocialCG/ActivityPub/MediaUpload).
|
|
||||||
///
|
|
||||||
/// - Range: `anyUri`
|
|
||||||
/// - Functional: false
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[activitystreams(concrete(String))]
|
|
||||||
pub upload_media: Option<serde_json::Value>,
|
|
||||||
}
|
|
|
@ -1,9 +1,9 @@
|
||||||
use crate::activitypub::{actor::Group, collection::UnorderedCollection, context};
|
|
||||||
use crate::apub::make_apub_endpoint;
|
use crate::apub::make_apub_endpoint;
|
||||||
use crate::db::community::Community;
|
use crate::db::community::Community;
|
||||||
use crate::db::community_view::CommunityFollowerView;
|
use crate::db::community_view::CommunityFollowerView;
|
||||||
use crate::db::establish_unpooled_connection;
|
use crate::db::establish_unpooled_connection;
|
||||||
use crate::to_datetime_utc;
|
use crate::to_datetime_utc;
|
||||||
|
use activitypub::{actor::Group, collection::UnorderedCollection, context};
|
||||||
use actix_web::body::Body;
|
use actix_web::body::Body;
|
||||||
use actix_web::web::Path;
|
use actix_web::web::Path;
|
||||||
use actix_web::HttpResponse;
|
use actix_web::HttpResponse;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::activitypub::{context, object::Page};
|
|
||||||
use crate::apub::make_apub_endpoint;
|
use crate::apub::make_apub_endpoint;
|
||||||
use crate::db::post::Post;
|
use crate::db::post::Post;
|
||||||
use crate::to_datetime_utc;
|
use crate::to_datetime_utc;
|
||||||
|
use activitypub::{context, object::Page};
|
||||||
|
|
||||||
impl Post {
|
impl Post {
|
||||||
pub fn as_page(&self) -> Page {
|
pub fn as_page(&self) -> Page {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
extern crate reqwest;
|
extern crate reqwest;
|
||||||
|
|
||||||
use self::reqwest::Error;
|
use self::reqwest::Error;
|
||||||
use crate::activitypub::actor::Group;
|
|
||||||
use crate::api::community::{GetCommunityResponse, ListCommunitiesResponse};
|
use crate::api::community::{GetCommunityResponse, ListCommunitiesResponse};
|
||||||
use crate::api::post::GetPosts;
|
use crate::api::post::GetPosts;
|
||||||
use crate::db::community_view::CommunityView;
|
use crate::db::community_view::CommunityView;
|
||||||
use crate::naive_now;
|
use crate::naive_now;
|
||||||
use crate::settings::Settings;
|
use crate::settings::Settings;
|
||||||
|
use activitypub::actor::Group;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
// TODO: right now all of the data is requested on demand, for production we will need to store
|
// TODO: right now all of the data is requested on demand, for production we will need to store
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::activitypub::{actor::Person, context};
|
|
||||||
use crate::apub::make_apub_endpoint;
|
use crate::apub::make_apub_endpoint;
|
||||||
use crate::db::establish_unpooled_connection;
|
use crate::db::establish_unpooled_connection;
|
||||||
use crate::db::user::User_;
|
use crate::db::user::User_;
|
||||||
use crate::to_datetime_utc;
|
use crate::to_datetime_utc;
|
||||||
|
use activitypub::{actor::Person, context};
|
||||||
use actix_web::body::Body;
|
use actix_web::body::Body;
|
||||||
use actix_web::web::Path;
|
use actix_web::web::Path;
|
||||||
use actix_web::HttpResponse;
|
use actix_web::HttpResponse;
|
||||||
|
|
|
@ -22,7 +22,6 @@ pub extern crate serde_json;
|
||||||
pub extern crate sha2;
|
pub extern crate sha2;
|
||||||
pub extern crate strum;
|
pub extern crate strum;
|
||||||
|
|
||||||
pub mod activitypub;
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
pub mod apub;
|
pub mod apub;
|
||||||
pub mod db;
|
pub mod db;
|
||||||
|
|
Loading…
Reference in a new issue