// TorrentHandler is now commented func TorrentHandler(w http.ResponseWriter, req *http.Request, renderer *render.Render) { searchString := req.FormValue("search") log.Printf("Searching for %s", searchString) torrents := make(map[int][]string) torrents = SearchTorrentsFor(searchString, torrents) // prepare response page renderer.HTML(w, http.StatusOK, "content", torrents) }
// ListDownloadsHandler AJAX method is now commented func ListDownloadsHandler(w http.ResponseWriter, req *http.Request, renderer *render.Render) { dir := req.FormValue("dir") if strings.HasPrefix(dir, "~") { homedir := os.Getenv("HOME") dir = homedir + dir[1:] } files := structures.PrepareDirectoryContents(dir) renderer.HTML(w, http.StatusOK, "downloadDirectory", files) }
func homeHandler(renderer *render.Render, data HomeDisplay) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { renderer.HTML(w, http.StatusOK, "home-template", data) }) }