mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 06:38:20 +01:00
fix: ap json for default user
This commit is contained in:
parent
451cf8941a
commit
9ce95c4b7a
31
src/main.rs
31
src/main.rs
|
|
@ -16,7 +16,7 @@ use database::Database;
|
||||||
use entities::post;
|
use entities::post;
|
||||||
use http::{http_get_user, http_post_user_inbox, webfinger};
|
use http::{http_get_user, http_post_user_inbox, webfinger};
|
||||||
use lysand::http::{create_activity, fetch_lysand_post, fetch_post, fetch_user, query_post};
|
use lysand::http::{create_activity, fetch_lysand_post, fetch_post, fetch_user, query_post};
|
||||||
use objects::person::DbUser;
|
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 std::{
|
use std::{
|
||||||
|
|
@ -188,6 +188,34 @@ async fn main() -> actix_web::Result<(), anyhow::Error> {
|
||||||
))?;
|
))?;
|
||||||
let keypair = generate_actor_keypair()?;
|
let keypair = generate_actor_keypair()?;
|
||||||
|
|
||||||
|
let ap_json = Person {
|
||||||
|
id: ap_id.clone().into(),
|
||||||
|
preferred_username: USERNAME.to_string(),
|
||||||
|
name: "Test account <3".to_string(),
|
||||||
|
inbox: inbox.clone(),
|
||||||
|
public_key: activitypub_federation::protocol::public_key::PublicKey {
|
||||||
|
owner: ap_id.clone(),
|
||||||
|
public_key_pem: keypair.public_key.clone(),
|
||||||
|
id: format!("{}#main-key", ap_id.clone()),
|
||||||
|
},
|
||||||
|
summary: Some("Test account <3".to_string()),
|
||||||
|
url: ap_id.clone(),
|
||||||
|
kind: Default::default(),
|
||||||
|
indexable: Some(false),
|
||||||
|
discoverable: Some(false),
|
||||||
|
icon: None,
|
||||||
|
image: None,
|
||||||
|
attachment: None,
|
||||||
|
tag: None,
|
||||||
|
endpoints: None,
|
||||||
|
followers: None,
|
||||||
|
following: None,
|
||||||
|
featured: None,
|
||||||
|
outbox: None,
|
||||||
|
featured_tags: None,
|
||||||
|
manually_approves_followers: Some(false),
|
||||||
|
};
|
||||||
|
|
||||||
let user = entities::user::ActiveModel {
|
let user = entities::user::ActiveModel {
|
||||||
id: Set(ap_id.clone().into()),
|
id: Set(ap_id.clone().into()),
|
||||||
username: Set(USERNAME.to_string()),
|
username: Set(USERNAME.to_string()),
|
||||||
|
|
@ -201,6 +229,7 @@ async fn main() -> actix_web::Result<(), anyhow::Error> {
|
||||||
url: Set(ap_id.to_string()),
|
url: Set(ap_id.to_string()),
|
||||||
local: Set(true),
|
local: Set(true),
|
||||||
created_at: Set(Utc::now()),
|
created_at: Set(Utc::now()),
|
||||||
|
ap_json: Set(Some(serde_json::to_string(&ap_json).unwrap())),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue