diff options
author | Adam Mathes <adam@trenchant.org> | 2018-07-04 17:13:01 -0700 |
---|---|---|
committer | Adam Mathes <adam@trenchant.org> | 2018-07-04 17:13:01 -0700 |
commit | d96957565a8b799e4efbd947eb710b0a6d7be1ea (patch) | |
tree | 1cdd199fbdaf9c77e00cd2e4073cec40e637c69f /web | |
parent | 150cd9b3362917d6d7538afab2c3ae7f6a594053 (diff) | |
download | neko-d96957565a8b799e4efbd947eb710b0a6d7be1ea.tar.gz neko-d96957565a8b799e4efbd947eb710b0a6d7be1ea.tar.bz2 neko-d96957565a8b799e4efbd947eb710b0a6d7be1ea.zip |
wip adding /crawl/ manual crawl update
Diffstat (limited to 'web')
-rw-r--r-- | web/web.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -201,6 +201,18 @@ func exportHandler(w http.ResponseWriter, r *http.Request) { return } +func crawlHandler(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "crawling...\n\n") + if f, ok := w.(http.Flusher); ok { + f.Flush() + } else { + log.Println("Damn, no flush") + } + crawler.Crawl() + fmt.Fprintf(w, "done...\n\n") + return +} + func fullTextHandler(w http.ResponseWriter, r *http.Request) { fmt.Printf("request: %v\n\n", r) @@ -298,6 +310,7 @@ func Serve() { http.HandleFunc("/tag/", AuthWrap(categoryHandler)) http.Handle("/image/", http.StripPrefix("/image/", AuthWrap(imageProxyHandler))) http.Handle("/export/", http.StripPrefix("/export/", AuthWrap(exportHandler))) + http.HandleFunc("/crawl/", AuthWrap(crawlHandler)) http.HandleFunc("/login/", loginHandler) http.HandleFunc("/logout/", logoutHandler) |