summaryrefslogtreecommitdiff
path: root/src/rhimportd/ctrlWeb.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-04-02 16:53:16 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-04-02 16:53:16 (GMT)
commit374cabeb4d2d59b588e9d4a30e3c09e2dbc0abdd (patch)
tree06bd6587085c6a572bee5077c440b445a4479b6a /src/rhimportd/ctrlWeb.go
parent27eaf84de6c5900c739f73725bd07270d43d49b7 (diff)
parent761d6d0824c0cc92fc746b77499ac563f4e6e579 (diff)
Merge branch 'upload-feature'
Diffstat (limited to 'src/rhimportd/ctrlWeb.go')
-rw-r--r--src/rhimportd/ctrlWeb.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rhimportd/ctrlWeb.go b/src/rhimportd/ctrlWeb.go
index 40075d0..2b52ef0 100644
--- a/src/rhimportd/ctrlWeb.go
+++ b/src/rhimportd/ctrlWeb.go
@@ -44,11 +44,14 @@ func (self webHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
self.H(self.Config, self.DBChan, self.SessionStoreChan, self.trusted, w, r)
}
-func StartControlWeb(addr string, conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport.SessionStoreChan) {
- http.Handle("/public/simple", webHandler{conf, db, sessions, false, webSimpleHandler})
- // http.Handle("/trusted/simple", webHandler{conf, db, sessions, true, webSimpleHandler})
+func StartControlWeb(addr, staticDir string, uploadMaxAge time.Duration, conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport.SessionStoreChan) {
+ http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir))))
+ // http.Handle("/trusted/simple", webHandler{conf, db, sessions, true, webSimpleHandler})
+ http.Handle("/public/simple", webHandler{conf, db, sessions, false, webSimpleHandler})
http.Handle("/public/socket", webHandler{conf, db, sessions, false, webSocketHandler})
+ http.Handle("/public/upload", webHandler{conf, db, sessions, false, webUploadHandler})
+ go webUploadCleaner(conf, uploadMaxAge)
rhl.Println("web-ctrl: listening on", addr)
server := &http.Server{Addr: addr, ReadTimeout: 60 * time.Second, WriteTimeout: 60 * time.Second}