X-Git-Url: http://www.git.cypherpunks.ru/?p=gocheese.git;a=blobdiff_plain;f=main.go;h=08c75535c1491feb8ac230f754cb37b63086e4c2;hp=bd3734a99d28ba3219c23858d4875338f8a3fa41;hb=HEAD;hpb=d4dc050f024708f91e1c9ebb63595a86efda24f9 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)