disable picture upload for anonymous
This commit is contained in:
@@ -525,6 +525,7 @@ func (s *ServerCommand) addAuthProviders(authenticator *auth.Service) {
|
||||
providers++
|
||||
}
|
||||
if s.Auth.Dev {
|
||||
log.Print("[INFO] dev access enabled")
|
||||
authenticator.AddProvider("dev", "", "")
|
||||
providers++
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ func (s *Rest) routes() chi.Router {
|
||||
rauth.Use(tollbooth_chi.LimitHandler(tollbooth.NewLimiter(lmt, nil)))
|
||||
rauth.Use(authMiddleware.Auth)
|
||||
rauth.Use(logger.New(logger.Log(log.Default()), logger.Prefix("[DEBUG]"), logger.IPfn(ipFn)).Handler)
|
||||
rauth.Post("/picture", s.savePictureCtrl)
|
||||
rauth.With(rejectAnonUser).Post("/picture", s.savePictureCtrl)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@@ -114,6 +114,11 @@ func (f *FileSystem) Load(id string) (io.ReadCloser, int64, error) {
|
||||
|
||||
// Cleanup runs scan of staging and removes old files based on ttl
|
||||
func (f *FileSystem) Cleanup(ctx context.Context, ttl time.Duration) error {
|
||||
|
||||
if _, err := os.Stat(f.Staging); os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
|
||||
err := filepath.Walk(f.Staging, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ require (
|
||||
github.com/go-chi/render v1.0.0
|
||||
github.com/go-pkgz/auth v0.5.0
|
||||
github.com/go-pkgz/lcw v0.2.0
|
||||
github.com/go-pkgz/lgr v0.6.1
|
||||
github.com/go-pkgz/lgr v0.6.2
|
||||
github.com/go-pkgz/mongo v1.1.2
|
||||
github.com/go-pkgz/repeater v1.1.1
|
||||
github.com/go-pkgz/rest v1.4.0
|
||||
|
||||
@@ -35,6 +35,8 @@ github.com/go-pkgz/lgr v0.6.0 h1:Z9FRhfSyuASiF05iXRj+clTAAl8+1EfLR7SeyLIaGKg=
|
||||
github.com/go-pkgz/lgr v0.6.0/go.mod h1:hBM1NM/SoYdlrykgdgJWGrZ/TM/XaZIjRbJfx7NkMm8=
|
||||
github.com/go-pkgz/lgr v0.6.1 h1:poohUbv/iguoQ6bzJ5j/Ubl1VcsjU+rzTbbxsKbkGXk=
|
||||
github.com/go-pkgz/lgr v0.6.1/go.mod h1:hBM1NM/SoYdlrykgdgJWGrZ/TM/XaZIjRbJfx7NkMm8=
|
||||
github.com/go-pkgz/lgr v0.6.2 h1:Twf2YIe2J5tg7mKs+IkDDxrDF7GWlTCl/LzqELWjT5o=
|
||||
github.com/go-pkgz/lgr v0.6.2/go.mod h1:hBM1NM/SoYdlrykgdgJWGrZ/TM/XaZIjRbJfx7NkMm8=
|
||||
github.com/go-pkgz/mongo v1.0.0/go.mod h1:R9si/F2aJsjz4MUxhzuppIHY8yLV3YCeuCpgcI50cu4=
|
||||
github.com/go-pkgz/mongo v1.1.2 h1:2Vqn3CWQJkkx4gxxDiQUitAW2FN/CH26lKHkipmpKcc=
|
||||
github.com/go-pkgz/mongo v1.1.2/go.mod h1:0NkWnzpiUxoL5fYZuttCtJrpC67oNDidfYxcdPqHTf0=
|
||||
|
||||
Reference in New Issue
Block a user