mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 04:52:46 +00:00
Separate muxes for public and internal APIs (#1056)
* Separate muxes for public and internal APIs * Update client-api-proxy and federation-api-proxy so they don't add /api to the path * Tidy up * Consistent HTTP setup * Set up prefixes properly
This commit is contained in:
parent
f223da2f35
commit
fe82e1f725
29 changed files with 131 additions and 119 deletions
|
@ -44,7 +44,7 @@ func SetupFederationAPIComponent(
|
|||
roomserverProducer := producers.NewRoomserverProducer(rsAPI)
|
||||
|
||||
routing.Setup(
|
||||
base.APIMux, base.Cfg, rsAPI, asAPI, roomserverProducer,
|
||||
base.PublicAPIMux, base.Cfg, rsAPI, asAPI, roomserverProducer,
|
||||
eduProducer, federationSenderAPI, *keyRing,
|
||||
federation, accountsDB, deviceDB,
|
||||
)
|
||||
|
|
|
@ -31,9 +31,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
pathPrefixV2Keys = "/_matrix/key/v2"
|
||||
pathPrefixV1Federation = "/_matrix/federation/v1"
|
||||
pathPrefixV2Federation = "/_matrix/federation/v2"
|
||||
pathPrefixV2Keys = "/key/v2"
|
||||
pathPrefixV1Federation = "/federation/v1"
|
||||
pathPrefixV2Federation = "/federation/v2"
|
||||
)
|
||||
|
||||
// Setup registers HTTP handlers with the given ServeMux.
|
||||
|
@ -42,7 +42,7 @@ const (
|
|||
// applied:
|
||||
// nolint: gocyclo
|
||||
func Setup(
|
||||
apiMux *mux.Router,
|
||||
publicAPIMux *mux.Router,
|
||||
cfg *config.Dendrite,
|
||||
rsAPI roomserverAPI.RoomserverInternalAPI,
|
||||
asAPI appserviceAPI.AppServiceQueryAPI,
|
||||
|
@ -54,9 +54,9 @@ func Setup(
|
|||
accountDB accounts.Database,
|
||||
deviceDB devices.Database,
|
||||
) {
|
||||
v2keysmux := apiMux.PathPrefix(pathPrefixV2Keys).Subrouter()
|
||||
v1fedmux := apiMux.PathPrefix(pathPrefixV1Federation).Subrouter()
|
||||
v2fedmux := apiMux.PathPrefix(pathPrefixV2Federation).Subrouter()
|
||||
v2keysmux := publicAPIMux.PathPrefix(pathPrefixV2Keys).Subrouter()
|
||||
v1fedmux := publicAPIMux.PathPrefix(pathPrefixV1Federation).Subrouter()
|
||||
v2fedmux := publicAPIMux.PathPrefix(pathPrefixV2Federation).Subrouter()
|
||||
|
||||
localKeys := internal.MakeExternalAPI("localkeys", func(req *http.Request) util.JSONResponse {
|
||||
return LocalKeys(cfg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue