summaryrefslogtreecommitdiffstats
path: root/server/src/routes/webfinger.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/routes/webfinger.rs')
-rw-r--r--server/src/routes/webfinger.rs24
1 files changed, 3 insertions, 21 deletions
diff --git a/server/src/routes/webfinger.rs b/server/src/routes/webfinger.rs
index af021dd5..e616de0e 100644
--- a/server/src/routes/webfinger.rs
+++ b/server/src/routes/webfinger.rs
@@ -1,12 +1,7 @@
-use crate::{
- blocking,
- db::{community::Community, user::User_},
- routes::DbPoolParam,
- LemmyError,
- Settings,
-};
+use crate::{blocking, routes::DbPoolParam, LemmyError};
use actix_web::{error::ErrorBadRequest, web::Query, *};
-use regex::Regex;
+use lemmy_db::{community::Community, user::User_};
+use lemmy_utils::{settings::Settings, WEBFINGER_COMMUNITY_REGEX, WEBFINGER_USER_REGEX};
use serde::{Deserialize, Serialize};
#[derive(Deserialize)]
@@ -40,19 +35,6 @@ pub fn config(cfg: &mut web::ServiceConfig) {
}
}
-lazy_static! {
- static ref WEBFINGER_COMMUNITY_REGEX: Regex = Regex::new(&format!(
- "^group:([a-z0-9_]{{3, 20}})@{}$",
- Settings::get().hostname
- ))
- .unwrap();
- static ref WEBFINGER_USER_REGEX: Regex = Regex::new(&format!(
- "^acct:([a-z0-9_]{{3, 20}})@{}$",
- Settings::get().hostname
- ))
- .unwrap();
-}
-
/// Responds to webfinger requests of the following format. There isn't any real documentation for
/// this, but it described in this blog post:
/// https://mastodon.social/.well-known/webfinger?resource=acct:gargron@mastodon.social