From 3e6e56b0087838162a2f3632dec79ab694f8955a Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 11 Apr 2024 17:53:00 +0800 Subject: [PATCH] refactor: update workspace store definition --- proto/api/v2/resource_service.proto | 29 +- proto/gen/api/v2/README.md | 12 +- proto/gen/api/v2/resource_service.pb.go | 366 +++++++------ proto/gen/store/README.md | 140 ++++- proto/gen/store/storage.pb.go | 465 ++++++++++++++++ proto/gen/store/workspace_setting.pb.go | 501 +++++++++++++----- proto/store/storage.proto | 35 ++ proto/store/workspace_setting.proto | 40 +- server/integration/telegram.go | 24 +- server/route/api/v1/memo.go | 123 +---- server/route/api/v1/system.go | 10 - server/route/api/v1/system_setting.go | 38 -- server/route/api/v2/apidocs.swagger.yaml | 64 ++- server/route/api/v2/memo_service.go | 84 +-- server/route/api/v2/resource_name.go | 14 + server/route/api/v2/resource_service.go | 178 ++++++- server/server.go | 57 +- store/migrator.go | 18 +- store/storage.go | 132 +++++ store/workspace_setting.go | 57 +- .../components/ChangeMemberPasswordDialog.tsx | 2 +- web/src/components/CreateResourceDialog.tsx | 23 +- web/src/components/MemoEditor/index.tsx | 34 +- web/src/helpers/api.ts | 5 - web/src/pages/Resources.tsx | 33 +- web/src/store/module/index.ts | 1 - web/src/store/module/resource.ts | 51 -- web/src/store/v1/resource.ts | 20 +- 28 files changed, 1803 insertions(+), 753 deletions(-) create mode 100644 proto/gen/store/storage.pb.go create mode 100644 proto/store/storage.proto delete mode 100644 web/src/store/module/resource.ts diff --git a/proto/api/v2/resource_service.proto b/proto/api/v2/resource_service.proto index 4a12d8bb2..967692488 100644 --- a/proto/api/v2/resource_service.proto +++ b/proto/api/v2/resource_service.proto @@ -4,6 +4,7 @@ package memos.api.v2; import "google/api/annotations.proto"; import "google/api/client.proto"; +import "google/api/field_behavior.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -51,29 +52,25 @@ message Resource { // The user defined id of the resource. string uid = 2; - google.protobuf.Timestamp create_time = 3; + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; string filename = 4; - string external_link = 5; + bytes content = 5 [(google.api.field_behavior) = INPUT_ONLY]; - string type = 6; + string external_link = 6; - int64 size = 7; + string type = 7; + int64 size = 8; + + // The related memo. // Format: memos/{id} - optional string memo = 8; + optional string memo = 9; } message CreateResourceRequest { - string filename = 1; - - string external_link = 2; - - string type = 3; - - // Format: memos/{id} - optional string memo = 4; + Resource resource = 1; } message CreateResourceResponse { @@ -95,6 +92,9 @@ message SearchResourcesResponse { } message GetResourceRequest { + // The name of the resource. + // Format: resources/{id} + // id is the system generated unique identifier. string name = 1; } @@ -113,6 +113,9 @@ message UpdateResourceResponse { } message DeleteResourceRequest { + // The name of the resource. + // Format: resources/{id} + // id is the system generated unique identifier. string name = 1; } diff --git a/proto/gen/api/v2/README.md b/proto/gen/api/v2/README.md index 2dd08e01c..9abe50247 100644 --- a/proto/gen/api/v2/README.md +++ b/proto/gen/api/v2/README.md @@ -1609,10 +1609,7 @@ Used internally for obfuscating the page token. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| filename | [string](#string) | | | -| external_link | [string](#string) | | | -| type | [string](#string) | | | -| memo | [string](#string) | optional | Format: memos/{id} | +| resource | [Resource](#memos-api-v2-Resource) | | | @@ -1642,7 +1639,7 @@ Used internally for obfuscating the page token. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| name | [string](#string) | | | +| name | [string](#string) | | The name of the resource. Format: resources/{id} id is the system generated unique identifier. | @@ -1667,7 +1664,7 @@ Used internally for obfuscating the page token. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| name | [string](#string) | | | +| name | [string](#string) | | The name of the resource. Format: resources/{id} id is the system generated unique identifier. | @@ -1726,10 +1723,11 @@ Used internally for obfuscating the page token. | uid | [string](#string) | | The user defined id of the resource. | | create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | | filename | [string](#string) | | | +| content | [bytes](#bytes) | | | | external_link | [string](#string) | | | | type | [string](#string) | | | | size | [int64](#int64) | | | -| memo | [string](#string) | optional | Format: memos/{id} | +| memo | [string](#string) | optional | The related memo. Format: memos/{id} | diff --git a/proto/gen/api/v2/resource_service.pb.go b/proto/gen/api/v2/resource_service.pb.go index c58a03b35..990d51f46 100644 --- a/proto/gen/api/v2/resource_service.pb.go +++ b/proto/gen/api/v2/resource_service.pb.go @@ -36,11 +36,13 @@ type Resource struct { Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"` CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` Filename string `protobuf:"bytes,4,opt,name=filename,proto3" json:"filename,omitempty"` - ExternalLink string `protobuf:"bytes,5,opt,name=external_link,json=externalLink,proto3" json:"external_link,omitempty"` - Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` - Size int64 `protobuf:"varint,7,opt,name=size,proto3" json:"size,omitempty"` + Content []byte `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"` + ExternalLink string `protobuf:"bytes,6,opt,name=external_link,json=externalLink,proto3" json:"external_link,omitempty"` + Type string `protobuf:"bytes,7,opt,name=type,proto3" json:"type,omitempty"` + Size int64 `protobuf:"varint,8,opt,name=size,proto3" json:"size,omitempty"` + // The related memo. // Format: memos/{id} - Memo *string `protobuf:"bytes,8,opt,name=memo,proto3,oneof" json:"memo,omitempty"` + Memo *string `protobuf:"bytes,9,opt,name=memo,proto3,oneof" json:"memo,omitempty"` } func (x *Resource) Reset() { @@ -103,6 +105,13 @@ func (x *Resource) GetFilename() string { return "" } +func (x *Resource) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + func (x *Resource) GetExternalLink() string { if x != nil { return x.ExternalLink @@ -136,11 +145,7 @@ type CreateResourceRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` - ExternalLink string `protobuf:"bytes,2,opt,name=external_link,json=externalLink,proto3" json:"external_link,omitempty"` - Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` - // Format: memos/{id} - Memo *string `protobuf:"bytes,4,opt,name=memo,proto3,oneof" json:"memo,omitempty"` + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` } func (x *CreateResourceRequest) Reset() { @@ -175,32 +180,11 @@ func (*CreateResourceRequest) Descriptor() ([]byte, []int) { return file_api_v2_resource_service_proto_rawDescGZIP(), []int{1} } -func (x *CreateResourceRequest) GetFilename() string { - if x != nil { - return x.Filename - } - return "" -} - -func (x *CreateResourceRequest) GetExternalLink() string { - if x != nil { - return x.ExternalLink - } - return "" -} - -func (x *CreateResourceRequest) GetType() string { +func (x *CreateResourceRequest) GetResource() *Resource { if x != nil { - return x.Type - } - return "" -} - -func (x *CreateResourceRequest) GetMemo() string { - if x != nil && x.Memo != nil { - return *x.Memo + return x.Resource } - return "" + return nil } type CreateResourceResponse struct { @@ -434,6 +418,9 @@ type GetResourceRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // The name of the resource. + // Format: resources/{id} + // id is the system generated unique identifier. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } @@ -630,6 +617,9 @@ type DeleteResourceRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // The name of the resource. + // Format: resources/{id} + // id is the system generated unique identifier. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } @@ -719,143 +709,143 @@ var file_api_v2_resource_service_proto_rawDesc = []byte{ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf8, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, - 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x73, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, - 0x12, 0x17, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6d, 0x65, - 0x6d, 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, - 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, + 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9c, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x40, 0x0a, 0x0b, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x03, 0xe0, 0x41, + 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x03, 0xe0, 0x41, 0x04, 0x52, + 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x17, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6d, - 0x65, 0x6d, 0x6f, 0x22, 0x4c, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x22, 0x4b, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, + 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x22, 0x16, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4d, 0x0a, 0x15, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x30, 0x0a, 0x16, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x4f, 0x0a, 0x17, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x28, 0x0a, 0x12, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x49, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x22, 0x16, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4d, 0x0a, 0x15, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x30, 0x0a, 0x16, 0x53, 0x65, 0x61, 0x72, - 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x4f, 0x0a, 0x17, 0x53, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x65, 0x22, 0x88, 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x08, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, + 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, + 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x4c, 0x0a, 0x16, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x28, 0x0a, 0x12, 0x47, - 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x49, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x22, 0x88, 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x3b, - 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, - 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x4c, 0x0a, 0x16, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, - 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x2b, 0x0a, 0x15, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x18, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x32, 0xb5, 0x06, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x76, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x73, 0x0a, 0x0d, - 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x22, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x73, 0x12, 0x80, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, - 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x73, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x12, 0x7d, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, - 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x2f, 0x2a, 0x7d, 0x12, 0xa9, 0x01, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x2b, 0x0a, 0x15, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x18, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x4c, 0xda, 0x41, 0x14, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2c, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, - 0x3a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x32, 0x23, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x6e, 0x61, - 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, - 0x86, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0xda, - 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x2a, 0x1a, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xac, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x14, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, - 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, - 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, - 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, - 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x32, 0xb5, 0x06, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x76, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x11, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x73, 0x0a, + 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x22, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, + 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x12, 0x80, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x73, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x7d, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0xda, 0x41, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xa9, 0x01, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x4c, 0xda, 0x41, 0x14, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2c, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x2f, 0x3a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x32, 0x23, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x6e, + 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, + 0x12, 0x86, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, + 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x2a, 0x1a, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xac, 0x01, 0x0a, 0x10, 0x63, 0x6f, + 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x14, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, + 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, + 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, + 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, + 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -890,30 +880,31 @@ var file_api_v2_resource_service_proto_goTypes = []interface{}{ } var file_api_v2_resource_service_proto_depIdxs = []int32{ 13, // 0: memos.api.v2.Resource.create_time:type_name -> google.protobuf.Timestamp - 0, // 1: memos.api.v2.CreateResourceResponse.resource:type_name -> memos.api.v2.Resource - 0, // 2: memos.api.v2.ListResourcesResponse.resources:type_name -> memos.api.v2.Resource - 0, // 3: memos.api.v2.SearchResourcesResponse.resources:type_name -> memos.api.v2.Resource - 0, // 4: memos.api.v2.GetResourceResponse.resource:type_name -> memos.api.v2.Resource - 0, // 5: memos.api.v2.UpdateResourceRequest.resource:type_name -> memos.api.v2.Resource - 14, // 6: memos.api.v2.UpdateResourceRequest.update_mask:type_name -> google.protobuf.FieldMask - 0, // 7: memos.api.v2.UpdateResourceResponse.resource:type_name -> memos.api.v2.Resource - 1, // 8: memos.api.v2.ResourceService.CreateResource:input_type -> memos.api.v2.CreateResourceRequest - 3, // 9: memos.api.v2.ResourceService.ListResources:input_type -> memos.api.v2.ListResourcesRequest - 5, // 10: memos.api.v2.ResourceService.SearchResources:input_type -> memos.api.v2.SearchResourcesRequest - 7, // 11: memos.api.v2.ResourceService.GetResource:input_type -> memos.api.v2.GetResourceRequest - 9, // 12: memos.api.v2.ResourceService.UpdateResource:input_type -> memos.api.v2.UpdateResourceRequest - 11, // 13: memos.api.v2.ResourceService.DeleteResource:input_type -> memos.api.v2.DeleteResourceRequest - 2, // 14: memos.api.v2.ResourceService.CreateResource:output_type -> memos.api.v2.CreateResourceResponse - 4, // 15: memos.api.v2.ResourceService.ListResources:output_type -> memos.api.v2.ListResourcesResponse - 6, // 16: memos.api.v2.ResourceService.SearchResources:output_type -> memos.api.v2.SearchResourcesResponse - 8, // 17: memos.api.v2.ResourceService.GetResource:output_type -> memos.api.v2.GetResourceResponse - 10, // 18: memos.api.v2.ResourceService.UpdateResource:output_type -> memos.api.v2.UpdateResourceResponse - 12, // 19: memos.api.v2.ResourceService.DeleteResource:output_type -> memos.api.v2.DeleteResourceResponse - 14, // [14:20] is the sub-list for method output_type - 8, // [8:14] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 0, // 1: memos.api.v2.CreateResourceRequest.resource:type_name -> memos.api.v2.Resource + 0, // 2: memos.api.v2.CreateResourceResponse.resource:type_name -> memos.api.v2.Resource + 0, // 3: memos.api.v2.ListResourcesResponse.resources:type_name -> memos.api.v2.Resource + 0, // 4: memos.api.v2.SearchResourcesResponse.resources:type_name -> memos.api.v2.Resource + 0, // 5: memos.api.v2.GetResourceResponse.resource:type_name -> memos.api.v2.Resource + 0, // 6: memos.api.v2.UpdateResourceRequest.resource:type_name -> memos.api.v2.Resource + 14, // 7: memos.api.v2.UpdateResourceRequest.update_mask:type_name -> google.protobuf.FieldMask + 0, // 8: memos.api.v2.UpdateResourceResponse.resource:type_name -> memos.api.v2.Resource + 1, // 9: memos.api.v2.ResourceService.CreateResource:input_type -> memos.api.v2.CreateResourceRequest + 3, // 10: memos.api.v2.ResourceService.ListResources:input_type -> memos.api.v2.ListResourcesRequest + 5, // 11: memos.api.v2.ResourceService.SearchResources:input_type -> memos.api.v2.SearchResourcesRequest + 7, // 12: memos.api.v2.ResourceService.GetResource:input_type -> memos.api.v2.GetResourceRequest + 9, // 13: memos.api.v2.ResourceService.UpdateResource:input_type -> memos.api.v2.UpdateResourceRequest + 11, // 14: memos.api.v2.ResourceService.DeleteResource:input_type -> memos.api.v2.DeleteResourceRequest + 2, // 15: memos.api.v2.ResourceService.CreateResource:output_type -> memos.api.v2.CreateResourceResponse + 4, // 16: memos.api.v2.ResourceService.ListResources:output_type -> memos.api.v2.ListResourcesResponse + 6, // 17: memos.api.v2.ResourceService.SearchResources:output_type -> memos.api.v2.SearchResourcesResponse + 8, // 18: memos.api.v2.ResourceService.GetResource:output_type -> memos.api.v2.GetResourceResponse + 10, // 19: memos.api.v2.ResourceService.UpdateResource:output_type -> memos.api.v2.UpdateResourceResponse + 12, // 20: memos.api.v2.ResourceService.DeleteResource:output_type -> memos.api.v2.DeleteResourceResponse + 15, // [15:21] is the sub-list for method output_type + 9, // [9:15] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_api_v2_resource_service_proto_init() } @@ -1080,7 +1071,6 @@ func file_api_v2_resource_service_proto_init() { } } file_api_v2_resource_service_proto_msgTypes[0].OneofWrappers = []interface{}{} - file_api_v2_resource_service_proto_msgTypes[1].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/gen/store/README.md b/proto/gen/store/README.md index ede361632..8e0342817 100644 --- a/proto/gen/store/README.md +++ b/proto/gen/store/README.md @@ -26,6 +26,13 @@ - [Reaction.Type](#memos-store-Reaction-Type) +- [store/storage.proto](#store_storage-proto) + - [S3Config](#memos-store-S3Config) + - [Storage](#memos-store-Storage) + - [StorageConfig](#memos-store-StorageConfig) + + - [Storage.Type](#memos-store-Storage-Type) + - [store/user_setting.proto](#store_user_setting-proto) - [AccessTokensUserSetting](#memos-store-AccessTokensUserSetting) - [AccessTokensUserSetting.AccessToken](#memos-store-AccessTokensUserSetting-AccessToken) @@ -37,6 +44,8 @@ - [Webhook](#memos-store-Webhook) - [store/workspace_setting.proto](#store_workspace_setting-proto) + - [WorkspaceBasicSetting](#memos-store-WorkspaceBasicSetting) + - [WorkspaceCustomProfile](#memos-store-WorkspaceCustomProfile) - [WorkspaceGeneralSetting](#memos-store-WorkspaceGeneralSetting) - [WorkspaceMemoRelatedSetting](#memos-store-WorkspaceMemoRelatedSetting) - [WorkspaceSetting](#memos-store-WorkspaceSetting) @@ -314,6 +323,90 @@ + +

