2022-11-21 14:14:45 +00:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2023-04-21 06:49:17 +00:00
|
|
|
. "github.com/reiver/greatape/components/api/protobuf"
|
|
|
|
. "github.com/reiver/greatape/components/contracts"
|
2022-11-21 14:14:45 +00:00
|
|
|
. "github.com/xeronith/diamante/contracts/network/http"
|
|
|
|
pipeline "github.com/xeronith/diamante/network/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
type webfingerHandler struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func WebfingerHandler() IHttpHandler {
|
|
|
|
return &webfingerHandler{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (handler *webfingerHandler) Method() string {
|
|
|
|
return http.MethodGet
|
|
|
|
}
|
|
|
|
|
|
|
|
func (handler *webfingerHandler) Path() string {
|
|
|
|
return "/.well-known/webfinger"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (handler *webfingerHandler) HandlerFunc() HttpHandlerFunc {
|
|
|
|
return func(x IServerDispatcher) error {
|
|
|
|
request := &WebfingerRequest{}
|
|
|
|
result := &WebfingerResult{}
|
|
|
|
|
|
|
|
onRequestUnmarshalled := func(request *WebfingerRequest) {
|
|
|
|
request.Resource = x.Query("resource")
|
|
|
|
}
|
|
|
|
|
|
|
|
return pipeline.Handle(x,
|
|
|
|
WEBFINGER_REQUEST,
|
|
|
|
WEBFINGER_RESULT,
|
|
|
|
request, result,
|
|
|
|
onRequestUnmarshalled,
|
2023-05-02 17:43:35 +00:00
|
|
|
nil,
|
2022-11-21 14:14:45 +00:00
|
|
|
false,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|