aboutsummaryrefslogtreecommitdiffstats
path: root/web/web.go
diff options
context:
space:
mode:
Diffstat (limited to 'web/web.go')
-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)