Skip to content

Commit

Permalink
streamer: fix #63
Browse files Browse the repository at this point in the history
  • Loading branch information
Wessie committed May 13, 2024
1 parent 2db809d commit 6b05617
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions streamer/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func (s *streamerService) Queue(ctx context.Context) ([]radio.QueueEntry, error)
return queue, nil
}

func (s *streamerService) areWeStreaming() bool {
return s.streamer.userValue.Latest().ID == s.streamer.StreamUser.ID
}

// RequestSong implements radio.StreamerService
//
// We do not do authentication or authorization checks, this is left to the client. Request can be
Expand All @@ -90,6 +94,11 @@ func (s *streamerService) RequestSong(ctx context.Context, song radio.Song, iden
return errors.E(op, errors.StreamerNoRequests)
}

// only accept requests if we are streaming
if !s.areWeStreaming() {
return errors.E(op, errors.StreamerNoRequests)
}

if identifier == "" {
return errors.E(op, errors.InvalidArgument, errors.Info("identifier"))
}
Expand Down

0 comments on commit 6b05617

Please sign in to comment.