summaryrefslogtreecommitdiff
path: root/internal/api/client/streaming/stream.go
diff options
context:
space:
mode:
authorLibravatar Matthew Phillips <matthew@matthewphillips.info>2022-12-14 04:56:42 -0500
committerLibravatar GitHub <noreply@github.com>2022-12-14 10:56:42 +0100
commitd10388cc285f09d4d80528a6e1195e0e1997a822 (patch)
tree657db1a2d5c40be487073de7348f7cc46cac58ed /internal/api/client/streaming/stream.go
parent[feature] domain block wildcarding (#1178) (diff)
downloadgotosocial-d10388cc285f09d4d80528a6e1195e0e1997a822.tar.xz
[feature] support Sec-Websocket-Protocol in streaming API (#1254)
* [feature] support Sec-Websocket-Protocol in streaming API * Fix lint problem * Update based on reviews
Diffstat (limited to 'internal/api/client/streaming/stream.go')
-rw-r--r--internal/api/client/streaming/stream.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/api/client/streaming/stream.go b/internal/api/client/streaming/stream.go
index a406de74b..a9cb62732 100644
--- a/internal/api/client/streaming/stream.go
+++ b/internal/api/client/streaming/stream.go
@@ -131,7 +131,10 @@ func (m *Module) StreamGETHandler(c *gin.Context) {
accessToken := c.Query(AccessTokenQueryKey)
if accessToken == "" {
- err := fmt.Errorf("no access token provided under query key %s", AccessTokenQueryKey)
+ accessToken = c.GetHeader(AccessTokenHeader)
+ }
+ if accessToken == "" {
+ err := fmt.Errorf("no access token provided under query key %s or under header %s", AccessTokenQueryKey, AccessTokenHeader)
api.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGet)
return
}
@@ -171,7 +174,7 @@ func (m *Module) StreamGETHandler(c *gin.Context) {
close(stream.Hangup)
}()
- streamTicker := time.NewTicker(30 * time.Second)
+ streamTicker := time.NewTicker(m.tickDuration)
// We want to stay in the loop as long as possible while the client is connected.
// The only thing that should break the loop is if the client leaves or the connection becomes unhealthy.