mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 06:38:20 +01:00
format
This commit is contained in:
parent
b278cd8a27
commit
25d857c0f3
|
|
@ -53,7 +53,9 @@ pub async fn db_post_from_url(url: Url) -> anyhow::Result<entities::post::Model>
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn db_user_from_url(url: Url) -> anyhow::Result<entities::user::Model> {
|
pub async fn db_user_from_url(url: Url) -> anyhow::Result<entities::user::Model> {
|
||||||
if !url.domain().eq(&Some(LYSAND_DOMAIN.as_str())) && !url.domain().eq(&Some(API_DOMAIN.as_str())) {
|
if !url.domain().eq(&Some(LYSAND_DOMAIN.as_str()))
|
||||||
|
&& !url.domain().eq(&Some(API_DOMAIN.as_str()))
|
||||||
|
{
|
||||||
return Err(anyhow!("not lysands domain"));
|
return Err(anyhow!("not lysands domain"));
|
||||||
}
|
}
|
||||||
let user_res: Option<user::Model> = prelude::User::find()
|
let user_res: Option<user::Model> = prelude::User::find()
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,7 @@ async fn fetch_post(
|
||||||
|
|
||||||
Ok(HttpResponse::Ok()
|
Ok(HttpResponse::Ok()
|
||||||
.content_type(FEDERATION_CONTENT_TYPE)
|
.content_type(FEDERATION_CONTENT_TYPE)
|
||||||
.json(
|
.json(crate::objects::post::Note::from_db(&post)))
|
||||||
crate::objects::post::Note::from_db(&post)
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/apbridge/create/{id}/{base64url}")]
|
#[get("/apbridge/create/{id}/{base64url}")]
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ use lysand::http::{create_activity, fetch_post};
|
||||||
use objects::person::DbUser;
|
use objects::person::DbUser;
|
||||||
use sea_orm::{ActiveModelTrait, DatabaseConnection, Set};
|
use sea_orm::{ActiveModelTrait, DatabaseConnection, Set};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use utils::generate_object_id;
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
env,
|
env,
|
||||||
|
|
@ -29,6 +28,7 @@ use std::{
|
||||||
use tokio::signal;
|
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 crate::{
|
use crate::{
|
||||||
activities::create_post::CreatePost,
|
activities::create_post::CreatePost,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue