mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-19 00:10:15 +00:00
Add Webfinger endpoint (#19462)
This adds the [Webfinger](https://webfinger.net/) endpoint for federation. Supported schemes are `acct` and `mailto`. The profile and avatar url are returned as metadata.
This commit is contained in:
parent
a61a47f9a0
commit
3da9dafc60
3 changed files with 189 additions and 2 deletions
|
@ -282,6 +282,13 @@ func RegisterRoutes(m *web.Route) {
|
|||
}
|
||||
}
|
||||
|
||||
federationEnabled := func(ctx *context.Context) {
|
||||
if !setting.Federation.Enabled {
|
||||
ctx.Error(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: not all routes need go through same middleware.
|
||||
// Especially some AJAX requests, we can reduce middleware number to improve performance.
|
||||
// Routers.
|
||||
|
@ -289,9 +296,10 @@ func RegisterRoutes(m *web.Route) {
|
|||
m.Get("/", Home)
|
||||
m.Group("/.well-known", func() {
|
||||
m.Get("/openid-configuration", auth.OIDCWellKnown)
|
||||
if setting.Federation.Enabled {
|
||||
m.Group("", func() {
|
||||
m.Get("/nodeinfo", NodeInfoLinks)
|
||||
}
|
||||
m.Get("/webfinger", WebfingerQuery)
|
||||
}, federationEnabled)
|
||||
m.Get("/change-password", func(w http.ResponseWriter, req *http.Request) {
|
||||
http.Redirect(w, req, "/user/settings/account", http.StatusTemporaryRedirect)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue