disambiguate routing

This commit is contained in:
Jimmy Zelinskie
2014-07-09 01:34:34 -04:00
parent afb2376286
commit e2af935b83
2 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -64,13 +64,9 @@ func makeHandler(handler ResponseHandler) httprouter.Handle {
func setupRoutes(t *Tracker, cfg *config.Config) *httprouter.Router {
r := httprouter.New()
r.GET("/torrents/:infohash", makeHandler(t.getTorrent))
r.PUT("/torrents/:infohash", makeHandler(t.putTorrent))
r.DELETE("/torrents/:infohash", makeHandler(t.delTorrent))
if cfg.Private {
r.GET("/:passkey/announce", makeHandler(t.ServeAnnounce))
r.GET("/:passkey/scrape", makeHandler(t.ServeScrape))
r.GET("/users/:passkey/announce", makeHandler(t.ServeAnnounce))
r.GET("/users/:passkey/scrape", makeHandler(t.ServeScrape))
r.PUT("/users/:passkey", makeHandler(t.putUser))
r.DELETE("/users/:passkey", makeHandler(t.delUser))
@@ -84,6 +80,10 @@ func setupRoutes(t *Tracker, cfg *config.Config) *httprouter.Router {
r.DELETE("/clients/:clientID", makeHandler(t.delClient))
}
r.GET("/torrents/:infohash", makeHandler(t.getTorrent))
r.PUT("/torrents/:infohash", makeHandler(t.putTorrent))
r.DELETE("/torrents/:infohash", makeHandler(t.delTorrent))
return r
}