Fix some federation issue (#573)

* send scheme as part of webfinger remote follow template

fix tsileo/microblog.pub#49

* bump webfinger to 0.4.1

* cargo fmt

* revert translations

* Use group: prefix for blog webfinger queries
This commit is contained in:
fdb-hiroshima
2019-07-31 11:38:49 +02:00
committed by Ana Gelez
parent 54c6d21fc5
commit 4f7c20fc26
6 changed files with 19 additions and 20 deletions
+11 -11
View File
@@ -48,14 +48,16 @@ impl Resolver<PlumeRocket> for WebfingerResolver {
CONFIG.base_url.as_str()
}
fn find(acct: String, ctx: PlumeRocket) -> Result<Webfinger, ResolverError> {
User::find_by_fqn(&ctx, &acct)
.and_then(|usr| usr.webfinger(&*ctx.conn))
.or_else(|_| {
Blog::find_by_fqn(&ctx, &acct)
.and_then(|blog| blog.webfinger(&*ctx.conn))
.or(Err(ResolverError::NotFound))
})
fn find(prefix: Prefix, acct: String, ctx: PlumeRocket) -> Result<Webfinger, ResolverError> {
match prefix {
Prefix::Acct => User::find_by_fqn(&ctx, &acct)
.and_then(|usr| usr.webfinger(&*ctx.conn))
.or(Err(ResolverError::NotFound)),
Prefix::Group => Blog::find_by_fqn(&ctx, &acct)
.and_then(|blog| blog.webfinger(&*ctx.conn))
.or(Err(ResolverError::NotFound)),
Prefix::Custom(_) => Err(ResolverError::NotFound),
}
}
}
@@ -72,9 +74,7 @@ pub fn webfinger(resource: String, rockets: PlumeRocket) -> Content<String> {
"Invalid resource. Make sure to request an acct: URI"
}
ResolverError::NotFound => "Requested resource was not found",
ResolverError::WrongInstance => {
"This is not the instance of the requested resource"
}
ResolverError::WrongDomain => "This is not the instance of the requested resource",
}),
),
}