More work on Shares

This commit is contained in:
Deluan 2023-01-20 19:53:53 -05:00
parent ab04e33da6
commit 84aa094e56
19 changed files with 150 additions and 167 deletions

View file

@ -84,9 +84,6 @@ func startServer(ctx context.Context) func() error {
a.MountRouter("Native API", consts.URLPathNativeAPI, CreateNativeAPIRouter())
a.MountRouter("Subsonic API", consts.URLPathSubsonicAPI, CreateSubsonicAPIRouter())
a.MountRouter("Public Endpoints", consts.URLPathPublic, CreatePublicRouter())
if conf.Server.DevEnableShare {
a.MountRouter("Share Endpoint", consts.URLPathShares, CreateSharesRouter())
}
if conf.Server.LastFM.Enabled {
a.MountRouter("LastFM Auth", consts.URLPathNativeAPI+"/lastfm", CreateLastFMRouter())
}

View file

@ -22,7 +22,6 @@ import (
"github.com/navidrome/navidrome/server/events"
"github.com/navidrome/navidrome/server/nativeapi"
"github.com/navidrome/navidrome/server/public"
"github.com/navidrome/navidrome/server/shares"
"github.com/navidrome/navidrome/server/subsonic"
"sync"
)
@ -75,15 +74,8 @@ func CreatePublicRouter() *public.Router {
artworkArtwork := artwork.NewArtwork(dataStore, fileCache, fFmpeg, externalMetadata)
transcodingCache := core.GetTranscodingCache()
mediaStreamer := core.NewMediaStreamer(dataStore, fFmpeg, transcodingCache)
router := public.New(artworkArtwork, mediaStreamer)
return router
}
func CreateSharesRouter() *shares.Router {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
share := core.NewShare(dataStore)
router := shares.New(dataStore, share)
router := public.New(dataStore, artworkArtwork, mediaStreamer, share)
return router
}
@ -118,7 +110,7 @@ func createScanner() scanner.Scanner {
// wire_injectors.go:
var allProviders = wire.NewSet(core.Set, artwork.Set, subsonic.New, nativeapi.New, public.New, shares.New, persistence.New, lastfm.NewRouter, listenbrainz.NewRouter, events.GetBroker, db.Db)
var allProviders = wire.NewSet(core.Set, artwork.Set, subsonic.New, nativeapi.New, public.New, persistence.New, lastfm.NewRouter, listenbrainz.NewRouter, events.GetBroker, db.Db)
// Scanner must be a Singleton
var (

View file

@ -17,7 +17,6 @@ import (
"github.com/navidrome/navidrome/server/events"
"github.com/navidrome/navidrome/server/nativeapi"
"github.com/navidrome/navidrome/server/public"
"github.com/navidrome/navidrome/server/shares"
"github.com/navidrome/navidrome/server/subsonic"
)
@ -27,7 +26,6 @@ var allProviders = wire.NewSet(
subsonic.New,
nativeapi.New,
public.New,
shares.New,
persistence.New,
lastfm.NewRouter,
listenbrainz.NewRouter,
@ -61,12 +59,6 @@ func CreatePublicRouter() *public.Router {
))
}
func CreateSharesRouter() *shares.Router {
panic(wire.Build(
allProviders,
))
}
func CreateLastFMRouter() *lastfm.Router {
panic(wire.Build(
allProviders,