Skip to content

🎧 Your Personal Streaming Service

Removed MainController

Deluan5d2a7b1db1c8
diff --git a/controllers/main.go b/controllers/main.go
deleted file mode 100644
index 73f1b81eb..000000000
--- a/controllers/main.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package controllers
-
-import (
- "fmt"
- "github.com/astaxie/beego"
-)
-
-type MainController struct{ beego.Controller }
-
-func (c *MainController) Get() {
- c.Ctx.Redirect(302, "/static/Jamstash/")
-}
-
-func (c *MainController) Error404() {
- if beego.BConfig.RunMode != beego.PROD || beego.BConfig.Log.AccessLogs {
- r := c.Ctx.Request
- devInfo := fmt.Sprintf("| %-10s | %-40s | %-16s", r.Method, r.URL.Path, r.URL.RawQuery)
- if beego.DefaultAccessLogFilter == nil || !beego.DefaultAccessLogFilter.Filter(c.Ctx) {
- beego.Warn(devInfo)
- }
- }
- c.CustomAbort(404, "Error 404")
-}
diff --git a/controllers/main_test.go b/controllers/main_test.go
deleted file mode 100644
index b9da98dd1..000000000
--- a/controllers/main_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package controllers_test
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-
- "github.com/astaxie/beego"
- "github.com/cloudsonic/sonic-server/tests"
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func TestErrorHandler(t *testing.T) {
- tests.Init(t, false)
-
- r, _ := http.NewRequest("GET", "/INVALID_PATH", nil)
- w := httptest.NewRecorder()
- beego.BeeApp.Handlers.ServeHTTP(w, r)
-
- beego.Debug("testing", "TestErrorHandler", fmt.Sprintf("\nUrl: %s\nStatus Code: [%d]\n%s", r.URL, w.Code, w.Body.String()))
-
- Convey("When requesting an non-existing URL\n", t, func() {
- Convey("Then the status code should be 404", func() {
- So(w.Code, ShouldEqual, 404)
- })
- })
-}
diff --git a/main.go b/main.go
index 802988a68..777885e74 100644
--- a/main.go
+++ b/main.go
@@ -3,7 +3,6 @@ package main
import (
"fmt"
- "github.com/astaxie/beego"
"github.com/cloudsonic/sonic-server/api"
"github.com/cloudsonic/sonic-server/conf"
)
@@ -12,7 +11,7 @@ func main() {
conf.LoadFromLocalFile()
conf.LoadFromFlags()
- fmt.Printf("\nCloudSonic Server v%s (%s mode)\n\n", "0.2", beego.BConfig.RunMode)
+ fmt.Printf("\nCloudSonic Server v%s\n\n", "0.2")
a := App{}
a.Initialize()