mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 06:53:09 -06:00
Add configuration option for sliding sync when hosting /.well-known/matrix/client
This commit is contained in:
parent
a721294e2b
commit
be51801788
|
|
@ -96,22 +96,50 @@ func Setup(
|
|||
|
||||
if cfg.Matrix.WellKnownClientName != "" {
|
||||
logrus.Infof("Setting m.homeserver base_url as %s at /.well-known/matrix/client", cfg.Matrix.WellKnownClientName)
|
||||
wkMux.Handle("/client", httputil.MakeExternalAPI("wellknown", func(r *http.Request) util.JSONResponse {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusOK,
|
||||
JSON: struct {
|
||||
HomeserverName struct {
|
||||
BaseUrl string `json:"base_url"`
|
||||
} `json:"m.homeserver"`
|
||||
}{
|
||||
HomeserverName: struct {
|
||||
BaseUrl string `json:"base_url"`
|
||||
if cfg.Matrix.WellKnownSlidingSyncProxy != "" {
|
||||
logrus.Infof("Setting org.matrix.msc3575.proxy url as %s at /.well-known/matrix/client", cfg.Matrix.WellKnownSlidingSyncProxy)
|
||||
wkMux.Handle("/client", httputil.MakeExternalAPI("wellknown", func(r *http.Request) util.JSONResponse {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusOK,
|
||||
JSON: struct {
|
||||
HomeserverName struct {
|
||||
BaseUrl string `json:"base_url"`
|
||||
} `json:"m.homeserver"`
|
||||
SlidingSyncProxy struct {
|
||||
Url string `json:"url"`
|
||||
} `json:"org.matrix.msc3575.proxy"`
|
||||
}{
|
||||
BaseUrl: cfg.Matrix.WellKnownClientName,
|
||||
HomeserverName: struct {
|
||||
BaseUrl string `json:"base_url"`
|
||||
}{
|
||||
BaseUrl: cfg.Matrix.WellKnownClientName,
|
||||
},
|
||||
SlidingSyncProxy: struct {
|
||||
Url string `json:"url"`
|
||||
}{
|
||||
Url: cfg.Matrix.WellKnownSlidingSyncProxy,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
})).Methods(http.MethodGet, http.MethodOptions)
|
||||
}
|
||||
})).Methods(http.MethodGet, http.MethodOptions)
|
||||
} else {
|
||||
wkMux.Handle("/client", httputil.MakeExternalAPI("wellknown", func(r *http.Request) util.JSONResponse {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusOK,
|
||||
JSON: struct {
|
||||
HomeserverName struct {
|
||||
BaseUrl string `json:"base_url"`
|
||||
} `json:"m.homeserver"`
|
||||
}{
|
||||
HomeserverName: struct {
|
||||
BaseUrl string `json:"base_url"`
|
||||
}{
|
||||
BaseUrl: cfg.Matrix.WellKnownClientName,
|
||||
},
|
||||
},
|
||||
}
|
||||
})).Methods(http.MethodGet, http.MethodOptions)
|
||||
}
|
||||
}
|
||||
|
||||
publicAPIMux.Handle("/versions",
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ type Global struct {
|
|||
// The server name to delegate client-server communications to, with optional port
|
||||
WellKnownClientName string `yaml:"well_known_client_name"`
|
||||
|
||||
// The server name to delegate sliding sync communications to, with optional port.
|
||||
// Requires `well_known_client_name` to also be configured.
|
||||
WellKnownSlidingSyncProxy string `yaml:"well_known_sliding_sync_proxy"`
|
||||
|
||||
// Disables federation. Dendrite will not be able to make any outbound HTTP requests
|
||||
// to other servers and the federation API will not be exposed.
|
||||
DisableFederation bool `yaml:"disable_federation"`
|
||||
|
|
|
|||
Loading…
Reference in a new issue