Moved RobotsTxt handler out of Handlers struct.
This commit is contained in:
parent
ca4391784a
commit
2987cf4a2a
@ -64,7 +64,7 @@ func main() {
|
|||||||
srv.GET("/playlist", hand.Playlist)
|
srv.GET("/playlist", hand.Playlist)
|
||||||
srv.GET("/filelist", hand.Filelist)
|
srv.GET("/filelist", hand.Filelist)
|
||||||
|
|
||||||
srv.GET("/robots.txt", hand.RobotsTxt)
|
srv.GET("/robots.txt", http.RobotsTxt)
|
||||||
srv.GET("/favicon.svg", http.Favicon)
|
srv.GET("/favicon.svg", http.Favicon)
|
||||||
|
|
||||||
if !*noLiquidsoap {
|
if !*noLiquidsoap {
|
||||||
|
@ -105,7 +105,7 @@ func (h *Handlers) Filelist(w http.ResponseWriter, _ *http.Request) {
|
|||||||
w.Write(data)
|
w.Write(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handlers) RobotsTxt(w http.ResponseWriter, _ *http.Request) {
|
func RobotsTxt(w http.ResponseWriter, _ *http.Request) {
|
||||||
w.Header().Add("Content-Disposition", "attachment; filename=\"robots.txt\"")
|
w.Header().Add("Content-Disposition", "attachment; filename=\"robots.txt\"")
|
||||||
w.Write([]byte("User-agent: *\nDisallow: /assets/\nDisallow: /live/"))
|
w.Write([]byte("User-agent: *\nDisallow: /assets/\nDisallow: /live/"))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user