mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 05:42:46 +00:00
API setup refactoring (#1266)
* Start HTTP endpoint refactoring * Update SetupAndServeHTTP * Fix builds * Don't set up external listener if no address configured * TLS HTTP setup * Break apart client/federation/key/media muxes * Tweaks * Fix P2P demos * Fix media API routing * Review comments @Kegsay * Update sample config * Fix gobind build * Fix External -> Public in federation API test
This commit is contained in:
parent
820c56c165
commit
9677a95afc
49 changed files with 542 additions and 383 deletions
|
@ -28,20 +28,18 @@ import (
|
|||
"github.com/matrix-org/util"
|
||||
)
|
||||
|
||||
const pathPrefixR0 = "/client/r0"
|
||||
|
||||
// Setup configures the given mux with sync-server listeners
|
||||
//
|
||||
// Due to Setup being used to call many other functions, a gocyclo nolint is
|
||||
// applied:
|
||||
// nolint: gocyclo
|
||||
func Setup(
|
||||
publicAPIMux *mux.Router, srp *sync.RequestPool, syncDB storage.Database,
|
||||
csMux *mux.Router, srp *sync.RequestPool, syncDB storage.Database,
|
||||
userAPI userapi.UserInternalAPI, federation *gomatrixserverlib.FederationClient,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
cfg *config.SyncAPI,
|
||||
) {
|
||||
r0mux := publicAPIMux.PathPrefix(pathPrefixR0).Subrouter()
|
||||
r0mux := csMux.PathPrefix("/r0").Subrouter()
|
||||
|
||||
// TODO: Add AS support for all handlers below.
|
||||
r0mux.Handle("/sync", httputil.MakeAuthAPI("sync", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue