Browse Source

Include available features in header of backend requests to Nextcloud.

The header "X-Spreed-Signaling-Features" will contain a comma-separated list
of feature flags.
pull/157/head
Joachim Bauch 3 months ago
parent
commit
a05acc9cb4
No known key found for this signature in database GPG Key ID: 77C1D22D53E15F02
  1. 4
      backend_client.go
  2. 1
      hub.go

4
backend_client.go

@ -56,6 +56,7 @@ const (
)
type BackendClient struct {
hub *Hub
transport *http.Transport
version string
backends *BackendConfiguration
@ -342,6 +343,9 @@ func (b *BackendClient) PerformJSONRequest(ctx context.Context, u *url.URL, requ
req.Header.Set("Accept", "application/json")
req.Header.Set("OCS-APIRequest", "true")
req.Header.Set("User-Agent", "nextcloud-spreed-signaling/"+b.version)
if b.hub != nil {
req.Header.Set("X-Spreed-Signaling-Features", strings.Join(b.hub.info.Features, ", "))
}
// Add checksum so the backend can validate the request.
AddBackendChecksum(req, data, secret)

1
hub.go

@ -333,6 +333,7 @@ func NewHub(config *goconf.ConfigFile, nats NatsClient, r *mux.Router, version s
geoip: geoip,
geoipOverrides: geoipOverrides,
}
backend.hub = hub
hub.upgrader.CheckOrigin = hub.checkOrigin
r.HandleFunc("/spreed", func(w http.ResponseWriter, r *http.Request) {
hub.serveWs(w, r)

Loading…
Cancel
Save