This commit is contained in:
aprilthepink 2024-06-27 09:48:47 +02:00
parent b278cd8a27
commit 25d857c0f3
3 changed files with 5 additions and 5 deletions

View file

@ -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> {
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"));
}
let user_res: Option<user::Model> = prelude::User::find()

View file

@ -35,9 +35,7 @@ async fn fetch_post(
Ok(HttpResponse::Ok()
.content_type(FEDERATION_CONTENT_TYPE)
.json(
crate::objects::post::Note::from_db(&post)
))
.json(crate::objects::post::Note::from_db(&post)))
}
#[get("/apbridge/create/{id}/{base64url}")]

View file

@ -19,7 +19,6 @@ use lysand::http::{create_activity, fetch_post};
use objects::person::DbUser;
use sea_orm::{ActiveModelTrait, DatabaseConnection, Set};
use serde::{Deserialize, Serialize};
use utils::generate_object_id;
use std::{
collections::HashMap,
env,
@ -29,6 +28,7 @@ use std::{
use tokio::signal;
use tracing::{info, instrument::WithSubscriber};
use url::Url;
use utils::generate_object_id;
use crate::{
activities::create_post::CreatePost,