Top

+ +## store/storage.proto + + + + + +### S3Config + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| end_point | [string](#string) | | | +| path | [string](#string) | | | +| region | [string](#string) | | | +| access_key | [string](#string) | | | +| secret_key | [string](#string) | | | +| bucket | [string](#string) | | | +| url_prefix | [string](#string) | | | +| url_suffix | [string](#string) | | | +| pre_sign | [bool](#bool) | | | + + + + + + + + +### Storage + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int32](#int32) | | | +| name | [string](#string) | | | +| type | [Storage.Type](#memos-store-Storage-Type) | | | +| config | [StorageConfig](#memos-store-StorageConfig) | | | + + + + + + + + +### StorageConfig + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| s3_config | [S3Config](#memos-store-S3Config) | | | + + + + + + + + + + +### Storage.Type + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| TYPE_UNSPECIFIED | 0 | | +| S3 | 1 | | + + + + + + + + + +

Top

@@ -442,6 +535,41 @@ + + +### WorkspaceBasicSetting + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| server_id | [string](#string) | | | +| secret_key | [string](#string) | | | + + + + + + + + +### WorkspaceCustomProfile + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| title | [string](#string) | | | +| description | [string](#string) | | | +| logo_url | [string](#string) | | | +| locale | [string](#string) | | | +| appearance | [string](#string) | | | + + + + + + ### WorkspaceGeneralSetting @@ -455,6 +583,7 @@ | disallow_password_login | [bool](#bool) | | disallow_password_login is the flag to disallow password login. | | additional_script | [string](#string) | | additional_script is the additional script. | | additional_style | [string](#string) | | additional_style is the additional style. | +| custom_profile | [WorkspaceCustomProfile](#memos-store-WorkspaceCustomProfile) | | custom_profile is the custom profile. | @@ -486,6 +615,7 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | key | [WorkspaceSettingKey](#memos-store-WorkspaceSettingKey) | | | +| basic_setting | [WorkspaceBasicSetting](#memos-store-WorkspaceBasicSetting) | | | | general_setting | [WorkspaceGeneralSetting](#memos-store-WorkspaceGeneralSetting) | | | | storage_setting | [WorkspaceStorageSetting](#memos-store-WorkspaceStorageSetting) | | | | memo_related_setting | [WorkspaceMemoRelatedSetting](#memos-store-WorkspaceMemoRelatedSetting) | | | @@ -505,6 +635,7 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | storage_type | [WorkspaceStorageSetting.StorageType](#memos-store-WorkspaceStorageSetting-StorageType) | | storage_type is the storage type. | +| actived_external_storage_id | [int32](#int32) | optional | The id of actived external storage. | | local_storage_path | [string](#string) | | The local storage path for STORAGE_TYPE_LOCAL. e.g. assets/{timestamp}_{filename} | | upload_size_limit_mb | [int64](#int64) | | The max upload size in megabytes. | @@ -538,10 +669,11 @@ | Name | Number | Description | | ---- | ------ | ----------- | | WORKSPACE_SETTING_KEY_UNSPECIFIED | 0 | | -| WORKSPACE_SETTING_GENERAL | 1 | WORKSPACE_SETTING_GENERAL is the key for general settings. | -| WORKSPACE_SETTING_STORAGE | 2 | WORKSPACE_SETTING_STORAGE is the key for storage settings. | -| WORKSPACE_SETTING_MEMO_RELATED | 3 | WORKSPACE_SETTING_MEMO_RELATED is the key for memo related settings. | -| WORKSPACE_SETTING_TELEGRAM_INTEGRATION | 4 | WORKSPACE_SETTING_TELEGRAM_INTEGRATION is the key for telegram integration settings. | +| WORKSPACE_SETTING_BASIC | 1 | WORKSPACE_SETTING_BASIC is the key for basic settings. | +| WORKSPACE_SETTING_GENERAL | 2 | WORKSPACE_SETTING_GENERAL is the key for general settings. | +| WORKSPACE_SETTING_STORAGE | 3 | WORKSPACE_SETTING_STORAGE is the key for storage settings. | +| WORKSPACE_SETTING_MEMO_RELATED | 4 | WORKSPACE_SETTING_MEMO_RELATED is the key for memo related settings. | +| WORKSPACE_SETTING_TELEGRAM_INTEGRATION | 5 | WORKSPACE_SETTING_TELEGRAM_INTEGRATION is the key for telegram integration settings. | diff --git a/proto/gen/store/storage.pb.go b/proto/gen/store/storage.pb.go new file mode 100644 index 000000000..3b6a118b2 --- /dev/null +++ b/proto/gen/store/storage.pb.go @@ -0,0 +1,465 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: store/storage.proto + +package store + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Storage_Type int32 + +const ( + Storage_TYPE_UNSPECIFIED Storage_Type = 0 + Storage_S3 Storage_Type = 1 +) + +// Enum value maps for Storage_Type. +var ( + Storage_Type_name = map[int32]string{ + 0: "TYPE_UNSPECIFIED", + 1: "S3", + } + Storage_Type_value = map[string]int32{ + "TYPE_UNSPECIFIED": 0, + "S3": 1, + } +) + +func (x Storage_Type) Enum() *Storage_Type { + p := new(Storage_Type) + *p = x + return p +} + +func (x Storage_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Storage_Type) Descriptor() protoreflect.EnumDescriptor { + return file_store_storage_proto_enumTypes[0].Descriptor() +} + +func (Storage_Type) Type() protoreflect.EnumType { + return &file_store_storage_proto_enumTypes[0] +} + +func (x Storage_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Storage_Type.Descriptor instead. +func (Storage_Type) EnumDescriptor() ([]byte, []int) { + return file_store_storage_proto_rawDescGZIP(), []int{0, 0} +} + +type Storage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Type Storage_Type `protobuf:"varint,3,opt,name=type,proto3,enum=memos.store.Storage_Type" json:"type,omitempty"` + Config *StorageConfig `protobuf:"bytes,4,opt,name=config,proto3" json:"config,omitempty"` +} + +func (x *Storage) Reset() { + *x = Storage{} + if protoimpl.UnsafeEnabled { + mi := &file_store_storage_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Storage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Storage) ProtoMessage() {} + +func (x *Storage) ProtoReflect() protoreflect.Message { + mi := &file_store_storage_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Storage.ProtoReflect.Descriptor instead. +func (*Storage) Descriptor() ([]byte, []int) { + return file_store_storage_proto_rawDescGZIP(), []int{0} +} + +func (x *Storage) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Storage) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Storage) GetType() Storage_Type { + if x != nil { + return x.Type + } + return Storage_TYPE_UNSPECIFIED +} + +func (x *Storage) GetConfig() *StorageConfig { + if x != nil { + return x.Config + } + return nil +} + +type StorageConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to StorageConfig: + // + // *StorageConfig_S3Config + StorageConfig isStorageConfig_StorageConfig `protobuf_oneof:"storage_config"` +} + +func (x *StorageConfig) Reset() { + *x = StorageConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_store_storage_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StorageConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StorageConfig) ProtoMessage() {} + +func (x *StorageConfig) ProtoReflect() protoreflect.Message { + mi := &file_store_storage_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StorageConfig.ProtoReflect.Descriptor instead. +func (*StorageConfig) Descriptor() ([]byte, []int) { + return file_store_storage_proto_rawDescGZIP(), []int{1} +} + +func (m *StorageConfig) GetStorageConfig() isStorageConfig_StorageConfig { + if m != nil { + return m.StorageConfig + } + return nil +} + +func (x *StorageConfig) GetS3Config() *S3Config { + if x, ok := x.GetStorageConfig().(*StorageConfig_S3Config); ok { + return x.S3Config + } + return nil +} + +type isStorageConfig_StorageConfig interface { + isStorageConfig_StorageConfig() +} + +type StorageConfig_S3Config struct { + S3Config *S3Config `protobuf:"bytes,1,opt,name=s3_config,json=s3Config,proto3,oneof"` +} + +func (*StorageConfig_S3Config) isStorageConfig_StorageConfig() {} + +type S3Config struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EndPoint string `protobuf:"bytes,1,opt,name=end_point,json=endPoint,proto3" json:"end_point,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"` + AccessKey string `protobuf:"bytes,4,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"` + SecretKey string `protobuf:"bytes,5,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"` + Bucket string `protobuf:"bytes,6,opt,name=bucket,proto3" json:"bucket,omitempty"` + UrlPrefix string `protobuf:"bytes,7,opt,name=url_prefix,json=urlPrefix,proto3" json:"url_prefix,omitempty"` + UrlSuffix string `protobuf:"bytes,8,opt,name=url_suffix,json=urlSuffix,proto3" json:"url_suffix,omitempty"` + PreSign bool `protobuf:"varint,9,opt,name=pre_sign,json=preSign,proto3" json:"pre_sign,omitempty"` +} + +func (x *S3Config) Reset() { + *x = S3Config{} + if protoimpl.UnsafeEnabled { + mi := &file_store_storage_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *S3Config) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*S3Config) ProtoMessage() {} + +func (x *S3Config) ProtoReflect() protoreflect.Message { + mi := &file_store_storage_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use S3Config.ProtoReflect.Descriptor instead. +func (*S3Config) Descriptor() ([]byte, []int) { + return file_store_storage_proto_rawDescGZIP(), []int{2} +} + +func (x *S3Config) GetEndPoint() string { + if x != nil { + return x.EndPoint + } + return "" +} + +func (x *S3Config) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *S3Config) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *S3Config) GetAccessKey() string { + if x != nil { + return x.AccessKey + } + return "" +} + +func (x *S3Config) GetSecretKey() string { + if x != nil { + return x.SecretKey + } + return "" +} + +func (x *S3Config) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *S3Config) GetUrlPrefix() string { + if x != nil { + return x.UrlPrefix + } + return "" +} + +func (x *S3Config) GetUrlSuffix() string { + if x != nil { + return x.UrlSuffix + } + return "" +} + +func (x *S3Config) GetPreSign() bool { + if x != nil { + return x.PreSign + } + return false +} + +var File_store_storage_proto protoreflect.FileDescriptor + +var file_store_storage_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x22, 0xb6, 0x01, 0x0a, 0x07, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x19, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x53, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x32, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x24, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, + 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x33, 0x10, 0x01, 0x22, 0x57, 0x0a, 0x0d, 0x53, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x34, 0x0a, 0x09, + 0x73, 0x33, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x33, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x08, 0x73, 0x33, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x42, 0x10, 0x0a, 0x0e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x22, 0x82, 0x02, 0x0a, 0x08, 0x53, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x63, + 0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x63, 0x6b, + 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, + 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x72, 0x6c, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x72, 0x6c, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, + 0x1d, 0x0a, 0x0a, 0x75, 0x72, 0x6c, 0x5f, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x72, 0x6c, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x19, + 0x0a, 0x08, 0x70, 0x72, 0x65, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x07, 0x70, 0x72, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x42, 0x97, 0x01, 0x0a, 0x0f, 0x63, 0x6f, + 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x0c, 0x53, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, + 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, + 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, + 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, + 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_store_storage_proto_rawDescOnce sync.Once + file_store_storage_proto_rawDescData = file_store_storage_proto_rawDesc +) + +func file_store_storage_proto_rawDescGZIP() []byte { + file_store_storage_proto_rawDescOnce.Do(func() { + file_store_storage_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_storage_proto_rawDescData) + }) + return file_store_storage_proto_rawDescData +} + +var file_store_storage_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_store_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_store_storage_proto_goTypes = []interface{}{ + (Storage_Type)(0), // 0: memos.store.Storage.Type + (*Storage)(nil), // 1: memos.store.Storage + (*StorageConfig)(nil), // 2: memos.store.StorageConfig + (*S3Config)(nil), // 3: memos.store.S3Config +} +var file_store_storage_proto_depIdxs = []int32{ + 0, // 0: memos.store.Storage.type:type_name -> memos.store.Storage.Type + 2, // 1: memos.store.Storage.config:type_name -> memos.store.StorageConfig + 3, // 2: memos.store.StorageConfig.s3_config:type_name -> memos.store.S3Config + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_store_storage_proto_init() } +func file_store_storage_proto_init() { + if File_store_storage_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_store_storage_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Storage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_store_storage_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StorageConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_store_storage_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*S3Config); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_store_storage_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*StorageConfig_S3Config)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_store_storage_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_store_storage_proto_goTypes, + DependencyIndexes: file_store_storage_proto_depIdxs, + EnumInfos: file_store_storage_proto_enumTypes, + MessageInfos: file_store_storage_proto_msgTypes, + }.Build() + File_store_storage_proto = out.File + file_store_storage_proto_rawDesc = nil + file_store_storage_proto_goTypes = nil + file_store_storage_proto_depIdxs = nil +} diff --git a/proto/gen/store/workspace_setting.pb.go b/proto/gen/store/workspace_setting.pb.go index a2e2be5d1..f45e4e9ac 100644 --- a/proto/gen/store/workspace_setting.pb.go +++ b/proto/gen/store/workspace_setting.pb.go @@ -24,31 +24,35 @@ type WorkspaceSettingKey int32 const ( WorkspaceSettingKey_WORKSPACE_SETTING_KEY_UNSPECIFIED WorkspaceSettingKey = 0 + // WORKSPACE_SETTING_BASIC is the key for basic settings. + WorkspaceSettingKey_WORKSPACE_SETTING_BASIC WorkspaceSettingKey = 1 // WORKSPACE_SETTING_GENERAL is the key for general settings. - WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL WorkspaceSettingKey = 1 + WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL WorkspaceSettingKey = 2 // WORKSPACE_SETTING_STORAGE is the key for storage settings. - WorkspaceSettingKey_WORKSPACE_SETTING_STORAGE WorkspaceSettingKey = 2 + WorkspaceSettingKey_WORKSPACE_SETTING_STORAGE WorkspaceSettingKey = 3 // WORKSPACE_SETTING_MEMO_RELATED is the key for memo related settings. - WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED WorkspaceSettingKey = 3 + WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED WorkspaceSettingKey = 4 // WORKSPACE_SETTING_TELEGRAM_INTEGRATION is the key for telegram integration settings. - WorkspaceSettingKey_WORKSPACE_SETTING_TELEGRAM_INTEGRATION WorkspaceSettingKey = 4 + WorkspaceSettingKey_WORKSPACE_SETTING_TELEGRAM_INTEGRATION WorkspaceSettingKey = 5 ) // Enum value maps for WorkspaceSettingKey. var ( WorkspaceSettingKey_name = map[int32]string{ 0: "WORKSPACE_SETTING_KEY_UNSPECIFIED", - 1: "WORKSPACE_SETTING_GENERAL", - 2: "WORKSPACE_SETTING_STORAGE", - 3: "WORKSPACE_SETTING_MEMO_RELATED", - 4: "WORKSPACE_SETTING_TELEGRAM_INTEGRATION", + 1: "WORKSPACE_SETTING_BASIC", + 2: "WORKSPACE_SETTING_GENERAL", + 3: "WORKSPACE_SETTING_STORAGE", + 4: "WORKSPACE_SETTING_MEMO_RELATED", + 5: "WORKSPACE_SETTING_TELEGRAM_INTEGRATION", } WorkspaceSettingKey_value = map[string]int32{ "WORKSPACE_SETTING_KEY_UNSPECIFIED": 0, - "WORKSPACE_SETTING_GENERAL": 1, - "WORKSPACE_SETTING_STORAGE": 2, - "WORKSPACE_SETTING_MEMO_RELATED": 3, - "WORKSPACE_SETTING_TELEGRAM_INTEGRATION": 4, + "WORKSPACE_SETTING_BASIC": 1, + "WORKSPACE_SETTING_GENERAL": 2, + "WORKSPACE_SETTING_STORAGE": 3, + "WORKSPACE_SETTING_MEMO_RELATED": 4, + "WORKSPACE_SETTING_TELEGRAM_INTEGRATION": 5, } ) @@ -131,7 +135,7 @@ func (x WorkspaceStorageSetting_StorageType) Number() protoreflect.EnumNumber { // Deprecated: Use WorkspaceStorageSetting_StorageType.Descriptor instead. func (WorkspaceStorageSetting_StorageType) EnumDescriptor() ([]byte, []int) { - return file_store_workspace_setting_proto_rawDescGZIP(), []int{2, 0} + return file_store_workspace_setting_proto_rawDescGZIP(), []int{4, 0} } type WorkspaceSetting struct { @@ -142,6 +146,7 @@ type WorkspaceSetting struct { Key WorkspaceSettingKey `protobuf:"varint,1,opt,name=key,proto3,enum=memos.store.WorkspaceSettingKey" json:"key,omitempty"` // Types that are assignable to Value: // + // *WorkspaceSetting_BasicSetting // *WorkspaceSetting_GeneralSetting // *WorkspaceSetting_StorageSetting // *WorkspaceSetting_MemoRelatedSetting @@ -195,6 +200,13 @@ func (m *WorkspaceSetting) GetValue() isWorkspaceSetting_Value { return nil } +func (x *WorkspaceSetting) GetBasicSetting() *WorkspaceBasicSetting { + if x, ok := x.GetValue().(*WorkspaceSetting_BasicSetting); ok { + return x.BasicSetting + } + return nil +} + func (x *WorkspaceSetting) GetGeneralSetting() *WorkspaceGeneralSetting { if x, ok := x.GetValue().(*WorkspaceSetting_GeneralSetting); ok { return x.GeneralSetting @@ -227,22 +239,28 @@ type isWorkspaceSetting_Value interface { isWorkspaceSetting_Value() } +type WorkspaceSetting_BasicSetting struct { + BasicSetting *WorkspaceBasicSetting `protobuf:"bytes,2,opt,name=basic_setting,json=basicSetting,proto3,oneof"` +} + type WorkspaceSetting_GeneralSetting struct { - GeneralSetting *WorkspaceGeneralSetting `protobuf:"bytes,2,opt,name=general_setting,json=generalSetting,proto3,oneof"` + GeneralSetting *WorkspaceGeneralSetting `protobuf:"bytes,3,opt,name=general_setting,json=generalSetting,proto3,oneof"` } type WorkspaceSetting_StorageSetting struct { - StorageSetting *WorkspaceStorageSetting `protobuf:"bytes,3,opt,name=storage_setting,json=storageSetting,proto3,oneof"` + StorageSetting *WorkspaceStorageSetting `protobuf:"bytes,4,opt,name=storage_setting,json=storageSetting,proto3,oneof"` } type WorkspaceSetting_MemoRelatedSetting struct { - MemoRelatedSetting *WorkspaceMemoRelatedSetting `protobuf:"bytes,4,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"` + MemoRelatedSetting *WorkspaceMemoRelatedSetting `protobuf:"bytes,5,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"` } type WorkspaceSetting_TelegramIntegrationSetting struct { - TelegramIntegrationSetting *WorkspaceTelegramIntegrationSetting `protobuf:"bytes,5,opt,name=telegram_integration_setting,json=telegramIntegrationSetting,proto3,oneof"` + TelegramIntegrationSetting *WorkspaceTelegramIntegrationSetting `protobuf:"bytes,6,opt,name=telegram_integration_setting,json=telegramIntegrationSetting,proto3,oneof"` } +func (*WorkspaceSetting_BasicSetting) isWorkspaceSetting_Value() {} + func (*WorkspaceSetting_GeneralSetting) isWorkspaceSetting_Value() {} func (*WorkspaceSetting_StorageSetting) isWorkspaceSetting_Value() {} @@ -251,6 +269,61 @@ func (*WorkspaceSetting_MemoRelatedSetting) isWorkspaceSetting_Value() {} func (*WorkspaceSetting_TelegramIntegrationSetting) isWorkspaceSetting_Value() {} +type WorkspaceBasicSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerId string `protobuf:"bytes,1,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` + SecretKey string `protobuf:"bytes,2,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"` +} + +func (x *WorkspaceBasicSetting) Reset() { + *x = WorkspaceBasicSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_store_workspace_setting_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WorkspaceBasicSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WorkspaceBasicSetting) ProtoMessage() {} + +func (x *WorkspaceBasicSetting) ProtoReflect() protoreflect.Message { + mi := &file_store_workspace_setting_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkspaceBasicSetting.ProtoReflect.Descriptor instead. +func (*WorkspaceBasicSetting) Descriptor() ([]byte, []int) { + return file_store_workspace_setting_proto_rawDescGZIP(), []int{1} +} + +func (x *WorkspaceBasicSetting) GetServerId() string { + if x != nil { + return x.ServerId + } + return "" +} + +func (x *WorkspaceBasicSetting) GetSecretKey() string { + if x != nil { + return x.SecretKey + } + return "" +} + type WorkspaceGeneralSetting struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -266,12 +339,14 @@ type WorkspaceGeneralSetting struct { AdditionalScript string `protobuf:"bytes,5,opt,name=additional_script,json=additionalScript,proto3" json:"additional_script,omitempty"` // additional_style is the additional style. AdditionalStyle string `protobuf:"bytes,6,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"` + // custom_profile is the custom profile. + CustomProfile *WorkspaceCustomProfile `protobuf:"bytes,4,opt,name=custom_profile,json=customProfile,proto3" json:"custom_profile,omitempty"` } func (x *WorkspaceGeneralSetting) Reset() { *x = WorkspaceGeneralSetting{} if protoimpl.UnsafeEnabled { - mi := &file_store_workspace_setting_proto_msgTypes[1] + mi := &file_store_workspace_setting_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -284,7 +359,7 @@ func (x *WorkspaceGeneralSetting) String() string { func (*WorkspaceGeneralSetting) ProtoMessage() {} func (x *WorkspaceGeneralSetting) ProtoReflect() protoreflect.Message { - mi := &file_store_workspace_setting_proto_msgTypes[1] + mi := &file_store_workspace_setting_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -297,7 +372,7 @@ func (x *WorkspaceGeneralSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkspaceGeneralSetting.ProtoReflect.Descriptor instead. func (*WorkspaceGeneralSetting) Descriptor() ([]byte, []int) { - return file_store_workspace_setting_proto_rawDescGZIP(), []int{1} + return file_store_workspace_setting_proto_rawDescGZIP(), []int{2} } func (x *WorkspaceGeneralSetting) GetInstanceUrl() string { @@ -335,6 +410,92 @@ func (x *WorkspaceGeneralSetting) GetAdditionalStyle() string { return "" } +func (x *WorkspaceGeneralSetting) GetCustomProfile() *WorkspaceCustomProfile { + if x != nil { + return x.CustomProfile + } + return nil +} + +type WorkspaceCustomProfile struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + LogoUrl string `protobuf:"bytes,3,opt,name=logo_url,json=logoUrl,proto3" json:"logo_url,omitempty"` + Locale string `protobuf:"bytes,4,opt,name=locale,proto3" json:"locale,omitempty"` + Appearance string `protobuf:"bytes,5,opt,name=appearance,proto3" json:"appearance,omitempty"` +} + +func (x *WorkspaceCustomProfile) Reset() { + *x = WorkspaceCustomProfile{} + if protoimpl.UnsafeEnabled { + mi := &file_store_workspace_setting_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WorkspaceCustomProfile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WorkspaceCustomProfile) ProtoMessage() {} + +func (x *WorkspaceCustomProfile) ProtoReflect() protoreflect.Message { + mi := &file_store_workspace_setting_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkspaceCustomProfile.ProtoReflect.Descriptor instead. +func (*WorkspaceCustomProfile) Descriptor() ([]byte, []int) { + return file_store_workspace_setting_proto_rawDescGZIP(), []int{3} +} + +func (x *WorkspaceCustomProfile) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *WorkspaceCustomProfile) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *WorkspaceCustomProfile) GetLogoUrl() string { + if x != nil { + return x.LogoUrl + } + return "" +} + +func (x *WorkspaceCustomProfile) GetLocale() string { + if x != nil { + return x.Locale + } + return "" +} + +func (x *WorkspaceCustomProfile) GetAppearance() string { + if x != nil { + return x.Appearance + } + return "" +} + type WorkspaceStorageSetting struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -342,17 +503,19 @@ type WorkspaceStorageSetting struct { // storage_type is the storage type. StorageType WorkspaceStorageSetting_StorageType `protobuf:"varint,1,opt,name=storage_type,json=storageType,proto3,enum=memos.store.WorkspaceStorageSetting_StorageType" json:"storage_type,omitempty"` + // The id of actived external storage. + ActivedExternalStorageId *int32 `protobuf:"varint,2,opt,name=actived_external_storage_id,json=activedExternalStorageId,proto3,oneof" json:"actived_external_storage_id,omitempty"` // The local storage path for STORAGE_TYPE_LOCAL. // e.g. assets/{timestamp}_{filename} - LocalStoragePath string `protobuf:"bytes,2,opt,name=local_storage_path,json=localStoragePath,proto3" json:"local_storage_path,omitempty"` + LocalStoragePath string `protobuf:"bytes,3,opt,name=local_storage_path,json=localStoragePath,proto3" json:"local_storage_path,omitempty"` // The max upload size in megabytes. - UploadSizeLimitMb int64 `protobuf:"varint,3,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"` + UploadSizeLimitMb int64 `protobuf:"varint,4,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"` } func (x *WorkspaceStorageSetting) Reset() { *x = WorkspaceStorageSetting{} if protoimpl.UnsafeEnabled { - mi := &file_store_workspace_setting_proto_msgTypes[2] + mi := &file_store_workspace_setting_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -365,7 +528,7 @@ func (x *WorkspaceStorageSetting) String() string { func (*WorkspaceStorageSetting) ProtoMessage() {} func (x *WorkspaceStorageSetting) ProtoReflect() protoreflect.Message { - mi := &file_store_workspace_setting_proto_msgTypes[2] + mi := &file_store_workspace_setting_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -378,7 +541,7 @@ func (x *WorkspaceStorageSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkspaceStorageSetting.ProtoReflect.Descriptor instead. func (*WorkspaceStorageSetting) Descriptor() ([]byte, []int) { - return file_store_workspace_setting_proto_rawDescGZIP(), []int{2} + return file_store_workspace_setting_proto_rawDescGZIP(), []int{4} } func (x *WorkspaceStorageSetting) GetStorageType() WorkspaceStorageSetting_StorageType { @@ -388,6 +551,13 @@ func (x *WorkspaceStorageSetting) GetStorageType() WorkspaceStorageSetting_Stora return WorkspaceStorageSetting_STORAGE_TYPE_UNSPECIFIED } +func (x *WorkspaceStorageSetting) GetActivedExternalStorageId() int32 { + if x != nil && x.ActivedExternalStorageId != nil { + return *x.ActivedExternalStorageId + } + return 0 +} + func (x *WorkspaceStorageSetting) GetLocalStoragePath() string { if x != nil { return x.LocalStoragePath @@ -416,7 +586,7 @@ type WorkspaceMemoRelatedSetting struct { func (x *WorkspaceMemoRelatedSetting) Reset() { *x = WorkspaceMemoRelatedSetting{} if protoimpl.UnsafeEnabled { - mi := &file_store_workspace_setting_proto_msgTypes[3] + mi := &file_store_workspace_setting_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -429,7 +599,7 @@ func (x *WorkspaceMemoRelatedSetting) String() string { func (*WorkspaceMemoRelatedSetting) ProtoMessage() {} func (x *WorkspaceMemoRelatedSetting) ProtoReflect() protoreflect.Message { - mi := &file_store_workspace_setting_proto_msgTypes[3] + mi := &file_store_workspace_setting_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -442,7 +612,7 @@ func (x *WorkspaceMemoRelatedSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkspaceMemoRelatedSetting.ProtoReflect.Descriptor instead. func (*WorkspaceMemoRelatedSetting) Descriptor() ([]byte, []int) { - return file_store_workspace_setting_proto_rawDescGZIP(), []int{3} + return file_store_workspace_setting_proto_rawDescGZIP(), []int{5} } func (x *WorkspaceMemoRelatedSetting) GetDisallowPublicVisible() bool { @@ -471,7 +641,7 @@ type WorkspaceTelegramIntegrationSetting struct { func (x *WorkspaceTelegramIntegrationSetting) Reset() { *x = WorkspaceTelegramIntegrationSetting{} if protoimpl.UnsafeEnabled { - mi := &file_store_workspace_setting_proto_msgTypes[4] + mi := &file_store_workspace_setting_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -484,7 +654,7 @@ func (x *WorkspaceTelegramIntegrationSetting) String() string { func (*WorkspaceTelegramIntegrationSetting) ProtoMessage() {} func (x *WorkspaceTelegramIntegrationSetting) ProtoReflect() protoreflect.Message { - mi := &file_store_workspace_setting_proto_msgTypes[4] + mi := &file_store_workspace_setting_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -497,7 +667,7 @@ func (x *WorkspaceTelegramIntegrationSetting) ProtoReflect() protoreflect.Messag // Deprecated: Use WorkspaceTelegramIntegrationSetting.ProtoReflect.Descriptor instead. func (*WorkspaceTelegramIntegrationSetting) Descriptor() ([]byte, []int) { - return file_store_workspace_setting_proto_rawDescGZIP(), []int{4} + return file_store_workspace_setting_proto_rawDescGZIP(), []int{6} } func (x *WorkspaceTelegramIntegrationSetting) GetBotToken() string { @@ -512,36 +682,46 @@ var File_store_workspace_setting_proto protoreflect.FileDescriptor var file_store_workspace_setting_proto_rawDesc = []byte{ 0x0a, 0x1d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0xc5, 0x03, 0x0a, + 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x90, 0x04, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x32, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x4f, 0x0a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, - 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x0e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x4f, 0x0a, 0x0f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x5c, 0x0a, 0x14, 0x6d, 0x65, 0x6d, 0x6f, 0x5f, - 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, - 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, - 0x00, 0x52, 0x12, 0x6d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x74, 0x0a, 0x1c, 0x74, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, - 0x6d, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x54, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, - 0x1a, 0x74, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x07, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0xf5, 0x01, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x49, 0x0a, 0x0d, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x73, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x42, 0x61, 0x73, 0x69, 0x63, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x48, 0x00, 0x52, 0x0c, 0x62, 0x61, 0x73, 0x69, 0x63, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x12, 0x4f, 0x0a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, + 0x00, 0x52, 0x0e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x12, 0x4f, 0x0a, 0x0f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x48, 0x00, 0x52, 0x0e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x12, 0x5c, 0x0a, 0x14, 0x6d, 0x65, 0x6d, 0x6f, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, + 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, + 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x12, 0x6d, 0x65, + 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x12, 0x74, 0x0a, 0x1c, 0x74, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x6d, 0x5f, 0x69, 0x6e, 0x74, + 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, + 0x6c, 0x65, 0x67, 0x72, 0x61, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x1a, 0x74, 0x65, 0x6c, 0x65, + 0x67, 0x72, 0x61, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x53, 0x0a, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x61, 0x73, 0x69, + 0x63, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x4b, 0x65, 0x79, 0x22, 0xc1, 0x02, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, @@ -556,65 +736,88 @@ var file_store_workspace_setting_proto_rawDesc = []byte{ 0x10, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x64, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x22, 0xc8, 0x02, 0x0a, - 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x53, 0x0a, 0x0c, 0x73, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2c, 0x0a, - 0x12, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x70, - 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x2f, 0x0a, 0x14, 0x75, - 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x5f, 0x6d, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x75, 0x70, 0x6c, 0x6f, 0x61, - 0x64, 0x53, 0x69, 0x7a, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x4d, 0x62, 0x22, 0x79, 0x0a, 0x0b, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x53, - 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x54, 0x4f, - 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, - 0x53, 0x45, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, - 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, - 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x03, 0x22, 0x8e, 0x01, 0x0a, 0x1b, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x36, 0x0a, 0x17, 0x64, 0x69, 0x73, 0x61, 0x6c, - 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, - 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, - 0x6f, 0x77, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x56, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x12, - 0x37, 0x0a, 0x18, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x57, 0x69, 0x74, 0x68, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x42, 0x0a, 0x23, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x6d, 0x49, 0x6e, 0x74, - 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, - 0x1b, 0x0a, 0x09, 0x62, 0x6f, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x62, 0x6f, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2a, 0xca, 0x01, 0x0a, - 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, - 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x57, - 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, - 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x57, 0x4f, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x12, 0x4a, 0x0a, 0x0e, + 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x43, 0x75, 0x73, 0x74, + 0x6f, 0x6d, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x0d, 0x63, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x22, 0xa3, 0x01, 0x0a, 0x16, 0x57, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x50, 0x72, 0x6f, 0x66, + 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6c, + 0x6f, 0x67, 0x6f, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6c, + 0x6f, 0x67, 0x6f, 0x55, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x22, 0xac, + 0x03, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x53, 0x0a, 0x0c, 0x73, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x30, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, + 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x42, 0x0a, 0x1b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x64, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x18, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x64, 0x45, + 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x49, 0x64, + 0x88, 0x01, 0x01, 0x12, 0x2c, 0x0a, 0x12, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x50, 0x61, 0x74, + 0x68, 0x12, 0x2f, 0x0a, 0x14, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, + 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x6d, 0x62, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x11, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, + 0x4d, 0x62, 0x22, 0x79, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x19, 0x0a, 0x15, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, + 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, + 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x03, 0x42, 0x1e, 0x0a, + 0x1c, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x64, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x22, 0x8e, 0x01, + 0x0a, 0x1b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, + 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x36, 0x0a, + 0x17, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, + 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x56, 0x69, + 0x73, 0x69, 0x62, 0x6c, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x57, 0x69, 0x74, 0x68, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x42, + 0x0a, 0x23, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6c, 0x65, 0x67, + 0x72, 0x61, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x6f, 0x74, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6f, 0x74, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x2a, 0xe7, 0x01, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, - 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, 0x02, 0x12, 0x22, 0x0a, 0x1e, 0x57, 0x4f, 0x52, - 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4d, - 0x45, 0x4d, 0x4f, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x2a, 0x0a, - 0x26, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, - 0x4e, 0x47, 0x5f, 0x54, 0x45, 0x4c, 0x45, 0x47, 0x52, 0x41, 0x4d, 0x5f, 0x49, 0x4e, 0x54, 0x45, - 0x47, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x42, 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x6f, - 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x15, 0x57, - 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, - 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, - 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, + 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x42, 0x41, 0x53, 0x49, 0x43, 0x10, 0x01, 0x12, 0x1d, + 0x0a, 0x19, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, + 0x49, 0x4e, 0x47, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x1d, 0x0a, + 0x19, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, + 0x4e, 0x47, 0x5f, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, 0x22, 0x0a, 0x1e, + 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, + 0x47, 0x5f, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x04, + 0x12, 0x2a, 0x0a, 0x26, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, + 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x54, 0x45, 0x4c, 0x45, 0x47, 0x52, 0x41, 0x4d, 0x5f, 0x49, + 0x4e, 0x54, 0x45, 0x47, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x05, 0x42, 0xa0, 0x01, 0x0a, + 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x42, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, + 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, + 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -630,28 +833,32 @@ func file_store_workspace_setting_proto_rawDescGZIP() []byte { } var file_store_workspace_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_store_workspace_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_store_workspace_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_store_workspace_setting_proto_goTypes = []interface{}{ (WorkspaceSettingKey)(0), // 0: memos.store.WorkspaceSettingKey (WorkspaceStorageSetting_StorageType)(0), // 1: memos.store.WorkspaceStorageSetting.StorageType (*WorkspaceSetting)(nil), // 2: memos.store.WorkspaceSetting - (*WorkspaceGeneralSetting)(nil), // 3: memos.store.WorkspaceGeneralSetting - (*WorkspaceStorageSetting)(nil), // 4: memos.store.WorkspaceStorageSetting - (*WorkspaceMemoRelatedSetting)(nil), // 5: memos.store.WorkspaceMemoRelatedSetting - (*WorkspaceTelegramIntegrationSetting)(nil), // 6: memos.store.WorkspaceTelegramIntegrationSetting + (*WorkspaceBasicSetting)(nil), // 3: memos.store.WorkspaceBasicSetting + (*WorkspaceGeneralSetting)(nil), // 4: memos.store.WorkspaceGeneralSetting + (*WorkspaceCustomProfile)(nil), // 5: memos.store.WorkspaceCustomProfile + (*WorkspaceStorageSetting)(nil), // 6: memos.store.WorkspaceStorageSetting + (*WorkspaceMemoRelatedSetting)(nil), // 7: memos.store.WorkspaceMemoRelatedSetting + (*WorkspaceTelegramIntegrationSetting)(nil), // 8: memos.store.WorkspaceTelegramIntegrationSetting } var file_store_workspace_setting_proto_depIdxs = []int32{ 0, // 0: memos.store.WorkspaceSetting.key:type_name -> memos.store.WorkspaceSettingKey - 3, // 1: memos.store.WorkspaceSetting.general_setting:type_name -> memos.store.WorkspaceGeneralSetting - 4, // 2: memos.store.WorkspaceSetting.storage_setting:type_name -> memos.store.WorkspaceStorageSetting - 5, // 3: memos.store.WorkspaceSetting.memo_related_setting:type_name -> memos.store.WorkspaceMemoRelatedSetting - 6, // 4: memos.store.WorkspaceSetting.telegram_integration_setting:type_name -> memos.store.WorkspaceTelegramIntegrationSetting - 1, // 5: memos.store.WorkspaceStorageSetting.storage_type:type_name -> memos.store.WorkspaceStorageSetting.StorageType - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 3, // 1: memos.store.WorkspaceSetting.basic_setting:type_name -> memos.store.WorkspaceBasicSetting + 4, // 2: memos.store.WorkspaceSetting.general_setting:type_name -> memos.store.WorkspaceGeneralSetting + 6, // 3: memos.store.WorkspaceSetting.storage_setting:type_name -> memos.store.WorkspaceStorageSetting + 7, // 4: memos.store.WorkspaceSetting.memo_related_setting:type_name -> memos.store.WorkspaceMemoRelatedSetting + 8, // 5: memos.store.WorkspaceSetting.telegram_integration_setting:type_name -> memos.store.WorkspaceTelegramIntegrationSetting + 5, // 6: memos.store.WorkspaceGeneralSetting.custom_profile:type_name -> memos.store.WorkspaceCustomProfile + 1, // 7: memos.store.WorkspaceStorageSetting.storage_type:type_name -> memos.store.WorkspaceStorageSetting.StorageType + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_store_workspace_setting_proto_init() } @@ -673,7 +880,7 @@ func file_store_workspace_setting_proto_init() { } } file_store_workspace_setting_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WorkspaceGeneralSetting); i { + switch v := v.(*WorkspaceBasicSetting); i { case 0: return &v.state case 1: @@ -685,7 +892,7 @@ func file_store_workspace_setting_proto_init() { } } file_store_workspace_setting_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WorkspaceStorageSetting); i { + switch v := v.(*WorkspaceGeneralSetting); i { case 0: return &v.state case 1: @@ -697,7 +904,7 @@ func file_store_workspace_setting_proto_init() { } } file_store_workspace_setting_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WorkspaceMemoRelatedSetting); i { + switch v := v.(*WorkspaceCustomProfile); i { case 0: return &v.state case 1: @@ -709,6 +916,30 @@ func file_store_workspace_setting_proto_init() { } } file_store_workspace_setting_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WorkspaceStorageSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_store_workspace_setting_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WorkspaceMemoRelatedSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_store_workspace_setting_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WorkspaceTelegramIntegrationSetting); i { case 0: return &v.state @@ -722,18 +953,20 @@ func file_store_workspace_setting_proto_init() { } } file_store_workspace_setting_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*WorkspaceSetting_BasicSetting)(nil), (*WorkspaceSetting_GeneralSetting)(nil), (*WorkspaceSetting_StorageSetting)(nil), (*WorkspaceSetting_MemoRelatedSetting)(nil), (*WorkspaceSetting_TelegramIntegrationSetting)(nil), } + file_store_workspace_setting_proto_msgTypes[4].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_store_workspace_setting_proto_rawDesc, NumEnums: 2, - NumMessages: 5, + NumMessages: 7, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/store/storage.proto b/proto/store/storage.proto new file mode 100644 index 000000000..675ab5d5c --- /dev/null +++ b/proto/store/storage.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; + +package memos.store; + +option go_package = "gen/store"; + +message Storage { + int32 id = 1; + string name = 2; + + enum Type { + TYPE_UNSPECIFIED = 0; + S3 = 1; + } + Type type = 3; + StorageConfig config = 4; +} + +message StorageConfig { + oneof storage_config { + S3Config s3_config = 1; + } +} + +message S3Config { + string end_point = 1; + string path = 2; + string region = 3; + string access_key = 4; + string secret_key = 5; + string bucket = 6; + string url_prefix = 7; + string url_suffix = 8; + bool pre_sign = 9; +} diff --git a/proto/store/workspace_setting.proto b/proto/store/workspace_setting.proto index 32fc10142..2127f96df 100644 --- a/proto/store/workspace_setting.proto +++ b/proto/store/workspace_setting.proto @@ -6,26 +6,34 @@ option go_package = "gen/store"; enum WorkspaceSettingKey { WORKSPACE_SETTING_KEY_UNSPECIFIED = 0; + // WORKSPACE_SETTING_BASIC is the key for basic settings. + WORKSPACE_SETTING_BASIC = 1; // WORKSPACE_SETTING_GENERAL is the key for general settings. - WORKSPACE_SETTING_GENERAL = 1; + WORKSPACE_SETTING_GENERAL = 2; // WORKSPACE_SETTING_STORAGE is the key for storage settings. - WORKSPACE_SETTING_STORAGE = 2; + WORKSPACE_SETTING_STORAGE = 3; // WORKSPACE_SETTING_MEMO_RELATED is the key for memo related settings. - WORKSPACE_SETTING_MEMO_RELATED = 3; + WORKSPACE_SETTING_MEMO_RELATED = 4; // WORKSPACE_SETTING_TELEGRAM_INTEGRATION is the key for telegram integration settings. - WORKSPACE_SETTING_TELEGRAM_INTEGRATION = 4; + WORKSPACE_SETTING_TELEGRAM_INTEGRATION = 5; } message WorkspaceSetting { WorkspaceSettingKey key = 1; oneof value { - WorkspaceGeneralSetting general_setting = 2; - WorkspaceStorageSetting storage_setting = 3; - WorkspaceMemoRelatedSetting memo_related_setting = 4; - WorkspaceTelegramIntegrationSetting telegram_integration_setting = 5; + WorkspaceBasicSetting basic_setting = 2; + WorkspaceGeneralSetting general_setting = 3; + WorkspaceStorageSetting storage_setting = 4; + WorkspaceMemoRelatedSetting memo_related_setting = 5; + WorkspaceTelegramIntegrationSetting telegram_integration_setting = 6; } } +message WorkspaceBasicSetting { + string server_id = 1; + string secret_key = 2; +} + message WorkspaceGeneralSetting { // instance_url is the instance URL. string instance_url = 1; @@ -37,16 +45,28 @@ message WorkspaceGeneralSetting { string additional_script = 5; // additional_style is the additional style. string additional_style = 6; + // custom_profile is the custom profile. + WorkspaceCustomProfile custom_profile = 4; +} + +message WorkspaceCustomProfile { + string title = 1; + string description = 2; + string logo_url = 3; + string locale = 4; + string appearance = 5; } message WorkspaceStorageSetting { // storage_type is the storage type. StorageType storage_type = 1; + // The id of actived external storage. + optional int32 actived_external_storage_id = 2; // The local storage path for STORAGE_TYPE_LOCAL. // e.g. assets/{timestamp}_{filename} - string local_storage_path = 2; + string local_storage_path = 3; // The max upload size in megabytes. - int64 upload_size_limit_mb = 3; + int64 upload_size_limit_mb = 4; enum StorageType { STORAGE_TYPE_UNSPECIFIED = 0; diff --git a/server/integration/telegram.go b/server/integration/telegram.go index c19e7cbb0..7c5a05cb7 100644 --- a/server/integration/telegram.go +++ b/server/integration/telegram.go @@ -3,7 +3,6 @@ package integration import ( "bytes" "context" - "encoding/json" "fmt" "path/filepath" "slices" @@ -34,10 +33,10 @@ func NewTelegramHandler(store *store.Store) *TelegramHandler { } func (t *TelegramHandler) BotToken(ctx context.Context) string { - if setting, err := t.store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ - Name: apiv1.SystemSettingTelegramBotTokenName.String(), - }); err == nil && setting != nil { - return setting.Value + if workspaceSetting, err := t.store.GetWorkspaceSettingV1(ctx, &store.FindWorkspaceSetting{ + Name: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_TELEGRAM_INTEGRATION.String(), + }); err == nil && workspaceSetting != nil { + return workspaceSetting.GetTelegramIntegrationSetting().BotToken } return "" } @@ -170,21 +169,12 @@ func (t *TelegramHandler) CallbackQueryHandle(ctx context.Context, bot *telegram return bot.AnswerCallbackQuery(ctx, callbackQuery.ID, fmt.Sprintf("Memo %d not found, possibly deleted elsewhere", memoID)) } - setting, err := t.store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ - Name: apiv1.SystemSettingDisablePublicMemosName.String(), - }) + workspaceMemoRelatedSetting, err := t.store.GetWorkspaceMemoRelatedSetting(ctx) if err != nil { return bot.AnswerCallbackQuery(ctx, callbackQuery.ID, fmt.Sprintf("Failed to get workspace setting %s", err)) } - if setting != nil && setting.Value != "" { - disablePublicMemo := false - err = json.Unmarshal([]byte(setting.Value), &disablePublicMemo) - if err != nil { - return bot.AnswerCallbackQuery(ctx, callbackQuery.ID, fmt.Sprintf("Failed to get workspace setting %s", err)) - } - if disablePublicMemo && visibility == store.Public { - return bot.AnswerCallbackQuery(ctx, callbackQuery.ID, fmt.Sprintf("Failed to changing Memo %d to %s\n(workspace disallowed public memo)", memoID, visibility)) - } + if workspaceMemoRelatedSetting.DisallowPublicVisible && visibility == store.Public { + return bot.AnswerCallbackQuery(ctx, callbackQuery.ID, fmt.Sprintf("Failed to changing Memo %d to %s\n(workspace disallowed public memo)", memoID, visibility)) } update := store.UpdateMemo{ diff --git a/server/route/api/v1/memo.go b/server/route/api/v1/memo.go index 08003ea01..0b92121d0 100644 --- a/server/route/api/v1/memo.go +++ b/server/route/api/v1/memo.go @@ -202,14 +202,6 @@ func (s *APIV1Service) GetMemoList(c echo.Context) error { find.Offset = &offset } - memoDisplayWithUpdatedTs, err := s.getMemoDisplayWithUpdatedTsSettingValue(ctx) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to get memo display with updated ts setting value").SetInternal(err) - } - if memoDisplayWithUpdatedTs { - find.OrderByUpdatedTs = true - } - list, err := s.Store.ListMemos(ctx, find) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch memo list").SetInternal(err) @@ -274,36 +266,6 @@ func (s *APIV1Service) CreateMemo(c echo.Context) error { } } - // Find disable public memos system setting. - disablePublicMemosSystemSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ - Name: SystemSettingDisablePublicMemosName.String(), - }) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find system setting").SetInternal(err) - } - if disablePublicMemosSystemSetting != nil { - disablePublicMemos := false - err = json.Unmarshal([]byte(disablePublicMemosSystemSetting.Value), &disablePublicMemos) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to unmarshal system setting").SetInternal(err) - } - if disablePublicMemos { - user, err := s.Store.GetUser(ctx, &store.FindUser{ - ID: &userID, - }) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find user").SetInternal(err) - } - if user == nil { - return echo.NewHTTPError(http.StatusNotFound, "User not found") - } - // Enforce normal user to create private memo if public memos are disabled. - if user.Role == store.RoleUser { - createMemoRequest.Visibility = Private - } - } - } - createMemoRequest.CreatorID = userID memo, err := s.Store.CreateMemo(ctx, convertCreateMemoRequestToMemoMessage(createMemoRequest)) if err != nil { @@ -444,14 +406,6 @@ func (s *APIV1Service) GetAllMemos(c echo.Context) error { normalStatus := store.Normal memoFind.RowStatus = &normalStatus - memoDisplayWithUpdatedTs, err := s.getMemoDisplayWithUpdatedTsSettingValue(ctx) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to get memo display with updated ts setting value").SetInternal(err) - } - if memoDisplayWithUpdatedTs { - memoFind.OrderByUpdatedTs = true - } - list, err := s.Store.ListMemos(ctx, memoFind) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch all memo list").SetInternal(err) @@ -512,28 +466,14 @@ func (s *APIV1Service) GetMemoStats(c echo.Context) error { } } - memoDisplayWithUpdatedTs, err := s.getMemoDisplayWithUpdatedTsSettingValue(ctx) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to get memo display with updated ts setting value").SetInternal(err) - } - if memoDisplayWithUpdatedTs { - findMemoMessage.OrderByUpdatedTs = true - } - list, err := s.Store.ListMemos(ctx, findMemoMessage) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find memo list").SetInternal(err) } displayTsList := []int64{} - if memoDisplayWithUpdatedTs { - for _, memo := range list { - displayTsList = append(displayTsList, memo.UpdatedTs) - } - } else { - for _, memo := range list { - displayTsList = append(displayTsList, memo.CreatedTs) - } + for _, memo := range list { + displayTsList = append(displayTsList, memo.CreatedTs) } return c.JSON(http.StatusOK, displayTsList) } @@ -704,40 +644,6 @@ func (s *APIV1Service) UpdateMemo(c echo.Context) error { rowStatus := store.RowStatus(patchMemoRequest.RowStatus.String()) updateMemoMessage.RowStatus = &rowStatus } - if patchMemoRequest.Visibility != nil { - visibility := store.Visibility(patchMemoRequest.Visibility.String()) - updateMemoMessage.Visibility = &visibility - // Find disable public memos system setting. - disablePublicMemosSystemSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ - Name: SystemSettingDisablePublicMemosName.String(), - }) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find system setting").SetInternal(err) - } - if disablePublicMemosSystemSetting != nil { - disablePublicMemos := false - err = json.Unmarshal([]byte(disablePublicMemosSystemSetting.Value), &disablePublicMemos) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to unmarshal system setting").SetInternal(err) - } - if disablePublicMemos { - user, err := s.Store.GetUser(ctx, &store.FindUser{ - ID: &userID, - }) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find user").SetInternal(err) - } - if user == nil { - return echo.NewHTTPError(http.StatusNotFound, "User not found") - } - // Enforce normal user to save as private memo if public memos are disabled. - if user.Role == store.RoleUser { - visibility = store.Visibility("PRIVATE") - updateMemoMessage.Visibility = &visibility - } - } - } - } err = s.Store.UpdateMemo(ctx, updateMemoMessage) if err != nil { @@ -853,14 +759,6 @@ func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Mem // Compose display ts. memoMessage.DisplayTs = memoMessage.CreatedTs - // Find memo display with updated ts setting. - memoDisplayWithUpdatedTs, err := s.getMemoDisplayWithUpdatedTsSettingValue(ctx) - if err != nil { - return nil, err - } - if memoDisplayWithUpdatedTs { - memoMessage.DisplayTs = memoMessage.UpdatedTs - } // Compose related resources. resourceList, err := s.Store.ListResources(ctx, &store.FindResource{ @@ -898,23 +796,6 @@ func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Mem return memoMessage, nil } -func (s *APIV1Service) getMemoDisplayWithUpdatedTsSettingValue(ctx context.Context) (bool, error) { - memoDisplayWithUpdatedTsSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ - Name: SystemSettingMemoDisplayWithUpdatedTsName.String(), - }) - if err != nil { - return false, errors.Wrap(err, "failed to find system setting") - } - memoDisplayWithUpdatedTs := false - if memoDisplayWithUpdatedTsSetting != nil { - err = json.Unmarshal([]byte(memoDisplayWithUpdatedTsSetting.Value), &memoDisplayWithUpdatedTs) - if err != nil { - return false, errors.Wrap(err, "failed to unmarshal system setting value") - } - } - return memoDisplayWithUpdatedTs, nil -} - func convertCreateMemoRequestToMemoMessage(memoCreate *CreateMemoRequest) *store.Memo { createdTs := time.Now().Unix() if memoCreate.CreatedTs != nil { diff --git a/server/route/api/v1/system.go b/server/route/api/v1/system.go index 51a26c11c..412f936f3 100644 --- a/server/route/api/v1/system.go +++ b/server/route/api/v1/system.go @@ -98,10 +98,6 @@ func (s *APIV1Service) GetSystemStatus(c echo.Context) error { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find system setting list").SetInternal(err) } for _, systemSetting := range systemSettingList { - if systemSetting.Name == SystemSettingServerIDName.String() || systemSetting.Name == SystemSettingSecretSessionName.String() || systemSetting.Name == SystemSettingTelegramBotTokenName.String() { - continue - } - var baseValue any err := json.Unmarshal([]byte(systemSetting.Value), &baseValue) if err != nil { @@ -110,8 +106,6 @@ func (s *APIV1Service) GetSystemStatus(c echo.Context) error { } switch systemSetting.Name { - case SystemSettingDisablePublicMemosName.String(): - systemStatus.DisablePublicMemos = baseValue.(bool) case SystemSettingMaxUploadSizeMiBName.String(): systemStatus.MaxUploadSizeMiB = int(baseValue.(float64)) case SystemSettingCustomizedProfileName.String(): @@ -122,10 +116,6 @@ func (s *APIV1Service) GetSystemStatus(c echo.Context) error { systemStatus.CustomizedProfile = customizedProfile case SystemSettingStorageServiceIDName.String(): systemStatus.StorageServiceID = int32(baseValue.(float64)) - case SystemSettingLocalStoragePathName.String(): - systemStatus.LocalStoragePath = baseValue.(string) - case SystemSettingMemoDisplayWithUpdatedTsName.String(): - systemStatus.MemoDisplayWithUpdatedTs = baseValue.(bool) default: // Skip unknown system setting. } diff --git a/server/route/api/v1/system_setting.go b/server/route/api/v1/system_setting.go index 4aff3816e..13fbcb90b 100644 --- a/server/route/api/v1/system_setting.go +++ b/server/route/api/v1/system_setting.go @@ -15,12 +15,6 @@ import ( type SystemSettingName string const ( - // SystemSettingServerIDName is the name of server id. - SystemSettingServerIDName SystemSettingName = "server-id" - // SystemSettingSecretSessionName is the name of secret session. - SystemSettingSecretSessionName SystemSettingName = "secret-session" - // SystemSettingDisablePublicMemosName is the name of disable public memos setting. - SystemSettingDisablePublicMemosName SystemSettingName = "disable-public-memos" // SystemSettingMaxUploadSizeMiBName is the name of max upload size setting. SystemSettingMaxUploadSizeMiBName SystemSettingName = "max-upload-size-mib" // SystemSettingCustomizedProfileName is the name of customized server profile. @@ -29,10 +23,6 @@ const ( SystemSettingStorageServiceIDName SystemSettingName = "storage-service-id" // SystemSettingLocalStoragePathName is the name of local storage path. SystemSettingLocalStoragePathName SystemSettingName = "local-storage-path" - // SystemSettingTelegramBotTokenName is the name of Telegram Bot Token. - SystemSettingTelegramBotTokenName SystemSettingName = "telegram-bot-token" - // SystemSettingMemoDisplayWithUpdatedTsName is the name of memo display with updated ts. - SystemSettingMemoDisplayWithUpdatedTsName SystemSettingName = "memo-display-with-updated-ts" ) const systemSettingUnmarshalError = `failed to unmarshal value from system setting "%v"` @@ -160,13 +150,6 @@ func (s *APIV1Service) CreateSystemSetting(c echo.Context) error { func (upsert UpsertSystemSettingRequest) Validate() error { switch settingName := upsert.Name; settingName { - case SystemSettingServerIDName: - return errors.Errorf("updating %v is not allowed", settingName) - case SystemSettingDisablePublicMemosName: - var value bool - if err := json.Unmarshal([]byte(upsert.Value), &value); err != nil { - return errors.Errorf(systemSettingUnmarshalError, settingName) - } case SystemSettingMaxUploadSizeMiBName: var value int if err := json.Unmarshal([]byte(upsert.Value), &value); err != nil { @@ -213,27 +196,6 @@ func (upsert UpsertSystemSettingRequest) Validate() error { case !strings.Contains(trimmedValue, "{filename}"): return errors.New("local storage path must contain `{filename}`") } - case SystemSettingTelegramBotTokenName: - if upsert.Value == "" { - return nil - } - // Bot Token with Reverse Proxy shoule like `http.../bot` - if strings.HasPrefix(upsert.Value, "http") { - slashIndex := strings.LastIndexAny(upsert.Value, "/") - if strings.HasPrefix(upsert.Value[slashIndex:], "/bot") { - return nil - } - return errors.New("token start with `http` must end with `/bot`") - } - fragments := strings.Split(upsert.Value, ":") - if len(fragments) != 2 { - return errors.Errorf(systemSettingUnmarshalError, settingName) - } - case SystemSettingMemoDisplayWithUpdatedTsName: - var value bool - if err := json.Unmarshal([]byte(upsert.Value), &value); err != nil { - return errors.Errorf(systemSettingUnmarshalError, settingName) - } default: return errors.New("invalid system setting name") } diff --git a/server/route/api/v2/apidocs.swagger.yaml b/server/route/api/v2/apidocs.swagger.yaml index 7a02a6697..dbdb0f78d 100644 --- a/server/route/api/v2/apidocs.swagger.yaml +++ b/server/route/api/v2/apidocs.swagger.yaml @@ -446,20 +446,50 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: filename + - name: resource.name + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: query required: false type: string - - name: externalLink + - name: resource.uid + description: The user defined id of the resource. in: query required: false type: string - - name: type + - name: resource.createTime in: query required: false type: string - - name: memo - description: 'Format: memos/{id}' + format: date-time + - name: resource.filename + in: query + required: false + type: string + - name: resource.content + in: query + required: false + type: string + format: byte + - name: resource.externalLink + in: query + required: false + type: string + - name: resource.type + in: query + required: false + type: string + - name: resource.size + in: query + required: false + type: string + format: int64 + - name: resource.memo + description: |- + The related memo. + Format: memos/{id} in: query required: false type: string @@ -1110,6 +1140,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1177,6 +1211,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1641,8 +1679,12 @@ paths: createTime: type: string format: date-time + readOnly: true filename: type: string + content: + type: string + format: byte externalLink: type: string type: @@ -1652,7 +1694,9 @@ paths: format: int64 memo: type: string - title: 'Format: memos/{id}' + title: |- + The related memo. + Format: memos/{id} tags: - ResourceService /api/v2/{setting.name}: @@ -2472,8 +2516,12 @@ definitions: createTime: type: string format: date-time + readOnly: true filename: type: string + content: + type: string + format: byte externalLink: type: string type: @@ -2483,7 +2531,9 @@ definitions: format: int64 memo: type: string - title: 'Format: memos/{id}' + title: |- + The related memo. + Format: memos/{id} v2SearchMemosResponse: type: object properties: diff --git a/server/route/api/v2/memo_service.go b/server/route/api/v2/memo_service.go index 339020f88..0d2ce538c 100644 --- a/server/route/api/v2/memo_service.go +++ b/server/route/api/v2/memo_service.go @@ -4,7 +4,6 @@ import ( "archive/zip" "bytes" "context" - "encoding/json" "fmt" "log/slog" "time" @@ -21,7 +20,6 @@ import ( "github.com/usememos/memos/plugin/webhook" apiv2pb "github.com/usememos/memos/proto/gen/api/v2" storepb "github.com/usememos/memos/proto/gen/store" - apiv1 "github.com/usememos/memos/server/route/api/v1" "github.com/usememos/memos/store" ) @@ -49,12 +47,11 @@ func (s *APIV2Service) CreateMemo(ctx context.Context, request *apiv2pb.CreateMe Content: request.Content, Visibility: convertVisibilityToStore(request.Visibility), } - // Find disable public memos system setting. - disablePublicMemosSystem, err := s.getDisablePublicMemosSystemSettingValue(ctx) + workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx) if err != nil { - return nil, status.Errorf(codes.Internal, "failed to get system setting") + return nil, status.Errorf(codes.Internal, "failed to get workspace memo related setting") } - if disablePublicMemosSystem && create.Visibility == store.Public { + if workspaceMemoRelatedSetting.DisallowPublicVisible && create.Visibility == store.Public { return nil, status.Errorf(codes.PermissionDenied, "disable public memos system setting is enabled") } @@ -238,13 +235,12 @@ func (s *APIV2Service) UpdateMemo(ctx context.Context, request *apiv2pb.UpdateMe return nil, status.Errorf(codes.InvalidArgument, "invalid resource name") } } else if path == "visibility" { - visibility := convertVisibilityToStore(request.Memo.Visibility) - // Find disable public memos system setting. - disablePublicMemosSystem, err := s.getDisablePublicMemosSystemSettingValue(ctx) + workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx) if err != nil { - return nil, status.Errorf(codes.Internal, "failed to get system setting") + return nil, status.Errorf(codes.Internal, "failed to get workspace memo related setting") } - if disablePublicMemosSystem && visibility == store.Public { + visibility := convertVisibilityToStore(request.Memo.Visibility) + if workspaceMemoRelatedSetting.DisallowPublicVisible && visibility == store.Public { return nil, status.Errorf(codes.PermissionDenied, "disable public memos system setting is enabled") } update.Visibility = &visibility @@ -467,14 +463,14 @@ func (s *APIV2Service) GetUserMemosStats(ctx context.Context, request *apiv2pb.G return nil, status.Errorf(codes.Internal, "invalid timezone location") } - displayWithUpdatedTs, err := s.getMemoDisplayWithUpdatedTsSettingValue(ctx) + workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx) if err != nil { - return nil, status.Errorf(codes.Internal, "failed to get memo display with updated ts setting value") + return nil, status.Errorf(codes.Internal, "failed to get workspace memo related setting") } stats := make(map[string]int32) for _, memo := range memos { displayTs := memo.CreatedTs - if displayWithUpdatedTs { + if workspaceMemoRelatedSetting.DisplayWithUpdateTime { displayTs = memo.UpdatedTs } stats[time.Unix(displayTs, 0).In(location).Format("2006-01-02")]++ @@ -529,7 +525,11 @@ func (s *APIV2Service) ExportMemos(ctx context.Context, request *apiv2pb.ExportM func (s *APIV2Service) convertMemoFromStore(ctx context.Context, memo *store.Memo) (*apiv2pb.Memo, error) { displayTs := memo.CreatedTs - if displayWithUpdatedTs, err := s.getMemoDisplayWithUpdatedTsSettingValue(ctx); err == nil && displayWithUpdatedTs { + workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx) + if err != nil { + return nil, errors.Wrap(err, "failed to get workspace memo related setting") + } + if workspaceMemoRelatedSetting.DisplayWithUpdateTime { displayTs = memo.UpdatedTs } @@ -572,42 +572,6 @@ func (s *APIV2Service) convertMemoFromStore(ctx context.Context, memo *store.Mem }, nil } -func (s *APIV2Service) getMemoDisplayWithUpdatedTsSettingValue(ctx context.Context) (bool, error) { - memoDisplayWithUpdatedTsSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ - Name: apiv1.SystemSettingMemoDisplayWithUpdatedTsName.String(), - }) - if err != nil { - return false, errors.Wrap(err, "failed to find system setting") - } - if memoDisplayWithUpdatedTsSetting == nil { - return false, nil - } - - memoDisplayWithUpdatedTs := false - if err := json.Unmarshal([]byte(memoDisplayWithUpdatedTsSetting.Value), &memoDisplayWithUpdatedTs); err != nil { - return false, errors.Wrap(err, "failed to unmarshal system setting value") - } - return memoDisplayWithUpdatedTs, nil -} - -func (s *APIV2Service) getDisablePublicMemosSystemSettingValue(ctx context.Context) (bool, error) { - disablePublicMemosSystemSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ - Name: apiv1.SystemSettingDisablePublicMemosName.String(), - }) - if err != nil { - return false, errors.Wrap(err, "failed to find system setting") - } - if disablePublicMemosSystemSetting == nil { - return false, nil - } - - disablePublicMemos := false - if err := json.Unmarshal([]byte(disablePublicMemosSystemSetting.Value), &disablePublicMemos); err != nil { - return false, errors.Wrap(err, "failed to unmarshal system setting value") - } - return disablePublicMemos, nil -} - func convertVisibilityFromStore(visibility store.Visibility) apiv2pb.Visibility { switch visibility { case store.Private: @@ -654,22 +618,22 @@ func (s *APIV2Service) buildMemoFindWithFilter(ctx context.Context, find *store. find.OrderByPinned = filter.OrderByPinned } if filter.DisplayTimeAfter != nil { - displayWithUpdatedTs, err := s.getMemoDisplayWithUpdatedTsSettingValue(ctx) + workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx) if err != nil { - return status.Errorf(codes.Internal, "failed to get memo display with updated ts setting value") + return status.Errorf(codes.Internal, "failed to get workspace memo related setting") } - if displayWithUpdatedTs { + if workspaceMemoRelatedSetting.DisplayWithUpdateTime { find.UpdatedTsAfter = filter.DisplayTimeAfter } else { find.CreatedTsAfter = filter.DisplayTimeAfter } } if filter.DisplayTimeBefore != nil { - displayWithUpdatedTs, err := s.getMemoDisplayWithUpdatedTsSettingValue(ctx) + workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx) if err != nil { - return status.Errorf(codes.Internal, "failed to get memo display with updated ts setting value") + return status.Errorf(codes.Internal, "failed to get workspace memo related setting") } - if displayWithUpdatedTs { + if workspaceMemoRelatedSetting.DisplayWithUpdateTime { find.UpdatedTsBefore = filter.DisplayTimeBefore } else { find.CreatedTsBefore = filter.DisplayTimeBefore @@ -717,11 +681,11 @@ func (s *APIV2Service) buildMemoFindWithFilter(ctx context.Context, find *store. find.VisibilityList = []store.Visibility{store.Public, store.Protected} } - displayWithUpdatedTs, err := s.getMemoDisplayWithUpdatedTsSettingValue(ctx) + workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx) if err != nil { - return status.Errorf(codes.Internal, "failed to get memo display with updated ts setting value") + return status.Errorf(codes.Internal, "failed to get workspace memo related setting") } - if displayWithUpdatedTs { + if workspaceMemoRelatedSetting.DisplayWithUpdateTime { find.OrderByUpdatedTs = true } return nil diff --git a/server/route/api/v2/resource_name.go b/server/route/api/v2/resource_name.go index 0aebea390..cc084e2d3 100644 --- a/server/route/api/v2/resource_name.go +++ b/server/route/api/v2/resource_name.go @@ -15,6 +15,7 @@ const ( MemoNamePrefix = "memos/" ResourceNamePrefix = "resources/" InboxNamePrefix = "inboxes/" + StorageNamePrefix = "storages/" ) // GetNameParentTokens returns the tokens from a resource name. @@ -96,3 +97,16 @@ func ExtractInboxIDFromName(name string) (int32, error) { } return id, nil } + +// ExtractStorageIDFromName returns the storage ID from a resource name. +func ExtractStorageIDFromName(name string) (int32, error) { + tokens, err := GetNameParentTokens(name, StorageNamePrefix) + if err != nil { + return 0, err + } + id, err := util.ConvertStringToInt32(tokens[0]) + if err != nil { + return 0, errors.Errorf("invalid storage ID %q", tokens[0]) + } + return id, nil +} diff --git a/server/route/api/v2/resource_service.go b/server/route/api/v2/resource_service.go index 705f78c20..59404a18c 100644 --- a/server/route/api/v2/resource_service.go +++ b/server/route/api/v2/resource_service.go @@ -1,9 +1,15 @@ package v2 import ( + "bytes" "context" + "encoding/binary" "fmt" "net/url" + "os" + "path/filepath" + "regexp" + "strings" "time" "github.com/google/cel-go/cel" @@ -14,35 +20,65 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" + "github.com/usememos/memos/internal/util" + "github.com/usememos/memos/plugin/storage/s3" apiv2pb "github.com/usememos/memos/proto/gen/api/v2" + storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) +const ( + // The upload memory buffer is 32 MiB. + // It should be kept low, so RAM usage doesn't get out of control. + // This is unrelated to maximum upload size limit, which is now set through system setting. + MaxUploadBufferSizeBytes = 32 << 20 + MebiByte = 1024 * 1024 +) + func (s *APIV2Service) CreateResource(ctx context.Context, request *apiv2pb.CreateResourceRequest) (*apiv2pb.CreateResourceResponse, error) { user, err := getCurrentUser(ctx, s.Store) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) } - if request.ExternalLink != "" { + + create := &store.Resource{ + UID: shortuuid.New(), + CreatorID: user.ID, + Filename: request.Resource.Filename, + Type: request.Resource.Type, + } + if request.Resource.ExternalLink != "" { // Only allow those external links scheme with http/https - linkURL, err := url.Parse(request.ExternalLink) + linkURL, err := url.Parse(request.Resource.ExternalLink) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid external link: %v", err) } if linkURL.Scheme != "http" && linkURL.Scheme != "https" { return nil, status.Errorf(codes.InvalidArgument, "invalid external link scheme: %v", linkURL.Scheme) } + create.ExternalLink = request.Resource.ExternalLink + } else { + workspaceStorageSetting, err := s.Store.GetWorkspaceStorageSetting(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get workspace storage setting: %v", err) + } + size := binary.Size(request.Resource.Content) + uploadSizeLimit := int(workspaceStorageSetting.UploadSizeLimitMb) * MebiByte + if uploadSizeLimit == 0 { + uploadSizeLimit = MaxUploadBufferSizeBytes + } + if size > uploadSizeLimit { + return nil, status.Errorf(codes.InvalidArgument, "file size exceeds the limit") + } + create.Size = int64(size) + create.Blob = request.Resource.Content + if err := SaveResourceBlob(ctx, s.Store, create); err != nil { + return nil, status.Errorf(codes.Internal, "failed to save resource blob: %v", err) + } } - create := &store.Resource{ - UID: shortuuid.New(), - CreatorID: user.ID, - Filename: request.Filename, - ExternalLink: request.ExternalLink, - Type: request.Type, - } - if request.Memo != nil { - memoID, err := ExtractMemoIDFromName(*request.Memo) + if request.Resource.Memo != nil { + memoID, err := ExtractMemoIDFromName(*request.Resource.Memo) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo id: %v", err) } @@ -215,6 +251,126 @@ func (s *APIV2Service) convertResourceFromStore(ctx context.Context, resource *s return resourceMessage } +// SaveResourceBlob save the blob of resource based on the storage config. +func SaveResourceBlob(ctx context.Context, s *store.Store, create *store.Resource) error { + workspaceStorageSetting, err := s.GetWorkspaceStorageSetting(ctx) + if err != nil { + return errors.Wrap(err, "Failed to find workspace storage setting") + } + + if workspaceStorageSetting.StorageType == storepb.WorkspaceStorageSetting_STORAGE_TYPE_LOCAL { + localStoragePath := "assets/{timestamp}_{filename}" + if workspaceStorageSetting.LocalStoragePath != "" { + localStoragePath = workspaceStorageSetting.LocalStoragePath + } + + internalPath := localStoragePath + if !strings.Contains(internalPath, "{filename}") { + internalPath = filepath.Join(internalPath, "{filename}") + } + internalPath = replacePathTemplate(internalPath, create.Filename) + internalPath = filepath.ToSlash(internalPath) + + osPath := filepath.FromSlash(internalPath) + if !filepath.IsAbs(osPath) { + osPath = filepath.Join(s.Profile.Data, osPath) + } + dir := filepath.Dir(osPath) + if err = os.MkdirAll(dir, os.ModePerm); err != nil { + return errors.Wrap(err, "Failed to create directory") + } + dst, err := os.Create(osPath) + if err != nil { + return errors.Wrap(err, "Failed to create file") + } + defer dst.Close() + + if err := os.WriteFile(dir, create.Blob, 0644); err != nil { + return errors.Wrap(err, "Failed to write file") + } + create.InternalPath = internalPath + create.Blob = nil + } else if workspaceStorageSetting.StorageType == storepb.WorkspaceStorageSetting_STORAGE_TYPE_EXTERNAL { + if workspaceStorageSetting.ActivedExternalStorageId == nil { + return errors.Errorf("No actived external storage found") + } + storage, err := s.GetStorageV1(ctx, &store.FindStorage{ID: workspaceStorageSetting.ActivedExternalStorageId}) + if err != nil { + return errors.Wrap(err, "Failed to find actived external storage") + } + if storage == nil { + return errors.Errorf("Storage %d not found", *workspaceStorageSetting.ActivedExternalStorageId) + } + if storage.Type != storepb.Storage_S3 { + return errors.Errorf("Unsupported storage type: %s", storage.Type.String()) + } + + s3Config := storage.Config.GetS3Config() + if s3Config == nil { + return errors.Errorf("S3 config not found") + } + s3Client, err := s3.NewClient(ctx, &s3.Config{ + AccessKey: s3Config.AccessKey, + SecretKey: s3Config.SecretKey, + EndPoint: s3Config.EndPoint, + Region: s3Config.Region, + Bucket: s3Config.Bucket, + URLPrefix: s3Config.UrlPrefix, + URLSuffix: s3Config.UrlSuffix, + PreSign: s3Config.PreSign, + }) + if err != nil { + return errors.Wrap(err, "Failed to create s3 client") + } + + filePath := s3Config.Path + if !strings.Contains(filePath, "{filename}") { + filePath = filepath.Join(filePath, "{filename}") + } + filePath = replacePathTemplate(filePath, create.Filename) + r := bytes.NewReader(create.Blob) + link, err := s3Client.UploadFile(ctx, filePath, create.Type, r) + if err != nil { + return errors.Wrap(err, "Failed to upload via s3 client") + } + + create.ExternalLink = link + create.Blob = nil + } + + return nil +} + +var fileKeyPattern = regexp.MustCompile(`\{[a-z]{1,9}\}`) + +func replacePathTemplate(path, filename string) string { + t := time.Now() + path = fileKeyPattern.ReplaceAllStringFunc(path, func(s string) string { + switch s { + case "{filename}": + return filename + case "{timestamp}": + return fmt.Sprintf("%d", t.Unix()) + case "{year}": + return fmt.Sprintf("%d", t.Year()) + case "{month}": + return fmt.Sprintf("%02d", t.Month()) + case "{day}": + return fmt.Sprintf("%02d", t.Day()) + case "{hour}": + return fmt.Sprintf("%02d", t.Hour()) + case "{minute}": + return fmt.Sprintf("%02d", t.Minute()) + case "{second}": + return fmt.Sprintf("%02d", t.Second()) + case "{uuid}": + return util.GenUUID() + } + return s + }) + return path +} + // SearchResourcesFilterCELAttributes are the CEL attributes for SearchResourcesFilter. var SearchResourcesFilterCELAttributes = []cel.EnvOption{ cel.Variable("uid", cel.StringType), diff --git a/server/server.go b/server/server.go index 132ecd4bf..ff84028ef 100644 --- a/server/server.go +++ b/server/server.go @@ -12,6 +12,7 @@ import ( "github.com/pkg/errors" "github.com/usememos/memos/plugin/telegram" + storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/server/integration" "github.com/usememos/memos/server/profile" apiv1 "github.com/usememos/memos/server/route/api/v1" @@ -51,19 +52,16 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store // Register CORS middleware. e.Use(CORSMiddleware(s.Profile.Origins)) - serverID, err := s.getSystemServerID(ctx) + workspaceBasicSetting, err := s.getOrUpsertWorkspaceBasicSetting(ctx) if err != nil { - return nil, errors.Wrap(err, "failed to retrieve system server ID") + return nil, errors.Wrap(err, "failed to get workspace basic setting") } - s.ID = serverID secret := "usememos" if profile.Mode == "prod" { - secret, err = s.getSystemSecretSessionName(ctx) - if err != nil { - return nil, errors.Wrap(err, "failed to retrieve system secret session name") - } + secret = workspaceBasicSetting.SecretKey } + s.ID = workspaceBasicSetting.ServerId s.Secret = secret // Register healthz endpoint. @@ -118,42 +116,31 @@ func (s *Server) GetEcho() *echo.Echo { return s.e } -func (s *Server) getSystemServerID(ctx context.Context) (string, error) { - serverIDSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ - Name: apiv1.SystemSettingServerIDName.String(), - }) +func (s *Server) getOrUpsertWorkspaceBasicSetting(ctx context.Context) (*storepb.WorkspaceBasicSetting, error) { + workspaceBasicSetting, err := s.Store.GetWorkspaceBasicSetting(ctx) if err != nil { - return "", err + return nil, errors.Wrap(err, "failed to get workspace basic setting") } - if serverIDSetting == nil || serverIDSetting.Value == "" { - serverIDSetting, err = s.Store.UpsertWorkspaceSetting(ctx, &store.WorkspaceSetting{ - Name: apiv1.SystemSettingServerIDName.String(), - Value: uuid.NewString(), - }) - if err != nil { - return "", err - } + modified := false + if workspaceBasicSetting.ServerId == "" { + workspaceBasicSetting.ServerId = uuid.NewString() + modified = true } - return serverIDSetting.Value, nil -} - -func (s *Server) getSystemSecretSessionName(ctx context.Context) (string, error) { - secretSessionNameValue, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ - Name: apiv1.SystemSettingSecretSessionName.String(), - }) - if err != nil { - return "", err + if workspaceBasicSetting.SecretKey == "" { + workspaceBasicSetting.SecretKey = uuid.NewString() + modified = true } - if secretSessionNameValue == nil || secretSessionNameValue.Value == "" { - secretSessionNameValue, err = s.Store.UpsertWorkspaceSetting(ctx, &store.WorkspaceSetting{ - Name: apiv1.SystemSettingSecretSessionName.String(), - Value: uuid.NewString(), + if modified { + workspaceSetting, err := s.Store.UpsertWorkspaceSettingV1(ctx, &storepb.WorkspaceSetting{ + Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC, + Value: &storepb.WorkspaceSetting_BasicSetting{BasicSetting: workspaceBasicSetting}, }) if err != nil { - return "", err + return nil, errors.Wrap(err, "failed to upsert workspace setting") } + workspaceBasicSetting = workspaceSetting.GetBasicSetting() } - return secretSessionNameValue.Value, nil + return workspaceBasicSetting, nil } func grpcRequestSkipper(c echo.Context) bool { diff --git a/store/migrator.go b/store/migrator.go index 2e2a37ed3..c7a456e6c 100644 --- a/store/migrator.go +++ b/store/migrator.go @@ -17,6 +17,11 @@ func (s *Store) MigrateWorkspaceSetting(ctx context.Context) error { return errors.Wrap(err, "failed to list workspace settings") } + workspaceBasicSetting, err := s.GetWorkspaceBasicSetting(ctx) + if err != nil { + return errors.Wrap(err, "failed to get workspace basic setting") + } + workspaceGeneralSetting, err := s.GetWorkspaceGeneralSetting(ctx) if err != nil { return errors.Wrap(err, "failed to get workspace general setting") @@ -27,7 +32,11 @@ func (s *Store) MigrateWorkspaceSetting(ctx context.Context) error { var baseValue any // nolint json.Unmarshal([]byte(workspaceSetting.Value), &baseValue) - if workspaceSetting.Name == "allow-signup" { + if workspaceSetting.Name == "server-id" { + workspaceBasicSetting.ServerId = workspaceSetting.Value + } else if workspaceSetting.Name == "secret-session" { + workspaceBasicSetting.SecretKey = workspaceSetting.Value + } else if workspaceSetting.Name == "allow-signup" { workspaceGeneralSetting.DisallowSignup = !baseValue.(bool) } else if workspaceSetting.Name == "disable-password-login" { workspaceGeneralSetting.DisallowPasswordLogin = baseValue.(bool) @@ -50,6 +59,13 @@ func (s *Store) MigrateWorkspaceSetting(ctx context.Context) error { } } + if _, err := s.UpsertWorkspaceSettingV1(ctx, &storepb.WorkspaceSetting{ + Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC, + Value: &storepb.WorkspaceSetting_BasicSetting{BasicSetting: workspaceBasicSetting}, + }); err != nil { + return errors.Wrap(err, "failed to upsert workspace basic setting") + } + if _, err := s.UpsertWorkspaceSettingV1(ctx, &storepb.WorkspaceSetting{ Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL, Value: &storepb.WorkspaceSetting_GeneralSetting{GeneralSetting: workspaceGeneralSetting}, diff --git a/store/storage.go b/store/storage.go index dd24bb3b9..0108b29f3 100644 --- a/store/storage.go +++ b/store/storage.go @@ -2,6 +2,10 @@ package store import ( "context" + + "github.com/pkg/errors" + storepb "github.com/usememos/memos/proto/gen/store" + "google.golang.org/protobuf/proto" ) type Storage struct { @@ -52,3 +56,131 @@ func (s *Store) UpdateStorage(ctx context.Context, update *UpdateStorage) (*Stor func (s *Store) DeleteStorage(ctx context.Context, delete *DeleteStorage) error { return s.driver.DeleteStorage(ctx, delete) } + +func (s *Store) CreateStorageV1(ctx context.Context, create *storepb.Storage) (*storepb.Storage, error) { + storageRaw := &Storage{ + Name: create.Name, + Type: create.Type.String(), + } + + switch create.Type { + case storepb.Storage_S3: + configBytes, err := proto.Marshal(create.Config.GetS3Config()) + if err != nil { + return nil, errors.Wrap(err, "failed to marshal s3 config") + } + storageRaw.Config = string(configBytes) + } + + storageRaw, err := s.driver.CreateStorage(ctx, storageRaw) + if err != nil { + return nil, err + } + storage, err := convertStorageFromRaw(storageRaw) + if err != nil { + return nil, err + } + return storage, nil +} + +func (s *Store) ListStoragesV1(ctx context.Context, find *FindStorage) ([]*storepb.Storage, error) { + list, err := s.driver.ListStorages(ctx, find) + if err != nil { + return nil, err + } + + storages := []*storepb.Storage{} + for _, storageRaw := range list { + storage, err := convertStorageFromRaw(storageRaw) + if err != nil { + return nil, err + } + storages = append(storages, storage) + } + return storages, nil +} + +func (s *Store) GetStorageV1(ctx context.Context, find *FindStorage) (*storepb.Storage, error) { + list, err := s.ListStoragesV1(ctx, find) + if err != nil { + return nil, err + } + if len(list) == 0 { + return nil, nil + } + + return list[0], nil +} + +type UpdateStorageV1 struct { + ID int32 + Type storepb.Storage_Type + Name *string + Config *storepb.StorageConfig +} + +func (s *Store) UpdateStorageV1(ctx context.Context, update *UpdateStorageV1) (*storepb.Storage, error) { + updateRaw := &UpdateStorage{ + ID: update.ID, + } + if update.Name != nil { + updateRaw.Name = update.Name + } + if update.Config != nil { + configRaw, err := convertStorageConfigToRaw(update.Type, update.Config) + if err != nil { + return nil, err + } + updateRaw.Config = &configRaw + } + storageRaw, err := s.driver.UpdateStorage(ctx, updateRaw) + if err != nil { + return nil, err + } + storage, err := convertStorageFromRaw(storageRaw) + if err != nil { + return nil, err + } + return storage, nil +} + +func convertStorageFromRaw(storageRaw *Storage) (*storepb.Storage, error) { + storage := &storepb.Storage{ + Id: storageRaw.ID, + Name: storageRaw.Name, + Type: storepb.Storage_Type(storepb.Storage_Type_value[storageRaw.Type]), + } + storageConfig, err := convertStorageConfigFromRaw(storage.Type, storageRaw.Config) + if err != nil { + return nil, err + } + storage.Config = storageConfig + return storage, nil +} + +func convertStorageConfigFromRaw(storageType storepb.Storage_Type, configRaw string) (*storepb.StorageConfig, error) { + storageConfig := &storepb.StorageConfig{} + switch storageType { + case storepb.Storage_S3: + s3Config := &storepb.S3Config{} + err := proto.Unmarshal([]byte(configRaw), s3Config) + if err != nil { + return nil, err + } + storageConfig.StorageConfig = &storepb.StorageConfig_S3Config{S3Config: s3Config} + } + return storageConfig, nil +} + +func convertStorageConfigToRaw(storageType storepb.Storage_Type, config *storepb.StorageConfig) (string, error) { + raw := "" + switch storageType { + case storepb.Storage_S3: + bytes, err := proto.Marshal(config.GetS3Config()) + if err != nil { + return "", err + } + raw = string(bytes) + } + return raw, nil +} diff --git a/store/workspace_setting.go b/store/workspace_setting.go index f3fae7875..7a4671f48 100644 --- a/store/workspace_setting.go +++ b/store/workspace_setting.go @@ -75,7 +75,9 @@ func (s *Store) UpsertWorkspaceSettingV1(ctx context.Context, upsert *storepb.Wo } var valueBytes []byte var err error - if upsert.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL { + if upsert.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC { + valueBytes, err = protojson.Marshal(upsert.GetBasicSetting()) + } else if upsert.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL { valueBytes, err = protojson.Marshal(upsert.GetGeneralSetting()) } else if upsert.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_STORAGE { valueBytes, err = protojson.Marshal(upsert.GetStorageSetting()) @@ -139,6 +141,21 @@ func (s *Store) GetWorkspaceSettingV1(ctx context.Context, find *FindWorkspaceSe return list[0], nil } +func (s *Store) GetWorkspaceBasicSetting(ctx context.Context) (*storepb.WorkspaceBasicSetting, error) { + workspaceSetting, err := s.GetWorkspaceSettingV1(ctx, &FindWorkspaceSetting{ + Name: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC.String(), + }) + if err != nil { + return nil, errors.Wrap(err, "failed to get workspace basic setting") + } + + workspaceBasicSetting := &storepb.WorkspaceBasicSetting{} + if workspaceSetting != nil { + workspaceBasicSetting = workspaceSetting.GetBasicSetting() + } + return workspaceBasicSetting, nil +} + func (s *Store) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.WorkspaceGeneralSetting, error) { workspaceSetting, err := s.GetWorkspaceSettingV1(ctx, &FindWorkspaceSetting{ Name: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL.String(), @@ -154,11 +171,47 @@ func (s *Store) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.Worksp return workspaceGeneralSetting, nil } +func (s *Store) GetWorkspaceMemoRelatedSetting(ctx context.Context) (*storepb.WorkspaceMemoRelatedSetting, error) { + workspaceSetting, err := s.GetWorkspaceSettingV1(ctx, &FindWorkspaceSetting{ + Name: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED.String(), + }) + if err != nil { + return nil, errors.Wrap(err, "failed to get workspace general setting") + } + + workspaceMemoRelatedSetting := &storepb.WorkspaceMemoRelatedSetting{} + if workspaceSetting != nil { + workspaceMemoRelatedSetting = workspaceSetting.GetMemoRelatedSetting() + } + return workspaceMemoRelatedSetting, nil +} + +func (s *Store) GetWorkspaceStorageSetting(ctx context.Context) (*storepb.WorkspaceStorageSetting, error) { + workspaceSetting, err := s.GetWorkspaceSettingV1(ctx, &FindWorkspaceSetting{ + Name: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_STORAGE.String(), + }) + if err != nil { + return nil, errors.Wrap(err, "failed to get workspace storage setting") + } + + workspaceStorageSetting := &storepb.WorkspaceStorageSetting{} + if workspaceSetting != nil { + workspaceStorageSetting = workspaceSetting.GetStorageSetting() + } + return workspaceStorageSetting, nil +} + func convertWorkspaceSettingFromRaw(workspaceSettingRaw *WorkspaceSetting) (*storepb.WorkspaceSetting, error) { workspaceSetting := &storepb.WorkspaceSetting{ Key: storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[workspaceSettingRaw.Name]), } switch workspaceSettingRaw.Name { + case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC.String(): + basicSetting := &storepb.WorkspaceBasicSetting{} + if err := protojson.Unmarshal([]byte(workspaceSettingRaw.Value), basicSetting); err != nil { + return nil, err + } + workspaceSetting.Value = &storepb.WorkspaceSetting_BasicSetting{BasicSetting: basicSetting} case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL.String(): generalSetting := &storepb.WorkspaceGeneralSetting{} if err := protojson.Unmarshal([]byte(workspaceSettingRaw.Value), generalSetting); err != nil { @@ -183,6 +236,8 @@ func convertWorkspaceSettingFromRaw(workspaceSettingRaw *WorkspaceSetting) (*sto return nil, err } workspaceSetting.Value = &storepb.WorkspaceSetting_TelegramIntegrationSetting{TelegramIntegrationSetting: telegramIntegrationSetting} + default: + return nil, errors.Errorf("unsupported workspace setting key: %v", workspaceSettingRaw.Name) } return workspaceSetting, nil } diff --git a/web/src/components/ChangeMemberPasswordDialog.tsx b/web/src/components/ChangeMemberPasswordDialog.tsx index adab6060b..137375b52 100644 --- a/web/src/components/ChangeMemberPasswordDialog.tsx +++ b/web/src/components/ChangeMemberPasswordDialog.tsx @@ -60,7 +60,7 @@ const ChangeMemberPasswordDialog: React.FC = (props: Props) => { handleCloseBtnClick(); } catch (error: any) { console.error(error); - toast.error(error.response.data.message); + toast.error(error.details); } }; diff --git a/web/src/components/CreateResourceDialog.tsx b/web/src/components/CreateResourceDialog.tsx index 5e540729f..cd8263213 100644 --- a/web/src/components/CreateResourceDialog.tsx +++ b/web/src/components/CreateResourceDialog.tsx @@ -1,9 +1,9 @@ import { Autocomplete, Button, IconButton, Input, List, ListItem, Option, Select, Typography } from "@mui/joy"; import React, { useRef, useState } from "react"; import { toast } from "react-hot-toast"; -import { CreateResourceRequest, Resource } from "@/types/proto/api/v2/resource_service"; +import { useResourceStore } from "@/store/v1"; +import { Resource } from "@/types/proto/api/v2/resource_service"; import { useTranslate } from "@/utils/i18n"; -import { useResourceStore } from "../store/module"; import { generateDialog } from "./Dialog"; import Icon from "./Icon"; @@ -29,8 +29,8 @@ const CreateResourceDialog: React.FC = (props: Props) => { selectedMode: "local-file", uploadingFlag: false, }); - const [resourceCreate, setResourceCreate] = useState( - CreateResourceRequest.fromPartial({ + const [resourceCreate, setResourceCreate] = useState( + Resource.fromPartial({ filename: "", externalLink: "", type: "", @@ -160,16 +160,25 @@ const CreateResourceDialog: React.FC = (props: Props) => { if (!fileOnInput) { continue; } - const resource = await resourceStore.createResourceWithBlob(file); + const { name: filename, size, type } = file; + const buffer = new Uint8Array(await file.arrayBuffer()); + const resource = await resourceStore.createResource({ + resource: Resource.fromPartial({ + filename, + size, + type, + content: buffer, + }), + }); createdResourceList.push(resource); } } else { - const resource = await resourceStore.createResource(resourceCreate); + const resource = await resourceStore.createResource({ resource: resourceCreate }); createdResourceList.push(resource); } } catch (error: any) { console.error(error); - toast.error(typeof error === "string" ? error : error.response.data.message); + toast.error(error.details); } if (onConfirm) { diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx index 2235c0de0..9d06b4bfd 100644 --- a/web/src/components/MemoEditor/index.tsx +++ b/web/src/components/MemoEditor/index.tsx @@ -7,8 +7,8 @@ import { memoServiceClient } from "@/grpcweb"; import { TAB_SPACE_WIDTH } from "@/helpers/consts"; import { isValidUrl } from "@/helpers/utils"; import useCurrentUser from "@/hooks/useCurrentUser"; -import { useGlobalStore, useResourceStore, useTagStore } from "@/store/module"; -import { useMemoStore, useUserStore } from "@/store/v1"; +import { useGlobalStore, useTagStore } from "@/store/module"; +import { useMemoStore, useResourceStore, useUserStore } from "@/store/v1"; import { MemoRelation, MemoRelation_Type } from "@/types/proto/api/v2/memo_relation_service"; import { Memo, Visibility } from "@/types/proto/api/v2/memo_service"; import { Resource } from "@/types/proto/api/v2/resource_service"; @@ -207,21 +207,29 @@ const MemoEditor = (props: Props) => { }; }); - let resource = undefined; + const { name: filename, size, type } = file; + const buffer = new Uint8Array(await file.arrayBuffer()); + try { - resource = await resourceStore.createResourceWithBlob(file); + const resource = await resourceStore.createResource({ + resource: Resource.fromPartial({ + filename, + size, + type, + content: buffer, + }), + }); + setState((state) => { + return { + ...state, + isUploadingResource: false, + }; + }); + return resource; } catch (error: any) { console.error(error); - toast.error(typeof error === "string" ? error : error.response.data.message); + toast.error(error.details); } - - setState((state) => { - return { - ...state, - isUploadingResource: false, - }; - }); - return resource; }; const uploadMultiFiles = async (files: FileList) => { diff --git a/web/src/helpers/api.ts b/web/src/helpers/api.ts index f318d1efe..01f4269ef 100644 --- a/web/src/helpers/api.ts +++ b/web/src/helpers/api.ts @@ -1,5 +1,4 @@ import axios from "axios"; -import { Resource } from "@/types/proto/api/v2/resource_service"; axios.defaults.baseURL = import.meta.env.VITE_API_BASE_URL || ""; axios.defaults.withCredentials = true; @@ -16,10 +15,6 @@ export function upsertSystemSetting(systemSetting: SystemSetting) { return axios.post("/api/v1/system/setting", systemSetting); } -export function createResourceWithBlob(formData: FormData) { - return axios.post("/api/v1/resource/blob", formData); -} - export function getStorageList() { return axios.get(`/api/v1/storage`); } diff --git a/web/src/pages/Resources.tsx b/web/src/pages/Resources.tsx index f1bb77b92..6e17f5648 100644 --- a/web/src/pages/Resources.tsx +++ b/web/src/pages/Resources.tsx @@ -15,24 +15,23 @@ import { Resource } from "@/types/proto/api/v2/resource_service"; import { useTranslate } from "@/utils/i18n"; function groupResourcesByDate(resources: Resource[]) { - const tmp_resources: Resource[] = resources.slice(); - tmp_resources.sort((a: Resource, b: Resource) => { - const a_date = new Date(a.createTime as any); - const b_date = new Date(b.createTime as any); - return b_date.getTime() - a_date.getTime(); - }); - const grouped = new Map(); - tmp_resources.forEach((item) => { - const date = new Date(item.createTime as any); - const year = date.getFullYear(); - const month = date.getMonth() + 1; - const timestamp = Date.UTC(year, month - 1, 1); - if (!grouped.has(timestamp)) { - grouped.set(timestamp, []); - } - grouped.get(timestamp)?.push(item); - }); + resources + .sort((a: Resource, b: Resource) => { + const a_date = new Date(a.createTime as any); + const b_date = new Date(b.createTime as any); + return b_date.getTime() - a_date.getTime(); + }) + .forEach((item) => { + const date = new Date(item.createTime as any); + const year = date.getFullYear(); + const month = date.getMonth() + 1; + const timestamp = Date.UTC(year, month - 1, 1); + if (!grouped.has(timestamp)) { + grouped.set(timestamp, []); + } + grouped.get(timestamp)?.push(item); + }); return grouped; } diff --git a/web/src/store/module/index.ts b/web/src/store/module/index.ts index 4d6b25b5b..57fc4f2ab 100644 --- a/web/src/store/module/index.ts +++ b/web/src/store/module/index.ts @@ -1,5 +1,4 @@ export * from "./global"; export * from "./filter"; export * from "./tag"; -export * from "./resource"; export * from "./dialog"; diff --git a/web/src/store/module/resource.ts b/web/src/store/module/resource.ts deleted file mode 100644 index eddcd7361..000000000 --- a/web/src/store/module/resource.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { resourceServiceClient } from "@/grpcweb"; -import * as api from "@/helpers/api"; -import { CreateResourceRequest, Resource, UpdateResourceRequest } from "@/types/proto/api/v2/resource_service"; -import { useTranslate } from "@/utils/i18n"; -import store, { useAppSelector } from "../"; -import { patchResource, setResources } from "../reducer/resource"; -import { useGlobalStore } from "./global"; - -export const useResourceStore = () => { - const state = useAppSelector((state) => state.resource); - const t = useTranslate(); - const globalStore = useGlobalStore(); - const maxUploadSizeMiB = globalStore.state.systemStatus.maxUploadSizeMiB; - - return { - state, - getState: () => { - return store.getState().resource; - }, - async createResource(create: CreateResourceRequest): Promise { - const { resource } = await resourceServiceClient.createResource(create); - if (!resource) { - throw new Error("resource is null"); - } - const resourceList = state.resources; - store.dispatch(setResources([resource, ...resourceList])); - return resource; - }, - async createResourceWithBlob(file: File): Promise { - const { name: filename, size } = file; - if (size > maxUploadSizeMiB * 1024 * 1024) { - return Promise.reject(t("message.maximum-upload-size-is", { size: maxUploadSizeMiB })); - } - - const formData = new FormData(); - formData.append("file", file, filename); - const { data: resource } = await api.createResourceWithBlob(formData); - const resourceList = state.resources; - store.dispatch(setResources([resource, ...resourceList])); - return resource; - }, - async updateResource(update: UpdateResourceRequest): Promise { - const { resource } = await resourceServiceClient.updateResource(update); - if (!resource) { - throw new Error("resource is null"); - } - store.dispatch(patchResource(resource)); - return resource; - }, - }; -}; diff --git a/web/src/store/v1/resource.ts b/web/src/store/v1/resource.ts index 91a79a895..0e6a6d3a8 100644 --- a/web/src/store/v1/resource.ts +++ b/web/src/store/v1/resource.ts @@ -1,7 +1,7 @@ import { create } from "zustand"; import { combine } from "zustand/middleware"; import { resourceServiceClient } from "@/grpcweb"; -import { Resource } from "@/types/proto/api/v2/resource_service"; +import { CreateResourceRequest, Resource, UpdateResourceRequest } from "@/types/proto/api/v2/resource_service"; interface State { resourceMapByName: Record; @@ -30,5 +30,23 @@ export const useResourceStore = create( const resourceMap = get().resourceMapByName; return Object.values(resourceMap).find((r) => r.name === name); }, + async createResource(create: CreateResourceRequest): Promise { + const { resource } = await resourceServiceClient.createResource(create); + if (!resource) { + throw new Error("resource is null"); + } + const resourceMap = get().resourceMapByName; + resourceMap[resource.name] = resource; + return resource; + }, + async updateResource(update: UpdateResourceRequest): Promise { + const { resource } = await resourceServiceClient.updateResource(update); + if (!resource) { + throw new Error("resource is null"); + } + const resourceMap = get().resourceMapByName; + resourceMap[resource.name] = resource; + return resource; + }, })), );