mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-20 13:23:22 -06:00
Route server key API endpoints on internal API mux
This commit is contained in:
parent
a435154fc1
commit
0a3d2fdf0d
|
|
@ -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{}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue