parent
eee8f467b5
commit
b9f1fc0518
2 changed files with 6 additions and 4 deletions
|
@ -32,9 +32,11 @@ pub async fn search_by_apub_id(
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
let (kind, identifier) = query.split_at(1);
|
let mut chars = query.chars();
|
||||||
|
let kind = chars.next();
|
||||||
|
let identifier = chars.as_str();
|
||||||
match kind {
|
match kind {
|
||||||
"@" => {
|
Some('@') => {
|
||||||
let id =
|
let id =
|
||||||
webfinger_resolve_actor::<ApubPerson>(identifier, context, request_counter).await?;
|
webfinger_resolve_actor::<ApubPerson>(identifier, context, request_counter).await?;
|
||||||
Ok(SearchableObjects::Person(
|
Ok(SearchableObjects::Person(
|
||||||
|
@ -43,7 +45,7 @@ pub async fn search_by_apub_id(
|
||||||
.await?,
|
.await?,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
"!" => {
|
Some('!') => {
|
||||||
let id =
|
let id =
|
||||||
webfinger_resolve_actor::<ApubCommunity>(identifier, context, request_counter).await?;
|
webfinger_resolve_actor::<ApubCommunity>(identifier, context, request_counter).await?;
|
||||||
Ok(SearchableObjects::Community(
|
Ok(SearchableObjects::Community(
|
||||||
|
|
|
@ -39,7 +39,7 @@ where
|
||||||
let (_, domain) = identifier
|
let (_, domain) = identifier
|
||||||
.splitn(2, '@')
|
.splitn(2, '@')
|
||||||
.collect_tuple()
|
.collect_tuple()
|
||||||
.expect("invalid query");
|
.ok_or_else(|| LemmyError::from_message("Invalid webfinger query, missing domain"))?;
|
||||||
let fetch_url = format!(
|
let fetch_url = format!(
|
||||||
"{}://{}/.well-known/webfinger?resource=acct:{}",
|
"{}://{}/.well-known/webfinger?resource=acct:{}",
|
||||||
protocol, domain, identifier
|
protocol, domain, identifier
|
||||||
|
|
Loading…
Reference in a new issue