mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 14:48:19 +01:00
fix: formatting & DB
This commit is contained in:
parent
2ffc66f412
commit
5949bb9bf3
|
|
@ -41,11 +41,7 @@ impl MigrationTrait for Migration {
|
||||||
.col(ColumnDef::new(FollowRelation::ApAcceptId).string())
|
.col(ColumnDef::new(FollowRelation::ApAcceptId).string())
|
||||||
.col(ColumnDef::new(FollowRelation::Remote).boolean().not_null())
|
.col(ColumnDef::new(FollowRelation::Remote).boolean().not_null())
|
||||||
.col(ColumnDef::new(FollowRelation::ApJson).string().not_null())
|
.col(ColumnDef::new(FollowRelation::ApJson).string().not_null())
|
||||||
.col(
|
.col(ColumnDef::new(FollowRelation::ApAcceptJson).string())
|
||||||
ColumnDef::new(FollowRelation::ApAcceptJson)
|
|
||||||
.string()
|
|
||||||
.not_null(),
|
|
||||||
)
|
|
||||||
.foreign_key(
|
.foreign_key(
|
||||||
ForeignKey::create()
|
ForeignKey::create()
|
||||||
.name("fk_follow_relation_followee_id")
|
.name("fk_follow_relation_followee_id")
|
||||||
|
|
|
||||||
|
|
@ -189,9 +189,7 @@ pub async fn lysand_user_from_db(
|
||||||
}
|
}
|
||||||
content_type_header.unwrap().to_str().unwrap().to_string()
|
content_type_header.unwrap().to_str().unwrap().to_string()
|
||||||
});
|
});
|
||||||
content_format
|
content_format.x.insert(media_type, content_entry);
|
||||||
.x
|
|
||||||
.insert(media_type, content_entry);
|
|
||||||
let mut name = tag.name.chars();
|
let mut name = tag.name.chars();
|
||||||
name.next();
|
name.next();
|
||||||
name.next_back();
|
name.next_back();
|
||||||
|
|
|
||||||
|
|
@ -354,6 +354,44 @@ pub struct Note {
|
||||||
//TODO extensions
|
//TODO extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct Patch {
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
pub rtype: LysandType,
|
||||||
|
pub id: Uuid,
|
||||||
|
pub uri: Url,
|
||||||
|
pub author: Url,
|
||||||
|
#[serde(with = "iso_lysand")]
|
||||||
|
pub created_at: OffsetDateTime,
|
||||||
|
#[serde(with = "iso_lysand")]
|
||||||
|
pub patched_at: OffsetDateTime,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub category: Option<CategoryType>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub content: Option<ContentFormat>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub device: Option<DeviceInfo>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub previews: Option<Vec<LinkPreview>>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub group: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub attachments: Option<Vec<ContentFormat>>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub replies_to: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub quotes: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub mentions: Option<Vec<Url>>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub subject: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub is_sensitive: Option<bool>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub visibility: Option<VisibilityType>,
|
||||||
|
//TODO extensions
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct Outbox {
|
pub struct Outbox {
|
||||||
pub first: Url,
|
pub first: Url,
|
||||||
|
|
@ -364,3 +402,27 @@ pub struct Outbox {
|
||||||
pub prev: Option<Url>,
|
pub prev: Option<Url>,
|
||||||
pub items: Vec<Note>,
|
pub items: Vec<Note>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct Follow {
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
pub rtype: LysandType,
|
||||||
|
pub id: Uuid,
|
||||||
|
pub uri: Url,
|
||||||
|
pub author: Url,
|
||||||
|
#[serde(with = "iso_lysand")]
|
||||||
|
pub created_at: OffsetDateTime,
|
||||||
|
pub followee: Url,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct FollowResult {
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
pub rtype: LysandType,
|
||||||
|
pub id: Uuid,
|
||||||
|
pub uri: Url,
|
||||||
|
pub author: Url,
|
||||||
|
#[serde(with = "iso_lysand")]
|
||||||
|
pub created_at: OffsetDateTime,
|
||||||
|
pub follower: Url,
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ use lysand::http::{create_activity, fetch_lysand_post, fetch_post, fetch_user, q
|
||||||
use objects::person::{DbUser, Person};
|
use objects::person::{DbUser, Person};
|
||||||
use sea_orm::{ActiveModelTrait, DatabaseConnection, Set};
|
use sea_orm::{ActiveModelTrait, DatabaseConnection, Set};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
env,
|
env,
|
||||||
|
|
@ -30,6 +29,7 @@ use tokio::signal;
|
||||||
use tracing::{info, instrument::WithSubscriber};
|
use tracing::{info, instrument::WithSubscriber};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use utils::generate_object_id;
|
use utils::generate_object_id;
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
activities::create_post::CreatePost,
|
activities::create_post::CreatePost,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ use crate::{
|
||||||
},
|
},
|
||||||
database::{State, StateHandle},
|
database::{State, StateHandle},
|
||||||
entities::{self, user},
|
entities::{self, user},
|
||||||
error::Error, API_DOMAIN,
|
error::Error,
|
||||||
|
API_DOMAIN,
|
||||||
};
|
};
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
config::Data,
|
config::Data,
|
||||||
|
|
@ -227,7 +228,8 @@ impl Actor for user::Model {
|
||||||
"https://{}/apbridge/user/{}",
|
"https://{}/apbridge/user/{}",
|
||||||
API_DOMAIN.to_string(),
|
API_DOMAIN.to_string(),
|
||||||
&self.id
|
&self.id
|
||||||
)).unwrap()
|
))
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn public_key_pem(&self) -> &str {
|
fn public_key_pem(&self) -> &str {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue