Move reader

This commit is contained in:
Milan Nikolic
2025-06-13 21:20:11 +02:00
parent 933b5eef22
commit f556285ad5
7 changed files with 13 additions and 18 deletions

View File

@@ -9,7 +9,6 @@ import (
"github.com/abbot/go-http-auth"
"github.com/gen2brain/cam2ip/handlers"
"github.com/gen2brain/cam2ip/reader"
)
// Server struct.
@@ -31,14 +30,13 @@ type Server struct {
NoWebGL bool
Timestamp bool
FileName string
Reader reader.ImageReader
Reader handlers.ImageReader
}
// NewServer returns new Server.
func NewServer() *Server {
s := &Server{}
return s
}
@@ -78,6 +76,7 @@ func newAuthHandler(handler http.Handler, authenticator *auth.BasicAuth) http.Ha
w.Header().Set("WWW-Authenticate", fmt.Sprintf("Basic realm=\"%s\"", authenticator.Realm))
if authenticator.CheckAuth(r) == "" {
http.Error(w, "401 Unauthorized", http.StatusUnauthorized)
return
}
}