1
0

Moved RobotsTxt handler out of Handlers struct.

This commit is contained in:
Alexander Andreev 2023-05-21 22:42:17 +04:00
parent ca4391784a
commit 2987cf4a2a
Signed by: Arav
GPG Key ID: D22A817D95815393
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

@ -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/"))
} }