mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 04:27:37 +03:00
Initial work on Shares
This commit is contained in:
parent
5331de17c2
commit
ab04e33da6
36 changed files with 841 additions and 84 deletions
|
@ -84,6 +84,9 @@ 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())
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ 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"
|
||||
)
|
||||
|
@ -72,7 +73,17 @@ func CreatePublicRouter() *public.Router {
|
|||
agentsAgents := agents.New(dataStore)
|
||||
externalMetadata := core.NewExternalMetadata(dataStore, agentsAgents)
|
||||
artworkArtwork := artwork.NewArtwork(dataStore, fileCache, fFmpeg, externalMetadata)
|
||||
router := public.New(artworkArtwork)
|
||||
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)
|
||||
return router
|
||||
}
|
||||
|
||||
|
@ -107,7 +118,7 @@ func createScanner() scanner.Scanner {
|
|||
|
||||
// wire_injectors.go:
|
||||
|
||||
var allProviders = wire.NewSet(core.Set, artwork.Set, subsonic.New, nativeapi.New, public.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, shares.New, persistence.New, lastfm.NewRouter, listenbrainz.NewRouter, events.GetBroker, db.Db)
|
||||
|
||||
// Scanner must be a Singleton
|
||||
var (
|
||||
|
|
|
@ -17,6 +17,7 @@ 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"
|
||||
)
|
||||
|
||||
|
@ -26,6 +27,7 @@ var allProviders = wire.NewSet(
|
|||
subsonic.New,
|
||||
nativeapi.New,
|
||||
public.New,
|
||||
shares.New,
|
||||
persistence.New,
|
||||
lastfm.NewRouter,
|
||||
listenbrainz.NewRouter,
|
||||
|
@ -59,6 +61,12 @@ func CreatePublicRouter() *public.Router {
|
|||
))
|
||||
}
|
||||
|
||||
func CreateSharesRouter() *shares.Router {
|
||||
panic(wire.Build(
|
||||
allProviders,
|
||||
))
|
||||
}
|
||||
|
||||
func CreateLastFMRouter() *lastfm.Router {
|
||||
panic(wire.Build(
|
||||
allProviders,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue