You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

attachment.go 997B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package setting
  4. // Attachment settings
  5. var Attachment = struct {
  6. Storage
  7. AllowedTypes string
  8. MaxSize int64
  9. MaxFiles int
  10. Enabled bool
  11. }{
  12. Storage: Storage{
  13. ServeDirect: false,
  14. },
  15. AllowedTypes: "image/jpeg,image/png,application/zip,application/gzip",
  16. MaxSize: 4,
  17. MaxFiles: 5,
  18. Enabled: true,
  19. }
  20. func newAttachmentService() {
  21. sec := Cfg.Section("attachment")
  22. storageType := sec.Key("STORAGE_TYPE").MustString("")
  23. Attachment.Storage = getStorage("attachments", storageType, sec)
  24. Attachment.AllowedTypes = sec.Key("ALLOWED_TYPES").MustString(".csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip")
  25. Attachment.MaxSize = sec.Key("MAX_SIZE").MustInt64(4)
  26. Attachment.MaxFiles = sec.Key("MAX_FILES").MustInt(5)
  27. Attachment.Enabled = sec.Key("ENABLED").MustBool(true)
  28. }