Builds lemmy_routes in parallel with lemmy_apub

This commit is contained in:
Felix Ableitner 2022-11-26 21:34:38 +01:00
parent 030afbc2e7
commit 904d7bec2f
5 changed files with 18 additions and 20 deletions

1
Cargo.lock generated
View file

@ -2231,7 +2231,6 @@ dependencies = [
"diesel", "diesel",
"futures", "futures",
"lemmy_api_common", "lemmy_api_common",
"lemmy_apub",
"lemmy_db_schema", "lemmy_db_schema",
"lemmy_db_views", "lemmy_db_views",
"lemmy_db_views_actor", "lemmy_db_views_actor",

View file

@ -4,25 +4,10 @@ use anyhow::anyhow;
use itertools::Itertools; use itertools::Itertools;
use lemmy_api_common::LemmyContext; use lemmy_api_common::LemmyContext;
use lemmy_db_schema::newtypes::DbUrl; use lemmy_db_schema::newtypes::DbUrl;
use lemmy_utils::error::LemmyError; use lemmy_utils::{error::LemmyError, WebfingerResponse};
use serde::{Deserialize, Serialize};
use tracing::debug; use tracing::debug;
use url::Url; use url::Url;
#[derive(Serialize, Deserialize, Debug)]
pub struct WebfingerLink {
pub rel: Option<String>,
#[serde(rename = "type")]
pub kind: Option<String>,
pub href: Option<Url>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct WebfingerResponse {
pub subject: String,
pub links: Vec<WebfingerLink>,
}
/// Turns a person id like `@name@example.com` into an apub ID, like `https://example.com/user/name`, /// Turns a person id like `@name@example.com` into an apub ID, like `https://example.com/user/name`,
/// using webfinger. /// using webfinger.
#[tracing::instrument(skip_all)] #[tracing::instrument(skip_all)]

View file

@ -17,7 +17,6 @@ lemmy_db_views = { workspace = true }
lemmy_db_views_actor = { workspace = true } lemmy_db_views_actor = { workspace = true }
lemmy_db_schema = { workspace = true } lemmy_db_schema = { workspace = true }
lemmy_api_common = { workspace = true } lemmy_api_common = { workspace = true }
lemmy_apub = { workspace = true }
diesel = { workspace = true } diesel = { workspace = true }
actix-web = { workspace = true } actix-web = { workspace = true }
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,12 +1,11 @@
use actix_web::{web, web::Query, HttpResponse}; use actix_web::{web, web::Query, HttpResponse};
use anyhow::Context; use anyhow::Context;
use lemmy_api_common::LemmyContext; use lemmy_api_common::LemmyContext;
use lemmy_apub::fetcher::webfinger::{WebfingerLink, WebfingerResponse};
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{community::Community, person::Person}, source::{community::Community, person::Person},
traits::ApubActor, traits::ApubActor,
}; };
use lemmy_utils::{error::LemmyError, location_info}; use lemmy_utils::{error::LemmyError, location_info, WebfingerLink, WebfingerResponse};
use serde::Deserialize; use serde::Deserialize;
use url::Url; use url::Url;

View file

@ -16,7 +16,9 @@ mod test;
pub mod utils; pub mod utils;
pub mod version; pub mod version;
use serde::{Deserialize, Serialize};
use std::{fmt, time::Duration}; use std::{fmt, time::Duration};
use url::Url;
pub type ConnectionId = usize; pub type ConnectionId = usize;
@ -31,6 +33,20 @@ impl fmt::Display for IpAddr {
} }
} }
#[derive(Serialize, Deserialize, Debug)]
pub struct WebfingerLink {
pub rel: Option<String>,
#[serde(rename = "type")]
pub kind: Option<String>,
pub href: Option<Url>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct WebfingerResponse {
pub subject: String,
pub links: Vec<WebfingerLink>,
}
#[macro_export] #[macro_export]
macro_rules! location_info { macro_rules! location_info {
() => { () => {