X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;ds=sidebyside;f=main.go;fp=main.go;h=cdab06e1de21ab38599c968d64a630a681b58239;hb=c5ca3f66f1b3cd24e55d6e5fc95fdf61cac7aec6;hp=bd3734a99d28ba3219c23858d4875338f8a3fa41;hpb=356b13afa3db5a989a82cc4de910715d74681320;p=gocheese.git diff --git a/main.go b/main.go index bd3734a..cdab06e 100644 --- a/main.go +++ b/main.go @@ -42,7 +42,7 @@ import ( ) const ( - Version = "4.1.0" + Version = "4.2.0" UserAgent = "GoCheese/" + Version ) @@ -66,6 +66,7 @@ var ( PasswdPath = flag.String("passwd", "", "") PasswdListPath = flag.String("passwd-list", "", "") PasswdCheck = flag.Bool("passwd-check", false, "") + AuthRequired = flag.Bool("auth-required", false, "") LogTimestamped = flag.Bool("log-timestamped", false, "") FSCK = flag.Bool("fsck", false, "") @@ -239,11 +240,11 @@ func main() { ReadTimeout: time.Minute, WriteTimeout: time.Minute, } - http.HandleFunc("/", serveHRRoot) - http.HandleFunc("/hr/", serveHRPkg) - http.HandleFunc(*JSONURLPath, serveJSON) - http.HandleFunc(*NoRefreshURLPath, handler) - http.HandleFunc(*RefreshURLPath, handler) + http.HandleFunc("/", checkAuth(serveHRRoot)) + http.HandleFunc("/hr/", checkAuth(serveHRPkg)) + http.HandleFunc(*JSONURLPath, checkAuth(serveJSON)) + http.HandleFunc(*NoRefreshURLPath, checkAuth(handler)) + http.HandleFunc(*RefreshURLPath, checkAuth(handler)) if *DoUCSPI { server.SetKeepAlivesEnabled(false)