Add robots.txt
This commit is contained in:
parent
3122a3158f
commit
45efecbfc8
3 changed files with 21 additions and 10 deletions
|
@ -32,6 +32,7 @@ const (
|
|||
CSS_PATH = "css/"
|
||||
JS_PATH = "js/"
|
||||
IMG_PATH = "img/"
|
||||
ROBOTS_PATH = "robots.txt"
|
||||
LOGGER_CONFIG = "logger.xml"
|
||||
|
||||
IMG_WIDTH_BIG = 300
|
||||
|
|
4
robots.txt
Normal file
4
robots.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
User-agent: *
|
||||
Disallow: /delete/
|
||||
Disallow: /edit/
|
||||
Disallow: /save/
|
26
trantor.go
26
trantor.go
|
@ -162,32 +162,38 @@ func initRouter(db *database.DB, sg *StatsGatherer) {
|
|||
r.NotFoundHandler = notFoundHandler
|
||||
|
||||
r.HandleFunc("/", sg.Gather(indexHandler))
|
||||
r.HandleFunc("/robots.txt", func(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, ROBOTS_PATH) })
|
||||
|
||||
r.HandleFunc("/book/{id:"+id_pattern+"}", sg.Gather(bookHandler))
|
||||
r.HandleFunc("/search/", sg.Gather(searchHandler))
|
||||
r.HandleFunc("/upload/", sg.Gather(uploadHandler)).Methods("GET")
|
||||
r.HandleFunc("/upload/", sg.Gather(uploadPostHandler)).Methods("POST")
|
||||
r.HandleFunc("/login/", sg.Gather(loginHandler)).Methods("GET")
|
||||
r.HandleFunc("/login/", sg.Gather(loginPostHandler)).Methods("POST")
|
||||
r.HandleFunc("/create_user/", sg.Gather(createUserHandler)).Methods("POST")
|
||||
r.HandleFunc("/logout/", sg.Gather(logoutHandler))
|
||||
r.HandleFunc("/new/", sg.Gather(newHandler))
|
||||
r.HandleFunc("/store/{ids:("+id_pattern+"/)+}", sg.Gather(storeHandler))
|
||||
r.HandleFunc("/delete/{ids:("+id_pattern+"/)+}", sg.Gather(deleteHandler))
|
||||
r.HandleFunc("/read/{id:"+id_pattern+"}", sg.Gather(readStartHandler))
|
||||
r.HandleFunc("/read/{id:"+id_pattern+"}/{file:.*}", sg.Gather(readHandler))
|
||||
r.HandleFunc("/content/{id:"+id_pattern+"}/{file:.*}", sg.Gather(contentHandler))
|
||||
r.HandleFunc("/edit/{id:"+id_pattern+"}", sg.Gather(editHandler))
|
||||
r.HandleFunc("/save/{id:"+id_pattern+"}", sg.Gather(saveHandler)).Methods("POST")
|
||||
r.HandleFunc("/about/", sg.Gather(aboutHandler))
|
||||
r.HandleFunc("/help/", sg.Gather(helpHandler))
|
||||
r.HandleFunc("/download/{id:"+id_pattern+"}/{epub:.*}", sg.Gather(downloadHandler))
|
||||
r.HandleFunc("/cover/{id:"+id_pattern+"}/{size}/{img:.*}", sg.Gather(coverHandler))
|
||||
r.HandleFunc("/stats/", sg.Gather(statsHandler))
|
||||
|
||||
r.HandleFunc("/login/", sg.Gather(loginHandler)).Methods("GET")
|
||||
r.HandleFunc("/login/", sg.Gather(loginPostHandler)).Methods("POST")
|
||||
r.HandleFunc("/create_user/", sg.Gather(createUserHandler)).Methods("POST")
|
||||
r.HandleFunc("/logout/", sg.Gather(logoutHandler))
|
||||
r.HandleFunc("/dashboard/", sg.Gather(dashboardHandler))
|
||||
r.HandleFunc("/settings/", sg.Gather(settingsHandler))
|
||||
r.HandleFunc("/stats/", sg.Gather(statsHandler))
|
||||
|
||||
r.HandleFunc("/new/", sg.Gather(newHandler))
|
||||
r.HandleFunc("/save/{id:"+id_pattern+"}", sg.Gather(saveHandler)).Methods("POST")
|
||||
r.HandleFunc("/edit/{id:"+id_pattern+"}", sg.Gather(editHandler))
|
||||
r.HandleFunc("/store/{ids:("+id_pattern+"/)+}", sg.Gather(storeHandler))
|
||||
r.HandleFunc("/delete/{ids:("+id_pattern+"/)+}", sg.Gather(deleteHandler))
|
||||
|
||||
r.HandleFunc("/news/", sg.Gather(newsHandler))
|
||||
r.HandleFunc("/news/edit", sg.Gather(editNewsHandler)).Methods("GET")
|
||||
r.HandleFunc("/news/edit", sg.Gather(postNewsHandler)).Methods("POST")
|
||||
|
||||
h := http.FileServer(http.Dir(IMG_PATH))
|
||||
r.Handle("/img/{img}", http.StripPrefix("/img/", h))
|
||||
h = http.FileServer(http.Dir(CSS_PATH))
|
||||
|
|
Reference in a new issue