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