Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: return workspace setting with default value

Steveneda1983964b5
diff --git a/docs/apidocs.swagger.yaml b/docs/apidocs.swagger.yaml
index 00a62af40..98aa5b818 100644
--- a/docs/apidocs.swagger.yaml
+++ b/docs/apidocs.swagger.yaml
@@ -691,21 +691,6 @@ paths:
$ref: '#/definitions/googlerpcStatus'
tags:
- WorkspaceService
- /api/v1/workspace/settings:
- get:
- summary: ListWorkspaceSetting returns the list of settings.
- operationId: WorkspaceSettingService_ListWorkspaceSettings
- responses:
- "200":
- description: A successful response.
- schema:
- $ref: '#/definitions/v1ListWorkspaceSettingsResponse'
- default:
- description: An unexpected error response.
- schema:
- $ref: '#/definitions/googlerpcStatus'
- tags:
- - WorkspaceSettingService
/api/v1/workspace/{name}:
get:
summary: GetWorkspaceSetting returns the setting by name.
@@ -2137,8 +2122,7 @@ definitions:
Note: this functionality is not currently available in the official
protobuf release, and it is not used for type URLs beginning with
- type.googleapis.com. As of May 2023, there are no widely used type server
- implementations and no plans to implement one.
+ type.googleapis.com.
Schemes other than `http`, `https` (or the empty scheme) might be
used with implementation specific semantics.
@@ -2173,7 +2157,7 @@ definitions:
foo = any.unpack(Foo.getDefaultInstance());
}
- Example 3: Pack and unpack a message in Python.
+ Example 3: Pack and unpack a message in Python.
foo = Foo(...)
any = Any()
@@ -2183,7 +2167,7 @@ definitions:
any.Unpack(foo)
...
- Example 4: Pack and unpack a message in Go
+ Example 4: Pack and unpack a message in Go
foo := &pb.Foo{...}
any, err := anypb.New(foo)
@@ -2203,7 +2187,7 @@ definitions:
name "y.z".
JSON
- ====
+
The JSON representation of an `Any` value uses the regular
representation of the deserialized, embedded message, with an
additional field `@type` which contains the type URL. Example:
@@ -2543,14 +2527,6 @@ definitions:
items:
type: object
$ref: '#/definitions/v1Webhook'
- v1ListWorkspaceSettingsResponse:
- type: object
- properties:
- settings:
- type: array
- items:
- type: object
- $ref: '#/definitions/apiv1WorkspaceSetting'
v1MathBlockNode:
type: object
properties:
diff --git a/proto/api/v1/workspace_setting_service.proto b/proto/api/v1/workspace_setting_service.proto
index 87dade369..0fc3f22e0 100644
--- a/proto/api/v1/workspace_setting_service.proto
+++ b/proto/api/v1/workspace_setting_service.proto
@@ -9,10 +9,6 @@ import "google/api/field_behavior.proto";
option go_package = "gen/api/v1";
service WorkspaceSettingService {
- // ListWorkspaceSetting returns the list of settings.
- rpc ListWorkspaceSettings(ListWorkspaceSettingsRequest) returns (ListWorkspaceSettingsResponse) {
- option (google.api.http) = {get: "/api/v1/workspace/settings"};
- }
// GetWorkspaceSetting returns the setting by name.
rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (WorkspaceSetting) {
option (google.api.http) = {get: "/api/v1/workspace/{name=settings/*}"};
@@ -100,12 +96,6 @@ message WorkspaceMemoRelatedSetting {
int32 content_length_limit = 3;
}
-message ListWorkspaceSettingsRequest {}
-
-message ListWorkspaceSettingsResponse {
- repeated WorkspaceSetting settings = 1;
-}
-
message GetWorkspaceSettingRequest {
// The resource name of the workspace setting.
// Format: settings/{setting}
diff --git a/proto/gen/api/v1/workspace_setting_service.pb.go b/proto/gen/api/v1/workspace_setting_service.pb.go
index 0a6cda337..14c2d18aa 100644
--- a/proto/gen/api/v1/workspace_setting_service.pb.go
+++ b/proto/gen/api/v1/workspace_setting_service.pb.go
@@ -495,91 +495,6 @@ func (x *WorkspaceMemoRelatedSetting) GetContentLengthLimit() int32 {
return 0
}
-type ListWorkspaceSettingsRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-}
-
-func (x *ListWorkspaceSettingsRequest) Reset() {
- *x = ListWorkspaceSettingsRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_workspace_setting_service_proto_msgTypes[5]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ListWorkspaceSettingsRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListWorkspaceSettingsRequest) ProtoMessage() {}
-
-func (x *ListWorkspaceSettingsRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_setting_service_proto_msgTypes[5]
- 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 ListWorkspaceSettingsRequest.ProtoReflect.Descriptor instead.
-func (*ListWorkspaceSettingsRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{5}
-}
-
-type ListWorkspaceSettingsResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Settings []*WorkspaceSetting `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty"`
-}
-
-func (x *ListWorkspaceSettingsResponse) Reset() {
- *x = ListWorkspaceSettingsResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_workspace_setting_service_proto_msgTypes[6]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ListWorkspaceSettingsResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListWorkspaceSettingsResponse) ProtoMessage() {}
-
-func (x *ListWorkspaceSettingsResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_setting_service_proto_msgTypes[6]
- 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 ListWorkspaceSettingsResponse.ProtoReflect.Descriptor instead.
-func (*ListWorkspaceSettingsResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{6}
-}
-
-func (x *ListWorkspaceSettingsResponse) GetSettings() []*WorkspaceSetting {
- if x != nil {
- return x.Settings
- }
- return nil
-}
-
type GetWorkspaceSettingRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -593,7 +508,7 @@ type GetWorkspaceSettingRequest struct {
func (x *GetWorkspaceSettingRequest) Reset() {
*x = GetWorkspaceSettingRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_workspace_setting_service_proto_msgTypes[7]
+ mi := &file_api_v1_workspace_setting_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -606,7 +521,7 @@ func (x *GetWorkspaceSettingRequest) String() string {
func (*GetWorkspaceSettingRequest) ProtoMessage() {}
func (x *GetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_setting_service_proto_msgTypes[7]
+ mi := &file_api_v1_workspace_setting_service_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -619,7 +534,7 @@ func (x *GetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetWorkspaceSettingRequest.ProtoReflect.Descriptor instead.
func (*GetWorkspaceSettingRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{7}
+ return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{5}
}
func (x *GetWorkspaceSettingRequest) GetName() string {
@@ -641,7 +556,7 @@ type SetWorkspaceSettingRequest struct {
func (x *SetWorkspaceSettingRequest) Reset() {
*x = SetWorkspaceSettingRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_workspace_setting_service_proto_msgTypes[8]
+ mi := &file_api_v1_workspace_setting_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -654,7 +569,7 @@ func (x *SetWorkspaceSettingRequest) String() string {
func (*SetWorkspaceSettingRequest) ProtoMessage() {}
func (x *SetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_setting_service_proto_msgTypes[8]
+ mi := &file_api_v1_workspace_setting_service_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -667,7 +582,7 @@ func (x *SetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SetWorkspaceSettingRequest.ProtoReflect.Descriptor instead.
func (*SetWorkspaceSettingRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{8}
+ return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{6}
}
func (x *SetWorkspaceSettingRequest) GetSetting() *WorkspaceSetting {
@@ -693,7 +608,7 @@ type WorkspaceStorageSetting_S3Config struct {
func (x *WorkspaceStorageSetting_S3Config) Reset() {
*x = WorkspaceStorageSetting_S3Config{}
if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_workspace_setting_service_proto_msgTypes[9]
+ mi := &file_api_v1_workspace_setting_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -706,7 +621,7 @@ func (x *WorkspaceStorageSetting_S3Config) String() string {
func (*WorkspaceStorageSetting_S3Config) ProtoMessage() {}
func (x *WorkspaceStorageSetting_S3Config) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_setting_service_proto_msgTypes[9]
+ mi := &file_api_v1_workspace_setting_service_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -866,67 +781,50 @@ var file_api_v1_workspace_setting_service_proto_rawDesc = []byte{
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f,
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5f, 0x6c, 0x69, 0x6d,
0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
- 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x1e, 0x0a, 0x1c,
- 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74,
- 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5b, 0x0a, 0x1d,
- 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74,
- 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a,
- 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
- 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57,
- 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52,
- 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x36, 0x0a, 0x1a, 0x47, 0x65, 0x74,
+ 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x36, 0x0a, 0x1a,
+ 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74,
+ 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x56, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73,
+ 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74,
+ 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xd9, 0x02, 0x0a,
+ 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e,
+ 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x93, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74,
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
- 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d,
- 0x65, 0x22, 0x56, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
- 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
- 0x38, 0x0a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
- 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e,
+ 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e,
+ 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74,
+ 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d,
+ 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70,
+ 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x32, 0xda, 0x41, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f,
+ 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x7b, 0x6e, 0x61,
+ 0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xa7,
+ 0x01, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53,
+ 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61,
+ 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e,
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
- 0x52, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xf0, 0x03, 0x0a, 0x17, 0x57, 0x6f,
- 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65,
- 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x94, 0x01, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f,
- 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12,
- 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c,
- 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74,
- 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6d, 0x65,
- 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57,
- 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73,
- 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c,
- 0x12, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70,
- 0x61, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x93, 0x01, 0x0a,
- 0x13, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74,
- 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
- 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65,
- 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e,
- 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f,
- 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x32,
- 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f,
- 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65,
- 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f,
- 0x2a, 0x7d, 0x12, 0xa7, 0x01, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70,
- 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d,
- 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72,
- 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71,
- 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
- 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74,
- 0x74, 0x69, 0x6e, 0x67, 0x22, 0x46, 0xda, 0x41, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
- 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x36, 0x3a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32,
- 0x2b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61,
- 0x63, 0x65, 0x2f, 0x7b, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xb4, 0x01, 0x0a,
- 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
- 0x31, 0x42, 0x1c, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74,
- 0x69, 0x6e, 0x67, 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, 0x31, 0x3b, 0x61, 0x70,
- 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f,
- 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73,
- 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c,
- 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 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, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x22, 0x46, 0xda, 0x41, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x82, 0xd3, 0xe4, 0x93,
+ 0x02, 0x36, 0x3a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x2b, 0x2f, 0x61, 0x70,
+ 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x7b,
+ 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74,
+ 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xb4, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d,
+ 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x1c, 0x57,
+ 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 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, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2,
+ 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70,
+ 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69,
+ 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c,
+ 0x56, 0x31, 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, 0x31, 0x62,
+ 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -942,7 +840,7 @@ func file_api_v1_workspace_setting_service_proto_rawDescGZIP() []byte {
}
var file_api_v1_workspace_setting_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_api_v1_workspace_setting_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
+var file_api_v1_workspace_setting_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_api_v1_workspace_setting_service_proto_goTypes = []interface{}{
(WorkspaceStorageSetting_StorageType)(0), // 0: memos.api.v1.WorkspaceStorageSetting.StorageType
(*WorkspaceSetting)(nil), // 1: memos.api.v1.WorkspaceSetting
@@ -950,32 +848,27 @@ var file_api_v1_workspace_setting_service_proto_goTypes = []interface{}{
(*WorkspaceCustomProfile)(nil), // 3: memos.api.v1.WorkspaceCustomProfile
(*WorkspaceStorageSetting)(nil), // 4: memos.api.v1.WorkspaceStorageSetting
(*WorkspaceMemoRelatedSetting)(nil), // 5: memos.api.v1.WorkspaceMemoRelatedSetting
- (*ListWorkspaceSettingsRequest)(nil), // 6: memos.api.v1.ListWorkspaceSettingsRequest
- (*ListWorkspaceSettingsResponse)(nil), // 7: memos.api.v1.ListWorkspaceSettingsResponse
- (*GetWorkspaceSettingRequest)(nil), // 8: memos.api.v1.GetWorkspaceSettingRequest
- (*SetWorkspaceSettingRequest)(nil), // 9: memos.api.v1.SetWorkspaceSettingRequest
- (*WorkspaceStorageSetting_S3Config)(nil), // 10: memos.api.v1.WorkspaceStorageSetting.S3Config
+ (*GetWorkspaceSettingRequest)(nil), // 6: memos.api.v1.GetWorkspaceSettingRequest
+ (*SetWorkspaceSettingRequest)(nil), // 7: memos.api.v1.SetWorkspaceSettingRequest
+ (*WorkspaceStorageSetting_S3Config)(nil), // 8: memos.api.v1.WorkspaceStorageSetting.S3Config
}
var file_api_v1_workspace_setting_service_proto_depIdxs = []int32{
- 2, // 0: memos.api.v1.WorkspaceSetting.general_setting:type_name -> memos.api.v1.WorkspaceGeneralSetting
- 4, // 1: memos.api.v1.WorkspaceSetting.storage_setting:type_name -> memos.api.v1.WorkspaceStorageSetting
- 5, // 2: memos.api.v1.WorkspaceSetting.memo_related_setting:type_name -> memos.api.v1.WorkspaceMemoRelatedSetting
- 3, // 3: memos.api.v1.WorkspaceGeneralSetting.custom_profile:type_name -> memos.api.v1.WorkspaceCustomProfile
- 0, // 4: memos.api.v1.WorkspaceStorageSetting.storage_type:type_name -> memos.api.v1.WorkspaceStorageSetting.StorageType
- 10, // 5: memos.api.v1.WorkspaceStorageSetting.s3_config:type_name -> memos.api.v1.WorkspaceStorageSetting.S3Config
- 1, // 6: memos.api.v1.ListWorkspaceSettingsResponse.settings:type_name -> memos.api.v1.WorkspaceSetting
- 1, // 7: memos.api.v1.SetWorkspaceSettingRequest.setting:type_name -> memos.api.v1.WorkspaceSetting
- 6, // 8: memos.api.v1.WorkspaceSettingService.ListWorkspaceSettings:input_type -> memos.api.v1.ListWorkspaceSettingsRequest
- 8, // 9: memos.api.v1.WorkspaceSettingService.GetWorkspaceSetting:input_type -> memos.api.v1.GetWorkspaceSettingRequest
- 9, // 10: memos.api.v1.WorkspaceSettingService.SetWorkspaceSetting:input_type -> memos.api.v1.SetWorkspaceSettingRequest
- 7, // 11: memos.api.v1.WorkspaceSettingService.ListWorkspaceSettings:output_type -> memos.api.v1.ListWorkspaceSettingsResponse
- 1, // 12: memos.api.v1.WorkspaceSettingService.GetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting
- 1, // 13: memos.api.v1.WorkspaceSettingService.SetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting
- 11, // [11:14] is the sub-list for method output_type
- 8, // [8:11] 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
+ 2, // 0: memos.api.v1.WorkspaceSetting.general_setting:type_name -> memos.api.v1.WorkspaceGeneralSetting
+ 4, // 1: memos.api.v1.WorkspaceSetting.storage_setting:type_name -> memos.api.v1.WorkspaceStorageSetting
+ 5, // 2: memos.api.v1.WorkspaceSetting.memo_related_setting:type_name -> memos.api.v1.WorkspaceMemoRelatedSetting
+ 3, // 3: memos.api.v1.WorkspaceGeneralSetting.custom_profile:type_name -> memos.api.v1.WorkspaceCustomProfile
+ 0, // 4: memos.api.v1.WorkspaceStorageSetting.storage_type:type_name -> memos.api.v1.WorkspaceStorageSetting.StorageType
+ 8, // 5: memos.api.v1.WorkspaceStorageSetting.s3_config:type_name -> memos.api.v1.WorkspaceStorageSetting.S3Config
+ 1, // 6: memos.api.v1.SetWorkspaceSettingRequest.setting:type_name -> memos.api.v1.WorkspaceSetting
+ 6, // 7: memos.api.v1.WorkspaceSettingService.GetWorkspaceSetting:input_type -> memos.api.v1.GetWorkspaceSettingRequest
+ 7, // 8: memos.api.v1.WorkspaceSettingService.SetWorkspaceSetting:input_type -> memos.api.v1.SetWorkspaceSettingRequest
+ 1, // 9: memos.api.v1.WorkspaceSettingService.GetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting
+ 1, // 10: memos.api.v1.WorkspaceSettingService.SetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting
+ 9, // [9:11] is the sub-list for method output_type
+ 7, // [7:9] is the sub-list for method input_type
+ 7, // [7:7] is the sub-list for extension type_name
+ 7, // [7:7] is the sub-list for extension extendee
+ 0, // [0:7] is the sub-list for field type_name
}
func init() { file_api_v1_workspace_setting_service_proto_init() }
@@ -1045,30 +938,6 @@ func file_api_v1_workspace_setting_service_proto_init() {
}
}
file_api_v1_workspace_setting_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ListWorkspaceSettingsRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_workspace_setting_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ListWorkspaceSettingsResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_workspace_setting_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetWorkspaceSettingRequest); i {
case 0:
return &v.state
@@ -1080,7 +949,7 @@ func file_api_v1_workspace_setting_service_proto_init() {
return nil
}
}
- file_api_v1_workspace_setting_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ file_api_v1_workspace_setting_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SetWorkspaceSettingRequest); i {
case 0:
return &v.state
@@ -1092,7 +961,7 @@ func file_api_v1_workspace_setting_service_proto_init() {
return nil
}
}
- file_api_v1_workspace_setting_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ file_api_v1_workspace_setting_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WorkspaceStorageSetting_S3Config); i {
case 0:
return &v.state
@@ -1116,7 +985,7 @@ func file_api_v1_workspace_setting_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_v1_workspace_setting_service_proto_rawDesc,
NumEnums: 1,
- NumMessages: 10,
+ NumMessages: 8,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/gen/api/v1/workspace_setting_service.pb.gw.go b/proto/gen/api/v1/workspace_setting_service.pb.gw.go
index a9839eb32..fea94724d 100644
--- a/proto/gen/api/v1/workspace_setting_service.pb.gw.go
+++ b/proto/gen/api/v1/workspace_setting_service.pb.gw.go
@@ -31,24 +31,6 @@ var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
-func request_WorkspaceSettingService_ListWorkspaceSettings_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceSettingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ListWorkspaceSettingsRequest
- var metadata runtime.ServerMetadata
-
- msg, err := client.ListWorkspaceSettings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func local_request_WorkspaceSettingService_ListWorkspaceSettings_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceSettingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ListWorkspaceSettingsRequest
- var metadata runtime.ServerMetadata
-
- msg, err := server.ListWorkspaceSettings(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
func request_WorkspaceSettingService_GetWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceSettingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetWorkspaceSettingRequest
var metadata runtime.ServerMetadata
@@ -167,31 +149,6 @@ func local_request_WorkspaceSettingService_SetWorkspaceSetting_0(ctx context.Con
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWorkspaceSettingServiceHandlerFromEndpoint instead.
func RegisterWorkspaceSettingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkspaceSettingServiceServer) error {
- mux.Handle("GET", pattern_WorkspaceSettingService_ListWorkspaceSettings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WorkspaceSettingService/ListWorkspaceSettings", runtime.WithHTTPPathPattern("/api/v1/workspace/settings"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_WorkspaceSettingService_ListWorkspaceSettings_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_WorkspaceSettingService_ListWorkspaceSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
mux.Handle("GET", pattern_WorkspaceSettingService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -283,28 +240,6 @@ func RegisterWorkspaceSettingServiceHandler(ctx context.Context, mux *runtime.Se
// "WorkspaceSettingServiceClient" to call the correct interceptors.
func RegisterWorkspaceSettingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkspaceSettingServiceClient) error {
- mux.Handle("GET", pattern_WorkspaceSettingService_ListWorkspaceSettings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WorkspaceSettingService/ListWorkspaceSettings", runtime.WithHTTPPathPattern("/api/v1/workspace/settings"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_WorkspaceSettingService_ListWorkspaceSettings_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_WorkspaceSettingService_ListWorkspaceSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
mux.Handle("GET", pattern_WorkspaceSettingService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -353,16 +288,12 @@ func RegisterWorkspaceSettingServiceHandlerClient(ctx context.Context, mux *runt
}
var (
- pattern_WorkspaceSettingService_ListWorkspaceSettings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "workspace", "settings"}, ""))
-
pattern_WorkspaceSettingService_GetWorkspaceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 2, 5, 4}, []string{"api", "v1", "workspace", "settings", "name"}, ""))
pattern_WorkspaceSettingService_SetWorkspaceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 2, 5, 4}, []string{"api", "v1", "workspace", "settings", "setting.name"}, ""))
)
var (
- forward_WorkspaceSettingService_ListWorkspaceSettings_0 = runtime.ForwardResponseMessage
-
forward_WorkspaceSettingService_GetWorkspaceSetting_0 = runtime.ForwardResponseMessage
forward_WorkspaceSettingService_SetWorkspaceSetting_0 = runtime.ForwardResponseMessage
diff --git a/proto/gen/api/v1/workspace_setting_service_grpc.pb.go b/proto/gen/api/v1/workspace_setting_service_grpc.pb.go
index 0e9c3cc40..ed06a241b 100644
--- a/proto/gen/api/v1/workspace_setting_service_grpc.pb.go
+++ b/proto/gen/api/v1/workspace_setting_service_grpc.pb.go
@@ -19,17 +19,14 @@ import (
const _ = grpc.SupportPackageIsVersion7
const (
- WorkspaceSettingService_ListWorkspaceSettings_FullMethodName = "/memos.api.v1.WorkspaceSettingService/ListWorkspaceSettings"
- WorkspaceSettingService_GetWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting"
- WorkspaceSettingService_SetWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceSettingService/SetWorkspaceSetting"
+ WorkspaceSettingService_GetWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting"
+ WorkspaceSettingService_SetWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceSettingService/SetWorkspaceSetting"
)
// WorkspaceSettingServiceClient is the client API for WorkspaceSettingService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type WorkspaceSettingServiceClient interface {
- // ListWorkspaceSetting returns the list of settings.
- ListWorkspaceSettings(ctx context.Context, in *ListWorkspaceSettingsRequest, opts ...grpc.CallOption) (*ListWorkspaceSettingsResponse, error)
// GetWorkspaceSetting returns the setting by name.
GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error)
// SetWorkspaceSetting updates the setting.
@@ -44,15 +41,6 @@ func NewWorkspaceSettingServiceClient(cc grpc.ClientConnInterface) WorkspaceSett
return &workspaceSettingServiceClient{cc}
}
-func (c *workspaceSettingServiceClient) ListWorkspaceSettings(ctx context.Context, in *ListWorkspaceSettingsRequest, opts ...grpc.CallOption) (*ListWorkspaceSettingsResponse, error) {
- out := new(ListWorkspaceSettingsResponse)
- err := c.cc.Invoke(ctx, WorkspaceSettingService_ListWorkspaceSettings_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
func (c *workspaceSettingServiceClient) GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error) {
out := new(WorkspaceSetting)
err := c.cc.Invoke(ctx, WorkspaceSettingService_GetWorkspaceSetting_FullMethodName, in, out, opts...)
@@ -75,8 +63,6 @@ func (c *workspaceSettingServiceClient) SetWorkspaceSetting(ctx context.Context,
// All implementations must embed UnimplementedWorkspaceSettingServiceServer
// for forward compatibility
type WorkspaceSettingServiceServer interface {
- // ListWorkspaceSetting returns the list of settings.
- ListWorkspaceSettings(context.Context, *ListWorkspaceSettingsRequest) (*ListWorkspaceSettingsResponse, error)
// GetWorkspaceSetting returns the setting by name.
GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error)
// SetWorkspaceSetting updates the setting.
@@ -88,9 +74,6 @@ type WorkspaceSettingServiceServer interface {
type UnimplementedWorkspaceSettingServiceServer struct {
}
-func (UnimplementedWorkspaceSettingServiceServer) ListWorkspaceSettings(context.Context, *ListWorkspaceSettingsRequest) (*ListWorkspaceSettingsResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ListWorkspaceSettings not implemented")
-}
func (UnimplementedWorkspaceSettingServiceServer) GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceSetting not implemented")
}
@@ -111,24 +94,6 @@ func RegisterWorkspaceSettingServiceServer(s grpc.ServiceRegistrar, srv Workspac
s.RegisterService(&WorkspaceSettingService_ServiceDesc, srv)
}
-func _WorkspaceSettingService_ListWorkspaceSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(ListWorkspaceSettingsRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(WorkspaceSettingServiceServer).ListWorkspaceSettings(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: WorkspaceSettingService_ListWorkspaceSettings_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(WorkspaceSettingServiceServer).ListWorkspaceSettings(ctx, req.(*ListWorkspaceSettingsRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
func _WorkspaceSettingService_GetWorkspaceSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWorkspaceSettingRequest)
if err := dec(in); err != nil {
@@ -172,10 +137,6 @@ var WorkspaceSettingService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "memos.api.v1.WorkspaceSettingService",
HandlerType: (*WorkspaceSettingServiceServer)(nil),
Methods: []grpc.MethodDesc{
- {
- MethodName: "ListWorkspaceSettings",
- Handler: _WorkspaceSettingService_ListWorkspaceSettings_Handler,
- },
{
MethodName: "GetWorkspaceSetting",
Handler: _WorkspaceSettingService_GetWorkspaceSetting_Handler,
diff --git a/server/router/api/v1/workspace_setting_service.go b/server/router/api/v1/workspace_setting_service.go
index 7b65d70f3..dcf668191 100644
--- a/server/router/api/v1/workspace_setting_service.go
+++ b/server/router/api/v1/workspace_setting_service.go
@@ -12,40 +12,32 @@ import (
"github.com/usememos/memos/store"
)
-func (s *APIV1Service) ListWorkspaceSettings(ctx context.Context, _ *v1pb.ListWorkspaceSettingsRequest) (*v1pb.ListWorkspaceSettingsResponse, error) {
- user, err := getCurrentUser(ctx, s.Store)
+func (s *APIV1Service) GetWorkspaceSetting(ctx context.Context, request *v1pb.GetWorkspaceSettingRequest) (*v1pb.WorkspaceSetting, error) {
+ workspaceSettingKeyString, err := ExtractWorkspaceSettingKeyFromName(request.Name)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
+ return nil, status.Errorf(codes.InvalidArgument, "invalid workspace setting name: %v", err)
}
- workspaceSettingFind := &store.FindWorkspaceSetting{}
- if user == nil || user.Role == store.RoleUser {
- workspaceSettingFind.Name = storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL.String()
+ workspaceSettingKey := storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[workspaceSettingKeyString])
+ // Get workspace setting from store with default value.
+ switch workspaceSettingKey {
+ case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC:
+ _, err = s.Store.GetWorkspaceBasicSetting(ctx)
+ case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL:
+ _, err = s.Store.GetWorkspaceGeneralSetting(ctx)
+ case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED:
+ _, err = s.Store.GetWorkspaceMemoRelatedSetting(ctx)
+ case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_STORAGE:
+ _, err = s.Store.GetWorkspaceStorageSetting(ctx)
+ default:
+ return nil, status.Errorf(codes.InvalidArgument, "unsupported workspace setting key: %v", workspaceSettingKey)
}
- workspaceSettings, err := s.Store.ListWorkspaceSettings(ctx, workspaceSettingFind)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err)
}
- response := &v1pb.ListWorkspaceSettingsResponse{
- Settings: []*v1pb.WorkspaceSetting{},
- }
- for _, workspaceSetting := range workspaceSettings {
- if workspaceSetting.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC {
- continue
- }
- response.Settings = append(response.Settings, convertWorkspaceSettingFromStore(workspaceSetting))
- }
- return response, nil
-}
-
-func (s *APIV1Service) GetWorkspaceSetting(ctx context.Context, request *v1pb.GetWorkspaceSettingRequest) (*v1pb.WorkspaceSetting, error) {
- settingKeyString, err := ExtractWorkspaceSettingKeyFromName(request.Name)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid workspace setting name: %v", err)
- }
workspaceSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{
- Name: settingKeyString,
+ Name: workspaceSettingKey.String(),
})
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err)
diff --git a/store/workspace_setting.go b/store/workspace_setting.go
index de33bccff..7d319cd41 100644
--- a/store/workspace_setting.go
+++ b/store/workspace_setting.go
@@ -111,6 +111,10 @@ func (s *Store) GetWorkspaceBasicSetting(ctx context.Context) (*storepb.Workspac
if workspaceSetting != nil {
workspaceBasicSetting = workspaceSetting.GetBasicSetting()
}
+ s.workspaceSettingCache.Store(storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC.String(), &storepb.WorkspaceSetting{
+ Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC,
+ Value: &storepb.WorkspaceSetting_BasicSetting{BasicSetting: workspaceBasicSetting},
+ })
return workspaceBasicSetting, nil
}
@@ -126,6 +130,10 @@ func (s *Store) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.Worksp
if workspaceSetting != nil {
workspaceGeneralSetting = workspaceSetting.GetGeneralSetting()
}
+ s.workspaceSettingCache.Store(storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL.String(), &storepb.WorkspaceSetting{
+ Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL,
+ Value: &storepb.WorkspaceSetting_GeneralSetting{GeneralSetting: workspaceGeneralSetting},
+ })
return workspaceGeneralSetting, nil
}
@@ -149,6 +157,10 @@ func (s *Store) GetWorkspaceMemoRelatedSetting(ctx context.Context) (*storepb.Wo
if workspaceMemoRelatedSetting.ContentLengthLimit < DefaultContentLengthLimit {
workspaceMemoRelatedSetting.ContentLengthLimit = DefaultContentLengthLimit
}
+ s.workspaceSettingCache.Store(storepb.WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED.String(), &storepb.WorkspaceSetting{
+ Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED,
+ Value: &storepb.WorkspaceSetting_MemoRelatedSetting{MemoRelatedSetting: workspaceMemoRelatedSetting},
+ })
return workspaceMemoRelatedSetting, nil
}
@@ -179,6 +191,10 @@ func (s *Store) GetWorkspaceStorageSetting(ctx context.Context) (*storepb.Worksp
if workspaceStorageSetting.FilepathTemplate == "" {
workspaceStorageSetting.FilepathTemplate = defaultWorkspaceFilepathTemplate
}
+ s.workspaceSettingCache.Store(storepb.WorkspaceSettingKey_WORKSPACE_SETTING_STORAGE.String(), &storepb.WorkspaceSetting{
+ Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_STORAGE,
+ Value: &storepb.WorkspaceSetting_StorageSetting{StorageSetting: workspaceStorageSetting},
+ })
return workspaceStorageSetting, nil
}
diff --git a/web/src/layouts/CommonContextProvider.tsx b/web/src/layouts/CommonContextProvider.tsx
index 116a811d2..b7ca71d38 100644
--- a/web/src/layouts/CommonContextProvider.tsx
+++ b/web/src/layouts/CommonContextProvider.tsx
@@ -36,7 +36,7 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => {
useEffect(() => {
const initialWorkspace = async () => {
const workspaceProfile = await workspaceServiceClient.getWorkspaceProfile({});
- await workspaceSettingStore.listWorkspaceSettings();
+ await workspaceSettingStore.fetchWorkspaceSetting(WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL);
const workspaceGeneralSetting =
workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL).generalSetting ||
diff --git a/web/src/pages/Setting.tsx b/web/src/pages/Setting.tsx
index 760c6de38..d9789fa7d 100644
--- a/web/src/pages/Setting.tsx
+++ b/web/src/pages/Setting.tsx
@@ -1,6 +1,6 @@
import { Option, Select } from "@mui/joy";
import { LucideIcon } from "lucide-react";
-import { useCallback, useMemo, useState } from "react";
+import { useCallback, useEffect, useMemo, useState } from "react";
import Icon from "@/components/Icon";
import MobileHeader from "@/components/MobileHeader";
import MemberSection from "@/components/Settings/MemberSection";
@@ -12,7 +12,9 @@ import StorageSection from "@/components/Settings/StorageSection";
import WorkspaceSection from "@/components/Settings/WorkspaceSection";
import useCurrentUser from "@/hooks/useCurrentUser";
import { useCommonContext } from "@/layouts/CommonContextProvider";
+import { useWorkspaceSettingStore } from "@/store/v1";
import { User_Role } from "@/types/proto/api/v1/user_service";
+import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";
import { useTranslate } from "@/utils/i18n";
type SettingSection = "my-account" | "preference" | "member" | "system" | "storage" | "sso";
@@ -36,10 +38,10 @@ const Setting = () => {
const t = useTranslate();
const commonContext = useCommonContext();
const user = useCurrentUser();
+ const workspaceSettingStore = useWorkspaceSettingStore();
const [state, setState] = useState<State>({
selectedSection: "my-account",
});
-
const isHost = user.role === User_Role.HOST;
const settingsSectionList = useMemo(() => {
@@ -50,6 +52,19 @@ const Setting = () => {
return settingList;
}, [isHost]);
+ useEffect(() => {
+ if (!isHost) {
+ return;
+ }
+
+ // Initial fetch for workspace settings.
+ (async () => {
+ [WorkspaceSettingKey.WORKSPACE_SETTING_MEMO_RELATED, WorkspaceSettingKey.WORKSPACE_SETTING_STORAGE].forEach(async (key) => {
+ await workspaceSettingStore.fetchWorkspaceSetting(key);
+ });
+ })();
+ }, [isHost]);
+
const handleSectionSelectorItemClick = useCallback((settingSection: SettingSection) => {
setState({
selectedSection: settingSection,
diff --git a/web/src/store/v1/workspaceSetting.ts b/web/src/store/v1/workspaceSetting.ts
index b1187bed9..31975b1ac 100644
--- a/web/src/store/v1/workspaceSetting.ts
+++ b/web/src/store/v1/workspaceSetting.ts
@@ -18,10 +18,6 @@ export const useWorkspaceSettingStore = create(
getState: () => {
return get();
},
- listWorkspaceSettings: async () => {
- const { settings } = await workspaceSettingServiceClient.listWorkspaceSettings({});
- set({ workspaceSettingByName: settings.reduce((acc, setting) => ({ ...acc, [setting.name]: setting }), {}) });
- },
fetchWorkspaceSetting: async (key: WorkspaceSettingKey) => {
const setting = await workspaceSettingServiceClient.getWorkspaceSetting({ name: `${WorkspaceSettingPrefix}${key}` });
set({ workspaceSettingByName: { ...get().workspaceSettingByName, [setting.name]: setting } });