diff --git a/streamer/api.go b/streamer/api.go index 94e5e65b..2bc57543 100644 --- a/streamer/api.go +++ b/streamer/api.go @@ -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 @@ -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")) }