mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-11 20:07:11 +02:00
Added a MainController
This commit is contained in:
parent
a4e7d63377
commit
1e842ccfdf
4 changed files with 37 additions and 1 deletions
26
controllers/main.go
Normal file
26
controllers/main.go
Normal file
|
|
@ -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")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue