* image proxy support

* go vet fix, remove mistakenly added coverage file

* fix test compile error

* add validation to config settings and documentation to model functions

* add message_source field to post
Этот коммит содержится в:
Chris
2018-01-22 15:32:50 -06:00
коммит произвёл GitHub
родитель a844577535
Коммит 599991ea73
33 изменённых файлов: 6080 добавлений и 32 удалений

Просмотреть файл

@@ -214,6 +214,9 @@ type ServiceSettings struct {
EnablePreviewFeatures *bool
EnableTutorial *bool
ExperimentalEnableDefaultChannelLeaveJoinMessages *bool
ImageProxyType *string
ImageProxyURL *string
ImageProxyOptions *string
}
func (s *ServiceSettings) SetDefaults() {
@@ -250,7 +253,7 @@ func (s *ServiceSettings) SetDefaults() {
}
if s.AllowedUntrustedInternalConnections == nil {
s.AllowedUntrustedInternalConnections = new(string)
s.AllowedUntrustedInternalConnections = NewString("")
}
if s.EnableMultifactorAuthentication == nil {
@@ -418,6 +421,18 @@ func (s *ServiceSettings) SetDefaults() {
if s.ExperimentalEnableDefaultChannelLeaveJoinMessages == nil {
s.ExperimentalEnableDefaultChannelLeaveJoinMessages = NewBool(true)
}
if s.ImageProxyType == nil {
s.ImageProxyType = NewString("")
}
if s.ImageProxyURL == nil {
s.ImageProxyURL = NewString("")
}
if s.ImageProxyOptions == nil {
s.ImageProxyOptions = NewString("")
}
}
type ClusterSettings struct {
@@ -2050,6 +2065,16 @@ func (ss *ServiceSettings) isValid() *AppError {
return NewAppError("Config.IsValid", "model.config.is_valid.listen_address.app_error", nil, "", http.StatusBadRequest)
}
switch *ss.ImageProxyType {
case "", "willnorris/imageproxy":
case "atmos/camo":
if *ss.ImageProxyOptions == "" {
return NewAppError("Config.IsValid", "model.config.is_valid.atmos_camo_image_proxy_options.app_error", nil, "", http.StatusBadRequest)
}
default:
return NewAppError("Config.IsValid", "model.config.is_valid.image_proxy_type.app_error", nil, "", http.StatusBadRequest)
}
return nil
}