mirror of
https://github.com/usememos/memos.git
synced 2025-12-15 21:29:52 +08:00
Rename variable use_thumbnails_for_s3_images to enable_s3_image_thumbnails
This commit is contained in:
parent
1aa30ec777
commit
aae0e56c60
9 changed files with 38 additions and 38 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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" +
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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" +
|
||||
|
|
|
|||
|
|
@ -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/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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{
|
||||
|
|
|
|||
|
|
@ -243,11 +243,11 @@ const StorageSection = observer(() => {
|
|||
<div className="w-full flex flex-row justify-between items-center">
|
||||
<span>{t("setting.storage-section.use-thumbnails-for-s3-images")}</span>
|
||||
<Switch
|
||||
checked={workspaceStorageSetting.useThumbnailsForS3Images}
|
||||
checked={workspaceStorageSetting.enableS3ImageThumbnails}
|
||||
onCheckedChange={(checked) =>
|
||||
setWorkspaceStorageSetting({
|
||||
...workspaceStorageSetting,
|
||||
useThumbnailsForS3Images: checked,
|
||||
enableS3ImageThumbnails: checked,
|
||||
})
|
||||
}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -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<WorkspaceSetting_Storag
|
|||
if (message.s3Config !== undefined) {
|
||||
WorkspaceSetting_StorageSetting_S3Config.encode(message.s3Config, writer.uint32(34).fork()).join();
|
||||
}
|
||||
if (message.useThumbnailsForS3Images !== false) {
|
||||
writer.uint32(40).bool(message.useThumbnailsForS3Images);
|
||||
if (message.enableS3ImageThumbnails !== false) {
|
||||
writer.uint32(40).bool(message.enableS3ImageThumbnails);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
|
@ -780,7 +780,7 @@ export const WorkspaceSetting_StorageSetting: MessageFns<WorkspaceSetting_Storag
|
|||
break;
|
||||
}
|
||||
|
||||
message.useThumbnailsForS3Images = reader.bool();
|
||||
message.enableS3ImageThumbnails = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -803,7 +803,7 @@ export const WorkspaceSetting_StorageSetting: MessageFns<WorkspaceSetting_Storag
|
|||
message.s3Config = (object.s3Config !== undefined && object.s3Config !== null)
|
||||
? WorkspaceSetting_StorageSetting_S3Config.fromPartial(object.s3Config)
|
||||
: undefined;
|
||||
message.useThumbnailsForS3Images = object.useThumbnailsForS3Images ?? false;
|
||||
message.enableS3ImageThumbnails = object.enableS3ImageThumbnails ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue