aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorAdam Mathes <adam@trenchant.org>2018-07-04 17:13:01 -0700
committerAdam Mathes <adam@trenchant.org>2018-07-04 17:13:01 -0700
commitd96957565a8b799e4efbd947eb710b0a6d7be1ea (patch)
tree1cdd199fbdaf9c77e00cd2e4073cec40e637c69f /web
parent150cd9b3362917d6d7538afab2c3ae7f6a594053 (diff)
downloadneko-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.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/web/web.go b/web/web.go
index f7fec31..fdcec7a 100644
--- a/web/web.go
+++ b/web/web.go
@@ -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)