Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/pterodactyl/wings into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
DaneEveritt committed Sep 11, 2020
2 parents c415abf + e10844d commit 8f6494b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion router/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func SetAccessControlHeaders(c *gin.Context) {
o := c.GetHeader("Origin")
if o != config.Get().PanelLocation {
for _, origin := range config.Get().AllowedOrigins {
if o != origin {
if origin != "*" && o != origin {
continue
}

Expand Down
22 changes: 11 additions & 11 deletions router/websocket/listeners.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ func (h *Handler) ListenForExpiration(ctx context.Context) {
}
}

var e = []string{
server.StatsEvent,
server.StatusEvent,
server.ConsoleOutputEvent,
server.InstallOutputEvent,
server.InstallStartedEvent,
server.InstallCompletedEvent,
server.DaemonMessageEvent,
server.BackupCompletedEvent,
}

// Listens for different events happening on a server and sends them along
// to the connected websocket.
func (h *Handler) ListenForServerEvents(ctx context.Context) {
e := []string{
server.StatsEvent,
server.StatusEvent,
server.ConsoleOutputEvent,
server.InstallOutputEvent,
server.InstallStartedEvent,
server.InstallCompletedEvent,
server.DaemonMessageEvent,
server.BackupCompletedEvent,
}

eventChannel := make(chan events.Event)
for _, event := range e {
h.server.Events().Subscribe(event, eventChannel)
Expand Down
4 changes: 4 additions & 0 deletions router/websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ func GetHandler(s *server.Server, w http.ResponseWriter, r *http.Request) (*Hand
}

for _, origin := range config.Get().AllowedOrigins {
if origin == "*" {
return true
}

if o != origin {
continue
}
Expand Down

0 comments on commit 8f6494b

Please sign in to comment.