Route server key API endpoints on internal API mux

This commit is contained in:
Neil Alexander 2020-05-26 15:53:25 +01:00
parent a435154fc1
commit 0a3d2fdf0d
2 changed files with 5 additions and 8 deletions

View file

@ -4,14 +4,15 @@ import (
"encoding/json" "encoding/json"
"net/http" "net/http"
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/internal" "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/serverkeyapi/api" "github.com/matrix-org/dendrite/serverkeyapi/api"
"github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util" "github.com/matrix-org/util"
) )
func (s *ServerKeyAPI) SetupHTTP(servMux *http.ServeMux) { func (s *ServerKeyAPI) SetupHTTP(internalAPIMux *mux.Router) {
servMux.Handle(api.ServerKeyQueryPublicKeyPath, internalAPIMux.Handle(api.ServerKeyQueryPublicKeyPath,
internal.MakeInternalAPI("queryPublicKeys", func(req *http.Request) util.JSONResponse { internal.MakeInternalAPI("queryPublicKeys", func(req *http.Request) util.JSONResponse {
result := map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult{} result := map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult{}
request := api.QueryPublicKeysRequest{} request := api.QueryPublicKeysRequest{}
@ -38,7 +39,7 @@ func (s *ServerKeyAPI) SetupHTTP(servMux *http.ServeMux) {
return util.JSONResponse{Code: http.StatusOK, JSON: &response} return util.JSONResponse{Code: http.StatusOK, JSON: &response}
}), }),
) )
servMux.Handle(api.ServerKeyInputPublicKeyPath, internalAPIMux.Handle(api.ServerKeyInputPublicKeyPath,
internal.MakeInternalAPI("inputPublicKeys", func(req *http.Request) util.JSONResponse { internal.MakeInternalAPI("inputPublicKeys", func(req *http.Request) util.JSONResponse {
request := api.InputPublicKeysRequest{} request := api.InputPublicKeysRequest{}
response := api.InputPublicKeysResponse{} response := api.InputPublicKeysResponse{}

View file

@ -79,11 +79,7 @@ func SetupServerKeyAPIComponent(
}).Info("Enabled perspective key fetcher") }).Info("Enabled perspective key fetcher")
} }
/* internalAPI.SetupHTTP(base.InternalAPIMux)
if base.EnableHTTPAPIs {
internalAPI.SetupHTTP(http.DefaultServeMux)
}
*/
return &internalAPI return &internalAPI
} }