Remove usages of get_config
This commit is contained in:
parent
3411d50205
commit
08cba60b25
2 changed files with 5 additions and 11 deletions
|
|
@ -9,7 +9,6 @@ use axum::response::IntoResponse;
|
|||
use axum::routing::{get, post};
|
||||
use serde::Serialize;
|
||||
use slop_common::auth::session_extractor::get_session_from_cookie;
|
||||
use slop_common::db::get_config;
|
||||
use slop_common::SlopState;
|
||||
use crate::routes::nodeinfo::nodeinfo;
|
||||
use crate::routes::oauth::oauth_routes;
|
||||
|
|
@ -70,12 +69,10 @@ struct WellKnownLink {
|
|||
pub async fn advertise_nodeinfo(
|
||||
Extension(state): Extension<SlopState>,
|
||||
) -> impl IntoResponse {
|
||||
let config = get_config(&state.db).await;
|
||||
|
||||
Json(NodeinfoAdvertisement {
|
||||
links: vec![WellKnownLink {
|
||||
rel: String::from("http://nodeinfo.diaspora.software/ns/schema/2.1"),
|
||||
href: format!("https://{}/.well-known/nodeinfo/2.1.json", config.domain),
|
||||
href: format!("https://{}/.well-known/nodeinfo/2.1.json", state.instance_options.domain),
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
|
@ -11,7 +11,6 @@ use serde::Deserialize;
|
|||
use slop_common::db::entities::prelude::User;
|
||||
use slop_common::db::entities::user;
|
||||
|
||||
use slop_common::db::get_config;
|
||||
use slop_common::SlopState;
|
||||
use slop_common::webfinger::{Link, Webfinger};
|
||||
|
||||
|
|
@ -24,8 +23,6 @@ pub async fn webfinger(
|
|||
Extension(state): Extension<SlopState>,
|
||||
Query(query): Query<WebfingerQuery>,
|
||||
) -> impl IntoResponse {
|
||||
let config = get_config(&state.db).await;
|
||||
|
||||
// Validate the uri
|
||||
let uri = Uri::parse(query.resource.clone());
|
||||
if uri.is_err() {
|
||||
|
|
@ -65,22 +62,22 @@ pub async fn webfinger(
|
|||
let response_body = Webfinger {
|
||||
subject: query.resource,
|
||||
aliases: Some(vec![
|
||||
format!("https://{}/@{}", config.domain, user.username),
|
||||
format!("https://{}/users/{}", config.domain, user.id)
|
||||
format!("https://{}/@{}", state.instance_options.domain, user.username),
|
||||
format!("https://{}/users/{}", state.instance_options.domain, user.id)
|
||||
]),
|
||||
properties: None,
|
||||
links: vec![
|
||||
Link {
|
||||
rel: String::from("self"),
|
||||
mime: Some(String::from("application/activity+json")),
|
||||
href: Some(format!("https://{}/ap/users/{}", config.domain, user.id)),
|
||||
href: Some(format!("https://{}/ap/users/{}", state.instance_options.domain, user.id)),
|
||||
titles: None,
|
||||
properties: None,
|
||||
},
|
||||
Link {
|
||||
rel: String::from("http://webfinger.net/rel/profile-page"),
|
||||
mime: Some(String::from("text/html")),
|
||||
href: Some(format!("https://{}/@{}", config.domain, user.username)),
|
||||
href: Some(format!("https://{}/@{}", state.instance_options.domain, user.username)),
|
||||
titles: None,
|
||||
properties: None,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue