options.go 737 B

12345678910111213141516171819202122232425262728293031
  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. MaxResultDimension int
  11. }
  12. func DefaultOptions() Options {
  13. return Options{
  14. MaxSrcResolution: config.MaxSrcResolution,
  15. MaxSrcFileSize: config.MaxSrcFileSize,
  16. MaxAnimationFrames: config.MaxAnimationFrames,
  17. MaxAnimationFrameResolution: config.MaxAnimationFrameResolution,
  18. MaxResultDimension: config.MaxResultDimension,
  19. }
  20. }
  21. func IsSecurityOptionsAllowed() error {
  22. if config.AllowSecurityOptions {
  23. return nil
  24. }
  25. return newSecurityOptionsError()
  26. }