improve fault tolerance and OS compat beyond linux

This commit is contained in:
ari melody 2026-07-24 09:54:54 +01:00
parent 8e4f353be1
commit 75bd36a332
Signed by: ari
GPG key ID: CF99829C92678188
3 changed files with 30 additions and 20 deletions

View file

@ -7,6 +7,7 @@ import (
"io"
"log"
"net/http"
"runtime"
"strings"
"time"
@ -50,7 +51,11 @@ type (
}
)
func New(ctx context.Context) *Service {
func New(ctx context.Context) (*Service, error) {
if runtime.GOOS != "linux" {
return nil, fmt.Errorf("Platform %s is unsupported", runtime.GOOS)
}
nextTrack := make(chan *trackMetadata)
nextPlaying := make(chan bool)
@ -63,7 +68,7 @@ func New(ctx context.Context) *Service {
playingBroadcast: broadcast.NewBroadcastChannel(ctx, nextPlaying),
}
return srv
return srv, nil
}
func (srv *Service) BindRoutes(group *gin.RouterGroup) {