options.go 646 B

1234567891011121314151617181920212223242526272829
  1. package security
  2. import (
  3. "github.com/imgproxy/imgproxy/v3/config"
  4. )
  5. type Options struct {
  6. MaxSrcResolution int
  7. MaxSrcFileSize int
  8. MaxAnimationFrames int
  9. MaxAnimationFrameResolution int
  10. }
  11. func DefaultOptions() Options {
  12. return Options{
  13. MaxSrcResolution: config.MaxSrcResolution,
  14. MaxSrcFileSize: config.MaxSrcFileSize,
  15. MaxAnimationFrames: config.MaxAnimationFrames,
  16. MaxAnimationFrameResolution: config.MaxAnimationFrameResolution,
  17. }
  18. }
  19. func IsSecurityOptionsAllowed() error {
  20. if config.AllowSecurityOptions {
  21. return nil
  22. }
  23. return newSecurityOptionsError()
  24. }