feat: extend webfinger to respond to profile page URIs
This commit is contained in:
parent
a179695f33
commit
fc31f14507
2 changed files with 25 additions and 0 deletions
|
@ -64,6 +64,19 @@ func WebfingerQuery(ctx *context.Context) {
|
|||
if u != nil && u.KeepEmailPrivate {
|
||||
err = user_model.ErrUserNotExist{}
|
||||
}
|
||||
case "https", "http":
|
||||
if resource.Host != appURL.Host {
|
||||
ctx.Error(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
parts := strings.Split(resource.Path, "/")
|
||||
if len(parts) < 2 { // fragment[0] is empty space, fragment[1] may be username
|
||||
ctx.Error(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
u, err = user_model.GetUserByName(ctx, parts[1])
|
||||
default:
|
||||
ctx.Error(http.StatusBadRequest)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue