github.com/gitbundle/modules@v0.0.0-20231025071548-85b91c5c3b01/setting/attachment.go (about) 1 // Copyright 2023 The GitBundle Inc. All rights reserved. 2 // Copyright 2017 The Gitea Authors. All rights reserved. 3 // Use of this source code is governed by a MIT-style 4 // license that can be found in the LICENSE file. 5 6 package setting 7 8 // Attachment settings 9 var Attachment = struct { 10 Storage 11 AllowedTypes string 12 MaxSize int64 13 MaxFiles int 14 Enabled bool 15 }{ 16 Storage: Storage{ 17 ServeDirect: false, 18 }, 19 AllowedTypes: "image/jpeg,image/png,application/zip,application/gzip", 20 MaxSize: 4, 21 MaxFiles: 5, 22 Enabled: true, 23 } 24 25 func newAttachmentService() { 26 sec := Cfg.Section("attachment") 27 storageType := sec.Key("STORAGE_TYPE").MustString("") 28 29 Attachment.Storage = getStorage("attachments", storageType, sec) 30 31 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") 32 Attachment.MaxSize = sec.Key("MAX_SIZE").MustInt64(4) 33 Attachment.MaxFiles = sec.Key("MAX_FILES").MustInt(5) 34 Attachment.Enabled = sec.Key("ENABLED").MustBool(true) 35 }