mirror of https://github.com/usememos/memos.git
refactor: workspace setting service
This commit is contained in:
parent
da906c665c
commit
1ea4cc453c
|
|
@ -3,6 +3,10 @@ syntax = "proto3";
|
|||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/api/resource.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
|
|
@ -11,6 +15,21 @@ service WorkspaceService {
|
|||
rpc GetWorkspaceProfile(GetWorkspaceProfileRequest) returns (WorkspaceProfile) {
|
||||
option (google.api.http) = {get: "/api/v1/workspace/profile"};
|
||||
}
|
||||
|
||||
// Gets a workspace setting.
|
||||
rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (WorkspaceSetting) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=workspace/settings/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
|
||||
// Updates a workspace setting.
|
||||
rpc UpdateWorkspaceSetting(UpdateWorkspaceSettingRequest) returns (WorkspaceSetting) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{setting.name=workspace/settings/*}"
|
||||
body: "setting"
|
||||
};
|
||||
option (google.api.method_signature) = "setting,update_mask";
|
||||
}
|
||||
}
|
||||
|
||||
// Workspace profile message containing basic workspace information.
|
||||
|
|
@ -31,3 +50,127 @@ message WorkspaceProfile {
|
|||
|
||||
// Request for workspace profile.
|
||||
message GetWorkspaceProfileRequest {}
|
||||
|
||||
// A workspace setting resource.
|
||||
message WorkspaceSetting {
|
||||
option (google.api.resource) = {
|
||||
type: "api.memos.dev/WorkspaceSetting"
|
||||
pattern: "workspace/settings/{setting}"
|
||||
singular: "workspaceSetting"
|
||||
plural: "workspaceSettings"
|
||||
};
|
||||
|
||||
// The name of the workspace setting.
|
||||
// Format: workspace/settings/{setting}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
oneof value {
|
||||
WorkspaceGeneralSetting general_setting = 2;
|
||||
WorkspaceStorageSetting storage_setting = 3;
|
||||
WorkspaceMemoRelatedSetting memo_related_setting = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message WorkspaceGeneralSetting {
|
||||
// disallow_user_registration disallows user registration.
|
||||
bool disallow_user_registration = 1;
|
||||
// disallow_password_auth disallows password authentication.
|
||||
bool disallow_password_auth = 2;
|
||||
// additional_script is the additional script.
|
||||
string additional_script = 3;
|
||||
// additional_style is the additional style.
|
||||
string additional_style = 4;
|
||||
// custom_profile is the custom profile.
|
||||
WorkspaceCustomProfile custom_profile = 5;
|
||||
// week_start_day_offset is the week start day offset from Sunday.
|
||||
// 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
|
||||
// Default is Sunday.
|
||||
int32 week_start_day_offset = 6;
|
||||
|
||||
// disallow_change_username disallows changing username.
|
||||
bool disallow_change_username = 7;
|
||||
// disallow_change_nickname disallows changing nickname.
|
||||
bool disallow_change_nickname = 8;
|
||||
}
|
||||
|
||||
message WorkspaceCustomProfile {
|
||||
string title = 1;
|
||||
string description = 2;
|
||||
string logo_url = 3;
|
||||
string locale = 4;
|
||||
string appearance = 5;
|
||||
}
|
||||
|
||||
message WorkspaceStorageSetting {
|
||||
enum StorageType {
|
||||
STORAGE_TYPE_UNSPECIFIED = 0;
|
||||
// DATABASE is the database storage type.
|
||||
DATABASE = 1;
|
||||
// LOCAL is the local storage type.
|
||||
LOCAL = 2;
|
||||
// S3 is the S3 storage type.
|
||||
S3 = 3;
|
||||
}
|
||||
// storage_type is the storage type.
|
||||
StorageType storage_type = 1;
|
||||
// The template of file path.
|
||||
// e.g. assets/{timestamp}_{filename}
|
||||
string filepath_template = 2;
|
||||
// The max upload size in megabytes.
|
||||
int64 upload_size_limit_mb = 3;
|
||||
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
|
||||
message S3Config {
|
||||
string access_key_id = 1;
|
||||
string access_key_secret = 2;
|
||||
string endpoint = 3;
|
||||
string region = 4;
|
||||
string bucket = 5;
|
||||
bool use_path_style = 6;
|
||||
}
|
||||
// The S3 config.
|
||||
S3Config s3_config = 4;
|
||||
}
|
||||
|
||||
message WorkspaceMemoRelatedSetting {
|
||||
reserved 4, 8;
|
||||
|
||||
// disallow_public_visibility disallows set memo as public visibility.
|
||||
bool disallow_public_visibility = 1;
|
||||
// display_with_update_time orders and displays memo with update time.
|
||||
bool display_with_update_time = 2;
|
||||
// content_length_limit is the limit of content length. Unit is byte.
|
||||
int32 content_length_limit = 3;
|
||||
// enable_double_click_edit enables editing on double click.
|
||||
bool enable_double_click_edit = 5;
|
||||
// enable_link_preview enables links preview.
|
||||
bool enable_link_preview = 6;
|
||||
// enable_comment enables comment.
|
||||
bool enable_comment = 7;
|
||||
// reactions is the list of reactions.
|
||||
repeated string reactions = 10;
|
||||
// disable_markdown_shortcuts disallow the registration of markdown shortcuts.
|
||||
bool disable_markdown_shortcuts = 11;
|
||||
// enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW).
|
||||
bool enable_blur_nsfw_content = 12;
|
||||
// nsfw_tags is the list of tags that mark content as NSFW for blurring.
|
||||
repeated string nsfw_tags = 13;
|
||||
}
|
||||
|
||||
// Request message for GetWorkspaceSetting method.
|
||||
message GetWorkspaceSettingRequest {
|
||||
// The resource name of the workspace setting.
|
||||
// Format: workspace/settings/{setting}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "api.memos.dev/WorkspaceSetting"}
|
||||
];
|
||||
}
|
||||
|
||||
// Request message for UpdateWorkspaceSetting method.
|
||||
message UpdateWorkspaceSettingRequest {
|
||||
// The workspace setting resource which replaces the resource on the server.
|
||||
WorkspaceSetting setting = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// The list of fields to update.
|
||||
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,132 +0,0 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service WorkspaceSettingService {
|
||||
// GetWorkspaceSetting returns the setting by name.
|
||||
rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (WorkspaceSetting) {
|
||||
option (google.api.http) = {get: "/api/v1/workspace/{name=settings/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// SetWorkspaceSetting updates the setting.
|
||||
rpc SetWorkspaceSetting(SetWorkspaceSettingRequest) returns (WorkspaceSetting) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/workspace/{setting.name=settings/*}"
|
||||
body: "setting"
|
||||
};
|
||||
option (google.api.method_signature) = "setting";
|
||||
}
|
||||
}
|
||||
|
||||
message WorkspaceSetting {
|
||||
// name is the name of the setting.
|
||||
// Format: settings/{setting}
|
||||
string name = 1;
|
||||
oneof value {
|
||||
WorkspaceGeneralSetting general_setting = 2;
|
||||
WorkspaceStorageSetting storage_setting = 3;
|
||||
WorkspaceMemoRelatedSetting memo_related_setting = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message WorkspaceGeneralSetting {
|
||||
// disallow_user_registration disallows user registration.
|
||||
bool disallow_user_registration = 1;
|
||||
// disallow_password_auth disallows password authentication.
|
||||
bool disallow_password_auth = 2;
|
||||
// additional_script is the additional script.
|
||||
string additional_script = 3;
|
||||
// additional_style is the additional style.
|
||||
string additional_style = 4;
|
||||
// custom_profile is the custom profile.
|
||||
WorkspaceCustomProfile custom_profile = 5;
|
||||
// week_start_day_offset is the week start day offset from Sunday.
|
||||
// 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
|
||||
// Default is Sunday.
|
||||
int32 week_start_day_offset = 6;
|
||||
|
||||
// disallow_change_username disallows changing username.
|
||||
bool disallow_change_username = 7;
|
||||
// disallow_change_nickname disallows changing nickname.
|
||||
bool disallow_change_nickname = 8;
|
||||
}
|
||||
|
||||
message WorkspaceCustomProfile {
|
||||
string title = 1;
|
||||
string description = 2;
|
||||
string logo_url = 3;
|
||||
string locale = 4;
|
||||
string appearance = 5;
|
||||
}
|
||||
|
||||
message WorkspaceStorageSetting {
|
||||
enum StorageType {
|
||||
STORAGE_TYPE_UNSPECIFIED = 0;
|
||||
// DATABASE is the database storage type.
|
||||
DATABASE = 1;
|
||||
// LOCAL is the local storage type.
|
||||
LOCAL = 2;
|
||||
// S3 is the S3 storage type.
|
||||
S3 = 3;
|
||||
}
|
||||
// storage_type is the storage type.
|
||||
StorageType storage_type = 1;
|
||||
// The template of file path.
|
||||
// e.g. assets/{timestamp}_{filename}
|
||||
string filepath_template = 2;
|
||||
// The max upload size in megabytes.
|
||||
int64 upload_size_limit_mb = 3;
|
||||
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
|
||||
message S3Config {
|
||||
string access_key_id = 1;
|
||||
string access_key_secret = 2;
|
||||
string endpoint = 3;
|
||||
string region = 4;
|
||||
string bucket = 5;
|
||||
bool use_path_style = 6;
|
||||
}
|
||||
// The S3 config.
|
||||
S3Config s3_config = 4;
|
||||
}
|
||||
|
||||
message WorkspaceMemoRelatedSetting {
|
||||
reserved 4, 8;
|
||||
|
||||
// disallow_public_visibility disallows set memo as public visibility.
|
||||
bool disallow_public_visibility = 1;
|
||||
// display_with_update_time orders and displays memo with update time.
|
||||
bool display_with_update_time = 2;
|
||||
// content_length_limit is the limit of content length. Unit is byte.
|
||||
int32 content_length_limit = 3;
|
||||
// enable_double_click_edit enables editing on double click.
|
||||
bool enable_double_click_edit = 5;
|
||||
// enable_link_preview enables links preview.
|
||||
bool enable_link_preview = 6;
|
||||
// enable_comment enables comment.
|
||||
bool enable_comment = 7;
|
||||
// reactions is the list of reactions.
|
||||
repeated string reactions = 10;
|
||||
// disable_markdown_shortcuts disallow the registration of markdown shortcuts.
|
||||
bool disable_markdown_shortcuts = 11;
|
||||
// enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW).
|
||||
bool enable_blur_nsfw_content = 12;
|
||||
// nsfw_tags is the list of tags that mark content as NSFW for blurring.
|
||||
repeated string nsfw_tags = 13;
|
||||
}
|
||||
|
||||
message GetWorkspaceSettingRequest {
|
||||
// The resource name of the workspace setting.
|
||||
// Format: settings/{setting}
|
||||
string name = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message SetWorkspaceSettingRequest {
|
||||
// setting is the setting to update.
|
||||
WorkspaceSetting setting = 1;
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import (
|
|||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
|
|
@ -22,6 +23,61 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type WorkspaceStorageSetting_StorageType int32
|
||||
|
||||
const (
|
||||
WorkspaceStorageSetting_STORAGE_TYPE_UNSPECIFIED WorkspaceStorageSetting_StorageType = 0
|
||||
// DATABASE is the database storage type.
|
||||
WorkspaceStorageSetting_DATABASE WorkspaceStorageSetting_StorageType = 1
|
||||
// LOCAL is the local storage type.
|
||||
WorkspaceStorageSetting_LOCAL WorkspaceStorageSetting_StorageType = 2
|
||||
// S3 is the S3 storage type.
|
||||
WorkspaceStorageSetting_S3 WorkspaceStorageSetting_StorageType = 3
|
||||
)
|
||||
|
||||
// Enum value maps for WorkspaceStorageSetting_StorageType.
|
||||
var (
|
||||
WorkspaceStorageSetting_StorageType_name = map[int32]string{
|
||||
0: "STORAGE_TYPE_UNSPECIFIED",
|
||||
1: "DATABASE",
|
||||
2: "LOCAL",
|
||||
3: "S3",
|
||||
}
|
||||
WorkspaceStorageSetting_StorageType_value = map[string]int32{
|
||||
"STORAGE_TYPE_UNSPECIFIED": 0,
|
||||
"DATABASE": 1,
|
||||
"LOCAL": 2,
|
||||
"S3": 3,
|
||||
}
|
||||
)
|
||||
|
||||
func (x WorkspaceStorageSetting_StorageType) Enum() *WorkspaceStorageSetting_StorageType {
|
||||
p := new(WorkspaceStorageSetting_StorageType)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x WorkspaceStorageSetting_StorageType) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (WorkspaceStorageSetting_StorageType) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_api_v1_workspace_service_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (WorkspaceStorageSetting_StorageType) Type() protoreflect.EnumType {
|
||||
return &file_api_v1_workspace_service_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x WorkspaceStorageSetting_StorageType) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceStorageSetting_StorageType.Descriptor instead.
|
||||
func (WorkspaceStorageSetting_StorageType) EnumDescriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{5, 0}
|
||||
}
|
||||
|
||||
// Workspace profile message containing basic workspace information.
|
||||
type WorkspaceProfile struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
|
|
@ -133,19 +189,762 @@ func (*GetWorkspaceProfileRequest) Descriptor() ([]byte, []int) {
|
|||
return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
// A workspace setting resource.
|
||||
type WorkspaceSetting struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// The name of the workspace setting.
|
||||
// Format: workspace/settings/{setting}
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// Types that are valid to be assigned to Value:
|
||||
//
|
||||
// *WorkspaceSetting_GeneralSetting
|
||||
// *WorkspaceSetting_StorageSetting
|
||||
// *WorkspaceSetting_MemoRelatedSetting
|
||||
Value isWorkspaceSetting_Value `protobuf_oneof:"value"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) Reset() {
|
||||
*x = WorkspaceSetting{}
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WorkspaceSetting) ProtoMessage() {}
|
||||
|
||||
func (x *WorkspaceSetting) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceSetting.ProtoReflect.Descriptor instead.
|
||||
func (*WorkspaceSetting) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) GetValue() isWorkspaceSetting_Value {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) GetGeneralSetting() *WorkspaceGeneralSetting {
|
||||
if x != nil {
|
||||
if x, ok := x.Value.(*WorkspaceSetting_GeneralSetting); ok {
|
||||
return x.GeneralSetting
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) GetStorageSetting() *WorkspaceStorageSetting {
|
||||
if x != nil {
|
||||
if x, ok := x.Value.(*WorkspaceSetting_StorageSetting); ok {
|
||||
return x.StorageSetting
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) GetMemoRelatedSetting() *WorkspaceMemoRelatedSetting {
|
||||
if x != nil {
|
||||
if x, ok := x.Value.(*WorkspaceSetting_MemoRelatedSetting); ok {
|
||||
return x.MemoRelatedSetting
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isWorkspaceSetting_Value interface {
|
||||
isWorkspaceSetting_Value()
|
||||
}
|
||||
|
||||
type WorkspaceSetting_GeneralSetting struct {
|
||||
GeneralSetting *WorkspaceGeneralSetting `protobuf:"bytes,2,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"`
|
||||
}
|
||||
|
||||
type WorkspaceSetting_MemoRelatedSetting struct {
|
||||
MemoRelatedSetting *WorkspaceMemoRelatedSetting `protobuf:"bytes,4,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*WorkspaceSetting_GeneralSetting) isWorkspaceSetting_Value() {}
|
||||
|
||||
func (*WorkspaceSetting_StorageSetting) isWorkspaceSetting_Value() {}
|
||||
|
||||
func (*WorkspaceSetting_MemoRelatedSetting) isWorkspaceSetting_Value() {}
|
||||
|
||||
type WorkspaceGeneralSetting struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// disallow_user_registration disallows user registration.
|
||||
DisallowUserRegistration bool `protobuf:"varint,1,opt,name=disallow_user_registration,json=disallowUserRegistration,proto3" json:"disallow_user_registration,omitempty"`
|
||||
// disallow_password_auth disallows password authentication.
|
||||
DisallowPasswordAuth bool `protobuf:"varint,2,opt,name=disallow_password_auth,json=disallowPasswordAuth,proto3" json:"disallow_password_auth,omitempty"`
|
||||
// additional_script is the additional script.
|
||||
AdditionalScript string `protobuf:"bytes,3,opt,name=additional_script,json=additionalScript,proto3" json:"additional_script,omitempty"`
|
||||
// additional_style is the additional style.
|
||||
AdditionalStyle string `protobuf:"bytes,4,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"`
|
||||
// custom_profile is the custom profile.
|
||||
CustomProfile *WorkspaceCustomProfile `protobuf:"bytes,5,opt,name=custom_profile,json=customProfile,proto3" json:"custom_profile,omitempty"`
|
||||
// week_start_day_offset is the week start day offset from Sunday.
|
||||
// 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
|
||||
// Default is Sunday.
|
||||
WeekStartDayOffset int32 `protobuf:"varint,6,opt,name=week_start_day_offset,json=weekStartDayOffset,proto3" json:"week_start_day_offset,omitempty"`
|
||||
// disallow_change_username disallows changing username.
|
||||
DisallowChangeUsername bool `protobuf:"varint,7,opt,name=disallow_change_username,json=disallowChangeUsername,proto3" json:"disallow_change_username,omitempty"`
|
||||
// disallow_change_nickname disallows changing nickname.
|
||||
DisallowChangeNickname bool `protobuf:"varint,8,opt,name=disallow_change_nickname,json=disallowChangeNickname,proto3" json:"disallow_change_nickname,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) Reset() {
|
||||
*x = WorkspaceGeneralSetting{}
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WorkspaceGeneralSetting) ProtoMessage() {}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceGeneralSetting.ProtoReflect.Descriptor instead.
|
||||
func (*WorkspaceGeneralSetting) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetDisallowUserRegistration() bool {
|
||||
if x != nil {
|
||||
return x.DisallowUserRegistration
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetDisallowPasswordAuth() bool {
|
||||
if x != nil {
|
||||
return x.DisallowPasswordAuth
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetAdditionalScript() string {
|
||||
if x != nil {
|
||||
return x.AdditionalScript
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetAdditionalStyle() string {
|
||||
if x != nil {
|
||||
return x.AdditionalStyle
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetCustomProfile() *WorkspaceCustomProfile {
|
||||
if x != nil {
|
||||
return x.CustomProfile
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetWeekStartDayOffset() int32 {
|
||||
if x != nil {
|
||||
return x.WeekStartDayOffset
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetDisallowChangeUsername() bool {
|
||||
if x != nil {
|
||||
return x.DisallowChangeUsername
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetDisallowChangeNickname() bool {
|
||||
if x != nil {
|
||||
return x.DisallowChangeNickname
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type WorkspaceCustomProfile struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceCustomProfile) Reset() {
|
||||
*x = WorkspaceCustomProfile{}
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[4]
|
||||
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_api_v1_workspace_service_proto_msgTypes[4]
|
||||
if 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_api_v1_workspace_service_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
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 `protogen:"open.v1"`
|
||||
// storage_type is the storage type.
|
||||
StorageType WorkspaceStorageSetting_StorageType `protobuf:"varint,1,opt,name=storage_type,json=storageType,proto3,enum=memos.api.v1.WorkspaceStorageSetting_StorageType" json:"storage_type,omitempty"`
|
||||
// The template of file path.
|
||||
// e.g. assets/{timestamp}_{filename}
|
||||
FilepathTemplate string `protobuf:"bytes,2,opt,name=filepath_template,json=filepathTemplate,proto3" json:"filepath_template,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"`
|
||||
// The S3 config.
|
||||
S3Config *WorkspaceStorageSetting_S3Config `protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) Reset() {
|
||||
*x = WorkspaceStorageSetting{}
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WorkspaceStorageSetting) ProtoMessage() {}
|
||||
|
||||
func (x *WorkspaceStorageSetting) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceStorageSetting.ProtoReflect.Descriptor instead.
|
||||
func (*WorkspaceStorageSetting) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) GetStorageType() WorkspaceStorageSetting_StorageType {
|
||||
if x != nil {
|
||||
return x.StorageType
|
||||
}
|
||||
return WorkspaceStorageSetting_STORAGE_TYPE_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) GetFilepathTemplate() string {
|
||||
if x != nil {
|
||||
return x.FilepathTemplate
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) GetUploadSizeLimitMb() int64 {
|
||||
if x != nil {
|
||||
return x.UploadSizeLimitMb
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) GetS3Config() *WorkspaceStorageSetting_S3Config {
|
||||
if x != nil {
|
||||
return x.S3Config
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type WorkspaceMemoRelatedSetting struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// disallow_public_visibility disallows set memo as public visibility.
|
||||
DisallowPublicVisibility bool `protobuf:"varint,1,opt,name=disallow_public_visibility,json=disallowPublicVisibility,proto3" json:"disallow_public_visibility,omitempty"`
|
||||
// display_with_update_time orders and displays memo with update time.
|
||||
DisplayWithUpdateTime bool `protobuf:"varint,2,opt,name=display_with_update_time,json=displayWithUpdateTime,proto3" json:"display_with_update_time,omitempty"`
|
||||
// content_length_limit is the limit of content length. Unit is byte.
|
||||
ContentLengthLimit int32 `protobuf:"varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"`
|
||||
// enable_double_click_edit enables editing on double click.
|
||||
EnableDoubleClickEdit bool `protobuf:"varint,5,opt,name=enable_double_click_edit,json=enableDoubleClickEdit,proto3" json:"enable_double_click_edit,omitempty"`
|
||||
// enable_link_preview enables links preview.
|
||||
EnableLinkPreview bool `protobuf:"varint,6,opt,name=enable_link_preview,json=enableLinkPreview,proto3" json:"enable_link_preview,omitempty"`
|
||||
// enable_comment enables comment.
|
||||
EnableComment bool `protobuf:"varint,7,opt,name=enable_comment,json=enableComment,proto3" json:"enable_comment,omitempty"`
|
||||
// reactions is the list of reactions.
|
||||
Reactions []string `protobuf:"bytes,10,rep,name=reactions,proto3" json:"reactions,omitempty"`
|
||||
// disable_markdown_shortcuts disallow the registration of markdown shortcuts.
|
||||
DisableMarkdownShortcuts bool `protobuf:"varint,11,opt,name=disable_markdown_shortcuts,json=disableMarkdownShortcuts,proto3" json:"disable_markdown_shortcuts,omitempty"`
|
||||
// enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW).
|
||||
EnableBlurNsfwContent bool `protobuf:"varint,12,opt,name=enable_blur_nsfw_content,json=enableBlurNsfwContent,proto3" json:"enable_blur_nsfw_content,omitempty"`
|
||||
// nsfw_tags is the list of tags that mark content as NSFW for blurring.
|
||||
NsfwTags []string `protobuf:"bytes,13,rep,name=nsfw_tags,json=nsfwTags,proto3" json:"nsfw_tags,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) Reset() {
|
||||
*x = WorkspaceMemoRelatedSetting{}
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WorkspaceMemoRelatedSetting) ProtoMessage() {}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceMemoRelatedSetting.ProtoReflect.Descriptor instead.
|
||||
func (*WorkspaceMemoRelatedSetting) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetDisallowPublicVisibility() bool {
|
||||
if x != nil {
|
||||
return x.DisallowPublicVisibility
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetDisplayWithUpdateTime() bool {
|
||||
if x != nil {
|
||||
return x.DisplayWithUpdateTime
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetContentLengthLimit() int32 {
|
||||
if x != nil {
|
||||
return x.ContentLengthLimit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetEnableDoubleClickEdit() bool {
|
||||
if x != nil {
|
||||
return x.EnableDoubleClickEdit
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetEnableLinkPreview() bool {
|
||||
if x != nil {
|
||||
return x.EnableLinkPreview
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetEnableComment() bool {
|
||||
if x != nil {
|
||||
return x.EnableComment
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetReactions() []string {
|
||||
if x != nil {
|
||||
return x.Reactions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetDisableMarkdownShortcuts() bool {
|
||||
if x != nil {
|
||||
return x.DisableMarkdownShortcuts
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetEnableBlurNsfwContent() bool {
|
||||
if x != nil {
|
||||
return x.EnableBlurNsfwContent
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetNsfwTags() []string {
|
||||
if x != nil {
|
||||
return x.NsfwTags
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Request message for GetWorkspaceSetting method.
|
||||
type GetWorkspaceSettingRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// The resource name of the workspace setting.
|
||||
// Format: workspace/settings/{setting}
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetWorkspaceSettingRequest) Reset() {
|
||||
*x = GetWorkspaceSettingRequest{}
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetWorkspaceSettingRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetWorkspaceSettingRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetWorkspaceSettingRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetWorkspaceSettingRequest) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *GetWorkspaceSettingRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Request message for UpdateWorkspaceSetting method.
|
||||
type UpdateWorkspaceSettingRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// The workspace setting resource which replaces the resource on the server.
|
||||
Setting *WorkspaceSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"`
|
||||
// The list of fields to update.
|
||||
UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *UpdateWorkspaceSettingRequest) Reset() {
|
||||
*x = UpdateWorkspaceSettingRequest{}
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UpdateWorkspaceSettingRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateWorkspaceSettingRequest) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateWorkspaceSettingRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateWorkspaceSettingRequest) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *UpdateWorkspaceSettingRequest) GetSetting() *WorkspaceSetting {
|
||||
if x != nil {
|
||||
return x.Setting
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdateWorkspaceSettingRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
|
||||
if x != nil {
|
||||
return x.UpdateMask
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
|
||||
type WorkspaceStorageSetting_S3Config struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
AccessKeyId string `protobuf:"bytes,1,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"`
|
||||
AccessKeySecret string `protobuf:"bytes,2,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"`
|
||||
Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
|
||||
Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"`
|
||||
Bucket string `protobuf:"bytes,5,opt,name=bucket,proto3" json:"bucket,omitempty"`
|
||||
UsePathStyle bool `protobuf:"varint,6,opt,name=use_path_style,json=usePathStyle,proto3" json:"use_path_style,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) Reset() {
|
||||
*x = WorkspaceStorageSetting_S3Config{}
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WorkspaceStorageSetting_S3Config) ProtoMessage() {}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_service_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceStorageSetting_S3Config.ProtoReflect.Descriptor instead.
|
||||
func (*WorkspaceStorageSetting_S3Config) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{5, 0}
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetAccessKeyId() string {
|
||||
if x != nil {
|
||||
return x.AccessKeyId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetAccessKeySecret() string {
|
||||
if x != nil {
|
||||
return x.AccessKeySecret
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetEndpoint() string {
|
||||
if x != nil {
|
||||
return x.Endpoint
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetRegion() string {
|
||||
if x != nil {
|
||||
return x.Region
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetBucket() string {
|
||||
if x != nil {
|
||||
return x.Bucket
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetUsePathStyle() bool {
|
||||
if x != nil {
|
||||
return x.UsePathStyle
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_api_v1_workspace_service_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_api_v1_workspace_service_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1eapi/v1/workspace_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\"y\n" +
|
||||
"\x1eapi/v1/workspace_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a google/protobuf/field_mask.proto\"y\n" +
|
||||
"\x10WorkspaceProfile\x12\x14\n" +
|
||||
"\x05owner\x18\x01 \x01(\tR\x05owner\x12\x18\n" +
|
||||
"\aversion\x18\x02 \x01(\tR\aversion\x12\x12\n" +
|
||||
"\x04mode\x18\x03 \x01(\tR\x04mode\x12!\n" +
|
||||
"\finstance_url\x18\x06 \x01(\tR\vinstanceUrl\"\x1c\n" +
|
||||
"\x1aGetWorkspaceProfileRequest2\x97\x01\n" +
|
||||
"\x1aGetWorkspaceProfileRequest\"\x9f\x03\n" +
|
||||
"\x10WorkspaceSetting\x12\x17\n" +
|
||||
"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12P\n" +
|
||||
"\x0fgeneral_setting\x18\x02 \x01(\v2%.memos.api.v1.WorkspaceGeneralSettingH\x00R\x0egeneralSetting\x12P\n" +
|
||||
"\x0fstorage_setting\x18\x03 \x01(\v2%.memos.api.v1.WorkspaceStorageSettingH\x00R\x0estorageSetting\x12]\n" +
|
||||
"\x14memo_related_setting\x18\x04 \x01(\v2).memos.api.v1.WorkspaceMemoRelatedSettingH\x00R\x12memoRelatedSetting:f\xeaAc\n" +
|
||||
"\x1eapi.memos.dev/WorkspaceSetting\x12\x1cworkspace/settings/{setting}*\x11workspaceSettings2\x10workspaceSettingB\a\n" +
|
||||
"\x05value\"\xd9\x03\n" +
|
||||
"\x17WorkspaceGeneralSetting\x12<\n" +
|
||||
"\x1adisallow_user_registration\x18\x01 \x01(\bR\x18disallowUserRegistration\x124\n" +
|
||||
"\x16disallow_password_auth\x18\x02 \x01(\bR\x14disallowPasswordAuth\x12+\n" +
|
||||
"\x11additional_script\x18\x03 \x01(\tR\x10additionalScript\x12)\n" +
|
||||
"\x10additional_style\x18\x04 \x01(\tR\x0fadditionalStyle\x12K\n" +
|
||||
"\x0ecustom_profile\x18\x05 \x01(\v2$.memos.api.v1.WorkspaceCustomProfileR\rcustomProfile\x121\n" +
|
||||
"\x15week_start_day_offset\x18\x06 \x01(\x05R\x12weekStartDayOffset\x128\n" +
|
||||
"\x18disallow_change_username\x18\a \x01(\bR\x16disallowChangeUsername\x128\n" +
|
||||
"\x18disallow_change_nickname\x18\b \x01(\bR\x16disallowChangeNickname\"\xa3\x01\n" +
|
||||
"\x16WorkspaceCustomProfile\x12\x14\n" +
|
||||
"\x05title\x18\x01 \x01(\tR\x05title\x12 \n" +
|
||||
"\vdescription\x18\x02 \x01(\tR\vdescription\x12\x19\n" +
|
||||
"\blogo_url\x18\x03 \x01(\tR\alogoUrl\x12\x16\n" +
|
||||
"\x06locale\x18\x04 \x01(\tR\x06locale\x12\x1e\n" +
|
||||
"\n" +
|
||||
"appearance\x18\x05 \x01(\tR\n" +
|
||||
"appearance\"\xb7\x04\n" +
|
||||
"\x17WorkspaceStorageSetting\x12T\n" +
|
||||
"\fstorage_type\x18\x01 \x01(\x0e21.memos.api.v1.WorkspaceStorageSetting.StorageTypeR\vstorageType\x12+\n" +
|
||||
"\x11filepath_template\x18\x02 \x01(\tR\x10filepathTemplate\x12/\n" +
|
||||
"\x14upload_size_limit_mb\x18\x03 \x01(\x03R\x11uploadSizeLimitMb\x12K\n" +
|
||||
"\ts3_config\x18\x04 \x01(\v2..memos.api.v1.WorkspaceStorageSetting.S3ConfigR\bs3Config\x1a\xcc\x01\n" +
|
||||
"\bS3Config\x12\"\n" +
|
||||
"\raccess_key_id\x18\x01 \x01(\tR\vaccessKeyId\x12*\n" +
|
||||
"\x11access_key_secret\x18\x02 \x01(\tR\x0faccessKeySecret\x12\x1a\n" +
|
||||
"\bendpoint\x18\x03 \x01(\tR\bendpoint\x12\x16\n" +
|
||||
"\x06region\x18\x04 \x01(\tR\x06region\x12\x16\n" +
|
||||
"\x06bucket\x18\x05 \x01(\tR\x06bucket\x12$\n" +
|
||||
"\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\"L\n" +
|
||||
"\vStorageType\x12\x1c\n" +
|
||||
"\x18STORAGE_TYPE_UNSPECIFIED\x10\x00\x12\f\n" +
|
||||
"\bDATABASE\x10\x01\x12\t\n" +
|
||||
"\x05LOCAL\x10\x02\x12\x06\n" +
|
||||
"\x02S3\x10\x03\"\x94\x04\n" +
|
||||
"\x1bWorkspaceMemoRelatedSetting\x12<\n" +
|
||||
"\x1adisallow_public_visibility\x18\x01 \x01(\bR\x18disallowPublicVisibility\x127\n" +
|
||||
"\x18display_with_update_time\x18\x02 \x01(\bR\x15displayWithUpdateTime\x120\n" +
|
||||
"\x14content_length_limit\x18\x03 \x01(\x05R\x12contentLengthLimit\x127\n" +
|
||||
"\x18enable_double_click_edit\x18\x05 \x01(\bR\x15enableDoubleClickEdit\x12.\n" +
|
||||
"\x13enable_link_preview\x18\x06 \x01(\bR\x11enableLinkPreview\x12%\n" +
|
||||
"\x0eenable_comment\x18\a \x01(\bR\renableComment\x12\x1c\n" +
|
||||
"\treactions\x18\n" +
|
||||
" \x03(\tR\treactions\x12<\n" +
|
||||
"\x1adisable_markdown_shortcuts\x18\v \x01(\bR\x18disableMarkdownShortcuts\x127\n" +
|
||||
"\x18enable_blur_nsfw_content\x18\f \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" +
|
||||
"\tnsfw_tags\x18\r \x03(\tR\bnsfwTagsJ\x04\b\x04\x10\x05J\x04\b\b\x10\t\"X\n" +
|
||||
"\x1aGetWorkspaceSettingRequest\x12:\n" +
|
||||
"\x04name\x18\x01 \x01(\tB&\xe0A\x02\xfaA \n" +
|
||||
"\x1eapi.memos.dev/WorkspaceSettingR\x04name\"\xa0\x01\n" +
|
||||
"\x1dUpdateWorkspaceSettingRequest\x12=\n" +
|
||||
"\asetting\x18\x01 \x01(\v2\x1e.memos.api.v1.WorkspaceSettingB\x03\xe0A\x02R\asetting\x12@\n" +
|
||||
"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\n" +
|
||||
"updateMask2\xe9\x03\n" +
|
||||
"\x10WorkspaceService\x12\x82\x01\n" +
|
||||
"\x13GetWorkspaceProfile\x12(.memos.api.v1.GetWorkspaceProfileRequest\x1a\x1e.memos.api.v1.WorkspaceProfile\"!\x82\xd3\xe4\x93\x02\x1b\x12\x19/api/v1/workspace/profileB\xad\x01\n" +
|
||||
"\x13GetWorkspaceProfile\x12(.memos.api.v1.GetWorkspaceProfileRequest\x1a\x1e.memos.api.v1.WorkspaceProfile\"!\x82\xd3\xe4\x93\x02\x1b\x12\x19/api/v1/workspace/profile\x12\x93\x01\n" +
|
||||
"\x13GetWorkspaceSetting\x12(.memos.api.v1.GetWorkspaceSettingRequest\x1a\x1e.memos.api.v1.WorkspaceSetting\"2\xdaA\x04name\x82\xd3\xe4\x93\x02%\x12#/api/v1/{name=workspace/settings/*}\x12\xb9\x01\n" +
|
||||
"\x16UpdateWorkspaceSetting\x12+.memos.api.v1.UpdateWorkspaceSettingRequest\x1a\x1e.memos.api.v1.WorkspaceSetting\"R\xdaA\x13setting,update_mask\x82\xd3\xe4\x93\x026:\asetting2+/api/v1/{setting.name=workspace/settings/*}B\xad\x01\n" +
|
||||
"\x10com.memos.api.v1B\x15WorkspaceServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
|
||||
|
||||
var (
|
||||
|
|
@ -160,19 +959,42 @@ func file_api_v1_workspace_service_proto_rawDescGZIP() []byte {
|
|||
return file_api_v1_workspace_service_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_api_v1_workspace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_api_v1_workspace_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_api_v1_workspace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_api_v1_workspace_service_proto_goTypes = []any{
|
||||
(*WorkspaceProfile)(nil), // 0: memos.api.v1.WorkspaceProfile
|
||||
(*GetWorkspaceProfileRequest)(nil), // 1: memos.api.v1.GetWorkspaceProfileRequest
|
||||
(WorkspaceStorageSetting_StorageType)(0), // 0: memos.api.v1.WorkspaceStorageSetting.StorageType
|
||||
(*WorkspaceProfile)(nil), // 1: memos.api.v1.WorkspaceProfile
|
||||
(*GetWorkspaceProfileRequest)(nil), // 2: memos.api.v1.GetWorkspaceProfileRequest
|
||||
(*WorkspaceSetting)(nil), // 3: memos.api.v1.WorkspaceSetting
|
||||
(*WorkspaceGeneralSetting)(nil), // 4: memos.api.v1.WorkspaceGeneralSetting
|
||||
(*WorkspaceCustomProfile)(nil), // 5: memos.api.v1.WorkspaceCustomProfile
|
||||
(*WorkspaceStorageSetting)(nil), // 6: memos.api.v1.WorkspaceStorageSetting
|
||||
(*WorkspaceMemoRelatedSetting)(nil), // 7: memos.api.v1.WorkspaceMemoRelatedSetting
|
||||
(*GetWorkspaceSettingRequest)(nil), // 8: memos.api.v1.GetWorkspaceSettingRequest
|
||||
(*UpdateWorkspaceSettingRequest)(nil), // 9: memos.api.v1.UpdateWorkspaceSettingRequest
|
||||
(*WorkspaceStorageSetting_S3Config)(nil), // 10: memos.api.v1.WorkspaceStorageSetting.S3Config
|
||||
(*fieldmaskpb.FieldMask)(nil), // 11: google.protobuf.FieldMask
|
||||
}
|
||||
var file_api_v1_workspace_service_proto_depIdxs = []int32{
|
||||
1, // 0: memos.api.v1.WorkspaceService.GetWorkspaceProfile:input_type -> memos.api.v1.GetWorkspaceProfileRequest
|
||||
0, // 1: memos.api.v1.WorkspaceService.GetWorkspaceProfile:output_type -> memos.api.v1.WorkspaceProfile
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
4, // 0: memos.api.v1.WorkspaceSetting.general_setting:type_name -> memos.api.v1.WorkspaceGeneralSetting
|
||||
6, // 1: memos.api.v1.WorkspaceSetting.storage_setting:type_name -> memos.api.v1.WorkspaceStorageSetting
|
||||
7, // 2: memos.api.v1.WorkspaceSetting.memo_related_setting:type_name -> memos.api.v1.WorkspaceMemoRelatedSetting
|
||||
5, // 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
|
||||
3, // 6: memos.api.v1.UpdateWorkspaceSettingRequest.setting:type_name -> memos.api.v1.WorkspaceSetting
|
||||
11, // 7: memos.api.v1.UpdateWorkspaceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
|
||||
2, // 8: memos.api.v1.WorkspaceService.GetWorkspaceProfile:input_type -> memos.api.v1.GetWorkspaceProfileRequest
|
||||
8, // 9: memos.api.v1.WorkspaceService.GetWorkspaceSetting:input_type -> memos.api.v1.GetWorkspaceSettingRequest
|
||||
9, // 10: memos.api.v1.WorkspaceService.UpdateWorkspaceSetting:input_type -> memos.api.v1.UpdateWorkspaceSettingRequest
|
||||
1, // 11: memos.api.v1.WorkspaceService.GetWorkspaceProfile:output_type -> memos.api.v1.WorkspaceProfile
|
||||
3, // 12: memos.api.v1.WorkspaceService.GetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting
|
||||
3, // 13: memos.api.v1.WorkspaceService.UpdateWorkspaceSetting: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
|
||||
}
|
||||
|
||||
func init() { file_api_v1_workspace_service_proto_init() }
|
||||
|
|
@ -180,18 +1002,24 @@ func file_api_v1_workspace_service_proto_init() {
|
|||
if File_api_v1_workspace_service_proto != nil {
|
||||
return
|
||||
}
|
||||
file_api_v1_workspace_service_proto_msgTypes[2].OneofWrappers = []any{
|
||||
(*WorkspaceSetting_GeneralSetting)(nil),
|
||||
(*WorkspaceSetting_StorageSetting)(nil),
|
||||
(*WorkspaceSetting_MemoRelatedSetting)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_workspace_service_proto_rawDesc), len(file_api_v1_workspace_service_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumEnums: 1,
|
||||
NumMessages: 10,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_api_v1_workspace_service_proto_goTypes,
|
||||
DependencyIndexes: file_api_v1_workspace_service_proto_depIdxs,
|
||||
EnumInfos: file_api_v1_workspace_service_proto_enumTypes,
|
||||
MessageInfos: file_api_v1_workspace_service_proto_msgTypes,
|
||||
}.Build()
|
||||
File_api_v1_workspace_service_proto = out.File
|
||||
|
|
|
|||
|
|
@ -54,6 +54,121 @@ func local_request_WorkspaceService_GetWorkspaceProfile_0(ctx context.Context, m
|
|||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_WorkspaceService_GetWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetWorkspaceSettingRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
val, ok := pathParams["name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
||||
}
|
||||
protoReq.Name, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
|
||||
}
|
||||
msg, err := client.GetWorkspaceSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_WorkspaceService_GetWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetWorkspaceSettingRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
val, ok := pathParams["name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
||||
}
|
||||
protoReq.Name, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
|
||||
}
|
||||
msg, err := server.GetWorkspaceSetting(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
var filter_WorkspaceService_UpdateWorkspaceSetting_0 = &utilities.DoubleArray{Encoding: map[string]int{"setting": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
|
||||
|
||||
func request_WorkspaceService_UpdateWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq UpdateWorkspaceSettingRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||
if berr != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||
}
|
||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Setting); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
|
||||
if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Setting); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
} else {
|
||||
protoReq.UpdateMask = fieldMask
|
||||
}
|
||||
}
|
||||
val, ok := pathParams["setting.name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "setting.name")
|
||||
}
|
||||
err = runtime.PopulateFieldFromPath(&protoReq, "setting.name", val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "setting.name", err)
|
||||
}
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WorkspaceService_UpdateWorkspaceSetting_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.UpdateWorkspaceSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_WorkspaceService_UpdateWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq UpdateWorkspaceSettingRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||
if berr != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||
}
|
||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Setting); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
|
||||
if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Setting); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
} else {
|
||||
protoReq.UpdateMask = fieldMask
|
||||
}
|
||||
}
|
||||
val, ok := pathParams["setting.name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "setting.name")
|
||||
}
|
||||
err = runtime.PopulateFieldFromPath(&protoReq, "setting.name", val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "setting.name", err)
|
||||
}
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WorkspaceService_UpdateWorkspaceSetting_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.UpdateWorkspaceSetting(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
// RegisterWorkspaceServiceHandlerServer registers the http handlers for service WorkspaceService to "mux".
|
||||
// UnaryRPC :call WorkspaceServiceServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
|
|
@ -80,6 +195,46 @@ func RegisterWorkspaceServiceHandlerServer(ctx context.Context, mux *runtime.Ser
|
|||
}
|
||||
forward_WorkspaceService_GetWorkspaceProfile_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodGet, pattern_WorkspaceService_GetWorkspaceSetting_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)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WorkspaceService/GetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/{name=workspace/settings/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_WorkspaceService_GetWorkspaceSetting_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_WorkspaceService_GetWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPatch, pattern_WorkspaceService_UpdateWorkspaceSetting_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)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WorkspaceService/UpdateWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=workspace/settings/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_WorkspaceService_UpdateWorkspaceSetting_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_WorkspaceService_UpdateWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -137,13 +292,51 @@ func RegisterWorkspaceServiceHandlerClient(ctx context.Context, mux *runtime.Ser
|
|||
}
|
||||
forward_WorkspaceService_GetWorkspaceProfile_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodGet, pattern_WorkspaceService_GetWorkspaceSetting_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)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WorkspaceService/GetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/{name=workspace/settings/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_WorkspaceService_GetWorkspaceSetting_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_WorkspaceService_GetWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPatch, pattern_WorkspaceService_UpdateWorkspaceSetting_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)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WorkspaceService/UpdateWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=workspace/settings/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_WorkspaceService_UpdateWorkspaceSetting_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_WorkspaceService_UpdateWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_WorkspaceService_GetWorkspaceProfile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "workspace", "profile"}, ""))
|
||||
pattern_WorkspaceService_GetWorkspaceProfile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "workspace", "profile"}, ""))
|
||||
pattern_WorkspaceService_GetWorkspaceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 3, 5, 4}, []string{"api", "v1", "workspace", "settings", "name"}, ""))
|
||||
pattern_WorkspaceService_UpdateWorkspaceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 3, 5, 4}, []string{"api", "v1", "workspace", "settings", "setting.name"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_WorkspaceService_GetWorkspaceProfile_0 = runtime.ForwardResponseMessage
|
||||
forward_WorkspaceService_GetWorkspaceProfile_0 = runtime.ForwardResponseMessage
|
||||
forward_WorkspaceService_GetWorkspaceSetting_0 = runtime.ForwardResponseMessage
|
||||
forward_WorkspaceService_UpdateWorkspaceSetting_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ import (
|
|||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
WorkspaceService_GetWorkspaceProfile_FullMethodName = "/memos.api.v1.WorkspaceService/GetWorkspaceProfile"
|
||||
WorkspaceService_GetWorkspaceProfile_FullMethodName = "/memos.api.v1.WorkspaceService/GetWorkspaceProfile"
|
||||
WorkspaceService_GetWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceService/GetWorkspaceSetting"
|
||||
WorkspaceService_UpdateWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceService/UpdateWorkspaceSetting"
|
||||
)
|
||||
|
||||
// WorkspaceServiceClient is the client API for WorkspaceService service.
|
||||
|
|
@ -28,6 +30,10 @@ const (
|
|||
type WorkspaceServiceClient interface {
|
||||
// Gets the workspace profile.
|
||||
GetWorkspaceProfile(ctx context.Context, in *GetWorkspaceProfileRequest, opts ...grpc.CallOption) (*WorkspaceProfile, error)
|
||||
// Gets a workspace setting.
|
||||
GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error)
|
||||
// Updates a workspace setting.
|
||||
UpdateWorkspaceSetting(ctx context.Context, in *UpdateWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error)
|
||||
}
|
||||
|
||||
type workspaceServiceClient struct {
|
||||
|
|
@ -48,12 +54,36 @@ func (c *workspaceServiceClient) GetWorkspaceProfile(ctx context.Context, in *Ge
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *workspaceServiceClient) GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(WorkspaceSetting)
|
||||
err := c.cc.Invoke(ctx, WorkspaceService_GetWorkspaceSetting_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *workspaceServiceClient) UpdateWorkspaceSetting(ctx context.Context, in *UpdateWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(WorkspaceSetting)
|
||||
err := c.cc.Invoke(ctx, WorkspaceService_UpdateWorkspaceSetting_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// WorkspaceServiceServer is the server API for WorkspaceService service.
|
||||
// All implementations must embed UnimplementedWorkspaceServiceServer
|
||||
// for forward compatibility.
|
||||
type WorkspaceServiceServer interface {
|
||||
// Gets the workspace profile.
|
||||
GetWorkspaceProfile(context.Context, *GetWorkspaceProfileRequest) (*WorkspaceProfile, error)
|
||||
// Gets a workspace setting.
|
||||
GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error)
|
||||
// Updates a workspace setting.
|
||||
UpdateWorkspaceSetting(context.Context, *UpdateWorkspaceSettingRequest) (*WorkspaceSetting, error)
|
||||
mustEmbedUnimplementedWorkspaceServiceServer()
|
||||
}
|
||||
|
||||
|
|
@ -67,6 +97,12 @@ type UnimplementedWorkspaceServiceServer struct{}
|
|||
func (UnimplementedWorkspaceServiceServer) GetWorkspaceProfile(context.Context, *GetWorkspaceProfileRequest) (*WorkspaceProfile, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceProfile not implemented")
|
||||
}
|
||||
func (UnimplementedWorkspaceServiceServer) GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceSetting not implemented")
|
||||
}
|
||||
func (UnimplementedWorkspaceServiceServer) UpdateWorkspaceSetting(context.Context, *UpdateWorkspaceSettingRequest) (*WorkspaceSetting, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateWorkspaceSetting not implemented")
|
||||
}
|
||||
func (UnimplementedWorkspaceServiceServer) mustEmbedUnimplementedWorkspaceServiceServer() {}
|
||||
func (UnimplementedWorkspaceServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
|
|
@ -106,6 +142,42 @@ func _WorkspaceService_GetWorkspaceProfile_Handler(srv interface{}, ctx context.
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _WorkspaceService_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 {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(WorkspaceServiceServer).GetWorkspaceSetting(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: WorkspaceService_GetWorkspaceSetting_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(WorkspaceServiceServer).GetWorkspaceSetting(ctx, req.(*GetWorkspaceSettingRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _WorkspaceService_UpdateWorkspaceSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateWorkspaceSettingRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(WorkspaceServiceServer).UpdateWorkspaceSetting(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: WorkspaceService_UpdateWorkspaceSetting_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(WorkspaceServiceServer).UpdateWorkspaceSetting(ctx, req.(*UpdateWorkspaceSettingRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// WorkspaceService_ServiceDesc is the grpc.ServiceDesc for WorkspaceService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
|
@ -117,6 +189,14 @@ var WorkspaceService_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "GetWorkspaceProfile",
|
||||
Handler: _WorkspaceService_GetWorkspaceProfile_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetWorkspaceSetting",
|
||||
Handler: _WorkspaceService_GetWorkspaceSetting_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateWorkspaceSetting",
|
||||
Handler: _WorkspaceService_UpdateWorkspaceSetting_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "api/v1/workspace_service.proto",
|
||||
|
|
|
|||
|
|
@ -1,887 +0,0 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: api/v1/workspace_setting_service.proto
|
||||
|
||||
package apiv1
|
||||
|
||||
import (
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
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 WorkspaceStorageSetting_StorageType int32
|
||||
|
||||
const (
|
||||
WorkspaceStorageSetting_STORAGE_TYPE_UNSPECIFIED WorkspaceStorageSetting_StorageType = 0
|
||||
// DATABASE is the database storage type.
|
||||
WorkspaceStorageSetting_DATABASE WorkspaceStorageSetting_StorageType = 1
|
||||
// LOCAL is the local storage type.
|
||||
WorkspaceStorageSetting_LOCAL WorkspaceStorageSetting_StorageType = 2
|
||||
// S3 is the S3 storage type.
|
||||
WorkspaceStorageSetting_S3 WorkspaceStorageSetting_StorageType = 3
|
||||
)
|
||||
|
||||
// Enum value maps for WorkspaceStorageSetting_StorageType.
|
||||
var (
|
||||
WorkspaceStorageSetting_StorageType_name = map[int32]string{
|
||||
0: "STORAGE_TYPE_UNSPECIFIED",
|
||||
1: "DATABASE",
|
||||
2: "LOCAL",
|
||||
3: "S3",
|
||||
}
|
||||
WorkspaceStorageSetting_StorageType_value = map[string]int32{
|
||||
"STORAGE_TYPE_UNSPECIFIED": 0,
|
||||
"DATABASE": 1,
|
||||
"LOCAL": 2,
|
||||
"S3": 3,
|
||||
}
|
||||
)
|
||||
|
||||
func (x WorkspaceStorageSetting_StorageType) Enum() *WorkspaceStorageSetting_StorageType {
|
||||
p := new(WorkspaceStorageSetting_StorageType)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x WorkspaceStorageSetting_StorageType) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (WorkspaceStorageSetting_StorageType) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_api_v1_workspace_setting_service_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (WorkspaceStorageSetting_StorageType) Type() protoreflect.EnumType {
|
||||
return &file_api_v1_workspace_setting_service_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x WorkspaceStorageSetting_StorageType) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceStorageSetting_StorageType.Descriptor instead.
|
||||
func (WorkspaceStorageSetting_StorageType) EnumDescriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{3, 0}
|
||||
}
|
||||
|
||||
type WorkspaceSetting struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// name is the name of the setting.
|
||||
// Format: settings/{setting}
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// Types that are valid to be assigned to Value:
|
||||
//
|
||||
// *WorkspaceSetting_GeneralSetting
|
||||
// *WorkspaceSetting_StorageSetting
|
||||
// *WorkspaceSetting_MemoRelatedSetting
|
||||
Value isWorkspaceSetting_Value `protobuf_oneof:"value"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) Reset() {
|
||||
*x = WorkspaceSetting{}
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WorkspaceSetting) ProtoMessage() {}
|
||||
|
||||
func (x *WorkspaceSetting) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceSetting.ProtoReflect.Descriptor instead.
|
||||
func (*WorkspaceSetting) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) GetValue() isWorkspaceSetting_Value {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) GetGeneralSetting() *WorkspaceGeneralSetting {
|
||||
if x != nil {
|
||||
if x, ok := x.Value.(*WorkspaceSetting_GeneralSetting); ok {
|
||||
return x.GeneralSetting
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) GetStorageSetting() *WorkspaceStorageSetting {
|
||||
if x != nil {
|
||||
if x, ok := x.Value.(*WorkspaceSetting_StorageSetting); ok {
|
||||
return x.StorageSetting
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WorkspaceSetting) GetMemoRelatedSetting() *WorkspaceMemoRelatedSetting {
|
||||
if x != nil {
|
||||
if x, ok := x.Value.(*WorkspaceSetting_MemoRelatedSetting); ok {
|
||||
return x.MemoRelatedSetting
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isWorkspaceSetting_Value interface {
|
||||
isWorkspaceSetting_Value()
|
||||
}
|
||||
|
||||
type WorkspaceSetting_GeneralSetting struct {
|
||||
GeneralSetting *WorkspaceGeneralSetting `protobuf:"bytes,2,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"`
|
||||
}
|
||||
|
||||
type WorkspaceSetting_MemoRelatedSetting struct {
|
||||
MemoRelatedSetting *WorkspaceMemoRelatedSetting `protobuf:"bytes,4,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*WorkspaceSetting_GeneralSetting) isWorkspaceSetting_Value() {}
|
||||
|
||||
func (*WorkspaceSetting_StorageSetting) isWorkspaceSetting_Value() {}
|
||||
|
||||
func (*WorkspaceSetting_MemoRelatedSetting) isWorkspaceSetting_Value() {}
|
||||
|
||||
type WorkspaceGeneralSetting struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// disallow_user_registration disallows user registration.
|
||||
DisallowUserRegistration bool `protobuf:"varint,1,opt,name=disallow_user_registration,json=disallowUserRegistration,proto3" json:"disallow_user_registration,omitempty"`
|
||||
// disallow_password_auth disallows password authentication.
|
||||
DisallowPasswordAuth bool `protobuf:"varint,2,opt,name=disallow_password_auth,json=disallowPasswordAuth,proto3" json:"disallow_password_auth,omitempty"`
|
||||
// additional_script is the additional script.
|
||||
AdditionalScript string `protobuf:"bytes,3,opt,name=additional_script,json=additionalScript,proto3" json:"additional_script,omitempty"`
|
||||
// additional_style is the additional style.
|
||||
AdditionalStyle string `protobuf:"bytes,4,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"`
|
||||
// custom_profile is the custom profile.
|
||||
CustomProfile *WorkspaceCustomProfile `protobuf:"bytes,5,opt,name=custom_profile,json=customProfile,proto3" json:"custom_profile,omitempty"`
|
||||
// week_start_day_offset is the week start day offset from Sunday.
|
||||
// 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
|
||||
// Default is Sunday.
|
||||
WeekStartDayOffset int32 `protobuf:"varint,6,opt,name=week_start_day_offset,json=weekStartDayOffset,proto3" json:"week_start_day_offset,omitempty"`
|
||||
// disallow_change_username disallows changing username.
|
||||
DisallowChangeUsername bool `protobuf:"varint,7,opt,name=disallow_change_username,json=disallowChangeUsername,proto3" json:"disallow_change_username,omitempty"`
|
||||
// disallow_change_nickname disallows changing nickname.
|
||||
DisallowChangeNickname bool `protobuf:"varint,8,opt,name=disallow_change_nickname,json=disallowChangeNickname,proto3" json:"disallow_change_nickname,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) Reset() {
|
||||
*x = WorkspaceGeneralSetting{}
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WorkspaceGeneralSetting) ProtoMessage() {}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceGeneralSetting.ProtoReflect.Descriptor instead.
|
||||
func (*WorkspaceGeneralSetting) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetDisallowUserRegistration() bool {
|
||||
if x != nil {
|
||||
return x.DisallowUserRegistration
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetDisallowPasswordAuth() bool {
|
||||
if x != nil {
|
||||
return x.DisallowPasswordAuth
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetAdditionalScript() string {
|
||||
if x != nil {
|
||||
return x.AdditionalScript
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetAdditionalStyle() string {
|
||||
if x != nil {
|
||||
return x.AdditionalStyle
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetCustomProfile() *WorkspaceCustomProfile {
|
||||
if x != nil {
|
||||
return x.CustomProfile
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetWeekStartDayOffset() int32 {
|
||||
if x != nil {
|
||||
return x.WeekStartDayOffset
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetDisallowChangeUsername() bool {
|
||||
if x != nil {
|
||||
return x.DisallowChangeUsername
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceGeneralSetting) GetDisallowChangeNickname() bool {
|
||||
if x != nil {
|
||||
return x.DisallowChangeNickname
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type WorkspaceCustomProfile struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceCustomProfile) Reset() {
|
||||
*x = WorkspaceCustomProfile{}
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[2]
|
||||
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_api_v1_workspace_setting_service_proto_msgTypes[2]
|
||||
if 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_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
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 `protogen:"open.v1"`
|
||||
// storage_type is the storage type.
|
||||
StorageType WorkspaceStorageSetting_StorageType `protobuf:"varint,1,opt,name=storage_type,json=storageType,proto3,enum=memos.api.v1.WorkspaceStorageSetting_StorageType" json:"storage_type,omitempty"`
|
||||
// The template of file path.
|
||||
// e.g. assets/{timestamp}_{filename}
|
||||
FilepathTemplate string `protobuf:"bytes,2,opt,name=filepath_template,json=filepathTemplate,proto3" json:"filepath_template,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"`
|
||||
// The S3 config.
|
||||
S3Config *WorkspaceStorageSetting_S3Config `protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) Reset() {
|
||||
*x = WorkspaceStorageSetting{}
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WorkspaceStorageSetting) ProtoMessage() {}
|
||||
|
||||
func (x *WorkspaceStorageSetting) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceStorageSetting.ProtoReflect.Descriptor instead.
|
||||
func (*WorkspaceStorageSetting) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) GetStorageType() WorkspaceStorageSetting_StorageType {
|
||||
if x != nil {
|
||||
return x.StorageType
|
||||
}
|
||||
return WorkspaceStorageSetting_STORAGE_TYPE_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) GetFilepathTemplate() string {
|
||||
if x != nil {
|
||||
return x.FilepathTemplate
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) GetUploadSizeLimitMb() int64 {
|
||||
if x != nil {
|
||||
return x.UploadSizeLimitMb
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting) GetS3Config() *WorkspaceStorageSetting_S3Config {
|
||||
if x != nil {
|
||||
return x.S3Config
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type WorkspaceMemoRelatedSetting struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// disallow_public_visibility disallows set memo as public visibility.
|
||||
DisallowPublicVisibility bool `protobuf:"varint,1,opt,name=disallow_public_visibility,json=disallowPublicVisibility,proto3" json:"disallow_public_visibility,omitempty"`
|
||||
// display_with_update_time orders and displays memo with update time.
|
||||
DisplayWithUpdateTime bool `protobuf:"varint,2,opt,name=display_with_update_time,json=displayWithUpdateTime,proto3" json:"display_with_update_time,omitempty"`
|
||||
// content_length_limit is the limit of content length. Unit is byte.
|
||||
ContentLengthLimit int32 `protobuf:"varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"`
|
||||
// enable_double_click_edit enables editing on double click.
|
||||
EnableDoubleClickEdit bool `protobuf:"varint,5,opt,name=enable_double_click_edit,json=enableDoubleClickEdit,proto3" json:"enable_double_click_edit,omitempty"`
|
||||
// enable_link_preview enables links preview.
|
||||
EnableLinkPreview bool `protobuf:"varint,6,opt,name=enable_link_preview,json=enableLinkPreview,proto3" json:"enable_link_preview,omitempty"`
|
||||
// enable_comment enables comment.
|
||||
EnableComment bool `protobuf:"varint,7,opt,name=enable_comment,json=enableComment,proto3" json:"enable_comment,omitempty"`
|
||||
// reactions is the list of reactions.
|
||||
Reactions []string `protobuf:"bytes,10,rep,name=reactions,proto3" json:"reactions,omitempty"`
|
||||
// disable_markdown_shortcuts disallow the registration of markdown shortcuts.
|
||||
DisableMarkdownShortcuts bool `protobuf:"varint,11,opt,name=disable_markdown_shortcuts,json=disableMarkdownShortcuts,proto3" json:"disable_markdown_shortcuts,omitempty"`
|
||||
// enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW).
|
||||
EnableBlurNsfwContent bool `protobuf:"varint,12,opt,name=enable_blur_nsfw_content,json=enableBlurNsfwContent,proto3" json:"enable_blur_nsfw_content,omitempty"`
|
||||
// nsfw_tags is the list of tags that mark content as NSFW for blurring.
|
||||
NsfwTags []string `protobuf:"bytes,13,rep,name=nsfw_tags,json=nsfwTags,proto3" json:"nsfw_tags,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) Reset() {
|
||||
*x = WorkspaceMemoRelatedSetting{}
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WorkspaceMemoRelatedSetting) ProtoMessage() {}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceMemoRelatedSetting.ProtoReflect.Descriptor instead.
|
||||
func (*WorkspaceMemoRelatedSetting) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetDisallowPublicVisibility() bool {
|
||||
if x != nil {
|
||||
return x.DisallowPublicVisibility
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetDisplayWithUpdateTime() bool {
|
||||
if x != nil {
|
||||
return x.DisplayWithUpdateTime
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetContentLengthLimit() int32 {
|
||||
if x != nil {
|
||||
return x.ContentLengthLimit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetEnableDoubleClickEdit() bool {
|
||||
if x != nil {
|
||||
return x.EnableDoubleClickEdit
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetEnableLinkPreview() bool {
|
||||
if x != nil {
|
||||
return x.EnableLinkPreview
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetEnableComment() bool {
|
||||
if x != nil {
|
||||
return x.EnableComment
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetReactions() []string {
|
||||
if x != nil {
|
||||
return x.Reactions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetDisableMarkdownShortcuts() bool {
|
||||
if x != nil {
|
||||
return x.DisableMarkdownShortcuts
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetEnableBlurNsfwContent() bool {
|
||||
if x != nil {
|
||||
return x.EnableBlurNsfwContent
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WorkspaceMemoRelatedSetting) GetNsfwTags() []string {
|
||||
if x != nil {
|
||||
return x.NsfwTags
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetWorkspaceSettingRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// The resource name of the workspace setting.
|
||||
// Format: settings/{setting}
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetWorkspaceSettingRequest) Reset() {
|
||||
*x = GetWorkspaceSettingRequest{}
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetWorkspaceSettingRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetWorkspaceSettingRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetWorkspaceSettingRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetWorkspaceSettingRequest) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *GetWorkspaceSettingRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SetWorkspaceSettingRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// setting is the setting to update.
|
||||
Setting *WorkspaceSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SetWorkspaceSettingRequest) Reset() {
|
||||
*x = SetWorkspaceSettingRequest{}
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SetWorkspaceSettingRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SetWorkspaceSettingRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SetWorkspaceSettingRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SetWorkspaceSettingRequest) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *SetWorkspaceSettingRequest) GetSetting() *WorkspaceSetting {
|
||||
if x != nil {
|
||||
return x.Setting
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
|
||||
type WorkspaceStorageSetting_S3Config struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
AccessKeyId string `protobuf:"bytes,1,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"`
|
||||
AccessKeySecret string `protobuf:"bytes,2,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"`
|
||||
Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
|
||||
Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"`
|
||||
Bucket string `protobuf:"bytes,5,opt,name=bucket,proto3" json:"bucket,omitempty"`
|
||||
UsePathStyle bool `protobuf:"varint,6,opt,name=use_path_style,json=usePathStyle,proto3" json:"use_path_style,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) Reset() {
|
||||
*x = WorkspaceStorageSetting_S3Config{}
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WorkspaceStorageSetting_S3Config) ProtoMessage() {}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WorkspaceStorageSetting_S3Config.ProtoReflect.Descriptor instead.
|
||||
func (*WorkspaceStorageSetting_S3Config) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{3, 0}
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetAccessKeyId() string {
|
||||
if x != nil {
|
||||
return x.AccessKeyId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetAccessKeySecret() string {
|
||||
if x != nil {
|
||||
return x.AccessKeySecret
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetEndpoint() string {
|
||||
if x != nil {
|
||||
return x.Endpoint
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetRegion() string {
|
||||
if x != nil {
|
||||
return x.Region
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetBucket() string {
|
||||
if x != nil {
|
||||
return x.Bucket
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WorkspaceStorageSetting_S3Config) GetUsePathStyle() bool {
|
||||
if x != nil {
|
||||
return x.UsePathStyle
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_api_v1_workspace_setting_service_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_api_v1_workspace_setting_service_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"&api/v1/workspace_setting_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\"\xb2\x02\n" +
|
||||
"\x10WorkspaceSetting\x12\x12\n" +
|
||||
"\x04name\x18\x01 \x01(\tR\x04name\x12P\n" +
|
||||
"\x0fgeneral_setting\x18\x02 \x01(\v2%.memos.api.v1.WorkspaceGeneralSettingH\x00R\x0egeneralSetting\x12P\n" +
|
||||
"\x0fstorage_setting\x18\x03 \x01(\v2%.memos.api.v1.WorkspaceStorageSettingH\x00R\x0estorageSetting\x12]\n" +
|
||||
"\x14memo_related_setting\x18\x04 \x01(\v2).memos.api.v1.WorkspaceMemoRelatedSettingH\x00R\x12memoRelatedSettingB\a\n" +
|
||||
"\x05value\"\xd9\x03\n" +
|
||||
"\x17WorkspaceGeneralSetting\x12<\n" +
|
||||
"\x1adisallow_user_registration\x18\x01 \x01(\bR\x18disallowUserRegistration\x124\n" +
|
||||
"\x16disallow_password_auth\x18\x02 \x01(\bR\x14disallowPasswordAuth\x12+\n" +
|
||||
"\x11additional_script\x18\x03 \x01(\tR\x10additionalScript\x12)\n" +
|
||||
"\x10additional_style\x18\x04 \x01(\tR\x0fadditionalStyle\x12K\n" +
|
||||
"\x0ecustom_profile\x18\x05 \x01(\v2$.memos.api.v1.WorkspaceCustomProfileR\rcustomProfile\x121\n" +
|
||||
"\x15week_start_day_offset\x18\x06 \x01(\x05R\x12weekStartDayOffset\x128\n" +
|
||||
"\x18disallow_change_username\x18\a \x01(\bR\x16disallowChangeUsername\x128\n" +
|
||||
"\x18disallow_change_nickname\x18\b \x01(\bR\x16disallowChangeNickname\"\xa3\x01\n" +
|
||||
"\x16WorkspaceCustomProfile\x12\x14\n" +
|
||||
"\x05title\x18\x01 \x01(\tR\x05title\x12 \n" +
|
||||
"\vdescription\x18\x02 \x01(\tR\vdescription\x12\x19\n" +
|
||||
"\blogo_url\x18\x03 \x01(\tR\alogoUrl\x12\x16\n" +
|
||||
"\x06locale\x18\x04 \x01(\tR\x06locale\x12\x1e\n" +
|
||||
"\n" +
|
||||
"appearance\x18\x05 \x01(\tR\n" +
|
||||
"appearance\"\xb7\x04\n" +
|
||||
"\x17WorkspaceStorageSetting\x12T\n" +
|
||||
"\fstorage_type\x18\x01 \x01(\x0e21.memos.api.v1.WorkspaceStorageSetting.StorageTypeR\vstorageType\x12+\n" +
|
||||
"\x11filepath_template\x18\x02 \x01(\tR\x10filepathTemplate\x12/\n" +
|
||||
"\x14upload_size_limit_mb\x18\x03 \x01(\x03R\x11uploadSizeLimitMb\x12K\n" +
|
||||
"\ts3_config\x18\x04 \x01(\v2..memos.api.v1.WorkspaceStorageSetting.S3ConfigR\bs3Config\x1a\xcc\x01\n" +
|
||||
"\bS3Config\x12\"\n" +
|
||||
"\raccess_key_id\x18\x01 \x01(\tR\vaccessKeyId\x12*\n" +
|
||||
"\x11access_key_secret\x18\x02 \x01(\tR\x0faccessKeySecret\x12\x1a\n" +
|
||||
"\bendpoint\x18\x03 \x01(\tR\bendpoint\x12\x16\n" +
|
||||
"\x06region\x18\x04 \x01(\tR\x06region\x12\x16\n" +
|
||||
"\x06bucket\x18\x05 \x01(\tR\x06bucket\x12$\n" +
|
||||
"\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\"L\n" +
|
||||
"\vStorageType\x12\x1c\n" +
|
||||
"\x18STORAGE_TYPE_UNSPECIFIED\x10\x00\x12\f\n" +
|
||||
"\bDATABASE\x10\x01\x12\t\n" +
|
||||
"\x05LOCAL\x10\x02\x12\x06\n" +
|
||||
"\x02S3\x10\x03\"\x94\x04\n" +
|
||||
"\x1bWorkspaceMemoRelatedSetting\x12<\n" +
|
||||
"\x1adisallow_public_visibility\x18\x01 \x01(\bR\x18disallowPublicVisibility\x127\n" +
|
||||
"\x18display_with_update_time\x18\x02 \x01(\bR\x15displayWithUpdateTime\x120\n" +
|
||||
"\x14content_length_limit\x18\x03 \x01(\x05R\x12contentLengthLimit\x127\n" +
|
||||
"\x18enable_double_click_edit\x18\x05 \x01(\bR\x15enableDoubleClickEdit\x12.\n" +
|
||||
"\x13enable_link_preview\x18\x06 \x01(\bR\x11enableLinkPreview\x12%\n" +
|
||||
"\x0eenable_comment\x18\a \x01(\bR\renableComment\x12\x1c\n" +
|
||||
"\treactions\x18\n" +
|
||||
" \x03(\tR\treactions\x12<\n" +
|
||||
"\x1adisable_markdown_shortcuts\x18\v \x01(\bR\x18disableMarkdownShortcuts\x127\n" +
|
||||
"\x18enable_blur_nsfw_content\x18\f \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" +
|
||||
"\tnsfw_tags\x18\r \x03(\tR\bnsfwTagsJ\x04\b\x04\x10\x05J\x04\b\b\x10\t\"5\n" +
|
||||
"\x1aGetWorkspaceSettingRequest\x12\x17\n" +
|
||||
"\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name\"V\n" +
|
||||
"\x1aSetWorkspaceSettingRequest\x128\n" +
|
||||
"\asetting\x18\x01 \x01(\v2\x1e.memos.api.v1.WorkspaceSettingR\asetting2\xd9\x02\n" +
|
||||
"\x17WorkspaceSettingService\x12\x93\x01\n" +
|
||||
"\x13GetWorkspaceSetting\x12(.memos.api.v1.GetWorkspaceSettingRequest\x1a\x1e.memos.api.v1.WorkspaceSetting\"2\xdaA\x04name\x82\xd3\xe4\x93\x02%\x12#/api/v1/workspace/{name=settings/*}\x12\xa7\x01\n" +
|
||||
"\x13SetWorkspaceSetting\x12(.memos.api.v1.SetWorkspaceSettingRequest\x1a\x1e.memos.api.v1.WorkspaceSetting\"F\xdaA\asetting\x82\xd3\xe4\x93\x026:\asetting2+/api/v1/workspace/{setting.name=settings/*}B\xb4\x01\n" +
|
||||
"\x10com.memos.api.v1B\x1cWorkspaceSettingServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
|
||||
|
||||
var (
|
||||
file_api_v1_workspace_setting_service_proto_rawDescOnce sync.Once
|
||||
file_api_v1_workspace_setting_service_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_api_v1_workspace_setting_service_proto_rawDescGZIP() []byte {
|
||||
file_api_v1_workspace_setting_service_proto_rawDescOnce.Do(func() {
|
||||
file_api_v1_workspace_setting_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_workspace_setting_service_proto_rawDesc), len(file_api_v1_workspace_setting_service_proto_rawDesc)))
|
||||
})
|
||||
return file_api_v1_workspace_setting_service_proto_rawDescData
|
||||
}
|
||||
|
||||
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, 8)
|
||||
var file_api_v1_workspace_setting_service_proto_goTypes = []any{
|
||||
(WorkspaceStorageSetting_StorageType)(0), // 0: memos.api.v1.WorkspaceStorageSetting.StorageType
|
||||
(*WorkspaceSetting)(nil), // 1: memos.api.v1.WorkspaceSetting
|
||||
(*WorkspaceGeneralSetting)(nil), // 2: memos.api.v1.WorkspaceGeneralSetting
|
||||
(*WorkspaceCustomProfile)(nil), // 3: memos.api.v1.WorkspaceCustomProfile
|
||||
(*WorkspaceStorageSetting)(nil), // 4: memos.api.v1.WorkspaceStorageSetting
|
||||
(*WorkspaceMemoRelatedSetting)(nil), // 5: memos.api.v1.WorkspaceMemoRelatedSetting
|
||||
(*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
|
||||
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() }
|
||||
func file_api_v1_workspace_setting_service_proto_init() {
|
||||
if File_api_v1_workspace_setting_service_proto != nil {
|
||||
return
|
||||
}
|
||||
file_api_v1_workspace_setting_service_proto_msgTypes[0].OneofWrappers = []any{
|
||||
(*WorkspaceSetting_GeneralSetting)(nil),
|
||||
(*WorkspaceSetting_StorageSetting)(nil),
|
||||
(*WorkspaceSetting_MemoRelatedSetting)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_workspace_setting_service_proto_rawDesc), len(file_api_v1_workspace_setting_service_proto_rawDesc)),
|
||||
NumEnums: 1,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_api_v1_workspace_setting_service_proto_goTypes,
|
||||
DependencyIndexes: file_api_v1_workspace_setting_service_proto_depIdxs,
|
||||
EnumInfos: file_api_v1_workspace_setting_service_proto_enumTypes,
|
||||
MessageInfos: file_api_v1_workspace_setting_service_proto_msgTypes,
|
||||
}.Build()
|
||||
File_api_v1_workspace_setting_service_proto = out.File
|
||||
file_api_v1_workspace_setting_service_proto_goTypes = nil
|
||||
file_api_v1_workspace_setting_service_proto_depIdxs = nil
|
||||
}
|
||||
|
|
@ -1,248 +0,0 @@
|
|||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: api/v1/workspace_setting_service.proto
|
||||
|
||||
/*
|
||||
Package apiv1 is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package apiv1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
var (
|
||||
_ codes.Code
|
||||
_ io.Reader
|
||||
_ status.Status
|
||||
_ = errors.New
|
||||
_ = runtime.String
|
||||
_ = utilities.NewDoubleArray
|
||||
_ = metadata.Join
|
||||
)
|
||||
|
||||
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
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
val, ok := pathParams["name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
||||
}
|
||||
protoReq.Name, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
|
||||
}
|
||||
msg, err := client.GetWorkspaceSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_WorkspaceSettingService_GetWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceSettingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetWorkspaceSettingRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
val, ok := pathParams["name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
||||
}
|
||||
protoReq.Name, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
|
||||
}
|
||||
msg, err := server.GetWorkspaceSetting(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_WorkspaceSettingService_SetWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceSettingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq SetWorkspaceSettingRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Setting); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
val, ok := pathParams["setting.name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "setting.name")
|
||||
}
|
||||
err = runtime.PopulateFieldFromPath(&protoReq, "setting.name", val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "setting.name", err)
|
||||
}
|
||||
msg, err := client.SetWorkspaceSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_WorkspaceSettingService_SetWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceSettingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq SetWorkspaceSettingRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Setting); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
val, ok := pathParams["setting.name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "setting.name")
|
||||
}
|
||||
err = runtime.PopulateFieldFromPath(&protoReq, "setting.name", val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "setting.name", err)
|
||||
}
|
||||
msg, err := server.SetWorkspaceSetting(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
// RegisterWorkspaceSettingServiceHandlerServer registers the http handlers for service WorkspaceSettingService to "mux".
|
||||
// UnaryRPC :call WorkspaceSettingServiceServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWorkspaceSettingServiceHandlerFromEndpoint instead.
|
||||
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
|
||||
func RegisterWorkspaceSettingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkspaceSettingServiceServer) error {
|
||||
mux.Handle(http.MethodGet, pattern_WorkspaceSettingService_GetWorkspaceSetting_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)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/workspace/{name=settings/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_WorkspaceSettingService_GetWorkspaceSetting_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_GetWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPatch, pattern_WorkspaceSettingService_SetWorkspaceSetting_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)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WorkspaceSettingService/SetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/workspace/{setting.name=settings/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_WorkspaceSettingService_SetWorkspaceSetting_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_SetWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterWorkspaceSettingServiceHandlerFromEndpoint is same as RegisterWorkspaceSettingServiceHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterWorkspaceSettingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.NewClient(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
return RegisterWorkspaceSettingServiceHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterWorkspaceSettingServiceHandler registers the http handlers for service WorkspaceSettingService to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterWorkspaceSettingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterWorkspaceSettingServiceHandlerClient(ctx, mux, NewWorkspaceSettingServiceClient(conn))
|
||||
}
|
||||
|
||||
// RegisterWorkspaceSettingServiceHandlerClient registers the http handlers for service WorkspaceSettingService
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WorkspaceSettingServiceClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WorkspaceSettingServiceClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "WorkspaceSettingServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
|
||||
func RegisterWorkspaceSettingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkspaceSettingServiceClient) error {
|
||||
mux.Handle(http.MethodGet, pattern_WorkspaceSettingService_GetWorkspaceSetting_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)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/workspace/{name=settings/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_WorkspaceSettingService_GetWorkspaceSetting_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_GetWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPatch, pattern_WorkspaceSettingService_SetWorkspaceSetting_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)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WorkspaceSettingService/SetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/workspace/{setting.name=settings/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_WorkspaceSettingService_SetWorkspaceSetting_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_SetWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
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_GetWorkspaceSetting_0 = runtime.ForwardResponseMessage
|
||||
forward_WorkspaceSettingService_SetWorkspaceSetting_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
|
@ -1,164 +0,0 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc (unknown)
|
||||
// source: api/v1/workspace_setting_service.proto
|
||||
|
||||
package apiv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
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 {
|
||||
// GetWorkspaceSetting returns the setting by name.
|
||||
GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error)
|
||||
// SetWorkspaceSetting updates the setting.
|
||||
SetWorkspaceSetting(ctx context.Context, in *SetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error)
|
||||
}
|
||||
|
||||
type workspaceSettingServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewWorkspaceSettingServiceClient(cc grpc.ClientConnInterface) WorkspaceSettingServiceClient {
|
||||
return &workspaceSettingServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *workspaceSettingServiceClient) GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(WorkspaceSetting)
|
||||
err := c.cc.Invoke(ctx, WorkspaceSettingService_GetWorkspaceSetting_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *workspaceSettingServiceClient) SetWorkspaceSetting(ctx context.Context, in *SetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(WorkspaceSetting)
|
||||
err := c.cc.Invoke(ctx, WorkspaceSettingService_SetWorkspaceSetting_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// WorkspaceSettingServiceServer is the server API for WorkspaceSettingService service.
|
||||
// All implementations must embed UnimplementedWorkspaceSettingServiceServer
|
||||
// for forward compatibility.
|
||||
type WorkspaceSettingServiceServer interface {
|
||||
// GetWorkspaceSetting returns the setting by name.
|
||||
GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error)
|
||||
// SetWorkspaceSetting updates the setting.
|
||||
SetWorkspaceSetting(context.Context, *SetWorkspaceSettingRequest) (*WorkspaceSetting, error)
|
||||
mustEmbedUnimplementedWorkspaceSettingServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedWorkspaceSettingServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedWorkspaceSettingServiceServer struct{}
|
||||
|
||||
func (UnimplementedWorkspaceSettingServiceServer) GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceSetting not implemented")
|
||||
}
|
||||
func (UnimplementedWorkspaceSettingServiceServer) SetWorkspaceSetting(context.Context, *SetWorkspaceSettingRequest) (*WorkspaceSetting, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetWorkspaceSetting not implemented")
|
||||
}
|
||||
func (UnimplementedWorkspaceSettingServiceServer) mustEmbedUnimplementedWorkspaceSettingServiceServer() {
|
||||
}
|
||||
func (UnimplementedWorkspaceSettingServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeWorkspaceSettingServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to WorkspaceSettingServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeWorkspaceSettingServiceServer interface {
|
||||
mustEmbedUnimplementedWorkspaceSettingServiceServer()
|
||||
}
|
||||
|
||||
func RegisterWorkspaceSettingServiceServer(s grpc.ServiceRegistrar, srv WorkspaceSettingServiceServer) {
|
||||
// If the following call pancis, it indicates UnimplementedWorkspaceSettingServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&WorkspaceSettingService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(WorkspaceSettingServiceServer).GetWorkspaceSetting(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: WorkspaceSettingService_GetWorkspaceSetting_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(WorkspaceSettingServiceServer).GetWorkspaceSetting(ctx, req.(*GetWorkspaceSettingRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _WorkspaceSettingService_SetWorkspaceSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetWorkspaceSettingRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(WorkspaceSettingServiceServer).SetWorkspaceSetting(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: WorkspaceSettingService_SetWorkspaceSetting_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(WorkspaceSettingServiceServer).SetWorkspaceSetting(ctx, req.(*SetWorkspaceSettingRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// WorkspaceSettingService_ServiceDesc is the grpc.ServiceDesc for WorkspaceSettingService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var WorkspaceSettingService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "memos.api.v1.WorkspaceSettingService",
|
||||
HandlerType: (*WorkspaceSettingServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetWorkspaceSetting",
|
||||
Handler: _WorkspaceSettingService_GetWorkspaceSetting_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SetWorkspaceSetting",
|
||||
Handler: _WorkspaceSettingService_SetWorkspaceSetting_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "api/v1/workspace_setting_service.proto",
|
||||
}
|
||||
|
|
@ -14,7 +14,6 @@ tags:
|
|||
- name: ShortcutService
|
||||
- name: WebhookService
|
||||
- name: WorkspaceService
|
||||
- name: WorkspaceSettingService
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
|
|
@ -707,68 +706,6 @@ paths:
|
|||
$ref: '#/definitions/googlerpcStatus'
|
||||
tags:
|
||||
- WorkspaceService
|
||||
/api/v1/workspace/{name}:
|
||||
get:
|
||||
summary: GetWorkspaceSetting returns the setting by name.
|
||||
operationId: WorkspaceSettingService_GetWorkspaceSetting
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/apiv1WorkspaceSetting'
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: name
|
||||
description: |-
|
||||
The resource name of the workspace setting.
|
||||
Format: settings/{setting}
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
pattern: settings/[^/]+
|
||||
tags:
|
||||
- WorkspaceSettingService
|
||||
/api/v1/workspace/{setting.name}:
|
||||
patch:
|
||||
summary: SetWorkspaceSetting updates the setting.
|
||||
operationId: WorkspaceSettingService_SetWorkspaceSetting
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/apiv1WorkspaceSetting'
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: setting.name
|
||||
description: |-
|
||||
name is the name of the setting.
|
||||
Format: settings/{setting}
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
pattern: settings/[^/]+
|
||||
- name: setting
|
||||
description: setting is the setting to update.
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
generalSetting:
|
||||
$ref: '#/definitions/apiv1WorkspaceGeneralSetting'
|
||||
storageSetting:
|
||||
$ref: '#/definitions/apiv1WorkspaceStorageSetting'
|
||||
memoRelatedSetting:
|
||||
$ref: '#/definitions/apiv1WorkspaceMemoRelatedSetting'
|
||||
title: setting is the setting to update.
|
||||
tags:
|
||||
- WorkspaceSettingService
|
||||
/api/v1/{identityProvider.name}:
|
||||
patch:
|
||||
summary: UpdateIdentityProvider updates an identity provider.
|
||||
|
|
@ -1199,6 +1136,29 @@ paths:
|
|||
tags:
|
||||
- MemoService
|
||||
/api/v1/{name_6}:
|
||||
get:
|
||||
summary: Gets a workspace setting.
|
||||
operationId: WorkspaceService_GetWorkspaceSetting
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/apiv1WorkspaceSetting'
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: name_6
|
||||
description: |-
|
||||
The resource name of the workspace setting.
|
||||
Format: workspace/settings/{setting}
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
pattern: workspace/settings/[^/]+
|
||||
tags:
|
||||
- WorkspaceService
|
||||
delete:
|
||||
summary: DeleteWebhook deletes a webhook.
|
||||
operationId: WebhookService_DeleteWebhook
|
||||
|
|
@ -1929,6 +1889,46 @@ paths:
|
|||
description: The related memo. Refer to `Memo.name`.
|
||||
tags:
|
||||
- ResourceService
|
||||
/api/v1/{setting.name}:
|
||||
patch:
|
||||
summary: Updates a workspace setting.
|
||||
operationId: WorkspaceService_UpdateWorkspaceSetting
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/apiv1WorkspaceSetting'
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: setting.name
|
||||
description: |-
|
||||
The name of the workspace setting.
|
||||
Format: workspace/settings/{setting}
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
pattern: workspace/settings/[^/]+
|
||||
- name: setting
|
||||
description: The workspace setting resource which replaces the resource on the server.
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
generalSetting:
|
||||
$ref: '#/definitions/apiv1WorkspaceGeneralSetting'
|
||||
storageSetting:
|
||||
$ref: '#/definitions/apiv1WorkspaceStorageSetting'
|
||||
memoRelatedSetting:
|
||||
$ref: '#/definitions/apiv1WorkspaceMemoRelatedSetting'
|
||||
title: The workspace setting resource which replaces the resource on the server.
|
||||
required:
|
||||
- setting
|
||||
tags:
|
||||
- WorkspaceService
|
||||
/api/v1/{setting.name}:updateSetting:
|
||||
patch:
|
||||
summary: UpdateUserSetting updates the user setting.
|
||||
|
|
@ -2591,14 +2591,15 @@ definitions:
|
|||
name:
|
||||
type: string
|
||||
title: |-
|
||||
name is the name of the setting.
|
||||
Format: settings/{setting}
|
||||
The name of the workspace setting.
|
||||
Format: workspace/settings/{setting}
|
||||
generalSetting:
|
||||
$ref: '#/definitions/apiv1WorkspaceGeneralSetting'
|
||||
storageSetting:
|
||||
$ref: '#/definitions/apiv1WorkspaceStorageSetting'
|
||||
memoRelatedSetting:
|
||||
$ref: '#/definitions/apiv1WorkspaceMemoRelatedSetting'
|
||||
description: A workspace setting resource.
|
||||
apiv1WorkspaceStorageSetting:
|
||||
type: object
|
||||
properties:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ package v1
|
|||
|
||||
var authenticationAllowlistMethods = map[string]bool{
|
||||
"/memos.api.v1.WorkspaceService/GetWorkspaceProfile": true,
|
||||
"/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting": true,
|
||||
"/memos.api.v1.WorkspaceSettingService/ListWorkspaceSettings": true,
|
||||
"/memos.api.v1.WorkspaceService/GetWorkspaceSetting": true,
|
||||
"/memos.api.v1.IdentityProviderService/GetIdentityProvider": true,
|
||||
"/memos.api.v1.IdentityProviderService/ListIdentityProviders": true,
|
||||
"/memos.api.v1.AuthService/GetAuthStatus": true,
|
||||
|
|
@ -28,8 +27,8 @@ func isUnauthorizeAllowedMethod(fullMethodName string) bool {
|
|||
}
|
||||
|
||||
var allowedMethodsOnlyForAdmin = map[string]bool{
|
||||
"/memos.api.v1.UserService/CreateUser": true,
|
||||
"/memos.api.v1.WorkspaceSettingService/SetWorkspaceSetting": true,
|
||||
"/memos.api.v1.UserService/CreateUser": true,
|
||||
"/memos.api.v1.WorkspaceService/UpdateWorkspaceSetting": true,
|
||||
}
|
||||
|
||||
// isOnlyForAdminAllowedMethod returns true if the method is allowed to be called only by admin.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
WorkspaceSettingNamePrefix = "settings/"
|
||||
WorkspaceSettingNamePrefix = "workspace/settings/"
|
||||
UserNamePrefix = "users/"
|
||||
MemoNamePrefix = "memos/"
|
||||
ResourceNamePrefix = "resources/"
|
||||
|
|
@ -41,11 +41,22 @@ func GetNameParentTokens(name string, tokenPrefixes ...string) ([]string, error)
|
|||
}
|
||||
|
||||
func ExtractWorkspaceSettingKeyFromName(name string) (string, error) {
|
||||
tokens, err := GetNameParentTokens(name, WorkspaceSettingNamePrefix)
|
||||
if err != nil {
|
||||
return "", err
|
||||
const prefix = "workspace/settings/"
|
||||
if !strings.HasPrefix(name, prefix) {
|
||||
return "", errors.Errorf("invalid workspace setting name: expected prefix %q, got %q", prefix, name)
|
||||
}
|
||||
return tokens[0], nil
|
||||
|
||||
settingKey := strings.TrimPrefix(name, prefix)
|
||||
if settingKey == "" {
|
||||
return "", errors.Errorf("invalid workspace setting name: empty setting key in %q", name)
|
||||
}
|
||||
|
||||
// Ensure there are no additional path segments
|
||||
if strings.Contains(settingKey, "/") {
|
||||
return "", errors.Errorf("invalid workspace setting name: setting key cannot contain '/' in %q", name)
|
||||
}
|
||||
|
||||
return settingKey, nil
|
||||
}
|
||||
|
||||
// ExtractUserIDFromName returns the uid from a resource name.
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ func (s *APIV1Service) GetUserSetting(ctx context.Context, request *v1pb.GetUser
|
|||
}
|
||||
|
||||
userSettingMessage := getDefaultUserSetting()
|
||||
userSettingMessage.Name = fmt.Sprintf("users/%d/setting", userID)
|
||||
userSettingMessage.Name = fmt.Sprintf("users/%d", userID)
|
||||
|
||||
for _, setting := range userSettings {
|
||||
if setting.Key == storepb.UserSettingKey_LOCALE {
|
||||
|
|
@ -357,12 +357,7 @@ func (s *APIV1Service) GetUserSetting(ctx context.Context, request *v1pb.GetUser
|
|||
|
||||
func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.UpdateUserSettingRequest) (*v1pb.UserSetting, error) {
|
||||
// Extract user ID from the setting resource name
|
||||
parts := strings.Split(request.Setting.Name, "/")
|
||||
if len(parts) != 3 || parts[0] != "users" || parts[2] != "setting" {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "invalid setting name format: %s", request.Setting.Name)
|
||||
}
|
||||
|
||||
userID, err := ExtractUserIDFromName(fmt.Sprintf("users/%s", parts[1]))
|
||||
userID, err := ExtractUserIDFromName(request.Setting.Name)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ type APIV1Service struct {
|
|||
grpc_health_v1.UnimplementedHealthServer
|
||||
|
||||
v1pb.UnimplementedWorkspaceServiceServer
|
||||
v1pb.UnimplementedWorkspaceSettingServiceServer
|
||||
v1pb.UnimplementedAuthServiceServer
|
||||
v1pb.UnimplementedUserServiceServer
|
||||
v1pb.UnimplementedMemoServiceServer
|
||||
|
|
@ -52,7 +51,6 @@ func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store
|
|||
}
|
||||
grpc_health_v1.RegisterHealthServer(grpcServer, apiv1Service)
|
||||
v1pb.RegisterWorkspaceServiceServer(grpcServer, apiv1Service)
|
||||
v1pb.RegisterWorkspaceSettingServiceServer(grpcServer, apiv1Service)
|
||||
v1pb.RegisterAuthServiceServer(grpcServer, apiv1Service)
|
||||
v1pb.RegisterUserServiceServer(grpcServer, apiv1Service)
|
||||
v1pb.RegisterMemoServiceServer(grpcServer, apiv1Service)
|
||||
|
|
@ -88,9 +86,6 @@ func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Ech
|
|||
if err := v1pb.RegisterWorkspaceServiceHandler(ctx, gwMux, conn); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v1pb.RegisterWorkspaceSettingServiceHandler(ctx, gwMux, conn); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v1pb.RegisterAuthServiceHandler(ctx, gwMux, conn); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package v1
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
v1pb "github.com/usememos/memos/proto/gen/api/v1"
|
||||
storepb "github.com/usememos/memos/proto/gen/store"
|
||||
"github.com/usememos/memos/store"
|
||||
)
|
||||
|
||||
|
|
@ -28,6 +30,251 @@ func (s *APIV1Service) GetWorkspaceProfile(ctx context.Context, _ *v1pb.GetWorks
|
|||
return workspaceProfile, nil
|
||||
}
|
||||
|
||||
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.InvalidArgument, "invalid workspace setting name: %v", err)
|
||||
}
|
||||
|
||||
workspaceSettingKey := storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[workspaceSettingKeyString])
|
||||
// Get workspace setting from store with default value.
|
||||
switch workspaceSettingKey {
|
||||
case storepb.WorkspaceSettingKey_BASIC:
|
||||
_, err = s.Store.GetWorkspaceBasicSetting(ctx)
|
||||
case storepb.WorkspaceSettingKey_GENERAL:
|
||||
_, err = s.Store.GetWorkspaceGeneralSetting(ctx)
|
||||
case storepb.WorkspaceSettingKey_MEMO_RELATED:
|
||||
_, err = s.Store.GetWorkspaceMemoRelatedSetting(ctx)
|
||||
case storepb.WorkspaceSettingKey_STORAGE:
|
||||
_, err = s.Store.GetWorkspaceStorageSetting(ctx)
|
||||
default:
|
||||
return nil, status.Errorf(codes.InvalidArgument, "unsupported workspace setting key: %v", workspaceSettingKey)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err)
|
||||
}
|
||||
|
||||
workspaceSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{
|
||||
Name: workspaceSettingKey.String(),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err)
|
||||
}
|
||||
if workspaceSetting == nil {
|
||||
return nil, status.Errorf(codes.NotFound, "workspace setting not found")
|
||||
}
|
||||
|
||||
// For storage setting, only host can get it.
|
||||
if workspaceSetting.Key == storepb.WorkspaceSettingKey_STORAGE {
|
||||
user, err := s.GetCurrentUser(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
|
||||
}
|
||||
if user == nil || user.Role != store.RoleHost {
|
||||
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
|
||||
}
|
||||
}
|
||||
|
||||
return convertWorkspaceSettingFromStore(workspaceSetting), nil
|
||||
}
|
||||
|
||||
func (s *APIV1Service) UpdateWorkspaceSetting(ctx context.Context, request *v1pb.UpdateWorkspaceSettingRequest) (*v1pb.WorkspaceSetting, error) {
|
||||
user, err := s.GetCurrentUser(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
|
||||
}
|
||||
if user.Role != store.RoleHost {
|
||||
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
|
||||
}
|
||||
|
||||
// TODO: Apply update_mask if specified
|
||||
_ = request.UpdateMask
|
||||
|
||||
updateSetting := convertWorkspaceSettingToStore(request.Setting)
|
||||
workspaceSetting, err := s.Store.UpsertWorkspaceSetting(ctx, updateSetting)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to upsert workspace setting: %v", err)
|
||||
}
|
||||
|
||||
return convertWorkspaceSettingFromStore(workspaceSetting), nil
|
||||
}
|
||||
|
||||
func convertWorkspaceSettingFromStore(setting *storepb.WorkspaceSetting) *v1pb.WorkspaceSetting {
|
||||
workspaceSetting := &v1pb.WorkspaceSetting{
|
||||
Name: fmt.Sprintf("workspace/settings/%s", setting.Key.String()),
|
||||
}
|
||||
switch setting.Value.(type) {
|
||||
case *storepb.WorkspaceSetting_GeneralSetting:
|
||||
workspaceSetting.Value = &v1pb.WorkspaceSetting_GeneralSetting{
|
||||
GeneralSetting: convertWorkspaceGeneralSettingFromStore(setting.GetGeneralSetting()),
|
||||
}
|
||||
case *storepb.WorkspaceSetting_StorageSetting:
|
||||
workspaceSetting.Value = &v1pb.WorkspaceSetting_StorageSetting{
|
||||
StorageSetting: convertWorkspaceStorageSettingFromStore(setting.GetStorageSetting()),
|
||||
}
|
||||
case *storepb.WorkspaceSetting_MemoRelatedSetting:
|
||||
workspaceSetting.Value = &v1pb.WorkspaceSetting_MemoRelatedSetting{
|
||||
MemoRelatedSetting: convertWorkspaceMemoRelatedSettingFromStore(setting.GetMemoRelatedSetting()),
|
||||
}
|
||||
}
|
||||
return workspaceSetting
|
||||
}
|
||||
|
||||
func convertWorkspaceSettingToStore(setting *v1pb.WorkspaceSetting) *storepb.WorkspaceSetting {
|
||||
settingKeyString, _ := ExtractWorkspaceSettingKeyFromName(setting.Name)
|
||||
workspaceSetting := &storepb.WorkspaceSetting{
|
||||
Key: storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[settingKeyString]),
|
||||
Value: &storepb.WorkspaceSetting_GeneralSetting{
|
||||
GeneralSetting: convertWorkspaceGeneralSettingToStore(setting.GetGeneralSetting()),
|
||||
},
|
||||
}
|
||||
switch workspaceSetting.Key {
|
||||
case storepb.WorkspaceSettingKey_GENERAL:
|
||||
workspaceSetting.Value = &storepb.WorkspaceSetting_GeneralSetting{
|
||||
GeneralSetting: convertWorkspaceGeneralSettingToStore(setting.GetGeneralSetting()),
|
||||
}
|
||||
case storepb.WorkspaceSettingKey_STORAGE:
|
||||
workspaceSetting.Value = &storepb.WorkspaceSetting_StorageSetting{
|
||||
StorageSetting: convertWorkspaceStorageSettingToStore(setting.GetStorageSetting()),
|
||||
}
|
||||
case storepb.WorkspaceSettingKey_MEMO_RELATED:
|
||||
workspaceSetting.Value = &storepb.WorkspaceSetting_MemoRelatedSetting{
|
||||
MemoRelatedSetting: convertWorkspaceMemoRelatedSettingToStore(setting.GetMemoRelatedSetting()),
|
||||
}
|
||||
}
|
||||
return workspaceSetting
|
||||
}
|
||||
|
||||
func convertWorkspaceGeneralSettingFromStore(setting *storepb.WorkspaceGeneralSetting) *v1pb.WorkspaceGeneralSetting {
|
||||
if setting == nil {
|
||||
return nil
|
||||
}
|
||||
generalSetting := &v1pb.WorkspaceGeneralSetting{
|
||||
DisallowUserRegistration: setting.DisallowUserRegistration,
|
||||
DisallowPasswordAuth: setting.DisallowPasswordAuth,
|
||||
AdditionalScript: setting.AdditionalScript,
|
||||
AdditionalStyle: setting.AdditionalStyle,
|
||||
WeekStartDayOffset: setting.WeekStartDayOffset,
|
||||
DisallowChangeUsername: setting.DisallowChangeUsername,
|
||||
DisallowChangeNickname: setting.DisallowChangeNickname,
|
||||
}
|
||||
if setting.CustomProfile != nil {
|
||||
generalSetting.CustomProfile = &v1pb.WorkspaceCustomProfile{
|
||||
Title: setting.CustomProfile.Title,
|
||||
Description: setting.CustomProfile.Description,
|
||||
LogoUrl: setting.CustomProfile.LogoUrl,
|
||||
Locale: setting.CustomProfile.Locale,
|
||||
Appearance: setting.CustomProfile.Appearance,
|
||||
}
|
||||
}
|
||||
return generalSetting
|
||||
}
|
||||
|
||||
func convertWorkspaceGeneralSettingToStore(setting *v1pb.WorkspaceGeneralSetting) *storepb.WorkspaceGeneralSetting {
|
||||
if setting == nil {
|
||||
return nil
|
||||
}
|
||||
generalSetting := &storepb.WorkspaceGeneralSetting{
|
||||
DisallowUserRegistration: setting.DisallowUserRegistration,
|
||||
DisallowPasswordAuth: setting.DisallowPasswordAuth,
|
||||
AdditionalScript: setting.AdditionalScript,
|
||||
AdditionalStyle: setting.AdditionalStyle,
|
||||
WeekStartDayOffset: setting.WeekStartDayOffset,
|
||||
DisallowChangeUsername: setting.DisallowChangeUsername,
|
||||
DisallowChangeNickname: setting.DisallowChangeNickname,
|
||||
}
|
||||
if setting.CustomProfile != nil {
|
||||
generalSetting.CustomProfile = &storepb.WorkspaceCustomProfile{
|
||||
Title: setting.CustomProfile.Title,
|
||||
Description: setting.CustomProfile.Description,
|
||||
LogoUrl: setting.CustomProfile.LogoUrl,
|
||||
Locale: setting.CustomProfile.Locale,
|
||||
Appearance: setting.CustomProfile.Appearance,
|
||||
}
|
||||
}
|
||||
return generalSetting
|
||||
}
|
||||
|
||||
func convertWorkspaceStorageSettingFromStore(settingpb *storepb.WorkspaceStorageSetting) *v1pb.WorkspaceStorageSetting {
|
||||
if settingpb == nil {
|
||||
return nil
|
||||
}
|
||||
setting := &v1pb.WorkspaceStorageSetting{
|
||||
StorageType: v1pb.WorkspaceStorageSetting_StorageType(settingpb.StorageType),
|
||||
FilepathTemplate: settingpb.FilepathTemplate,
|
||||
UploadSizeLimitMb: settingpb.UploadSizeLimitMb,
|
||||
}
|
||||
if settingpb.S3Config != nil {
|
||||
setting.S3Config = &v1pb.WorkspaceStorageSetting_S3Config{
|
||||
AccessKeyId: settingpb.S3Config.AccessKeyId,
|
||||
AccessKeySecret: settingpb.S3Config.AccessKeySecret,
|
||||
Endpoint: settingpb.S3Config.Endpoint,
|
||||
Region: settingpb.S3Config.Region,
|
||||
Bucket: settingpb.S3Config.Bucket,
|
||||
UsePathStyle: settingpb.S3Config.UsePathStyle,
|
||||
}
|
||||
}
|
||||
return setting
|
||||
}
|
||||
|
||||
func convertWorkspaceStorageSettingToStore(setting *v1pb.WorkspaceStorageSetting) *storepb.WorkspaceStorageSetting {
|
||||
if setting == nil {
|
||||
return nil
|
||||
}
|
||||
settingpb := &storepb.WorkspaceStorageSetting{
|
||||
StorageType: storepb.WorkspaceStorageSetting_StorageType(setting.StorageType),
|
||||
FilepathTemplate: setting.FilepathTemplate,
|
||||
UploadSizeLimitMb: setting.UploadSizeLimitMb,
|
||||
}
|
||||
if setting.S3Config != nil {
|
||||
settingpb.S3Config = &storepb.StorageS3Config{
|
||||
AccessKeyId: setting.S3Config.AccessKeyId,
|
||||
AccessKeySecret: setting.S3Config.AccessKeySecret,
|
||||
Endpoint: setting.S3Config.Endpoint,
|
||||
Region: setting.S3Config.Region,
|
||||
Bucket: setting.S3Config.Bucket,
|
||||
UsePathStyle: setting.S3Config.UsePathStyle,
|
||||
}
|
||||
}
|
||||
return settingpb
|
||||
}
|
||||
|
||||
func convertWorkspaceMemoRelatedSettingFromStore(setting *storepb.WorkspaceMemoRelatedSetting) *v1pb.WorkspaceMemoRelatedSetting {
|
||||
if setting == nil {
|
||||
return nil
|
||||
}
|
||||
return &v1pb.WorkspaceMemoRelatedSetting{
|
||||
DisallowPublicVisibility: setting.DisallowPublicVisibility,
|
||||
DisplayWithUpdateTime: setting.DisplayWithUpdateTime,
|
||||
ContentLengthLimit: setting.ContentLengthLimit,
|
||||
EnableDoubleClickEdit: setting.EnableDoubleClickEdit,
|
||||
EnableLinkPreview: setting.EnableLinkPreview,
|
||||
EnableComment: setting.EnableComment,
|
||||
Reactions: setting.Reactions,
|
||||
DisableMarkdownShortcuts: setting.DisableMarkdownShortcuts,
|
||||
EnableBlurNsfwContent: setting.EnableBlurNsfwContent,
|
||||
NsfwTags: setting.NsfwTags,
|
||||
}
|
||||
}
|
||||
|
||||
func convertWorkspaceMemoRelatedSettingToStore(setting *v1pb.WorkspaceMemoRelatedSetting) *storepb.WorkspaceMemoRelatedSetting {
|
||||
if setting == nil {
|
||||
return nil
|
||||
}
|
||||
return &storepb.WorkspaceMemoRelatedSetting{
|
||||
DisallowPublicVisibility: setting.DisallowPublicVisibility,
|
||||
DisplayWithUpdateTime: setting.DisplayWithUpdateTime,
|
||||
ContentLengthLimit: setting.ContentLengthLimit,
|
||||
EnableDoubleClickEdit: setting.EnableDoubleClickEdit,
|
||||
EnableLinkPreview: setting.EnableLinkPreview,
|
||||
EnableComment: setting.EnableComment,
|
||||
Reactions: setting.Reactions,
|
||||
DisableMarkdownShortcuts: setting.DisableMarkdownShortcuts,
|
||||
EnableBlurNsfwContent: setting.EnableBlurNsfwContent,
|
||||
NsfwTags: setting.NsfwTags,
|
||||
}
|
||||
}
|
||||
|
||||
var ownerCache *v1pb.User
|
||||
|
||||
func (s *APIV1Service) GetInstanceOwner(ctx context.Context) (*v1pb.User, error) {
|
||||
|
|
|
|||
|
|
@ -1,255 +0,0 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
v1pb "github.com/usememos/memos/proto/gen/api/v1"
|
||||
storepb "github.com/usememos/memos/proto/gen/store"
|
||||
"github.com/usememos/memos/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.InvalidArgument, "invalid workspace setting name: %v", err)
|
||||
}
|
||||
|
||||
workspaceSettingKey := storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[workspaceSettingKeyString])
|
||||
// Get workspace setting from store with default value.
|
||||
switch workspaceSettingKey {
|
||||
case storepb.WorkspaceSettingKey_BASIC:
|
||||
_, err = s.Store.GetWorkspaceBasicSetting(ctx)
|
||||
case storepb.WorkspaceSettingKey_GENERAL:
|
||||
_, err = s.Store.GetWorkspaceGeneralSetting(ctx)
|
||||
case storepb.WorkspaceSettingKey_MEMO_RELATED:
|
||||
_, err = s.Store.GetWorkspaceMemoRelatedSetting(ctx)
|
||||
case storepb.WorkspaceSettingKey_STORAGE:
|
||||
_, err = s.Store.GetWorkspaceStorageSetting(ctx)
|
||||
default:
|
||||
return nil, status.Errorf(codes.InvalidArgument, "unsupported workspace setting key: %v", workspaceSettingKey)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err)
|
||||
}
|
||||
|
||||
workspaceSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{
|
||||
Name: workspaceSettingKey.String(),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err)
|
||||
}
|
||||
if workspaceSetting == nil {
|
||||
return nil, status.Errorf(codes.NotFound, "workspace setting not found")
|
||||
}
|
||||
|
||||
// For storage setting, only host can get it.
|
||||
if workspaceSetting.Key == storepb.WorkspaceSettingKey_STORAGE {
|
||||
user, err := s.GetCurrentUser(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
|
||||
}
|
||||
if user == nil || user.Role != store.RoleHost {
|
||||
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
|
||||
}
|
||||
}
|
||||
|
||||
return convertWorkspaceSettingFromStore(workspaceSetting), nil
|
||||
}
|
||||
|
||||
func (s *APIV1Service) SetWorkspaceSetting(ctx context.Context, request *v1pb.SetWorkspaceSettingRequest) (*v1pb.WorkspaceSetting, error) {
|
||||
user, err := s.GetCurrentUser(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
|
||||
}
|
||||
if user.Role != store.RoleHost {
|
||||
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
|
||||
}
|
||||
|
||||
updateSetting := convertWorkspaceSettingToStore(request.Setting)
|
||||
workspaceSetting, err := s.Store.UpsertWorkspaceSetting(ctx, updateSetting)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to upsert workspace setting: %v", err)
|
||||
}
|
||||
|
||||
return convertWorkspaceSettingFromStore(workspaceSetting), nil
|
||||
}
|
||||
|
||||
func convertWorkspaceSettingFromStore(setting *storepb.WorkspaceSetting) *v1pb.WorkspaceSetting {
|
||||
workspaceSetting := &v1pb.WorkspaceSetting{
|
||||
Name: fmt.Sprintf("%s%s", WorkspaceSettingNamePrefix, setting.Key.String()),
|
||||
}
|
||||
switch setting.Value.(type) {
|
||||
case *storepb.WorkspaceSetting_GeneralSetting:
|
||||
workspaceSetting.Value = &v1pb.WorkspaceSetting_GeneralSetting{
|
||||
GeneralSetting: convertWorkspaceGeneralSettingFromStore(setting.GetGeneralSetting()),
|
||||
}
|
||||
case *storepb.WorkspaceSetting_StorageSetting:
|
||||
workspaceSetting.Value = &v1pb.WorkspaceSetting_StorageSetting{
|
||||
StorageSetting: convertWorkspaceStorageSettingFromStore(setting.GetStorageSetting()),
|
||||
}
|
||||
case *storepb.WorkspaceSetting_MemoRelatedSetting:
|
||||
workspaceSetting.Value = &v1pb.WorkspaceSetting_MemoRelatedSetting{
|
||||
MemoRelatedSetting: convertWorkspaceMemoRelatedSettingFromStore(setting.GetMemoRelatedSetting()),
|
||||
}
|
||||
}
|
||||
return workspaceSetting
|
||||
}
|
||||
|
||||
func convertWorkspaceSettingToStore(setting *v1pb.WorkspaceSetting) *storepb.WorkspaceSetting {
|
||||
settingKeyString, _ := ExtractWorkspaceSettingKeyFromName(setting.Name)
|
||||
workspaceSetting := &storepb.WorkspaceSetting{
|
||||
Key: storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[settingKeyString]),
|
||||
Value: &storepb.WorkspaceSetting_GeneralSetting{
|
||||
GeneralSetting: convertWorkspaceGeneralSettingToStore(setting.GetGeneralSetting()),
|
||||
},
|
||||
}
|
||||
switch workspaceSetting.Key {
|
||||
case storepb.WorkspaceSettingKey_GENERAL:
|
||||
workspaceSetting.Value = &storepb.WorkspaceSetting_GeneralSetting{
|
||||
GeneralSetting: convertWorkspaceGeneralSettingToStore(setting.GetGeneralSetting()),
|
||||
}
|
||||
case storepb.WorkspaceSettingKey_STORAGE:
|
||||
workspaceSetting.Value = &storepb.WorkspaceSetting_StorageSetting{
|
||||
StorageSetting: convertWorkspaceStorageSettingToStore(setting.GetStorageSetting()),
|
||||
}
|
||||
case storepb.WorkspaceSettingKey_MEMO_RELATED:
|
||||
workspaceSetting.Value = &storepb.WorkspaceSetting_MemoRelatedSetting{
|
||||
MemoRelatedSetting: convertWorkspaceMemoRelatedSettingToStore(setting.GetMemoRelatedSetting()),
|
||||
}
|
||||
}
|
||||
return workspaceSetting
|
||||
}
|
||||
|
||||
func convertWorkspaceGeneralSettingFromStore(setting *storepb.WorkspaceGeneralSetting) *v1pb.WorkspaceGeneralSetting {
|
||||
if setting == nil {
|
||||
return nil
|
||||
}
|
||||
generalSetting := &v1pb.WorkspaceGeneralSetting{
|
||||
DisallowUserRegistration: setting.DisallowUserRegistration,
|
||||
DisallowPasswordAuth: setting.DisallowPasswordAuth,
|
||||
AdditionalScript: setting.AdditionalScript,
|
||||
AdditionalStyle: setting.AdditionalStyle,
|
||||
WeekStartDayOffset: setting.WeekStartDayOffset,
|
||||
DisallowChangeUsername: setting.DisallowChangeUsername,
|
||||
DisallowChangeNickname: setting.DisallowChangeNickname,
|
||||
}
|
||||
if setting.CustomProfile != nil {
|
||||
generalSetting.CustomProfile = &v1pb.WorkspaceCustomProfile{
|
||||
Title: setting.CustomProfile.Title,
|
||||
Description: setting.CustomProfile.Description,
|
||||
LogoUrl: setting.CustomProfile.LogoUrl,
|
||||
Locale: setting.CustomProfile.Locale,
|
||||
Appearance: setting.CustomProfile.Appearance,
|
||||
}
|
||||
}
|
||||
return generalSetting
|
||||
}
|
||||
|
||||
func convertWorkspaceGeneralSettingToStore(setting *v1pb.WorkspaceGeneralSetting) *storepb.WorkspaceGeneralSetting {
|
||||
if setting == nil {
|
||||
return nil
|
||||
}
|
||||
generalSetting := &storepb.WorkspaceGeneralSetting{
|
||||
DisallowUserRegistration: setting.DisallowUserRegistration,
|
||||
DisallowPasswordAuth: setting.DisallowPasswordAuth,
|
||||
AdditionalScript: setting.AdditionalScript,
|
||||
AdditionalStyle: setting.AdditionalStyle,
|
||||
WeekStartDayOffset: setting.WeekStartDayOffset,
|
||||
DisallowChangeUsername: setting.DisallowChangeUsername,
|
||||
DisallowChangeNickname: setting.DisallowChangeNickname,
|
||||
}
|
||||
if setting.CustomProfile != nil {
|
||||
generalSetting.CustomProfile = &storepb.WorkspaceCustomProfile{
|
||||
Title: setting.CustomProfile.Title,
|
||||
Description: setting.CustomProfile.Description,
|
||||
LogoUrl: setting.CustomProfile.LogoUrl,
|
||||
Locale: setting.CustomProfile.Locale,
|
||||
Appearance: setting.CustomProfile.Appearance,
|
||||
}
|
||||
}
|
||||
return generalSetting
|
||||
}
|
||||
|
||||
func convertWorkspaceStorageSettingFromStore(settingpb *storepb.WorkspaceStorageSetting) *v1pb.WorkspaceStorageSetting {
|
||||
if settingpb == nil {
|
||||
return nil
|
||||
}
|
||||
setting := &v1pb.WorkspaceStorageSetting{
|
||||
StorageType: v1pb.WorkspaceStorageSetting_StorageType(settingpb.StorageType),
|
||||
FilepathTemplate: settingpb.FilepathTemplate,
|
||||
UploadSizeLimitMb: settingpb.UploadSizeLimitMb,
|
||||
}
|
||||
if settingpb.S3Config != nil {
|
||||
setting.S3Config = &v1pb.WorkspaceStorageSetting_S3Config{
|
||||
AccessKeyId: settingpb.S3Config.AccessKeyId,
|
||||
AccessKeySecret: settingpb.S3Config.AccessKeySecret,
|
||||
Endpoint: settingpb.S3Config.Endpoint,
|
||||
Region: settingpb.S3Config.Region,
|
||||
Bucket: settingpb.S3Config.Bucket,
|
||||
UsePathStyle: settingpb.S3Config.UsePathStyle,
|
||||
}
|
||||
}
|
||||
return setting
|
||||
}
|
||||
|
||||
func convertWorkspaceStorageSettingToStore(setting *v1pb.WorkspaceStorageSetting) *storepb.WorkspaceStorageSetting {
|
||||
if setting == nil {
|
||||
return nil
|
||||
}
|
||||
settingpb := &storepb.WorkspaceStorageSetting{
|
||||
StorageType: storepb.WorkspaceStorageSetting_StorageType(setting.StorageType),
|
||||
FilepathTemplate: setting.FilepathTemplate,
|
||||
UploadSizeLimitMb: setting.UploadSizeLimitMb,
|
||||
}
|
||||
if setting.S3Config != nil {
|
||||
settingpb.S3Config = &storepb.StorageS3Config{
|
||||
AccessKeyId: setting.S3Config.AccessKeyId,
|
||||
AccessKeySecret: setting.S3Config.AccessKeySecret,
|
||||
Endpoint: setting.S3Config.Endpoint,
|
||||
Region: setting.S3Config.Region,
|
||||
Bucket: setting.S3Config.Bucket,
|
||||
UsePathStyle: setting.S3Config.UsePathStyle,
|
||||
}
|
||||
}
|
||||
return settingpb
|
||||
}
|
||||
|
||||
func convertWorkspaceMemoRelatedSettingFromStore(setting *storepb.WorkspaceMemoRelatedSetting) *v1pb.WorkspaceMemoRelatedSetting {
|
||||
if setting == nil {
|
||||
return nil
|
||||
}
|
||||
return &v1pb.WorkspaceMemoRelatedSetting{
|
||||
DisallowPublicVisibility: setting.DisallowPublicVisibility,
|
||||
DisplayWithUpdateTime: setting.DisplayWithUpdateTime,
|
||||
ContentLengthLimit: setting.ContentLengthLimit,
|
||||
EnableDoubleClickEdit: setting.EnableDoubleClickEdit,
|
||||
EnableLinkPreview: setting.EnableLinkPreview,
|
||||
EnableComment: setting.EnableComment,
|
||||
Reactions: setting.Reactions,
|
||||
DisableMarkdownShortcuts: setting.DisableMarkdownShortcuts,
|
||||
EnableBlurNsfwContent: setting.EnableBlurNsfwContent,
|
||||
NsfwTags: setting.NsfwTags,
|
||||
}
|
||||
}
|
||||
|
||||
func convertWorkspaceMemoRelatedSettingToStore(setting *v1pb.WorkspaceMemoRelatedSetting) *storepb.WorkspaceMemoRelatedSetting {
|
||||
if setting == nil {
|
||||
return nil
|
||||
}
|
||||
return &storepb.WorkspaceMemoRelatedSetting{
|
||||
DisallowPublicVisibility: setting.DisallowPublicVisibility,
|
||||
DisplayWithUpdateTime: setting.DisplayWithUpdateTime,
|
||||
ContentLengthLimit: setting.ContentLengthLimit,
|
||||
EnableDoubleClickEdit: setting.EnableDoubleClickEdit,
|
||||
EnableLinkPreview: setting.EnableLinkPreview,
|
||||
EnableComment: setting.EnableComment,
|
||||
Reactions: setting.Reactions,
|
||||
DisableMarkdownShortcuts: setting.DisableMarkdownShortcuts,
|
||||
EnableBlurNsfwContent: setting.EnableBlurNsfwContent,
|
||||
NsfwTags: setting.NsfwTags,
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ import { toast } from "react-hot-toast";
|
|||
import { workspaceSettingNamePrefix } from "@/store/common";
|
||||
import { workspaceStore } from "@/store/v2";
|
||||
import { WorkspaceSettingKey } from "@/store/v2/workspace";
|
||||
import { WorkspaceMemoRelatedSetting } from "@/types/proto/api/v1/workspace_setting_service";
|
||||
import { WorkspaceMemoRelatedSetting } from "@/types/proto/api/v1/workspace_service";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
|
||||
const MemoRelatedSettings = observer(() => {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
WorkspaceStorageSetting,
|
||||
WorkspaceStorageSetting_S3Config,
|
||||
WorkspaceStorageSetting_StorageType,
|
||||
} from "@/types/proto/api/v1/workspace_setting_service";
|
||||
} from "@/types/proto/api/v1/workspace_service";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
|
||||
const StorageSection = observer(() => {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { workspaceSettingNamePrefix } from "@/store/common";
|
|||
import { workspaceStore } from "@/store/v2";
|
||||
import { WorkspaceSettingKey } from "@/store/v2/workspace";
|
||||
import { IdentityProvider } from "@/types/proto/api/v1/idp_service";
|
||||
import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_setting_service";
|
||||
import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_service";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
import showUpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog";
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { toast } from "react-hot-toast";
|
|||
import { workspaceSettingNamePrefix } from "@/store/common";
|
||||
import { workspaceStore } from "@/store/v2";
|
||||
import { WorkspaceSettingKey } from "@/store/v2/workspace";
|
||||
import { WorkspaceCustomProfile } from "@/types/proto/api/v1/workspace_setting_service";
|
||||
import { WorkspaceCustomProfile } from "@/types/proto/api/v1/workspace_service";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
import AppearanceSelect from "./AppearanceSelect";
|
||||
import { generateDialog } from "./Dialog";
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import { ShortcutServiceDefinition } from "./types/proto/api/v1/shortcut_service
|
|||
import { UserServiceDefinition } from "./types/proto/api/v1/user_service";
|
||||
import { WebhookServiceDefinition } from "./types/proto/api/v1/webhook_service";
|
||||
import { WorkspaceServiceDefinition } from "./types/proto/api/v1/workspace_service";
|
||||
import { WorkspaceSettingServiceDefinition } from "./types/proto/api/v1/workspace_setting_service";
|
||||
|
||||
const channel = createChannel(
|
||||
window.location.origin,
|
||||
|
|
@ -23,8 +22,6 @@ const clientFactory = createClientFactory();
|
|||
|
||||
export const workspaceServiceClient = clientFactory.create(WorkspaceServiceDefinition, channel);
|
||||
|
||||
export const workspaceSettingServiceClient = clientFactory.create(WorkspaceSettingServiceDefinition, channel);
|
||||
|
||||
export const authServiceClient = clientFactory.create(AuthServiceDefinition, channel);
|
||||
|
||||
export const userServiceClient = clientFactory.create(UserServiceDefinition, channel);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export const workspaceSettingNamePrefix = "settings/";
|
||||
export const workspaceSettingNamePrefix = "workspace/settings/";
|
||||
export const userNamePrefix = "users/";
|
||||
export const memoNamePrefix = "memos/";
|
||||
export const identityProviderNamePrefix = "identityProviders/";
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ const userStore = (() => {
|
|||
// Ensure the setting has the proper resource name
|
||||
const settingWithName = {
|
||||
...userSetting,
|
||||
name: `${state.currentUser}/setting`,
|
||||
name: state.currentUser,
|
||||
};
|
||||
const updatedUserSetting = await userServiceClient.updateUserSetting({
|
||||
setting: settingWithName,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { uniqBy } from "lodash-es";
|
||||
import { makeAutoObservable } from "mobx";
|
||||
import { workspaceServiceClient, workspaceSettingServiceClient } from "@/grpcweb";
|
||||
import { workspaceServiceClient } from "@/grpcweb";
|
||||
import { WorkspaceProfile } from "@/types/proto/api/v1/workspace_service";
|
||||
import { WorkspaceGeneralSetting, WorkspaceMemoRelatedSetting, WorkspaceSetting } from "@/types/proto/api/v1/workspace_setting_service";
|
||||
import { WorkspaceGeneralSetting, WorkspaceMemoRelatedSetting, WorkspaceSetting } from "@/types/proto/api/v1/workspace_service";
|
||||
import { isValidateLocale } from "@/utils/i18n";
|
||||
import { workspaceSettingNamePrefix } from "../common";
|
||||
|
||||
|
|
@ -60,14 +60,14 @@ const workspaceStore = (() => {
|
|||
const state = new LocalState();
|
||||
|
||||
const fetchWorkspaceSetting = async (settingKey: WorkspaceSettingKey) => {
|
||||
const setting = await workspaceSettingServiceClient.getWorkspaceSetting({ name: `${workspaceSettingNamePrefix}${settingKey}` });
|
||||
const setting = await workspaceServiceClient.getWorkspaceSetting({ name: `${workspaceSettingNamePrefix}${settingKey}` });
|
||||
state.setPartial({
|
||||
settings: uniqBy([setting, ...state.settings], "name"),
|
||||
});
|
||||
};
|
||||
|
||||
const upsertWorkspaceSetting = async (setting: WorkspaceSetting) => {
|
||||
await workspaceSettingServiceClient.setWorkspaceSetting({ setting });
|
||||
await workspaceServiceClient.updateWorkspaceSetting({ setting });
|
||||
state.setPartial({
|
||||
settings: uniqBy([setting, ...state.settings], "name"),
|
||||
});
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue