🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Added a MainController
Deluan1e842ccfdf9e
diff --git a/.gitignore b/.gitignoreindex e515ea7dd..7e39b205b 100644--- a/.gitignore+++ b/.gitignore@@ -2,4 +2,5 @@ tests/**/commentsRouter_*.golastupdate.tmpgosoniciTunes Music Library.xml-gosonic.index\ No newline at end of file+gosonic.index+static/Jamstash\ No newline at end of filediff --git a/controllers/main.go b/controllers/main.gonew file mode 100644index 000000000..e84272cde--- /dev/null+++ b/controllers/main.go@@ -0,0 +1,26 @@+package controllers++import (+ "github.com/astaxie/beego"+ "fmt"+)++type MainController struct{ beego.Controller }+++// @router / [get]+func (this *MainController) Get() {+ this.Ctx.Redirect(302, "/static/Jamstash/")+}+++func (this *MainController) Error404() {+ if beego.BConfig.RunMode == beego.DEV || beego.BConfig.Log.AccessLogs {+ r := this.Ctx.Request+ devInfo := fmt.Sprintf(" | %-10s | %-40s | %-16s | %-10s |", r.Method, r.URL.Path, " ", "notmatch")+ if beego.DefaultAccessLogFilter == nil || !beego.DefaultAccessLogFilter.Filter(this.Ctx) {+ beego.Warn(devInfo)+ }+ }+ this.CustomAbort(404, "Error 404")+}diff --git a/routers/commentsRouter_github_com_deluan_gosonic_controllers.go b/routers/commentsRouter_github_com_deluan_gosonic_controllers.goindex af8914ece..a286ad4b9 100644--- a/routers/commentsRouter_github_com_deluan_gosonic_controllers.go+++ b/routers/commentsRouter_github_com_deluan_gosonic_controllers.go@@ -20,6 +20,13 @@ func init() {[]string{"get"},nil})+ beego.GlobalControllerRouter["github.com/deluan/gosonic/controllers:MainController"] = append(beego.GlobalControllerRouter["github.com/deluan/gosonic/controllers:MainController"],+ beego.ControllerComments{+ "Get",+ `/`,+ []string{"get"},+ nil})+beego.GlobalControllerRouter["github.com/deluan/gosonic/controllers:ObjectController"] = append(beego.GlobalControllerRouter["github.com/deluan/gosonic/controllers:ObjectController"],beego.ControllerComments{"Post",diff --git a/routers/router.go b/routers/router.goindex ae36cb160..6cb63fcc2 100644--- a/routers/router.go+++ b/routers/router.go@@ -9,6 +9,7 @@ import (func init() {beego.Include(+ &controllers.MainController{},&controllers.PingController{},&controllers.GetLicenseController{},&controllers.GetMusicFoldersController{},@@ -19,4 +20,5 @@ func init() {}beego.InsertFilter("/rest/*", beego.BeforeRouter, ValidateRequest)+ beego.ErrorController(&controllers.MainController{})}