Skip to content

Commit

Permalink
fix: origin for websockets
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTipo01 committed Oct 25, 2023
1 parent cfa2e87 commit 100e20b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func NewApi(servers map[string]*manager.Server, address, owner string, clients *

conf := cors.DefaultConfig()
conf.AllowMethods = []string{"GET", "POST", "DELETE"}
// TODO: Set this to false
// TODO: Set this to false, and add the frontend url
conf.AllowAllOrigins = true

r.Use(gin.Recovery(), cors.New(conf))
Expand Down
4 changes: 4 additions & 0 deletions api/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
var wsupgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
CheckOrigin: func(r *http.Request) bool {
// TODO: Set this to false, and add the frontend url
return true
},
}

func (a *Api) getQueue(c *gin.Context) {
Expand Down
1 change: 0 additions & 1 deletion manager/sound.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func (server *Server) playSound(el *queue.Element) (SkipReason, error) {
lit.Debug("VC is nil, triggering reconnection")
server.VC, _ = server.Clients.Discord.ChannelVoiceJoin(server.GuildID, server.VoiceChannel, false, true)
}

}
}
}
Expand Down

0 comments on commit 100e20b

Please sign in to comment.