]> Cypherpunks.ru repositories - gocheese.git/blobdiff - main.go
-auth-required option and optional :ro per-user attribute
[gocheese.git] / main.go
diff --git a/main.go b/main.go
index bd3734a99d28ba3219c23858d4875338f8a3fa41..cdab06e1de21ab38599c968d64a630a681b58239 100644 (file)
--- 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)