add sonos handler to play file

This commit is contained in:
kaedwen committed 2023-07-16 09:50:19 +02:00
1 parent b7e7db4127
commit 783aa5fd79
44 files changed
+12187 -14

No files matched your search

+9 -3
View File
@@ -38,9 +38,15 @@ func (s staticDiskSource) Open(p string) (common.StaticSourceFile, error) {
return &staticSourceFile{t}, nil
}
func SetupHandler(e *gin.Engine, cfg *common.ConfigHTTP) {
if cfg.StaticPath != nil {
handler := common.NewStaticHandler(staticDiskSource{*cfg.StaticPath}, "index.html")
func SetupHandler(e *gin.Engine, cfg *common.Config) {
if cfg.Ring.JinglePath != nil {
e.GET(cfg.Ring.JingleName, func(c *gin.Context) {
c.File(path.Join(*cfg.Ring.JinglePath, cfg.Ring.JingleName))
})
}
if cfg.Http.StaticPath != nil {
handler := common.NewStaticHandler(staticDiskSource{*cfg.Http.StaticPath}, "index.html")
e.NoRoute(func(c *gin.Context) {
encoding := c.Request.Header.Get("Accept-Encoding")
+7 -1
View File
@@ -41,7 +41,13 @@ func (s staticSource) Open(p string) (common.StaticSourceFile, error) {
return &staticSourceFile{t}, nil
}
func SetupHandler(e *gin.Engine, _ *common.ConfigHTTP) {
func SetupHandler(e *gin.Engine, cfg *common.Config) {
if cfg.Ring.JinglePath != nil {
e.GET(cfg.Ring.JingleName, func(c *gin.Context) {
c.File(path.Join(*cfg.Ring.JinglePath, cfg.Ring.JingleName))
})
}
handler := common.NewStaticHandler(staticSource{"dist"}, "index.html")
e.NoRoute(func(c *gin.Context) {
encoding := c.Request.Header.Get("Accept-Encoding")