Merge branch 'develop' of https://github.com/pterodactyl/wings into develop

This commit is contained in:
Dane Everitt 2020-09-10 20:17:16 -07:00
commit 8f6494b092
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
3 changed files with 16 additions and 12 deletions

View File

@ -16,7 +16,7 @@ func SetAccessControlHeaders(c *gin.Context) {
o := c.GetHeader("Origin") o := c.GetHeader("Origin")
if o != config.Get().PanelLocation { if o != config.Get().PanelLocation {
for _, origin := range config.Get().AllowedOrigins { for _, origin := range config.Get().AllowedOrigins {
if o != origin { if origin != "*" && o != origin {
continue continue
} }

View File

@ -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 // Listens for different events happening on a server and sends them along
// to the connected websocket. // to the connected websocket.
func (h *Handler) ListenForServerEvents(ctx context.Context) { 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) eventChannel := make(chan events.Event)
for _, event := range e { for _, event := range e {
h.server.Events().Subscribe(event, eventChannel) h.server.Events().Subscribe(event, eventChannel)

View File

@ -64,6 +64,10 @@ func GetHandler(s *server.Server, w http.ResponseWriter, r *http.Request) (*Hand
} }
for _, origin := range config.Get().AllowedOrigins { for _, origin := range config.Get().AllowedOrigins {
if origin == "*" {
return true
}
if o != origin { if o != origin {
continue continue
} }