[MM-53454] Add export file settings + slash command for public link (#23915)
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -8403,6 +8403,22 @@ func (c *Client4) DownloadExport(ctx context.Context, name string, wr io.Writer,
|
||||
return n, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
func (c *Client4) GeneratePresignedURL(ctx context.Context, name string) (*PresignURLResponse, *Response, error) {
|
||||
r, err := c.DoAPIRequest(ctx, http.MethodPost, c.APIURL+c.exportRoute(name)+"/presign-url", "", "")
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
|
||||
res := &PresignURLResponse{}
|
||||
err = json.NewDecoder(r.Body).Decode(res)
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), NewAppError("GeneratePresignedURL", "model.client.json_decode.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
return res, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
func (c *Client4) GetUserThreads(ctx context.Context, userId, teamId string, options GetUserThreadsOpts) (*Threads, *Response, error) {
|
||||
v := url.Values{}
|
||||
if options.Since != 0 {
|
||||
|
||||
@@ -1546,6 +1546,22 @@ type FileSettings struct {
|
||||
AmazonS3SSE *bool `access:"environment_file_storage,write_restrictable,cloud_restrictable"`
|
||||
AmazonS3Trace *bool `access:"environment_file_storage,write_restrictable,cloud_restrictable"`
|
||||
AmazonS3RequestTimeoutMilliseconds *int64 `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
// Export store settings
|
||||
DedicatedExportStore *bool `access:"environment_file_storage,write_restrictable,cloud_restrictable"`
|
||||
ExportDriverName *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"`
|
||||
ExportDirectory *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
ExportAmazonS3AccessKeyId *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
ExportAmazonS3SecretAccessKey *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
ExportAmazonS3Bucket *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
ExportAmazonS3PathPrefix *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
ExportAmazonS3Region *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
ExportAmazonS3Endpoint *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
ExportAmazonS3SSL *bool `access:"environment_file_storage,write_restrictable,cloud_restrictable"`
|
||||
ExportAmazonS3SignV2 *bool `access:"environment_file_storage,write_restrictable,cloud_restrictable"`
|
||||
ExportAmazonS3SSE *bool `access:"environment_file_storage,write_restrictable,cloud_restrictable"`
|
||||
ExportAmazonS3Trace *bool `access:"environment_file_storage,write_restrictable,cloud_restrictable"`
|
||||
ExportAmazonS3RequestTimeoutMilliseconds *int64 `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
ExportAmazonS3PresignExpiresSeconds *int64 `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
}
|
||||
|
||||
func (s *FileSettings) SetDefaults(isUpdate bool) {
|
||||
@@ -1653,6 +1669,68 @@ func (s *FileSettings) SetDefaults(isUpdate bool) {
|
||||
if s.AmazonS3RequestTimeoutMilliseconds == nil {
|
||||
s.AmazonS3RequestTimeoutMilliseconds = NewInt64(30000)
|
||||
}
|
||||
|
||||
if s.DedicatedExportStore == nil {
|
||||
s.DedicatedExportStore = NewBool(false)
|
||||
}
|
||||
|
||||
if s.ExportDriverName == nil {
|
||||
s.ExportDriverName = NewString(ImageDriverLocal)
|
||||
}
|
||||
|
||||
if s.ExportDirectory == nil || *s.ExportDirectory == "" {
|
||||
s.ExportDirectory = NewString(FileSettingsDefaultDirectory)
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3AccessKeyId == nil {
|
||||
s.ExportAmazonS3AccessKeyId = NewString("")
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3SecretAccessKey == nil {
|
||||
s.ExportAmazonS3SecretAccessKey = NewString("")
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3Bucket == nil {
|
||||
s.ExportAmazonS3Bucket = NewString("")
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3PathPrefix == nil {
|
||||
s.ExportAmazonS3PathPrefix = NewString("")
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3Region == nil {
|
||||
s.ExportAmazonS3Region = NewString("")
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3Endpoint == nil || *s.ExportAmazonS3Endpoint == "" {
|
||||
// Defaults to "s3.amazonaws.com"
|
||||
s.ExportAmazonS3Endpoint = NewString("s3.amazonaws.com")
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3SSL == nil {
|
||||
s.ExportAmazonS3SSL = NewBool(true) // Secure by default.
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3SignV2 == nil {
|
||||
s.ExportAmazonS3SignV2 = new(bool)
|
||||
// Signature v2 is not enabled by default.
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3SSE == nil {
|
||||
s.ExportAmazonS3SSE = NewBool(false) // Not Encrypted by default.
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3Trace == nil {
|
||||
s.ExportAmazonS3Trace = NewBool(false)
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3RequestTimeoutMilliseconds == nil {
|
||||
s.ExportAmazonS3RequestTimeoutMilliseconds = NewInt64(30000)
|
||||
}
|
||||
|
||||
if s.ExportAmazonS3PresignExpiresSeconds == nil {
|
||||
s.ExportAmazonS3PresignExpiresSeconds = NewInt64(21600) // 6h
|
||||
}
|
||||
}
|
||||
|
||||
type EmailSettings struct {
|
||||
|
||||
@@ -58,6 +58,8 @@ type FeatureFlags struct {
|
||||
|
||||
CloudReverseTrial bool
|
||||
|
||||
EnableExportDirectDownload bool
|
||||
|
||||
DataRetentionConcurrencyEnabled bool
|
||||
}
|
||||
|
||||
@@ -79,6 +81,7 @@ func (f *FeatureFlags) SetDefaults() {
|
||||
f.WysiwygEditor = false
|
||||
f.OnboardingTourTips = true
|
||||
f.CloudReverseTrial = false
|
||||
f.EnableExportDirectDownload = false
|
||||
f.DataRetentionConcurrencyEnabled = true
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
MaxImageSize = int64(6048 * 4032) // 24 megapixels, roughly 36MB as a raw image
|
||||
)
|
||||
@@ -11,3 +13,8 @@ type FileUploadResponse struct {
|
||||
FileInfos []*FileInfo `json:"file_infos"`
|
||||
ClientIds []string `json:"client_ids"`
|
||||
}
|
||||
|
||||
type PresignURLResponse struct {
|
||||
URL string `json:"url"`
|
||||
Expiration time.Duration `json:"expiration"`
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user