diff --git a/proto/api/v1/workspace_service.proto b/proto/api/v1/workspace_service.proto index 9dc4b3819..0764bf70c 100644 --- a/proto/api/v1/workspace_service.proto +++ b/proto/api/v1/workspace_service.proto @@ -147,9 +147,9 @@ message WorkspaceSetting { } // The S3 config. S3Config s3_config = 4; - // use_thumbnails_for_s3_images enables thumbnail generation for images stored in S3. + // enable_s3_image_thumbnails enables thumbnail generation for images stored in S3. // When false, images stored in S3 will not have thumbnails generated. - bool use_thumbnails_for_s3_images = 5; + bool enable_s3_image_thumbnails = 5; } // Memo-related workspace settings and policies. diff --git a/proto/gen/api/v1/workspace_service.pb.go b/proto/gen/api/v1/workspace_service.pb.go index 088ca86ac..da1467a65 100644 --- a/proto/gen/api/v1/workspace_service.pb.go +++ b/proto/gen/api/v1/workspace_service.pb.go @@ -590,11 +590,11 @@ type WorkspaceSetting_StorageSetting struct { UploadSizeLimitMb int64 `protobuf:"varint,3,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"` // The S3 config. S3Config *WorkspaceSetting_StorageSetting_S3Config `protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"` - // use_thumbnails_for_s3_images enables thumbnail generation for images stored in S3. + // enable_s3_image_thumbnails enables thumbnail generation for images stored in S3. // When false, images stored in S3 will not have thumbnails generated. - UseThumbnailsForS3Images bool `protobuf:"varint,5,opt,name=use_thumbnails_for_s3_images,json=useThumbnailsForS3Images,proto3" json:"use_thumbnails_for_s3_images,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + EnableS3ImageThumbnails bool `protobuf:"varint,5,opt,name=enable_s3_image_thumbnails,json=enableS3ImageThumbnails,proto3" json:"enable_s3_image_thumbnails,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *WorkspaceSetting_StorageSetting) Reset() { @@ -655,9 +655,9 @@ func (x *WorkspaceSetting_StorageSetting) GetS3Config() *WorkspaceSetting_Storag return nil } -func (x *WorkspaceSetting_StorageSetting) GetUseThumbnailsForS3Images() bool { +func (x *WorkspaceSetting_StorageSetting) GetEnableS3ImageThumbnails() bool { if x != nil { - return x.UseThumbnailsForS3Images + return x.EnableS3ImageThumbnails } return false } @@ -945,7 +945,7 @@ const file_api_v1_workspace_service_proto_rawDesc = "" + "\aversion\x18\x02 \x01(\tR\aversion\x12\x12\n" + "\x04mode\x18\x03 \x01(\tR\x04mode\x12!\n" + "\finstance_url\x18\x06 \x01(\tR\vinstanceUrl\"\x1c\n" + - "\x1aGetWorkspaceProfileRequest\"\xd7\x11\n" + + "\x1aGetWorkspaceProfileRequest\"\xd4\x11\n" + "\x10WorkspaceSetting\x12\x17\n" + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12X\n" + "\x0fgeneral_setting\x18\x02 \x01(\v2-.memos.api.v1.WorkspaceSetting.GeneralSettingH\x00R\x0egeneralSetting\x12X\n" + @@ -965,13 +965,13 @@ const file_api_v1_workspace_service_proto_rawDesc = "" + "\x05title\x18\x01 \x01(\tR\x05title\x12 \n" + "\vdescription\x18\x02 \x01(\tR\vdescription\x12\x19\n" + "\blogo_url\x18\x03 \x01(\tR\alogoUrl\x12\x16\n" + - "\x06locale\x18\x04 \x01(\tR\x06locale\x1a\xfe\x04\n" + + "\x06locale\x18\x04 \x01(\tR\x06locale\x1a\xfb\x04\n" + "\x0eStorageSetting\x12\\\n" + "\fstorage_type\x18\x01 \x01(\x0e29.memos.api.v1.WorkspaceSetting.StorageSetting.StorageTypeR\vstorageType\x12+\n" + "\x11filepath_template\x18\x02 \x01(\tR\x10filepathTemplate\x12/\n" + "\x14upload_size_limit_mb\x18\x03 \x01(\x03R\x11uploadSizeLimitMb\x12S\n" + - "\ts3_config\x18\x04 \x01(\v26.memos.api.v1.WorkspaceSetting.StorageSetting.S3ConfigR\bs3Config\x12>\n" + - "\x1cuse_thumbnails_for_s3_images\x18\x05 \x01(\bR\x18useThumbnailsForS3Images\x1a\xcc\x01\n" + + "\ts3_config\x18\x04 \x01(\v26.memos.api.v1.WorkspaceSetting.StorageSetting.S3ConfigR\bs3Config\x12;\n" + + "\x1aenable_s3_image_thumbnails\x18\x05 \x01(\bR\x17enableS3ImageThumbnails\x1a\xcc\x01\n" + "\bS3Config\x12\"\n" + "\raccess_key_id\x18\x01 \x01(\tR\vaccessKeyId\x12*\n" + "\x11access_key_secret\x18\x02 \x01(\tR\x0faccessKeySecret\x12\x1a\n" + diff --git a/proto/gen/openapi.yaml b/proto/gen/openapi.yaml index 650532c8f..9c43420f1 100644 --- a/proto/gen/openapi.yaml +++ b/proto/gen/openapi.yaml @@ -3269,9 +3269,9 @@ components: allOf: - $ref: '#/components/schemas/StorageSetting_S3Config' description: The S3 config. - useThumbnailsForS3Images: + enableS3ImageThumbnails: type: boolean - description: "use_thumbnails_for_s3_images enables thumbnail generation for images stored in S3.\r\n When false, images stored in S3 will not have thumbnails generated." + description: "enable_s3_image_thumbnails enables thumbnail generation for images stored in S3.\r\n When false, images stored in S3 will not have thumbnails generated." description: Storage configuration settings for workspace attachments. tags: - name: ActivityService diff --git a/proto/gen/store/workspace_setting.pb.go b/proto/gen/store/workspace_setting.pb.go index 8cc6c09ec..42096636e 100644 --- a/proto/gen/store/workspace_setting.pb.go +++ b/proto/gen/store/workspace_setting.pb.go @@ -510,11 +510,11 @@ type WorkspaceStorageSetting struct { UploadSizeLimitMb int64 `protobuf:"varint,3,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"` // The S3 config. S3Config *StorageS3Config `protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"` - // use_thumbnails_for_s3_images enables thumbnail generation for images stored in S3. + // enable_s3_image_thumbnails enables thumbnail generation for images stored in S3. // When false, images stored in S3 will not have thumbnails generated. - UseThumbnailsForS3Images bool `protobuf:"varint,5,opt,name=use_thumbnails_for_s3_images,json=useThumbnailsForS3Images,proto3" json:"use_thumbnails_for_s3_images,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + EnableS3ImageThumbnails bool `protobuf:"varint,5,opt,name=enable_s3_image_thumbnails,json=enableS3ImageThumbnails,proto3" json:"enable_s3_image_thumbnails,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *WorkspaceStorageSetting) Reset() { @@ -575,9 +575,9 @@ func (x *WorkspaceStorageSetting) GetS3Config() *StorageS3Config { return nil } -func (x *WorkspaceStorageSetting) GetUseThumbnailsForS3Images() bool { +func (x *WorkspaceStorageSetting) GetEnableS3ImageThumbnails() bool { if x != nil { - return x.UseThumbnailsForS3Images + return x.EnableS3ImageThumbnails } return false } @@ -814,13 +814,13 @@ const file_store_workspace_setting_proto_rawDesc = "" + "\x05title\x18\x01 \x01(\tR\x05title\x12 \n" + "\vdescription\x18\x02 \x01(\tR\vdescription\x12\x19\n" + "\blogo_url\x18\x03 \x01(\tR\alogoUrl\x12\x16\n" + - "\x06locale\x18\x04 \x01(\tR\x06locale\"\x95\x03\n" + + "\x06locale\x18\x04 \x01(\tR\x06locale\"\x92\x03\n" + "\x17WorkspaceStorageSetting\x12S\n" + "\fstorage_type\x18\x01 \x01(\x0e20.memos.store.WorkspaceStorageSetting.StorageTypeR\vstorageType\x12+\n" + "\x11filepath_template\x18\x02 \x01(\tR\x10filepathTemplate\x12/\n" + "\x14upload_size_limit_mb\x18\x03 \x01(\x03R\x11uploadSizeLimitMb\x129\n" + - "\ts3_config\x18\x04 \x01(\v2\x1c.memos.store.StorageS3ConfigR\bs3Config\x12>\n" + - "\x1cuse_thumbnails_for_s3_images\x18\x05 \x01(\bR\x18useThumbnailsForS3Images\"L\n" + + "\ts3_config\x18\x04 \x01(\v2\x1c.memos.store.StorageS3ConfigR\bs3Config\x12;\n" + + "\x1aenable_s3_image_thumbnails\x18\x05 \x01(\bR\x17enableS3ImageThumbnails\"L\n" + "\vStorageType\x12\x1c\n" + "\x18STORAGE_TYPE_UNSPECIFIED\x10\x00\x12\f\n" + "\bDATABASE\x10\x01\x12\t\n" + diff --git a/proto/store/workspace_setting.proto b/proto/store/workspace_setting.proto index 91a48b18a..adfc69835 100644 --- a/proto/store/workspace_setting.proto +++ b/proto/store/workspace_setting.proto @@ -83,9 +83,9 @@ message WorkspaceStorageSetting { int64 upload_size_limit_mb = 3; // The S3 config. StorageS3Config s3_config = 4; - // use_thumbnails_for_s3_images enables thumbnail generation for images stored in S3. + // enable_s3_image_thumbnails enables thumbnail generation for images stored in S3. // When false, images stored in S3 will not have thumbnails generated. - bool use_thumbnails_for_s3_images = 5; + bool enable_s3_image_thumbnails = 5; } // Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ diff --git a/server/router/api/v1/attachment_service.go b/server/router/api/v1/attachment_service.go index f75488a32..c6d041eb0 100644 --- a/server/router/api/v1/attachment_service.go +++ b/server/router/api/v1/attachment_service.go @@ -247,7 +247,7 @@ func (s *APIV1Service) GetAttachmentBinary(ctx context.Context, request *v1pb.Ge storageSetting, err := s.Store.GetWorkspaceStorageSetting(ctx) if err != nil { slog.Warn("failed to get workspace storage setting", slog.Any("error", err)) - } else if !storageSetting.UseThumbnailsForS3Images { + } else if !storageSetting.EnableS3ImageThumbnails { shouldGenerateThumbnail = false } } @@ -408,7 +408,7 @@ func convertAttachmentFromStore(attachment *store.Attachment, workspaceStorageSe // Populate use_thumbnail_for_s3_image based on workspace setting and storage type if attachment.StorageType == storepb.AttachmentStorageType_S3 && workspaceStorageSetting != nil { - useThumbnail := workspaceStorageSetting.UseThumbnailsForS3Images + useThumbnail := workspaceStorageSetting.EnableS3ImageThumbnails attachmentMessage.UseThumbnailForS3Image = &useThumbnail } diff --git a/server/router/api/v1/workspace_service.go b/server/router/api/v1/workspace_service.go index 52cad2327..ed1482305 100644 --- a/server/router/api/v1/workspace_service.go +++ b/server/router/api/v1/workspace_service.go @@ -214,7 +214,7 @@ func convertWorkspaceStorageSettingFromStore(settingpb *storepb.WorkspaceStorage StorageType: v1pb.WorkspaceSetting_StorageSetting_StorageType(settingpb.StorageType), FilepathTemplate: settingpb.FilepathTemplate, UploadSizeLimitMb: settingpb.UploadSizeLimitMb, - UseThumbnailsForS3Images: settingpb.UseThumbnailsForS3Images, + EnableS3ImageThumbnails: settingpb.EnableS3ImageThumbnails, } if settingpb.S3Config != nil { setting.S3Config = &v1pb.WorkspaceSetting_StorageSetting_S3Config{ @@ -237,7 +237,7 @@ func convertWorkspaceStorageSettingToStore(setting *v1pb.WorkspaceSetting_Storag StorageType: storepb.WorkspaceStorageSetting_StorageType(setting.StorageType), FilepathTemplate: setting.FilepathTemplate, UploadSizeLimitMb: setting.UploadSizeLimitMb, - UseThumbnailsForS3Images: setting.UseThumbnailsForS3Images, + EnableS3ImageThumbnails: setting.EnableS3ImageThumbnails, } if setting.S3Config != nil { settingpb.S3Config = &storepb.StorageS3Config{ diff --git a/web/src/components/Settings/StorageSection.tsx b/web/src/components/Settings/StorageSection.tsx index b0d086582..b10b3f093 100644 --- a/web/src/components/Settings/StorageSection.tsx +++ b/web/src/components/Settings/StorageSection.tsx @@ -243,11 +243,11 @@ const StorageSection = observer(() => {
{t("setting.storage-section.use-thumbnails-for-s3-images")} setWorkspaceStorageSetting({ ...workspaceStorageSetting, - useThumbnailsForS3Images: checked, + enableS3ImageThumbnails: checked, }) } /> diff --git a/web/src/types/proto/api/v1/workspace_service.ts b/web/src/types/proto/api/v1/workspace_service.ts index 7192c1824..7e556ceeb 100644 --- a/web/src/types/proto/api/v1/workspace_service.ts +++ b/web/src/types/proto/api/v1/workspace_service.ts @@ -145,10 +145,10 @@ export interface WorkspaceSetting_StorageSetting { | WorkspaceSetting_StorageSetting_S3Config | undefined; /** - * use_thumbnails_for_s3_images enables thumbnail generation for images stored in S3. + * enable_s3_image_thumbnails enables thumbnail generation for images stored in S3. * When false, images stored in S3 will not have thumbnails generated. */ - useThumbnailsForS3Images: boolean; + enableS3ImageThumbnails: boolean; } /** Storage type enumeration for different storage backends. */ @@ -712,7 +712,7 @@ function createBaseWorkspaceSetting_StorageSetting(): WorkspaceSetting_StorageSe filepathTemplate: "", uploadSizeLimitMb: 0, s3Config: undefined, - useThumbnailsForS3Images: false, + enableS3ImageThumbnails: false, }; } @@ -730,8 +730,8 @@ export const WorkspaceSetting_StorageSetting: MessageFns