From 8e11826db12d01b99f38e598f056ce348d354018 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 20 Feb 2024 23:02:01 +0800 Subject: [PATCH] chore: update workspace setting service --- api/v1/resource.go | 19 +- api/v2/acl_config.go | 1 + api/v2/apidocs.swagger.yaml | 105 +- api/v2/auth_service.go | 2 +- api/v2/memo_service.go | 1 - api/v2/resource_name.go | 13 +- api/v2/v2.go | 5 + api/v2/workspace_service.go | 97 +- api/v2/workspace_setting_service.go | 113 + bin/memos/main.go | 57 +- proto/api/v2/workspace_service.proto | 26 +- proto/api/v2/workspace_setting_service.proto | 67 + proto/gen/api/v2/README.md | 178 +- proto/gen/api/v2/node.pb.go | 2906 ----------------- proto/gen/api/v2/workspace_service.pb.go | 306 +- proto/gen/api/v2/workspace_service.pb.gw.go | 117 - proto/gen/api/v2/workspace_service_grpc.pb.go | 41 +- .../api/v2/workspace_setting_service.pb.go | 607 ++++ .../api/v2/workspace_setting_service.pb.gw.go | 308 ++ .../v2/workspace_setting_service_grpc.pb.go | 151 + proto/gen/store/README.md | 27 +- proto/gen/store/workspace_setting.pb.go | 215 +- proto/store/user_setting.proto | 40 +- proto/store/workspace_setting.proto | 25 +- server/integration/telegram.go | 7 +- server/profile/profile.go | 2 + server/server.go | 8 +- store/db/mysql/migrator.go | 6 +- store/db/mysql/workspace_setting.go | 66 + store/db/postgres/migrator.go | 6 +- store/db/postgres/workspace_setting.go | 68 + store/db/sqlite/migrator.go | 10 +- store/db/sqlite/user_setting.go | 1 - store/db/sqlite/workspace_setting.go | 68 + store/driver.go | 2 + store/store.go | 13 +- store/workspace_setting.go | 60 +- test/store/workspace_setting_test.go | 20 + web/src/components/Settings/SystemSection.tsx | 123 +- web/src/grpcweb.ts | 3 + web/src/store/v1/resourceName.ts | 1 + 41 files changed, 2213 insertions(+), 3678 deletions(-) create mode 100644 api/v2/workspace_setting_service.go create mode 100644 proto/api/v2/workspace_setting_service.proto delete mode 100644 proto/gen/api/v2/node.pb.go create mode 100644 proto/gen/api/v2/workspace_setting_service.pb.go create mode 100644 proto/gen/api/v2/workspace_setting_service.pb.gw.go create mode 100644 proto/gen/api/v2/workspace_setting_service_grpc.pb.go diff --git a/api/v1/resource.go b/api/v1/resource.go index 00f6ebd2..0b587de4 100644 --- a/api/v1/resource.go +++ b/api/v1/resource.go @@ -185,14 +185,21 @@ func (s *APIV1Service) UploadResource(c echo.Context) error { return echo.NewHTTPError(http.StatusUnauthorized, "Missing user in session") } - // This is the backend default max upload size limit. - maxUploadSetting := s.Store.GetWorkspaceSettingWithDefaultValue(ctx, SystemSettingMaxUploadSizeMiBName.String(), "32") + maxUploadSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{Name: SystemSettingMaxUploadSizeMiBName.String()}) + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, "Failed to get max upload size").SetInternal(err) + } var settingMaxUploadSizeBytes int - if settingMaxUploadSizeMiB, err := strconv.Atoi(maxUploadSetting); err == nil { - settingMaxUploadSizeBytes = settingMaxUploadSizeMiB * MebiByte + if maxUploadSetting != nil { + if settingMaxUploadSizeMiB, err := strconv.Atoi(maxUploadSetting.Value); err == nil { + settingMaxUploadSizeBytes = settingMaxUploadSizeMiB * MebiByte + } else { + log.Warn("Failed to parse max upload size", zap.Error(err)) + settingMaxUploadSizeBytes = 0 + } } else { - log.Warn("Failed to parse max upload size", zap.Error(err)) - settingMaxUploadSizeBytes = 0 + // Default to 32 MiB. + settingMaxUploadSizeBytes = 32 * MebiByte } file, err := c.FormFile("file") diff --git a/api/v2/acl_config.go b/api/v2/acl_config.go index 7bb54422..12bff738 100644 --- a/api/v2/acl_config.go +++ b/api/v2/acl_config.go @@ -4,6 +4,7 @@ import "strings" var authenticationAllowlistMethods = map[string]bool{ "/memos.api.v2.WorkspaceService/GetWorkspaceProfile": true, + "/memos.api.v2.WorkspaceService/GetWorkspaceSetting": true, "/memos.api.v2.AuthService/GetAuthStatus": true, "/memos.api.v2.AuthService/SignIn": true, "/memos.api.v2.AuthService/SignInWithSSO": true, diff --git a/api/v2/apidocs.swagger.yaml b/api/v2/apidocs.swagger.yaml index ed7d7088..e1f393c9 100644 --- a/api/v2/apidocs.swagger.yaml +++ b/api/v2/apidocs.swagger.yaml @@ -12,6 +12,7 @@ tags: - name: TagService - name: WebhookService - name: WorkspaceService + - name: WorkspaceSettingService consumes: - application/json produces: @@ -1115,27 +1116,65 @@ paths: $ref: '#/definitions/googlerpcStatus' tags: - WorkspaceService - patch: - summary: UpdateWorkspaceProfile updates the workspace profile. - operationId: WorkspaceService_UpdateWorkspaceProfile + /api/v2/workspace/{name}: + get: + summary: GetWorkspaceSetting returns the setting by name. + operationId: WorkspaceSettingService_GetWorkspaceSetting responses: "200": description: A successful response. schema: - $ref: '#/definitions/v2UpdateWorkspaceProfileResponse' + $ref: '#/definitions/v2GetWorkspaceSettingResponse' default: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: workspaceProfile - description: System info is the updated data. + - name: name + description: |- + The resource name of the workspace setting. + Format: settings/{setting} + in: path + required: true + type: string + pattern: settings/[^/]+ + tags: + - WorkspaceSettingService + /api/v2/workspace/{setting.name}: + patch: + summary: SetWorkspaceSetting updates the setting. + operationId: WorkspaceSettingService_SetWorkspaceSetting + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/v2SetWorkspaceSettingResponse' + 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: - $ref: '#/definitions/v2WorkspaceProfile' + type: object + properties: + generalSetting: + $ref: '#/definitions/apiv2WorkspaceGeneralSetting' + description: general_setting is the general setting of workspace. + title: setting is the setting to update. tags: - - WorkspaceService + - WorkspaceSettingService /api/v2/{inbox.name}: patch: summary: UpdateInbox updates an inbox. @@ -1611,6 +1650,35 @@ definitions: type: string url: type: string + apiv2WorkspaceGeneralSetting: + type: object + properties: + instanceUrl: + type: string + description: instance_url is the instance URL. + disallowSignup: + type: boolean + description: disallow_signup is the flag to disallow signup. + disallowPasswordLogin: + type: boolean + description: disallow_password_login is the flag to disallow password login. + additionalScript: + type: string + description: additional_script is the additional script. + additionalStyle: + type: string + description: additional_style is the additional style. + apiv2WorkspaceSetting: + type: object + properties: + name: + type: string + title: |- + name is the name of the setting. + Format: settings/{setting} + generalSetting: + $ref: '#/definitions/apiv2WorkspaceGeneralSetting' + description: general_setting is the general setting of workspace. googlerpcStatus: type: object properties: @@ -1784,6 +1852,11 @@ definitions: properties: workspaceProfile: $ref: '#/definitions/v2WorkspaceProfile' + v2GetWorkspaceSettingResponse: + type: object + properties: + setting: + $ref: '#/definitions/apiv2WorkspaceSetting' v2Inbox: type: object properties: @@ -2024,6 +2097,11 @@ definitions: type: object v2SetMemoResourcesResponse: type: object + v2SetWorkspaceSettingResponse: + type: object + properties: + setting: + $ref: '#/definitions/apiv2WorkspaceSetting' v2SignInResponse: type: object properties: @@ -2081,11 +2159,6 @@ definitions: properties: webhook: $ref: '#/definitions/apiv2Webhook' - v2UpdateWorkspaceProfileResponse: - type: object - properties: - workspaceProfile: - $ref: '#/definitions/v2WorkspaceProfile' v2UpsertMemoReactionResponse: type: object properties: @@ -2158,13 +2231,19 @@ definitions: properties: version: type: string + title: version is the current version of instance mode: type: string + description: mode is the instance mode (e.g. "prod", "dev" or "demo"). allowRegistration: type: boolean + description: allow_registration is whether the registration is allowed. disablePasswordLogin: type: boolean + description: allow_password_login is whether the password login is allowed. additionalScript: type: string + description: additional_script is the additional script. additionalStyle: type: string + description: additional_style is the additional style. diff --git a/api/v2/auth_service.go b/api/v2/auth_service.go index 3ce83eca..4a680c42 100644 --- a/api/v2/auth_service.go +++ b/api/v2/auth_service.go @@ -255,7 +255,7 @@ func (s *APIV2Service) buildAccessTokenCookie(ctx context.Context, accessToken s if err != nil { return "", errors.Wrap(err, "failed to get workspace setting") } - if workspaceGeneralSetting.InstanceUrl != "" && strings.HasPrefix(workspaceGeneralSetting.InstanceUrl, "https://") { + if strings.HasPrefix(workspaceGeneralSetting.InstanceUrl, "https://") { attrs = append(attrs, "SameSite=None") attrs = append(attrs, "Secure") } else { diff --git a/api/v2/memo_service.go b/api/v2/memo_service.go index ef0bff8a..13ac8679 100644 --- a/api/v2/memo_service.go +++ b/api/v2/memo_service.go @@ -248,7 +248,6 @@ func (s *APIV2Service) UpdateMemo(ctx context.Context, request *apiv2pb.UpdateMe update.Visibility = &visibility } else if path == "row_status" { rowStatus := convertRowStatusToStore(request.Memo.RowStatus) - println("rowStatus", rowStatus) update.RowStatus = &rowStatus } else if path == "created_ts" { createdTs := request.Memo.CreateTime.AsTime().Unix() diff --git a/api/v2/resource_name.go b/api/v2/resource_name.go index fea44cff..a2987dfb 100644 --- a/api/v2/resource_name.go +++ b/api/v2/resource_name.go @@ -10,8 +10,9 @@ import ( ) const ( - UserNamePrefix = "users/" - InboxNamePrefix = "inboxes/" + WorkspaceSettingNamePrefix = "settings/" + UserNamePrefix = "users/" + InboxNamePrefix = "inboxes/" ) // GetNameParentTokens returns the tokens from a resource name. @@ -34,6 +35,14 @@ func GetNameParentTokens(name string, tokenPrefixes ...string) ([]string, error) return tokens, nil } +func ExtractWorkspaceSettingKeyFromName(name string) (string, error) { + tokens, err := GetNameParentTokens(name, WorkspaceSettingNamePrefix) + if err != nil { + return "", err + } + return tokens[0], nil +} + // ExtractUsernameFromName returns the username from a resource name. func ExtractUsernameFromName(name string) (string, error) { tokens, err := GetNameParentTokens(name, UserNamePrefix) diff --git a/api/v2/v2.go b/api/v2/v2.go index 5cc1fd14..176e94a5 100644 --- a/api/v2/v2.go +++ b/api/v2/v2.go @@ -22,6 +22,7 @@ import ( type APIV2Service struct { apiv2pb.UnimplementedWorkspaceServiceServer + apiv2pb.UnimplementedWorkspaceSettingServiceServer apiv2pb.UnimplementedAuthServiceServer apiv2pb.UnimplementedUserServiceServer apiv2pb.UnimplementedMemoServiceServer @@ -56,6 +57,7 @@ func NewAPIV2Service(secret string, profile *profile.Profile, store *store.Store } apiv2pb.RegisterWorkspaceServiceServer(grpcServer, apiv2Service) + apiv2pb.RegisterWorkspaceSettingServiceServer(grpcServer, apiv2Service) apiv2pb.RegisterAuthServiceServer(grpcServer, apiv2Service) apiv2pb.RegisterUserServiceServer(grpcServer, apiv2Service) apiv2pb.RegisterMemoServiceServer(grpcServer, apiv2Service) @@ -90,6 +92,9 @@ func (s *APIV2Service) RegisterGateway(ctx context.Context, e *echo.Echo) error if err := apiv2pb.RegisterWorkspaceServiceHandler(context.Background(), gwMux, conn); err != nil { return err } + if err := apiv2pb.RegisterWorkspaceSettingServiceHandler(context.Background(), gwMux, conn); err != nil { + return err + } if err := apiv2pb.RegisterAuthServiceHandler(context.Background(), gwMux, conn); err != nil { return err } diff --git a/api/v2/workspace_service.go b/api/v2/workspace_service.go index 0c48ae26..8324502e 100644 --- a/api/v2/workspace_service.go +++ b/api/v2/workspace_service.go @@ -2,109 +2,16 @@ package v2 import ( "context" - "strconv" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" - - "github.com/pkg/errors" apiv2pb "github.com/usememos/memos/proto/gen/api/v2" - storepb "github.com/usememos/memos/proto/gen/store" - "github.com/usememos/memos/store" ) -func (s *APIV2Service) GetWorkspaceProfile(_ context.Context, _ *apiv2pb.GetWorkspaceProfileRequest) (*apiv2pb.GetWorkspaceProfileResponse, error) { +func (s *APIV2Service) GetWorkspaceProfile(ctx context.Context, _ *apiv2pb.GetWorkspaceProfileRequest) (*apiv2pb.GetWorkspaceProfileResponse, error) { workspaceProfile := &apiv2pb.WorkspaceProfile{ Version: s.Profile.Version, Mode: s.Profile.Mode, } - response := &apiv2pb.GetWorkspaceProfileResponse{ + return &apiv2pb.GetWorkspaceProfileResponse{ WorkspaceProfile: workspaceProfile, - } - return response, nil -} - -func (s *APIV2Service) UpdateWorkspaceProfile(ctx context.Context, request *apiv2pb.UpdateWorkspaceProfileRequest) (*apiv2pb.UpdateWorkspaceProfileResponse, error) { - user, err := getCurrentUser(ctx, s.Store) - 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") - } - if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 { - return nil, status.Errorf(codes.InvalidArgument, "update mask is required") - } - - // Update system settings. - for _, field := range request.UpdateMask.Paths { - if field == "allow_registration" { - _, err := s.Store.UpsertWorkspaceSetting(ctx, &store.WorkspaceSetting{ - Name: "allow-signup", - Value: strconv.FormatBool(request.WorkspaceProfile.AllowRegistration), - }) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to update allow_registration system setting: %v", err) - } - } else if field == "disable_password_login" { - if s.Profile.Mode == "demo" { - return nil, status.Errorf(codes.PermissionDenied, "disabling password login is not allowed in demo mode") - } - _, err := s.Store.UpsertWorkspaceSetting(ctx, &store.WorkspaceSetting{ - Name: "disable-password-login", - Value: strconv.FormatBool(request.WorkspaceProfile.DisablePasswordLogin), - }) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to update disable_password_login system setting: %v", err) - } - } else if field == "additional_script" { - if s.Profile.Mode == "demo" { - return nil, status.Errorf(codes.PermissionDenied, "additional script is not allowed in demo mode") - } - _, err := s.Store.UpsertWorkspaceSetting(ctx, &store.WorkspaceSetting{ - Name: "additional-script", - Value: request.WorkspaceProfile.AdditionalScript, - }) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to update additional_script system setting: %v", err) - } - } else if field == "additional_style" { - if s.Profile.Mode == "demo" { - return nil, status.Errorf(codes.PermissionDenied, "additional style is not allowed in demo mode") - } - _, err := s.Store.UpsertWorkspaceSetting(ctx, &store.WorkspaceSetting{ - Name: "additional-style", - Value: request.WorkspaceProfile.AdditionalStyle, - }) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to update additional_style system setting: %v", err) - } - } - } - - workspaceProfileMessage, err := s.GetWorkspaceProfile(ctx, &apiv2pb.GetWorkspaceProfileRequest{}) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to get system info: %v", err) - } - return &apiv2pb.UpdateWorkspaceProfileResponse{ - WorkspaceProfile: workspaceProfileMessage.WorkspaceProfile, }, nil } - -func (s *APIV2Service) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.WorkspaceGeneralSetting, error) { - workspaceSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ - Name: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL.String(), - }) - if err != nil { - return nil, errors.Wrap(err, "failed to get workspace setting") - } - workspaceGeneralSetting := &storepb.WorkspaceGeneralSetting{} - if workspaceSetting != nil { - if err := proto.Unmarshal([]byte(workspaceSetting.Value), workspaceGeneralSetting); err != nil { - return nil, errors.Wrap(err, "failed to unmarshal workspace setting") - } - } - return workspaceGeneralSetting, nil -} diff --git a/api/v2/workspace_setting_service.go b/api/v2/workspace_setting_service.go new file mode 100644 index 00000000..e79bd64f --- /dev/null +++ b/api/v2/workspace_setting_service.go @@ -0,0 +1,113 @@ +package v2 + +import ( + "context" + "fmt" + + "github.com/pkg/errors" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + + apiv2pb "github.com/usememos/memos/proto/gen/api/v2" + storepb "github.com/usememos/memos/proto/gen/store" + "github.com/usememos/memos/store" +) + +func (s *APIV2Service) GetWorkspaceSetting(ctx context.Context, request *apiv2pb.GetWorkspaceSettingRequest) (*apiv2pb.GetWorkspaceSettingResponse, error) { + settingKeyString, err := ExtractWorkspaceSettingKeyFromName(request.Name) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid workspace setting name: %v", err) + } + settingKey := storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[settingKeyString]) + workspaceSetting, err := s.Store.GetWorkspaceSettingV1(ctx, &store.FindWorkspaceSettingV1{ + Key: settingKey, + }) + 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") + } + + return &apiv2pb.GetWorkspaceSettingResponse{ + Setting: convertWorkspaceSettingFromStore(workspaceSetting), + }, nil +} + +func (s *APIV2Service) SetWorkspaceSetting(ctx context.Context, request *apiv2pb.SetWorkspaceSettingRequest) (*apiv2pb.SetWorkspaceSettingResponse, error) { + user, err := getCurrentUser(ctx, s.Store) + 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") + } + + if _, err := s.Store.UpsertWorkspaceSettingV1(ctx, convertWorkspaceSettingToStore(request.Setting)); err != nil { + return nil, status.Errorf(codes.Internal, "failed to upsert workspace setting: %v", err) + } + + return &apiv2pb.SetWorkspaceSettingResponse{}, nil +} + +func (s *APIV2Service) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.WorkspaceGeneralSetting, error) { + workspaceSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ + Name: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL.String(), + }) + if err != nil { + return nil, errors.Wrap(err, "failed to get workspace setting") + } + workspaceGeneralSetting := &storepb.WorkspaceGeneralSetting{} + if workspaceSetting != nil { + if err := proto.Unmarshal([]byte(workspaceSetting.Value), workspaceGeneralSetting); err != nil { + return nil, errors.Wrap(err, "failed to unmarshal workspace setting") + } + } + return workspaceGeneralSetting, nil +} + +func convertWorkspaceSettingFromStore(setting *storepb.WorkspaceSetting) *apiv2pb.WorkspaceSetting { + return &apiv2pb.WorkspaceSetting{ + Name: fmt.Sprintf("%s%s", WorkspaceSettingNamePrefix, setting.Key.String()), + Value: &apiv2pb.WorkspaceSetting_GeneralSetting{ + GeneralSetting: convertWorkspaceGeneralSettingFromStore(setting.GetGeneral()), + }, + } +} + +func convertWorkspaceSettingToStore(setting *apiv2pb.WorkspaceSetting) *storepb.WorkspaceSetting { + settingKeyString, _ := ExtractWorkspaceSettingKeyFromName(setting.Name) + return &storepb.WorkspaceSetting{ + Key: storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[settingKeyString]), + Value: &storepb.WorkspaceSetting_General{ + General: convertWorkspaceGeneralSettingToStore(setting.GetGeneralSetting()), + }, + } +} + +func convertWorkspaceGeneralSettingFromStore(setting *storepb.WorkspaceGeneralSetting) *apiv2pb.WorkspaceGeneralSetting { + if setting == nil { + return nil + } + return &apiv2pb.WorkspaceGeneralSetting{ + InstanceUrl: setting.InstanceUrl, + DisallowSignup: setting.DisallowSignup, + DisallowPasswordLogin: setting.DisallowPasswordLogin, + AdditionalScript: setting.AdditionalScript, + AdditionalStyle: setting.AdditionalStyle, + } +} + +func convertWorkspaceGeneralSettingToStore(setting *apiv2pb.WorkspaceGeneralSetting) *storepb.WorkspaceGeneralSetting { + if setting == nil { + return nil + } + return &storepb.WorkspaceGeneralSetting{ + InstanceUrl: setting.InstanceUrl, + DisallowSignup: setting.DisallowSignup, + DisallowPasswordLogin: setting.DisallowPasswordLogin, + AdditionalScript: setting.AdditionalScript, + AdditionalStyle: setting.AdditionalStyle, + } +} diff --git a/bin/memos/main.go b/bin/memos/main.go index 47a9ca62..ed3f0793 100644 --- a/bin/memos/main.go +++ b/bin/memos/main.go @@ -34,14 +34,15 @@ const ( ) var ( - profile *_profile.Profile - mode string - addr string - port int - data string - driver string - dsn string - enableMetric bool + profile *_profile.Profile + mode string + addr string + port int + data string + driver string + dsn string + serveFrontend bool + enableMetric bool rootCmd = &cobra.Command{ Use: "memos", @@ -117,6 +118,7 @@ func init() { rootCmd.PersistentFlags().StringVarP(&data, "data", "d", "", "data directory") rootCmd.PersistentFlags().StringVarP(&driver, "driver", "", "", "database driver") rootCmd.PersistentFlags().StringVarP(&dsn, "dsn", "", "", "database source name(aka. DSN)") + rootCmd.PersistentFlags().BoolVarP(&serveFrontend, "frontend", "", true, "serve frontend files") rootCmd.PersistentFlags().BoolVarP(&enableMetric, "metric", "", true, "allow metric collection") err := viper.BindPFlag("mode", rootCmd.PersistentFlags().Lookup("mode")) @@ -143,6 +145,10 @@ func init() { if err != nil { panic(err) } + err = viper.BindPFlag("frontend", rootCmd.PersistentFlags().Lookup("frontend")) + if err != nil { + panic(err) + } err = viper.BindPFlag("metric", rootCmd.PersistentFlags().Lookup("metric")) if err != nil { panic(err) @@ -152,6 +158,7 @@ func init() { viper.SetDefault("driver", "sqlite") viper.SetDefault("addr", "") viper.SetDefault("port", 8081) + viper.SetDefault("frontend", true) viper.SetDefault("metric", true) viper.SetEnvPrefix("memos") } @@ -165,17 +172,18 @@ func initConfig() { return } - println("---") - println("Server profile") - println("data:", profile.Data) - println("dsn:", profile.DSN) - println("addr:", profile.Addr) - println("port:", profile.Port) - println("mode:", profile.Mode) - println("driver:", profile.Driver) - println("version:", profile.Version) - println("metric:", profile.Metric) - println("---") + fmt.Printf(`--- +Server profile +data: %s +dsn: %s +addr: %s +port: %d +mode: %s +driver: %s +version: %s +metric: %t +--- +`, profile.Data, profile.DSN, profile.Addr, profile.Port, profile.Mode, profile.Driver, profile.Version, profile.Metric) } func printGreetings() { @@ -185,11 +193,12 @@ func printGreetings() { } else { fmt.Printf("Version %s has been started on address '%s' and port %d\n", profile.Version, profile.Addr, profile.Port) } - println("---") - println("See more in:") - fmt.Printf("👉Website: %s\n", "https://usememos.com") - fmt.Printf("👉GitHub: %s\n", "https://github.com/usememos/memos") - println("---") + fmt.Printf(`--- +See more in: +👉Website: %s +👉GitHub: %s +--- +`, "https://usememos.com", "https://github.com/usememos/memos") } func main() { diff --git a/proto/api/v2/workspace_service.proto b/proto/api/v2/workspace_service.proto index 0eab3679..680c4b4f 100644 --- a/proto/api/v2/workspace_service.proto +++ b/proto/api/v2/workspace_service.proto @@ -3,8 +3,6 @@ syntax = "proto3"; package memos.api.v2; import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/protobuf/field_mask.proto"; option go_package = "gen/api/v2"; @@ -13,22 +11,20 @@ service WorkspaceService { rpc GetWorkspaceProfile(GetWorkspaceProfileRequest) returns (GetWorkspaceProfileResponse) { option (google.api.http) = {get: "/api/v2/workspace/profile"}; } - // UpdateWorkspaceProfile updates the workspace profile. - rpc UpdateWorkspaceProfile(UpdateWorkspaceProfileRequest) returns (UpdateWorkspaceProfileResponse) { - option (google.api.http) = { - patch: "/api/v2/workspace/profile", - body: "workspace_profile" - }; - option (google.api.method_signature) = "workspace_profile,update_mask"; - } } message WorkspaceProfile { + // version is the current version of instance string version = 1; + // mode is the instance mode (e.g. "prod", "dev" or "demo"). string mode = 2; + // allow_registration is whether the registration is allowed. bool allow_registration = 3; + // allow_password_login is whether the password login is allowed. bool disable_password_login = 4; + // additional_script is the additional script. string additional_script = 5; + // additional_style is the additional style. string additional_style = 6; } @@ -37,13 +33,3 @@ message GetWorkspaceProfileRequest {} message GetWorkspaceProfileResponse { WorkspaceProfile workspace_profile = 1; } - -message UpdateWorkspaceProfileRequest { - // System info is the updated data. - WorkspaceProfile workspace_profile = 1; - google.protobuf.FieldMask update_mask = 2; -} - -message UpdateWorkspaceProfileResponse { - WorkspaceProfile workspace_profile = 1; -} diff --git a/proto/api/v2/workspace_setting_service.proto b/proto/api/v2/workspace_setting_service.proto new file mode 100644 index 00000000..3d82175d --- /dev/null +++ b/proto/api/v2/workspace_setting_service.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; + +package memos.api.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; + +option go_package = "gen/api/v2"; + +service WorkspaceSettingService { + // GetWorkspaceSetting returns the setting by name. + rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (GetWorkspaceSettingResponse) { + option (google.api.http) = {get: "/api/v2/workspace/{name=settings/*}"}; + option (google.api.method_signature) = "name"; + } + // SetWorkspaceSetting updates the setting. + rpc SetWorkspaceSetting(SetWorkspaceSettingRequest) returns (SetWorkspaceSettingResponse) { + option (google.api.http) = { + patch: "/api/v2/workspace/{setting.name=settings/*}", + body: "setting" + }; + option (google.api.method_signature) = "setting"; + } +} + +message GetWorkspaceSettingRequest { + // The resource name of the workspace setting. + // Format: settings/{setting} + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +message GetWorkspaceSettingResponse { + WorkspaceSetting setting = 1; +} + +message SetWorkspaceSettingRequest { + // setting is the setting to update. + WorkspaceSetting setting = 1; +} + +message SetWorkspaceSettingResponse { + WorkspaceSetting setting = 1; +} + +message WorkspaceSetting { + // name is the name of the setting. + // Format: settings/{setting} + string name = 1; + oneof value { + // general_setting is the general setting of workspace. + WorkspaceGeneralSetting general_setting = 2; + } +} + +message WorkspaceGeneralSetting { + // instance_url is the instance URL. + string instance_url = 1; + // disallow_signup is the flag to disallow signup. + bool disallow_signup = 2; + // disallow_password_login is the flag to disallow password login. + bool disallow_password_login = 3; + // additional_script is the additional script. + string additional_script = 5; + // additional_style is the additional style. + string additional_style = 6; +} diff --git a/proto/gen/api/v2/README.md b/proto/gen/api/v2/README.md index 6a5dcc01..c5f08292 100644 --- a/proto/gen/api/v2/README.md +++ b/proto/gen/api/v2/README.md @@ -179,12 +179,20 @@ - [api/v2/workspace_service.proto](#api_v2_workspace_service-proto) - [GetWorkspaceProfileRequest](#memos-api-v2-GetWorkspaceProfileRequest) - [GetWorkspaceProfileResponse](#memos-api-v2-GetWorkspaceProfileResponse) - - [UpdateWorkspaceProfileRequest](#memos-api-v2-UpdateWorkspaceProfileRequest) - - [UpdateWorkspaceProfileResponse](#memos-api-v2-UpdateWorkspaceProfileResponse) - [WorkspaceProfile](#memos-api-v2-WorkspaceProfile) - [WorkspaceService](#memos-api-v2-WorkspaceService) +- [api/v2/workspace_setting_service.proto](#api_v2_workspace_setting_service-proto) + - [GetWorkspaceSettingRequest](#memos-api-v2-GetWorkspaceSettingRequest) + - [GetWorkspaceSettingResponse](#memos-api-v2-GetWorkspaceSettingResponse) + - [SetWorkspaceSettingRequest](#memos-api-v2-SetWorkspaceSettingRequest) + - [SetWorkspaceSettingResponse](#memos-api-v2-SetWorkspaceSettingResponse) + - [WorkspaceGeneralSetting](#memos-api-v2-WorkspaceGeneralSetting) + - [WorkspaceSetting](#memos-api-v2-WorkspaceSetting) + + - [WorkspaceSettingService](#memos-api-v2-WorkspaceSettingService) + - [Scalar Value Types](#scalar-value-types) @@ -2472,37 +2480,6 @@ Used internally for obfuscating the page token. - - -### UpdateWorkspaceProfileRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| workspace_profile | [WorkspaceProfile](#memos-api-v2-WorkspaceProfile) | | System info is the updated data. | -| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | | - - - - - - - - -### UpdateWorkspaceProfileResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| workspace_profile | [WorkspaceProfile](#memos-api-v2-WorkspaceProfile) | | | - - - - - - ### WorkspaceProfile @@ -2511,12 +2488,12 @@ Used internally for obfuscating the page token. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| version | [string](#string) | | | -| mode | [string](#string) | | | -| allow_registration | [bool](#bool) | | | -| disable_password_login | [bool](#bool) | | | -| additional_script | [string](#string) | | | -| additional_style | [string](#string) | | | +| version | [string](#string) | | version is the current version of instance | +| mode | [string](#string) | | mode is the instance mode (e.g. "prod", "dev" or "demo"). | +| allow_registration | [bool](#bool) | | allow_registration is whether the registration is allowed. | +| disable_password_login | [bool](#bool) | | allow_password_login is whether the password login is allowed. | +| additional_script | [string](#string) | | additional_script is the additional script. | +| additional_style | [string](#string) | | additional_style is the additional style. | @@ -2537,7 +2514,128 @@ Used internally for obfuscating the page token. | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| | GetWorkspaceProfile | [GetWorkspaceProfileRequest](#memos-api-v2-GetWorkspaceProfileRequest) | [GetWorkspaceProfileResponse](#memos-api-v2-GetWorkspaceProfileResponse) | GetWorkspaceProfile returns the workspace profile. | -| UpdateWorkspaceProfile | [UpdateWorkspaceProfileRequest](#memos-api-v2-UpdateWorkspaceProfileRequest) | [UpdateWorkspaceProfileResponse](#memos-api-v2-UpdateWorkspaceProfileResponse) | UpdateWorkspaceProfile updates the workspace profile. | + + + + + + +

Top

+ +## api/v2/workspace_setting_service.proto + + + + + +### GetWorkspaceSettingRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | The resource name of the workspace setting. Format: settings/{setting} | + + + + + + + + +### GetWorkspaceSettingResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| setting | [WorkspaceSetting](#memos-api-v2-WorkspaceSetting) | | | + + + + + + + + +### SetWorkspaceSettingRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| setting | [WorkspaceSetting](#memos-api-v2-WorkspaceSetting) | | setting is the setting to update. | + + + + + + + + +### SetWorkspaceSettingResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| setting | [WorkspaceSetting](#memos-api-v2-WorkspaceSetting) | | | + + + + + + + + +### WorkspaceGeneralSetting + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| instance_url | [string](#string) | | instance_url is the instance URL. | +| disallow_signup | [bool](#bool) | | disallow_signup is the flag to disallow signup. | +| disallow_password_login | [bool](#bool) | | disallow_password_login is the flag to disallow password login. | +| additional_script | [string](#string) | | additional_script is the additional script. | +| additional_style | [string](#string) | | additional_style is the additional style. | + + + + + + + + +### WorkspaceSetting + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | name is the name of the setting. Format: settings/{setting} | +| general_setting | [WorkspaceGeneralSetting](#memos-api-v2-WorkspaceGeneralSetting) | | general_setting is the general setting of workspace. | + + + + + + + + + + + + + + +### WorkspaceSettingService + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| GetWorkspaceSetting | [GetWorkspaceSettingRequest](#memos-api-v2-GetWorkspaceSettingRequest) | [GetWorkspaceSettingResponse](#memos-api-v2-GetWorkspaceSettingResponse) | GetWorkspaceSetting returns the setting by name. | +| SetWorkspaceSetting | [SetWorkspaceSettingRequest](#memos-api-v2-SetWorkspaceSettingRequest) | [SetWorkspaceSettingResponse](#memos-api-v2-SetWorkspaceSettingResponse) | SetWorkspaceSetting updates the setting. | diff --git a/proto/gen/api/v2/node.pb.go b/proto/gen/api/v2/node.pb.go deleted file mode 100644 index fd4568cf..00000000 --- a/proto/gen/api/v2/node.pb.go +++ /dev/null @@ -1,2906 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc (unknown) -// source: api/v2/node.proto - -package apiv2 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type NodeType int32 - -const ( - NodeType_NODE_UNSPECIFIED NodeType = 0 - NodeType_LINE_BREAK NodeType = 1 - NodeType_PARAGRAPH NodeType = 2 - NodeType_CODE_BLOCK NodeType = 3 - NodeType_HEADING NodeType = 4 - NodeType_HORIZONTAL_RULE NodeType = 5 - NodeType_BLOCKQUOTE NodeType = 6 - NodeType_ORDERED_LIST NodeType = 7 - NodeType_UNORDERED_LIST NodeType = 8 - NodeType_TASK_LIST NodeType = 9 - NodeType_MATH_BLOCK NodeType = 10 - NodeType_TABLE NodeType = 11 - NodeType_EMBEDDED_CONTENT NodeType = 12 - NodeType_TEXT NodeType = 13 - NodeType_BOLD NodeType = 14 - NodeType_ITALIC NodeType = 15 - NodeType_BOLD_ITALIC NodeType = 16 - NodeType_CODE NodeType = 17 - NodeType_IMAGE NodeType = 18 - NodeType_LINK NodeType = 19 - NodeType_AUTO_LINK NodeType = 20 - NodeType_TAG NodeType = 21 - NodeType_STRIKETHROUGH NodeType = 22 - NodeType_ESCAPING_CHARACTER NodeType = 23 - NodeType_MATH NodeType = 24 - NodeType_HIGHLIGHT NodeType = 25 - NodeType_SUBSCRIPT NodeType = 26 - NodeType_SUPERSCRIPT NodeType = 27 - NodeType_REFERENCED_CONTENT NodeType = 28 -) - -// Enum value maps for NodeType. -var ( - NodeType_name = map[int32]string{ - 0: "NODE_UNSPECIFIED", - 1: "LINE_BREAK", - 2: "PARAGRAPH", - 3: "CODE_BLOCK", - 4: "HEADING", - 5: "HORIZONTAL_RULE", - 6: "BLOCKQUOTE", - 7: "ORDERED_LIST", - 8: "UNORDERED_LIST", - 9: "TASK_LIST", - 10: "MATH_BLOCK", - 11: "TABLE", - 12: "EMBEDDED_CONTENT", - 13: "TEXT", - 14: "BOLD", - 15: "ITALIC", - 16: "BOLD_ITALIC", - 17: "CODE", - 18: "IMAGE", - 19: "LINK", - 20: "AUTO_LINK", - 21: "TAG", - 22: "STRIKETHROUGH", - 23: "ESCAPING_CHARACTER", - 24: "MATH", - 25: "HIGHLIGHT", - 26: "SUBSCRIPT", - 27: "SUPERSCRIPT", - 28: "REFERENCED_CONTENT", - } - NodeType_value = map[string]int32{ - "NODE_UNSPECIFIED": 0, - "LINE_BREAK": 1, - "PARAGRAPH": 2, - "CODE_BLOCK": 3, - "HEADING": 4, - "HORIZONTAL_RULE": 5, - "BLOCKQUOTE": 6, - "ORDERED_LIST": 7, - "UNORDERED_LIST": 8, - "TASK_LIST": 9, - "MATH_BLOCK": 10, - "TABLE": 11, - "EMBEDDED_CONTENT": 12, - "TEXT": 13, - "BOLD": 14, - "ITALIC": 15, - "BOLD_ITALIC": 16, - "CODE": 17, - "IMAGE": 18, - "LINK": 19, - "AUTO_LINK": 20, - "TAG": 21, - "STRIKETHROUGH": 22, - "ESCAPING_CHARACTER": 23, - "MATH": 24, - "HIGHLIGHT": 25, - "SUBSCRIPT": 26, - "SUPERSCRIPT": 27, - "REFERENCED_CONTENT": 28, - } -) - -func (x NodeType) Enum() *NodeType { - p := new(NodeType) - *p = x - return p -} - -func (x NodeType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (NodeType) Descriptor() protoreflect.EnumDescriptor { - return file_api_v2_node_proto_enumTypes[0].Descriptor() -} - -func (NodeType) Type() protoreflect.EnumType { - return &file_api_v2_node_proto_enumTypes[0] -} - -func (x NodeType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use NodeType.Descriptor instead. -func (NodeType) EnumDescriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{0} -} - -type Node struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type NodeType `protobuf:"varint,1,opt,name=type,proto3,enum=memos.api.v2.NodeType" json:"type,omitempty"` - // Types that are assignable to Node: - // - // *Node_LineBreakNode - // *Node_ParagraphNode - // *Node_CodeBlockNode - // *Node_HeadingNode - // *Node_HorizontalRuleNode - // *Node_BlockquoteNode - // *Node_OrderedListNode - // *Node_UnorderedListNode - // *Node_TaskListNode - // *Node_MathBlockNode - // *Node_TableNode - // *Node_EmbeddedContentNode - // *Node_TextNode - // *Node_BoldNode - // *Node_ItalicNode - // *Node_BoldItalicNode - // *Node_CodeNode - // *Node_ImageNode - // *Node_LinkNode - // *Node_AutoLinkNode - // *Node_TagNode - // *Node_StrikethroughNode - // *Node_EscapingCharacterNode - // *Node_MathNode - // *Node_HighlightNode - // *Node_SubscriptNode - // *Node_SuperscriptNode - // *Node_ReferencedContentNode - Node isNode_Node `protobuf_oneof:"node"` -} - -func (x *Node) Reset() { - *x = Node{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Node) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Node) ProtoMessage() {} - -func (x *Node) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Node.ProtoReflect.Descriptor instead. -func (*Node) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{0} -} - -func (x *Node) GetType() NodeType { - if x != nil { - return x.Type - } - return NodeType_NODE_UNSPECIFIED -} - -func (m *Node) GetNode() isNode_Node { - if m != nil { - return m.Node - } - return nil -} - -func (x *Node) GetLineBreakNode() *LineBreakNode { - if x, ok := x.GetNode().(*Node_LineBreakNode); ok { - return x.LineBreakNode - } - return nil -} - -func (x *Node) GetParagraphNode() *ParagraphNode { - if x, ok := x.GetNode().(*Node_ParagraphNode); ok { - return x.ParagraphNode - } - return nil -} - -func (x *Node) GetCodeBlockNode() *CodeBlockNode { - if x, ok := x.GetNode().(*Node_CodeBlockNode); ok { - return x.CodeBlockNode - } - return nil -} - -func (x *Node) GetHeadingNode() *HeadingNode { - if x, ok := x.GetNode().(*Node_HeadingNode); ok { - return x.HeadingNode - } - return nil -} - -func (x *Node) GetHorizontalRuleNode() *HorizontalRuleNode { - if x, ok := x.GetNode().(*Node_HorizontalRuleNode); ok { - return x.HorizontalRuleNode - } - return nil -} - -func (x *Node) GetBlockquoteNode() *BlockquoteNode { - if x, ok := x.GetNode().(*Node_BlockquoteNode); ok { - return x.BlockquoteNode - } - return nil -} - -func (x *Node) GetOrderedListNode() *OrderedListNode { - if x, ok := x.GetNode().(*Node_OrderedListNode); ok { - return x.OrderedListNode - } - return nil -} - -func (x *Node) GetUnorderedListNode() *UnorderedListNode { - if x, ok := x.GetNode().(*Node_UnorderedListNode); ok { - return x.UnorderedListNode - } - return nil -} - -func (x *Node) GetTaskListNode() *TaskListNode { - if x, ok := x.GetNode().(*Node_TaskListNode); ok { - return x.TaskListNode - } - return nil -} - -func (x *Node) GetMathBlockNode() *MathBlockNode { - if x, ok := x.GetNode().(*Node_MathBlockNode); ok { - return x.MathBlockNode - } - return nil -} - -func (x *Node) GetTableNode() *TableNode { - if x, ok := x.GetNode().(*Node_TableNode); ok { - return x.TableNode - } - return nil -} - -func (x *Node) GetEmbeddedContentNode() *EmbeddedContentNode { - if x, ok := x.GetNode().(*Node_EmbeddedContentNode); ok { - return x.EmbeddedContentNode - } - return nil -} - -func (x *Node) GetTextNode() *TextNode { - if x, ok := x.GetNode().(*Node_TextNode); ok { - return x.TextNode - } - return nil -} - -func (x *Node) GetBoldNode() *BoldNode { - if x, ok := x.GetNode().(*Node_BoldNode); ok { - return x.BoldNode - } - return nil -} - -func (x *Node) GetItalicNode() *ItalicNode { - if x, ok := x.GetNode().(*Node_ItalicNode); ok { - return x.ItalicNode - } - return nil -} - -func (x *Node) GetBoldItalicNode() *BoldItalicNode { - if x, ok := x.GetNode().(*Node_BoldItalicNode); ok { - return x.BoldItalicNode - } - return nil -} - -func (x *Node) GetCodeNode() *CodeNode { - if x, ok := x.GetNode().(*Node_CodeNode); ok { - return x.CodeNode - } - return nil -} - -func (x *Node) GetImageNode() *ImageNode { - if x, ok := x.GetNode().(*Node_ImageNode); ok { - return x.ImageNode - } - return nil -} - -func (x *Node) GetLinkNode() *LinkNode { - if x, ok := x.GetNode().(*Node_LinkNode); ok { - return x.LinkNode - } - return nil -} - -func (x *Node) GetAutoLinkNode() *AutoLinkNode { - if x, ok := x.GetNode().(*Node_AutoLinkNode); ok { - return x.AutoLinkNode - } - return nil -} - -func (x *Node) GetTagNode() *TagNode { - if x, ok := x.GetNode().(*Node_TagNode); ok { - return x.TagNode - } - return nil -} - -func (x *Node) GetStrikethroughNode() *StrikethroughNode { - if x, ok := x.GetNode().(*Node_StrikethroughNode); ok { - return x.StrikethroughNode - } - return nil -} - -func (x *Node) GetEscapingCharacterNode() *EscapingCharacterNode { - if x, ok := x.GetNode().(*Node_EscapingCharacterNode); ok { - return x.EscapingCharacterNode - } - return nil -} - -func (x *Node) GetMathNode() *MathNode { - if x, ok := x.GetNode().(*Node_MathNode); ok { - return x.MathNode - } - return nil -} - -func (x *Node) GetHighlightNode() *HighlightNode { - if x, ok := x.GetNode().(*Node_HighlightNode); ok { - return x.HighlightNode - } - return nil -} - -func (x *Node) GetSubscriptNode() *SubscriptNode { - if x, ok := x.GetNode().(*Node_SubscriptNode); ok { - return x.SubscriptNode - } - return nil -} - -func (x *Node) GetSuperscriptNode() *SuperscriptNode { - if x, ok := x.GetNode().(*Node_SuperscriptNode); ok { - return x.SuperscriptNode - } - return nil -} - -func (x *Node) GetReferencedContentNode() *ReferencedContentNode { - if x, ok := x.GetNode().(*Node_ReferencedContentNode); ok { - return x.ReferencedContentNode - } - return nil -} - -type isNode_Node interface { - isNode_Node() -} - -type Node_LineBreakNode struct { - LineBreakNode *LineBreakNode `protobuf:"bytes,2,opt,name=line_break_node,json=lineBreakNode,proto3,oneof"` -} - -type Node_ParagraphNode struct { - ParagraphNode *ParagraphNode `protobuf:"bytes,3,opt,name=paragraph_node,json=paragraphNode,proto3,oneof"` -} - -type Node_CodeBlockNode struct { - CodeBlockNode *CodeBlockNode `protobuf:"bytes,4,opt,name=code_block_node,json=codeBlockNode,proto3,oneof"` -} - -type Node_HeadingNode struct { - HeadingNode *HeadingNode `protobuf:"bytes,5,opt,name=heading_node,json=headingNode,proto3,oneof"` -} - -type Node_HorizontalRuleNode struct { - HorizontalRuleNode *HorizontalRuleNode `protobuf:"bytes,6,opt,name=horizontal_rule_node,json=horizontalRuleNode,proto3,oneof"` -} - -type Node_BlockquoteNode struct { - BlockquoteNode *BlockquoteNode `protobuf:"bytes,7,opt,name=blockquote_node,json=blockquoteNode,proto3,oneof"` -} - -type Node_OrderedListNode struct { - OrderedListNode *OrderedListNode `protobuf:"bytes,8,opt,name=ordered_list_node,json=orderedListNode,proto3,oneof"` -} - -type Node_UnorderedListNode struct { - UnorderedListNode *UnorderedListNode `protobuf:"bytes,9,opt,name=unordered_list_node,json=unorderedListNode,proto3,oneof"` -} - -type Node_TaskListNode struct { - TaskListNode *TaskListNode `protobuf:"bytes,10,opt,name=task_list_node,json=taskListNode,proto3,oneof"` -} - -type Node_MathBlockNode struct { - MathBlockNode *MathBlockNode `protobuf:"bytes,11,opt,name=math_block_node,json=mathBlockNode,proto3,oneof"` -} - -type Node_TableNode struct { - TableNode *TableNode `protobuf:"bytes,12,opt,name=table_node,json=tableNode,proto3,oneof"` -} - -type Node_EmbeddedContentNode struct { - EmbeddedContentNode *EmbeddedContentNode `protobuf:"bytes,13,opt,name=embedded_content_node,json=embeddedContentNode,proto3,oneof"` -} - -type Node_TextNode struct { - TextNode *TextNode `protobuf:"bytes,14,opt,name=text_node,json=textNode,proto3,oneof"` -} - -type Node_BoldNode struct { - BoldNode *BoldNode `protobuf:"bytes,15,opt,name=bold_node,json=boldNode,proto3,oneof"` -} - -type Node_ItalicNode struct { - ItalicNode *ItalicNode `protobuf:"bytes,16,opt,name=italic_node,json=italicNode,proto3,oneof"` -} - -type Node_BoldItalicNode struct { - BoldItalicNode *BoldItalicNode `protobuf:"bytes,17,opt,name=bold_italic_node,json=boldItalicNode,proto3,oneof"` -} - -type Node_CodeNode struct { - CodeNode *CodeNode `protobuf:"bytes,18,opt,name=code_node,json=codeNode,proto3,oneof"` -} - -type Node_ImageNode struct { - ImageNode *ImageNode `protobuf:"bytes,19,opt,name=image_node,json=imageNode,proto3,oneof"` -} - -type Node_LinkNode struct { - LinkNode *LinkNode `protobuf:"bytes,20,opt,name=link_node,json=linkNode,proto3,oneof"` -} - -type Node_AutoLinkNode struct { - AutoLinkNode *AutoLinkNode `protobuf:"bytes,21,opt,name=auto_link_node,json=autoLinkNode,proto3,oneof"` -} - -type Node_TagNode struct { - TagNode *TagNode `protobuf:"bytes,22,opt,name=tag_node,json=tagNode,proto3,oneof"` -} - -type Node_StrikethroughNode struct { - StrikethroughNode *StrikethroughNode `protobuf:"bytes,23,opt,name=strikethrough_node,json=strikethroughNode,proto3,oneof"` -} - -type Node_EscapingCharacterNode struct { - EscapingCharacterNode *EscapingCharacterNode `protobuf:"bytes,24,opt,name=escaping_character_node,json=escapingCharacterNode,proto3,oneof"` -} - -type Node_MathNode struct { - MathNode *MathNode `protobuf:"bytes,25,opt,name=math_node,json=mathNode,proto3,oneof"` -} - -type Node_HighlightNode struct { - HighlightNode *HighlightNode `protobuf:"bytes,26,opt,name=highlight_node,json=highlightNode,proto3,oneof"` -} - -type Node_SubscriptNode struct { - SubscriptNode *SubscriptNode `protobuf:"bytes,27,opt,name=subscript_node,json=subscriptNode,proto3,oneof"` -} - -type Node_SuperscriptNode struct { - SuperscriptNode *SuperscriptNode `protobuf:"bytes,28,opt,name=superscript_node,json=superscriptNode,proto3,oneof"` -} - -type Node_ReferencedContentNode struct { - ReferencedContentNode *ReferencedContentNode `protobuf:"bytes,29,opt,name=referenced_content_node,json=referencedContentNode,proto3,oneof"` -} - -func (*Node_LineBreakNode) isNode_Node() {} - -func (*Node_ParagraphNode) isNode_Node() {} - -func (*Node_CodeBlockNode) isNode_Node() {} - -func (*Node_HeadingNode) isNode_Node() {} - -func (*Node_HorizontalRuleNode) isNode_Node() {} - -func (*Node_BlockquoteNode) isNode_Node() {} - -func (*Node_OrderedListNode) isNode_Node() {} - -func (*Node_UnorderedListNode) isNode_Node() {} - -func (*Node_TaskListNode) isNode_Node() {} - -func (*Node_MathBlockNode) isNode_Node() {} - -func (*Node_TableNode) isNode_Node() {} - -func (*Node_EmbeddedContentNode) isNode_Node() {} - -func (*Node_TextNode) isNode_Node() {} - -func (*Node_BoldNode) isNode_Node() {} - -func (*Node_ItalicNode) isNode_Node() {} - -func (*Node_BoldItalicNode) isNode_Node() {} - -func (*Node_CodeNode) isNode_Node() {} - -func (*Node_ImageNode) isNode_Node() {} - -func (*Node_LinkNode) isNode_Node() {} - -func (*Node_AutoLinkNode) isNode_Node() {} - -func (*Node_TagNode) isNode_Node() {} - -func (*Node_StrikethroughNode) isNode_Node() {} - -func (*Node_EscapingCharacterNode) isNode_Node() {} - -func (*Node_MathNode) isNode_Node() {} - -func (*Node_HighlightNode) isNode_Node() {} - -func (*Node_SubscriptNode) isNode_Node() {} - -func (*Node_SuperscriptNode) isNode_Node() {} - -func (*Node_ReferencedContentNode) isNode_Node() {} - -type LineBreakNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *LineBreakNode) Reset() { - *x = LineBreakNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LineBreakNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LineBreakNode) ProtoMessage() {} - -func (x *LineBreakNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LineBreakNode.ProtoReflect.Descriptor instead. -func (*LineBreakNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{1} -} - -type ParagraphNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Children []*Node `protobuf:"bytes,1,rep,name=children,proto3" json:"children,omitempty"` -} - -func (x *ParagraphNode) Reset() { - *x = ParagraphNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParagraphNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParagraphNode) ProtoMessage() {} - -func (x *ParagraphNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParagraphNode.ProtoReflect.Descriptor instead. -func (*ParagraphNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{2} -} - -func (x *ParagraphNode) GetChildren() []*Node { - if x != nil { - return x.Children - } - return nil -} - -type CodeBlockNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"` - Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *CodeBlockNode) Reset() { - *x = CodeBlockNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CodeBlockNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CodeBlockNode) ProtoMessage() {} - -func (x *CodeBlockNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CodeBlockNode.ProtoReflect.Descriptor instead. -func (*CodeBlockNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{3} -} - -func (x *CodeBlockNode) GetLanguage() string { - if x != nil { - return x.Language - } - return "" -} - -func (x *CodeBlockNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type HeadingNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Level int32 `protobuf:"varint,1,opt,name=level,proto3" json:"level,omitempty"` - Children []*Node `protobuf:"bytes,2,rep,name=children,proto3" json:"children,omitempty"` -} - -func (x *HeadingNode) Reset() { - *x = HeadingNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeadingNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeadingNode) ProtoMessage() {} - -func (x *HeadingNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeadingNode.ProtoReflect.Descriptor instead. -func (*HeadingNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{4} -} - -func (x *HeadingNode) GetLevel() int32 { - if x != nil { - return x.Level - } - return 0 -} - -func (x *HeadingNode) GetChildren() []*Node { - if x != nil { - return x.Children - } - return nil -} - -type HorizontalRuleNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` -} - -func (x *HorizontalRuleNode) Reset() { - *x = HorizontalRuleNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HorizontalRuleNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HorizontalRuleNode) ProtoMessage() {} - -func (x *HorizontalRuleNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HorizontalRuleNode.ProtoReflect.Descriptor instead. -func (*HorizontalRuleNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{5} -} - -func (x *HorizontalRuleNode) GetSymbol() string { - if x != nil { - return x.Symbol - } - return "" -} - -type BlockquoteNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Children []*Node `protobuf:"bytes,1,rep,name=children,proto3" json:"children,omitempty"` -} - -func (x *BlockquoteNode) Reset() { - *x = BlockquoteNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BlockquoteNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BlockquoteNode) ProtoMessage() {} - -func (x *BlockquoteNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BlockquoteNode.ProtoReflect.Descriptor instead. -func (*BlockquoteNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{6} -} - -func (x *BlockquoteNode) GetChildren() []*Node { - if x != nil { - return x.Children - } - return nil -} - -type OrderedListNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number,omitempty"` - Indent int32 `protobuf:"varint,2,opt,name=indent,proto3" json:"indent,omitempty"` - Children []*Node `protobuf:"bytes,3,rep,name=children,proto3" json:"children,omitempty"` -} - -func (x *OrderedListNode) Reset() { - *x = OrderedListNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OrderedListNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OrderedListNode) ProtoMessage() {} - -func (x *OrderedListNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OrderedListNode.ProtoReflect.Descriptor instead. -func (*OrderedListNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{7} -} - -func (x *OrderedListNode) GetNumber() string { - if x != nil { - return x.Number - } - return "" -} - -func (x *OrderedListNode) GetIndent() int32 { - if x != nil { - return x.Indent - } - return 0 -} - -func (x *OrderedListNode) GetChildren() []*Node { - if x != nil { - return x.Children - } - return nil -} - -type UnorderedListNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` - Indent int32 `protobuf:"varint,2,opt,name=indent,proto3" json:"indent,omitempty"` - Children []*Node `protobuf:"bytes,3,rep,name=children,proto3" json:"children,omitempty"` -} - -func (x *UnorderedListNode) Reset() { - *x = UnorderedListNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UnorderedListNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UnorderedListNode) ProtoMessage() {} - -func (x *UnorderedListNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UnorderedListNode.ProtoReflect.Descriptor instead. -func (*UnorderedListNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{8} -} - -func (x *UnorderedListNode) GetSymbol() string { - if x != nil { - return x.Symbol - } - return "" -} - -func (x *UnorderedListNode) GetIndent() int32 { - if x != nil { - return x.Indent - } - return 0 -} - -func (x *UnorderedListNode) GetChildren() []*Node { - if x != nil { - return x.Children - } - return nil -} - -type TaskListNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` - Indent int32 `protobuf:"varint,2,opt,name=indent,proto3" json:"indent,omitempty"` - Complete bool `protobuf:"varint,3,opt,name=complete,proto3" json:"complete,omitempty"` - Children []*Node `protobuf:"bytes,4,rep,name=children,proto3" json:"children,omitempty"` -} - -func (x *TaskListNode) Reset() { - *x = TaskListNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TaskListNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TaskListNode) ProtoMessage() {} - -func (x *TaskListNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TaskListNode.ProtoReflect.Descriptor instead. -func (*TaskListNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{9} -} - -func (x *TaskListNode) GetSymbol() string { - if x != nil { - return x.Symbol - } - return "" -} - -func (x *TaskListNode) GetIndent() int32 { - if x != nil { - return x.Indent - } - return 0 -} - -func (x *TaskListNode) GetComplete() bool { - if x != nil { - return x.Complete - } - return false -} - -func (x *TaskListNode) GetChildren() []*Node { - if x != nil { - return x.Children - } - return nil -} - -type MathBlockNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *MathBlockNode) Reset() { - *x = MathBlockNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MathBlockNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MathBlockNode) ProtoMessage() {} - -func (x *MathBlockNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MathBlockNode.ProtoReflect.Descriptor instead. -func (*MathBlockNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{10} -} - -func (x *MathBlockNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type TableNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Header []string `protobuf:"bytes,1,rep,name=header,proto3" json:"header,omitempty"` - Delimiter []string `protobuf:"bytes,2,rep,name=delimiter,proto3" json:"delimiter,omitempty"` - Rows []*TableNode_Row `protobuf:"bytes,3,rep,name=rows,proto3" json:"rows,omitempty"` -} - -func (x *TableNode) Reset() { - *x = TableNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TableNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TableNode) ProtoMessage() {} - -func (x *TableNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TableNode.ProtoReflect.Descriptor instead. -func (*TableNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{11} -} - -func (x *TableNode) GetHeader() []string { - if x != nil { - return x.Header - } - return nil -} - -func (x *TableNode) GetDelimiter() []string { - if x != nil { - return x.Delimiter - } - return nil -} - -func (x *TableNode) GetRows() []*TableNode_Row { - if x != nil { - return x.Rows - } - return nil -} - -type EmbeddedContentNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"` - Params string `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *EmbeddedContentNode) Reset() { - *x = EmbeddedContentNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EmbeddedContentNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EmbeddedContentNode) ProtoMessage() {} - -func (x *EmbeddedContentNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EmbeddedContentNode.ProtoReflect.Descriptor instead. -func (*EmbeddedContentNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{12} -} - -func (x *EmbeddedContentNode) GetResourceName() string { - if x != nil { - return x.ResourceName - } - return "" -} - -func (x *EmbeddedContentNode) GetParams() string { - if x != nil { - return x.Params - } - return "" -} - -type TextNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *TextNode) Reset() { - *x = TextNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TextNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TextNode) ProtoMessage() {} - -func (x *TextNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TextNode.ProtoReflect.Descriptor instead. -func (*TextNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{13} -} - -func (x *TextNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type BoldNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` - Children []*Node `protobuf:"bytes,2,rep,name=children,proto3" json:"children,omitempty"` -} - -func (x *BoldNode) Reset() { - *x = BoldNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BoldNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BoldNode) ProtoMessage() {} - -func (x *BoldNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BoldNode.ProtoReflect.Descriptor instead. -func (*BoldNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{14} -} - -func (x *BoldNode) GetSymbol() string { - if x != nil { - return x.Symbol - } - return "" -} - -func (x *BoldNode) GetChildren() []*Node { - if x != nil { - return x.Children - } - return nil -} - -type ItalicNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` - Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *ItalicNode) Reset() { - *x = ItalicNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ItalicNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ItalicNode) ProtoMessage() {} - -func (x *ItalicNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ItalicNode.ProtoReflect.Descriptor instead. -func (*ItalicNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{15} -} - -func (x *ItalicNode) GetSymbol() string { - if x != nil { - return x.Symbol - } - return "" -} - -func (x *ItalicNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type BoldItalicNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` - Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *BoldItalicNode) Reset() { - *x = BoldItalicNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BoldItalicNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BoldItalicNode) ProtoMessage() {} - -func (x *BoldItalicNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BoldItalicNode.ProtoReflect.Descriptor instead. -func (*BoldItalicNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{16} -} - -func (x *BoldItalicNode) GetSymbol() string { - if x != nil { - return x.Symbol - } - return "" -} - -func (x *BoldItalicNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type CodeNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *CodeNode) Reset() { - *x = CodeNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CodeNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CodeNode) ProtoMessage() {} - -func (x *CodeNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CodeNode.ProtoReflect.Descriptor instead. -func (*CodeNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{17} -} - -func (x *CodeNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type ImageNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AltText string `protobuf:"bytes,1,opt,name=alt_text,json=altText,proto3" json:"alt_text,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` -} - -func (x *ImageNode) Reset() { - *x = ImageNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ImageNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImageNode) ProtoMessage() {} - -func (x *ImageNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ImageNode.ProtoReflect.Descriptor instead. -func (*ImageNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{18} -} - -func (x *ImageNode) GetAltText() string { - if x != nil { - return x.AltText - } - return "" -} - -func (x *ImageNode) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -type LinkNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` -} - -func (x *LinkNode) Reset() { - *x = LinkNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LinkNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LinkNode) ProtoMessage() {} - -func (x *LinkNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LinkNode.ProtoReflect.Descriptor instead. -func (*LinkNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{19} -} - -func (x *LinkNode) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -func (x *LinkNode) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -type AutoLinkNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` - IsRawText bool `protobuf:"varint,2,opt,name=is_raw_text,json=isRawText,proto3" json:"is_raw_text,omitempty"` -} - -func (x *AutoLinkNode) Reset() { - *x = AutoLinkNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AutoLinkNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AutoLinkNode) ProtoMessage() {} - -func (x *AutoLinkNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AutoLinkNode.ProtoReflect.Descriptor instead. -func (*AutoLinkNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{20} -} - -func (x *AutoLinkNode) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *AutoLinkNode) GetIsRawText() bool { - if x != nil { - return x.IsRawText - } - return false -} - -type TagNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *TagNode) Reset() { - *x = TagNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TagNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TagNode) ProtoMessage() {} - -func (x *TagNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TagNode.ProtoReflect.Descriptor instead. -func (*TagNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{21} -} - -func (x *TagNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type StrikethroughNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *StrikethroughNode) Reset() { - *x = StrikethroughNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StrikethroughNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StrikethroughNode) ProtoMessage() {} - -func (x *StrikethroughNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StrikethroughNode.ProtoReflect.Descriptor instead. -func (*StrikethroughNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{22} -} - -func (x *StrikethroughNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type EscapingCharacterNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` -} - -func (x *EscapingCharacterNode) Reset() { - *x = EscapingCharacterNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EscapingCharacterNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EscapingCharacterNode) ProtoMessage() {} - -func (x *EscapingCharacterNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EscapingCharacterNode.ProtoReflect.Descriptor instead. -func (*EscapingCharacterNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{23} -} - -func (x *EscapingCharacterNode) GetSymbol() string { - if x != nil { - return x.Symbol - } - return "" -} - -type MathNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *MathNode) Reset() { - *x = MathNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MathNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MathNode) ProtoMessage() {} - -func (x *MathNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MathNode.ProtoReflect.Descriptor instead. -func (*MathNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{24} -} - -func (x *MathNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type HighlightNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *HighlightNode) Reset() { - *x = HighlightNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HighlightNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HighlightNode) ProtoMessage() {} - -func (x *HighlightNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HighlightNode.ProtoReflect.Descriptor instead. -func (*HighlightNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{25} -} - -func (x *HighlightNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type SubscriptNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *SubscriptNode) Reset() { - *x = SubscriptNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SubscriptNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscriptNode) ProtoMessage() {} - -func (x *SubscriptNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SubscriptNode.ProtoReflect.Descriptor instead. -func (*SubscriptNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{26} -} - -func (x *SubscriptNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type SuperscriptNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *SuperscriptNode) Reset() { - *x = SuperscriptNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SuperscriptNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SuperscriptNode) ProtoMessage() {} - -func (x *SuperscriptNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SuperscriptNode.ProtoReflect.Descriptor instead. -func (*SuperscriptNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{27} -} - -func (x *SuperscriptNode) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -type ReferencedContentNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"` - Params string `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *ReferencedContentNode) Reset() { - *x = ReferencedContentNode{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReferencedContentNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReferencedContentNode) ProtoMessage() {} - -func (x *ReferencedContentNode) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReferencedContentNode.ProtoReflect.Descriptor instead. -func (*ReferencedContentNode) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{28} -} - -func (x *ReferencedContentNode) GetResourceName() string { - if x != nil { - return x.ResourceName - } - return "" -} - -func (x *ReferencedContentNode) GetParams() string { - if x != nil { - return x.Params - } - return "" -} - -type TableNode_Row struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Cells []string `protobuf:"bytes,1,rep,name=cells,proto3" json:"cells,omitempty"` -} - -func (x *TableNode_Row) Reset() { - *x = TableNode_Row{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_node_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TableNode_Row) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TableNode_Row) ProtoMessage() {} - -func (x *TableNode_Row) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_node_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TableNode_Row.ProtoReflect.Descriptor instead. -func (*TableNode_Row) Descriptor() ([]byte, []int) { - return file_api_v2_node_proto_rawDescGZIP(), []int{11, 0} -} - -func (x *TableNode_Row) GetCells() []string { - if x != nil { - return x.Cells - } - return nil -} - -var File_api_v2_node_proto protoreflect.FileDescriptor - -var file_api_v2_node_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x22, 0xdf, 0x0f, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x2a, 0x0a, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x45, 0x0a, 0x0f, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x62, - 0x72, 0x65, 0x61, 0x6b, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, - 0x69, 0x6e, 0x65, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x0d, - 0x6c, 0x69, 0x6e, 0x65, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x44, 0x0a, - 0x0e, 0x70, 0x61, 0x72, 0x61, 0x67, 0x72, 0x61, 0x70, 0x68, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x67, 0x72, 0x61, 0x70, 0x68, 0x4e, 0x6f, - 0x64, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x61, 0x67, 0x72, 0x61, 0x70, 0x68, 0x4e, - 0x6f, 0x64, 0x65, 0x12, 0x45, 0x0a, 0x0f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x6c, 0x6f, 0x63, - 0x6b, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x64, 0x65, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x63, 0x6f, 0x64, - 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x68, 0x65, - 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x48, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x0b, 0x68, - 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x54, 0x0a, 0x14, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x6f, 0x6e, 0x74, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x6e, 0x6f, - 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x6f, 0x72, 0x69, 0x7a, 0x6f, 0x6e, 0x74, - 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x12, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x6f, 0x6e, 0x74, 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, - 0x12, 0x47, 0x0a, 0x0f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x5f, 0x6e, - 0x6f, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x71, 0x75, - 0x6f, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x0e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x71, 0x75, 0x6f, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x4b, 0x0a, 0x11, 0x6f, 0x72, 0x64, - 0x65, 0x72, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x4e, - 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x0f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x4c, 0x69, - 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x51, 0x0a, 0x13, 0x75, 0x6e, 0x6f, 0x72, 0x64, 0x65, - 0x72, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x55, 0x6e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, - 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x11, 0x75, 0x6e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, - 0x64, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x74, 0x61, 0x73, - 0x6b, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, - 0x0c, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x45, 0x0a, - 0x0f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x6f, 0x64, 0x65, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x61, 0x74, 0x68, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, - 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6d, 0x61, 0x74, 0x68, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x38, 0x0a, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x6f, - 0x64, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, - 0x65, 0x48, 0x00, 0x52, 0x09, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x57, - 0x0a, 0x15, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x6d, 0x62, - 0x65, 0x64, 0x64, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, - 0x48, 0x00, 0x52, 0x13, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x74, 0x65, 0x78, 0x74, 0x5f, - 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x65, 0x78, 0x74, 0x4e, 0x6f, - 0x64, 0x65, 0x48, 0x00, 0x52, 0x08, 0x74, 0x65, 0x78, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x35, - 0x0a, 0x09, 0x62, 0x6f, 0x6c, 0x64, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x42, 0x6f, 0x6c, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x08, 0x62, 0x6f, 0x6c, - 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x69, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x5f, - 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x74, 0x61, 0x6c, 0x69, 0x63, - 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x4e, 0x6f, - 0x64, 0x65, 0x12, 0x48, 0x0a, 0x10, 0x62, 0x6f, 0x6c, 0x64, 0x5f, 0x69, 0x74, 0x61, 0x6c, 0x69, - 0x63, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x6f, 0x6c, 0x64, - 0x49, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x0e, 0x62, 0x6f, - 0x6c, 0x64, 0x49, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x35, 0x0a, 0x09, - 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, - 0x6f, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x64, 0x65, 0x4e, - 0x6f, 0x64, 0x65, 0x12, 0x38, 0x0a, 0x0a, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x6f, 0x64, - 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x4e, 0x6f, 0x64, 0x65, - 0x48, 0x00, 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x35, 0x0a, - 0x09, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x4c, 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x08, 0x6c, 0x69, 0x6e, 0x6b, - 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x6c, 0x69, 0x6e, - 0x6b, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x75, 0x74, 0x6f, - 0x4c, 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x61, 0x75, 0x74, 0x6f, - 0x4c, 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x74, 0x61, 0x67, 0x5f, - 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x4e, 0x6f, 0x64, - 0x65, 0x48, 0x00, 0x52, 0x07, 0x74, 0x61, 0x67, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x50, 0x0a, 0x12, - 0x73, 0x74, 0x72, 0x69, 0x6b, 0x65, 0x74, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x5f, 0x6e, 0x6f, - 0x64, 0x65, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6b, 0x65, 0x74, 0x68, - 0x72, 0x6f, 0x75, 0x67, 0x68, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x11, 0x73, 0x74, 0x72, - 0x69, 0x6b, 0x65, 0x74, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x5d, - 0x0a, 0x17, 0x65, 0x73, 0x63, 0x61, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x68, 0x61, 0x72, 0x61, - 0x63, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, - 0x73, 0x63, 0x61, 0x70, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, - 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x15, 0x65, 0x73, 0x63, 0x61, 0x70, 0x69, 0x6e, 0x67, - 0x43, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x35, 0x0a, - 0x09, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x4d, 0x61, 0x74, 0x68, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x08, 0x6d, 0x61, 0x74, 0x68, - 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x44, 0x0a, 0x0e, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, - 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x69, 0x67, 0x68, - 0x6c, 0x69, 0x67, 0x68, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x68, 0x69, 0x67, - 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x44, 0x0a, 0x0e, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x1b, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x48, - 0x00, 0x52, 0x0d, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4e, 0x6f, 0x64, 0x65, - 0x12, 0x4a, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x65, 0x72, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x5f, - 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x75, 0x70, 0x65, 0x72, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x00, 0x52, 0x0f, 0x73, 0x75, 0x70, - 0x65, 0x72, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x5d, 0x0a, 0x17, - 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4e, 0x6f, - 0x64, 0x65, 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6e, - 0x6f, 0x64, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x4c, 0x69, 0x6e, 0x65, 0x42, 0x72, 0x65, 0x61, 0x6b, - 0x4e, 0x6f, 0x64, 0x65, 0x22, 0x3f, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x61, 0x67, 0x72, 0x61, 0x70, - 0x68, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, - 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x08, 0x63, 0x68, 0x69, - 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x22, 0x45, 0x0a, 0x0d, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, - 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, - 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x53, 0x0a, 0x0b, - 0x48, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, - 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, - 0x6c, 0x12, 0x2e, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, - 0x6e, 0x22, 0x2c, 0x0a, 0x12, 0x48, 0x6f, 0x72, 0x69, 0x7a, 0x6f, 0x6e, 0x74, 0x61, 0x6c, 0x52, - 0x75, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, - 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x22, - 0x40, 0x0a, 0x0e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x4e, 0x6f, 0x64, - 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, - 0x6e, 0x22, 0x71, 0x0a, 0x0f, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, - 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, - 0x69, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x69, 0x6e, - 0x64, 0x65, 0x6e, 0x74, 0x12, 0x2e, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, - 0x64, 0x72, 0x65, 0x6e, 0x22, 0x73, 0x0a, 0x11, 0x55, 0x6e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, - 0x64, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, - 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, - 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x69, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x12, 0x2e, 0x0a, 0x08, 0x63, 0x68, 0x69, - 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, - 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x22, 0x8a, 0x01, 0x0a, 0x0c, 0x54, 0x61, - 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, - 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, - 0x6f, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x69, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, - 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x63, 0x6f, - 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, - 0x65, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x08, 0x63, 0x68, - 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x22, 0x29, 0x0a, 0x0d, 0x4d, 0x61, 0x74, 0x68, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x22, 0x8f, 0x01, 0x0a, 0x09, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x65, 0x6c, 0x69, 0x6d, - 0x69, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x64, 0x65, 0x6c, 0x69, - 0x6d, 0x69, 0x74, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x52, 0x6f, 0x77, - 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x1a, 0x1b, 0x0a, 0x03, 0x52, 0x6f, 0x77, 0x12, 0x14, 0x0a, - 0x05, 0x63, 0x65, 0x6c, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x63, 0x65, - 0x6c, 0x6c, 0x73, 0x22, 0x52, 0x0a, 0x13, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x43, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x24, 0x0a, 0x08, 0x54, 0x65, 0x78, 0x74, 0x4e, - 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x52, 0x0a, - 0x08, 0x42, 0x6f, 0x6c, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, - 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, - 0x6c, 0x12, 0x2e, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, - 0x6e, 0x22, 0x3e, 0x0a, 0x0a, 0x49, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x22, 0x42, 0x0a, 0x0e, 0x42, 0x6f, 0x6c, 0x64, 0x49, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x4e, - 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x24, 0x0a, 0x08, 0x43, 0x6f, 0x64, 0x65, 0x4e, 0x6f, 0x64, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x38, 0x0a, 0x09, 0x49, - 0x6d, 0x61, 0x67, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x6c, 0x74, 0x5f, - 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x6c, 0x74, 0x54, - 0x65, 0x78, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x30, 0x0a, 0x08, 0x4c, 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x40, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x6f, 0x4c, - 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1e, 0x0a, 0x0b, 0x69, 0x73, 0x5f, - 0x72, 0x61, 0x77, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, - 0x69, 0x73, 0x52, 0x61, 0x77, 0x54, 0x65, 0x78, 0x74, 0x22, 0x23, 0x0a, 0x07, 0x54, 0x61, 0x67, - 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x2d, - 0x0a, 0x11, 0x53, 0x74, 0x72, 0x69, 0x6b, 0x65, 0x74, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x4e, - 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x2f, 0x0a, - 0x15, 0x45, 0x73, 0x63, 0x61, 0x70, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, - 0x65, 0x72, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x22, 0x24, - 0x0a, 0x08, 0x4d, 0x61, 0x74, 0x68, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x22, 0x29, 0x0a, 0x0d, 0x48, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, - 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, - 0x29, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4e, 0x6f, 0x64, 0x65, - 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x2b, 0x0a, 0x0f, 0x53, 0x75, - 0x70, 0x65, 0x72, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x54, 0x0a, 0x15, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, - 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2a, 0xcb, 0x03, - 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x4e, 0x4f, - 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x0e, 0x0a, 0x0a, 0x4c, 0x49, 0x4e, 0x45, 0x5f, 0x42, 0x52, 0x45, 0x41, 0x4b, 0x10, 0x01, - 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x41, 0x52, 0x41, 0x47, 0x52, 0x41, 0x50, 0x48, 0x10, 0x02, 0x12, - 0x0e, 0x0a, 0x0a, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x03, 0x12, - 0x0b, 0x0a, 0x07, 0x48, 0x45, 0x41, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, - 0x48, 0x4f, 0x52, 0x49, 0x5a, 0x4f, 0x4e, 0x54, 0x41, 0x4c, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x10, - 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x51, 0x55, 0x4f, 0x54, 0x45, 0x10, - 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x45, 0x44, 0x5f, 0x4c, 0x49, 0x53, - 0x54, 0x10, 0x07, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x45, 0x44, - 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x10, 0x08, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x41, 0x53, 0x4b, 0x5f, - 0x4c, 0x49, 0x53, 0x54, 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x4d, 0x41, 0x54, 0x48, 0x5f, 0x42, - 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x0a, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x10, - 0x0b, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x4d, 0x42, 0x45, 0x44, 0x44, 0x45, 0x44, 0x5f, 0x43, 0x4f, - 0x4e, 0x54, 0x45, 0x4e, 0x54, 0x10, 0x0c, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x45, 0x58, 0x54, 0x10, - 0x0d, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4f, 0x4c, 0x44, 0x10, 0x0e, 0x12, 0x0a, 0x0a, 0x06, 0x49, - 0x54, 0x41, 0x4c, 0x49, 0x43, 0x10, 0x0f, 0x12, 0x0f, 0x0a, 0x0b, 0x42, 0x4f, 0x4c, 0x44, 0x5f, - 0x49, 0x54, 0x41, 0x4c, 0x49, 0x43, 0x10, 0x10, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x44, 0x45, - 0x10, 0x11, 0x12, 0x09, 0x0a, 0x05, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x10, 0x12, 0x12, 0x08, 0x0a, - 0x04, 0x4c, 0x49, 0x4e, 0x4b, 0x10, 0x13, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x55, 0x54, 0x4f, 0x5f, - 0x4c, 0x49, 0x4e, 0x4b, 0x10, 0x14, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x41, 0x47, 0x10, 0x15, 0x12, - 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x52, 0x49, 0x4b, 0x45, 0x54, 0x48, 0x52, 0x4f, 0x55, 0x47, 0x48, - 0x10, 0x16, 0x12, 0x16, 0x0a, 0x12, 0x45, 0x53, 0x43, 0x41, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x43, - 0x48, 0x41, 0x52, 0x41, 0x43, 0x54, 0x45, 0x52, 0x10, 0x17, 0x12, 0x08, 0x0a, 0x04, 0x4d, 0x41, - 0x54, 0x48, 0x10, 0x18, 0x12, 0x0d, 0x0a, 0x09, 0x48, 0x49, 0x47, 0x48, 0x4c, 0x49, 0x47, 0x48, - 0x54, 0x10, 0x19, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x50, 0x54, - 0x10, 0x1a, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x55, 0x50, 0x45, 0x52, 0x53, 0x43, 0x52, 0x49, 0x50, - 0x54, 0x10, 0x1b, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x45, 0x46, 0x45, 0x52, 0x45, 0x4e, 0x43, 0x45, - 0x44, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x45, 0x4e, 0x54, 0x10, 0x1c, 0x42, 0xa1, 0x01, 0x0a, 0x10, - 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x42, 0x09, 0x4e, 0x6f, 0x64, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, - 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, - 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, - 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, - 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_api_v2_node_proto_rawDescOnce sync.Once - file_api_v2_node_proto_rawDescData = file_api_v2_node_proto_rawDesc -) - -func file_api_v2_node_proto_rawDescGZIP() []byte { - file_api_v2_node_proto_rawDescOnce.Do(func() { - file_api_v2_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v2_node_proto_rawDescData) - }) - return file_api_v2_node_proto_rawDescData -} - -var file_api_v2_node_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_api_v2_node_proto_msgTypes = make([]protoimpl.MessageInfo, 30) -var file_api_v2_node_proto_goTypes = []interface{}{ - (NodeType)(0), // 0: memos.api.v2.NodeType - (*Node)(nil), // 1: memos.api.v2.Node - (*LineBreakNode)(nil), // 2: memos.api.v2.LineBreakNode - (*ParagraphNode)(nil), // 3: memos.api.v2.ParagraphNode - (*CodeBlockNode)(nil), // 4: memos.api.v2.CodeBlockNode - (*HeadingNode)(nil), // 5: memos.api.v2.HeadingNode - (*HorizontalRuleNode)(nil), // 6: memos.api.v2.HorizontalRuleNode - (*BlockquoteNode)(nil), // 7: memos.api.v2.BlockquoteNode - (*OrderedListNode)(nil), // 8: memos.api.v2.OrderedListNode - (*UnorderedListNode)(nil), // 9: memos.api.v2.UnorderedListNode - (*TaskListNode)(nil), // 10: memos.api.v2.TaskListNode - (*MathBlockNode)(nil), // 11: memos.api.v2.MathBlockNode - (*TableNode)(nil), // 12: memos.api.v2.TableNode - (*EmbeddedContentNode)(nil), // 13: memos.api.v2.EmbeddedContentNode - (*TextNode)(nil), // 14: memos.api.v2.TextNode - (*BoldNode)(nil), // 15: memos.api.v2.BoldNode - (*ItalicNode)(nil), // 16: memos.api.v2.ItalicNode - (*BoldItalicNode)(nil), // 17: memos.api.v2.BoldItalicNode - (*CodeNode)(nil), // 18: memos.api.v2.CodeNode - (*ImageNode)(nil), // 19: memos.api.v2.ImageNode - (*LinkNode)(nil), // 20: memos.api.v2.LinkNode - (*AutoLinkNode)(nil), // 21: memos.api.v2.AutoLinkNode - (*TagNode)(nil), // 22: memos.api.v2.TagNode - (*StrikethroughNode)(nil), // 23: memos.api.v2.StrikethroughNode - (*EscapingCharacterNode)(nil), // 24: memos.api.v2.EscapingCharacterNode - (*MathNode)(nil), // 25: memos.api.v2.MathNode - (*HighlightNode)(nil), // 26: memos.api.v2.HighlightNode - (*SubscriptNode)(nil), // 27: memos.api.v2.SubscriptNode - (*SuperscriptNode)(nil), // 28: memos.api.v2.SuperscriptNode - (*ReferencedContentNode)(nil), // 29: memos.api.v2.ReferencedContentNode - (*TableNode_Row)(nil), // 30: memos.api.v2.TableNode.Row -} -var file_api_v2_node_proto_depIdxs = []int32{ - 0, // 0: memos.api.v2.Node.type:type_name -> memos.api.v2.NodeType - 2, // 1: memos.api.v2.Node.line_break_node:type_name -> memos.api.v2.LineBreakNode - 3, // 2: memos.api.v2.Node.paragraph_node:type_name -> memos.api.v2.ParagraphNode - 4, // 3: memos.api.v2.Node.code_block_node:type_name -> memos.api.v2.CodeBlockNode - 5, // 4: memos.api.v2.Node.heading_node:type_name -> memos.api.v2.HeadingNode - 6, // 5: memos.api.v2.Node.horizontal_rule_node:type_name -> memos.api.v2.HorizontalRuleNode - 7, // 6: memos.api.v2.Node.blockquote_node:type_name -> memos.api.v2.BlockquoteNode - 8, // 7: memos.api.v2.Node.ordered_list_node:type_name -> memos.api.v2.OrderedListNode - 9, // 8: memos.api.v2.Node.unordered_list_node:type_name -> memos.api.v2.UnorderedListNode - 10, // 9: memos.api.v2.Node.task_list_node:type_name -> memos.api.v2.TaskListNode - 11, // 10: memos.api.v2.Node.math_block_node:type_name -> memos.api.v2.MathBlockNode - 12, // 11: memos.api.v2.Node.table_node:type_name -> memos.api.v2.TableNode - 13, // 12: memos.api.v2.Node.embedded_content_node:type_name -> memos.api.v2.EmbeddedContentNode - 14, // 13: memos.api.v2.Node.text_node:type_name -> memos.api.v2.TextNode - 15, // 14: memos.api.v2.Node.bold_node:type_name -> memos.api.v2.BoldNode - 16, // 15: memos.api.v2.Node.italic_node:type_name -> memos.api.v2.ItalicNode - 17, // 16: memos.api.v2.Node.bold_italic_node:type_name -> memos.api.v2.BoldItalicNode - 18, // 17: memos.api.v2.Node.code_node:type_name -> memos.api.v2.CodeNode - 19, // 18: memos.api.v2.Node.image_node:type_name -> memos.api.v2.ImageNode - 20, // 19: memos.api.v2.Node.link_node:type_name -> memos.api.v2.LinkNode - 21, // 20: memos.api.v2.Node.auto_link_node:type_name -> memos.api.v2.AutoLinkNode - 22, // 21: memos.api.v2.Node.tag_node:type_name -> memos.api.v2.TagNode - 23, // 22: memos.api.v2.Node.strikethrough_node:type_name -> memos.api.v2.StrikethroughNode - 24, // 23: memos.api.v2.Node.escaping_character_node:type_name -> memos.api.v2.EscapingCharacterNode - 25, // 24: memos.api.v2.Node.math_node:type_name -> memos.api.v2.MathNode - 26, // 25: memos.api.v2.Node.highlight_node:type_name -> memos.api.v2.HighlightNode - 27, // 26: memos.api.v2.Node.subscript_node:type_name -> memos.api.v2.SubscriptNode - 28, // 27: memos.api.v2.Node.superscript_node:type_name -> memos.api.v2.SuperscriptNode - 29, // 28: memos.api.v2.Node.referenced_content_node:type_name -> memos.api.v2.ReferencedContentNode - 1, // 29: memos.api.v2.ParagraphNode.children:type_name -> memos.api.v2.Node - 1, // 30: memos.api.v2.HeadingNode.children:type_name -> memos.api.v2.Node - 1, // 31: memos.api.v2.BlockquoteNode.children:type_name -> memos.api.v2.Node - 1, // 32: memos.api.v2.OrderedListNode.children:type_name -> memos.api.v2.Node - 1, // 33: memos.api.v2.UnorderedListNode.children:type_name -> memos.api.v2.Node - 1, // 34: memos.api.v2.TaskListNode.children:type_name -> memos.api.v2.Node - 30, // 35: memos.api.v2.TableNode.rows:type_name -> memos.api.v2.TableNode.Row - 1, // 36: memos.api.v2.BoldNode.children:type_name -> memos.api.v2.Node - 37, // [37:37] is the sub-list for method output_type - 37, // [37:37] is the sub-list for method input_type - 37, // [37:37] is the sub-list for extension type_name - 37, // [37:37] is the sub-list for extension extendee - 0, // [0:37] is the sub-list for field type_name -} - -func init() { file_api_v2_node_proto_init() } -func file_api_v2_node_proto_init() { - if File_api_v2_node_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_api_v2_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Node); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LineBreakNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParagraphNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeBlockNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeadingNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HorizontalRuleNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BlockquoteNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OrderedListNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnorderedListNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TaskListNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MathBlockNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TableNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EmbeddedContentNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TextNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BoldNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ItalicNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BoldItalicNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImageNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LinkNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AutoLinkNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TagNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StrikethroughNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EscapingCharacterNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MathNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HighlightNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubscriptNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SuperscriptNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReferencedContentNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_node_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TableNode_Row); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_api_v2_node_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*Node_LineBreakNode)(nil), - (*Node_ParagraphNode)(nil), - (*Node_CodeBlockNode)(nil), - (*Node_HeadingNode)(nil), - (*Node_HorizontalRuleNode)(nil), - (*Node_BlockquoteNode)(nil), - (*Node_OrderedListNode)(nil), - (*Node_UnorderedListNode)(nil), - (*Node_TaskListNode)(nil), - (*Node_MathBlockNode)(nil), - (*Node_TableNode)(nil), - (*Node_EmbeddedContentNode)(nil), - (*Node_TextNode)(nil), - (*Node_BoldNode)(nil), - (*Node_ItalicNode)(nil), - (*Node_BoldItalicNode)(nil), - (*Node_CodeNode)(nil), - (*Node_ImageNode)(nil), - (*Node_LinkNode)(nil), - (*Node_AutoLinkNode)(nil), - (*Node_TagNode)(nil), - (*Node_StrikethroughNode)(nil), - (*Node_EscapingCharacterNode)(nil), - (*Node_MathNode)(nil), - (*Node_HighlightNode)(nil), - (*Node_SubscriptNode)(nil), - (*Node_SuperscriptNode)(nil), - (*Node_ReferencedContentNode)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_v2_node_proto_rawDesc, - NumEnums: 1, - NumMessages: 30, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_api_v2_node_proto_goTypes, - DependencyIndexes: file_api_v2_node_proto_depIdxs, - EnumInfos: file_api_v2_node_proto_enumTypes, - MessageInfos: file_api_v2_node_proto_msgTypes, - }.Build() - File_api_v2_node_proto = out.File - file_api_v2_node_proto_rawDesc = nil - file_api_v2_node_proto_goTypes = nil - file_api_v2_node_proto_depIdxs = nil -} diff --git a/proto/gen/api/v2/workspace_service.pb.go b/proto/gen/api/v2/workspace_service.pb.go index 66e97afc..89f88fdc 100644 --- a/proto/gen/api/v2/workspace_service.pb.go +++ b/proto/gen/api/v2/workspace_service.pb.go @@ -10,7 +10,6 @@ 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" ) @@ -27,12 +26,18 @@ type WorkspaceProfile struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Mode string `protobuf:"bytes,2,opt,name=mode,proto3" json:"mode,omitempty"` - AllowRegistration bool `protobuf:"varint,3,opt,name=allow_registration,json=allowRegistration,proto3" json:"allow_registration,omitempty"` - DisablePasswordLogin bool `protobuf:"varint,4,opt,name=disable_password_login,json=disablePasswordLogin,proto3" json:"disable_password_login,omitempty"` - AdditionalScript string `protobuf:"bytes,5,opt,name=additional_script,json=additionalScript,proto3" json:"additional_script,omitempty"` - AdditionalStyle string `protobuf:"bytes,6,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"` + // version is the current version of instance + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // mode is the instance mode (e.g. "prod", "dev" or "demo"). + Mode string `protobuf:"bytes,2,opt,name=mode,proto3" json:"mode,omitempty"` + // allow_registration is whether the registration is allowed. + AllowRegistration bool `protobuf:"varint,3,opt,name=allow_registration,json=allowRegistration,proto3" json:"allow_registration,omitempty"` + // allow_password_login is whether the password login is allowed. + DisablePasswordLogin bool `protobuf:"varint,4,opt,name=disable_password_login,json=disablePasswordLogin,proto3" json:"disable_password_login,omitempty"` + // additional_script is the additional script. + AdditionalScript string `protobuf:"bytes,5,opt,name=additional_script,json=additionalScript,proto3" json:"additional_script,omitempty"` + // additional_style is the additional style. + AdditionalStyle string `protobuf:"bytes,6,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"` } func (x *WorkspaceProfile) Reset() { @@ -194,109 +199,6 @@ func (x *GetWorkspaceProfileResponse) GetWorkspaceProfile() *WorkspaceProfile { return nil } -type UpdateWorkspaceProfileRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // System info is the updated data. - WorkspaceProfile *WorkspaceProfile `protobuf:"bytes,1,opt,name=workspace_profile,json=workspaceProfile,proto3" json:"workspace_profile,omitempty"` - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` -} - -func (x *UpdateWorkspaceProfileRequest) Reset() { - *x = UpdateWorkspaceProfileRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_workspace_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateWorkspaceProfileRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateWorkspaceProfileRequest) ProtoMessage() {} - -func (x *UpdateWorkspaceProfileRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_workspace_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateWorkspaceProfileRequest.ProtoReflect.Descriptor instead. -func (*UpdateWorkspaceProfileRequest) Descriptor() ([]byte, []int) { - return file_api_v2_workspace_service_proto_rawDescGZIP(), []int{3} -} - -func (x *UpdateWorkspaceProfileRequest) GetWorkspaceProfile() *WorkspaceProfile { - if x != nil { - return x.WorkspaceProfile - } - return nil -} - -func (x *UpdateWorkspaceProfileRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type UpdateWorkspaceProfileResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WorkspaceProfile *WorkspaceProfile `protobuf:"bytes,1,opt,name=workspace_profile,json=workspaceProfile,proto3" json:"workspace_profile,omitempty"` -} - -func (x *UpdateWorkspaceProfileResponse) Reset() { - *x = UpdateWorkspaceProfileResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v2_workspace_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateWorkspaceProfileResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateWorkspaceProfileResponse) ProtoMessage() {} - -func (x *UpdateWorkspaceProfileResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_workspace_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateWorkspaceProfileResponse.ProtoReflect.Descriptor instead. -func (*UpdateWorkspaceProfileResponse) Descriptor() ([]byte, []int) { - return file_api_v2_workspace_service_proto_rawDescGZIP(), []int{4} -} - -func (x *UpdateWorkspaceProfileResponse) GetWorkspaceProfile() *WorkspaceProfile { - if x != nil { - return x.WorkspaceProfile - } - return nil -} - var File_api_v2_workspace_service_proto protoreflect.FileDescriptor var file_api_v2_workspace_service_proto_rawDesc = []byte{ @@ -304,88 +206,54 @@ var file_api_v2_workspace_service_proto_rawDesc = []byte{ 0x63, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, - 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfd, 0x01, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x2d, 0x0a, 0x12, 0x61, 0x6c, - 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x16, 0x64, 0x69, 0x73, - 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x6c, 0x6f, - 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x64, 0x69, 0x73, 0x61, 0x62, - 0x6c, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, - 0x2b, 0x0a, 0x11, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x64, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x29, 0x0a, 0x10, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x79, 0x6c, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x22, 0x1c, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x57, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x6a, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x57, - 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, - 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, - 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x4b, 0x0a, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x57, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x10, - 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, - 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, - 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x6d, 0x0a, - 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x4b, 0x0a, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, - 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x32, 0xee, 0x02, 0x0a, - 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x8d, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfd, 0x01, 0x0a, + 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6d, + 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, + 0x2d, 0x0a, 0x12, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, + 0x0a, 0x16, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, + 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, + 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x61, 0x6c, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, + 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x64, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x22, 0x1c, 0x0a, 0x1a, + 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, + 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x6a, 0x0a, 0x1b, 0x47, 0x65, + 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x11, 0x77, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, + 0x66, 0x69, 0x6c, 0x65, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, + 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x32, 0xa2, 0x01, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x8d, 0x01, 0x0a, 0x13, + 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, + 0x69, 0x6c, 0x65, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, - 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, - 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, - 0x65, 0x12, 0xc9, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x2b, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, - 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, - 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x54, 0xda, 0x41, 0x1d, 0x77, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x2c, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2e, 0x3a, - 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, - 0x6c, 0x65, 0x32, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x77, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x42, 0xad, 0x01, - 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x42, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, - 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, - 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, - 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, - 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, + 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, + 0x12, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x42, 0xad, 0x01, 0x0a, 0x10, + 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x42, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, + 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, + 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, + 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, + 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -400,29 +268,21 @@ func file_api_v2_workspace_service_proto_rawDescGZIP() []byte { return file_api_v2_workspace_service_proto_rawDescData } -var file_api_v2_workspace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_api_v2_workspace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_api_v2_workspace_service_proto_goTypes = []interface{}{ - (*WorkspaceProfile)(nil), // 0: memos.api.v2.WorkspaceProfile - (*GetWorkspaceProfileRequest)(nil), // 1: memos.api.v2.GetWorkspaceProfileRequest - (*GetWorkspaceProfileResponse)(nil), // 2: memos.api.v2.GetWorkspaceProfileResponse - (*UpdateWorkspaceProfileRequest)(nil), // 3: memos.api.v2.UpdateWorkspaceProfileRequest - (*UpdateWorkspaceProfileResponse)(nil), // 4: memos.api.v2.UpdateWorkspaceProfileResponse - (*fieldmaskpb.FieldMask)(nil), // 5: google.protobuf.FieldMask + (*WorkspaceProfile)(nil), // 0: memos.api.v2.WorkspaceProfile + (*GetWorkspaceProfileRequest)(nil), // 1: memos.api.v2.GetWorkspaceProfileRequest + (*GetWorkspaceProfileResponse)(nil), // 2: memos.api.v2.GetWorkspaceProfileResponse } var file_api_v2_workspace_service_proto_depIdxs = []int32{ 0, // 0: memos.api.v2.GetWorkspaceProfileResponse.workspace_profile:type_name -> memos.api.v2.WorkspaceProfile - 0, // 1: memos.api.v2.UpdateWorkspaceProfileRequest.workspace_profile:type_name -> memos.api.v2.WorkspaceProfile - 5, // 2: memos.api.v2.UpdateWorkspaceProfileRequest.update_mask:type_name -> google.protobuf.FieldMask - 0, // 3: memos.api.v2.UpdateWorkspaceProfileResponse.workspace_profile:type_name -> memos.api.v2.WorkspaceProfile - 1, // 4: memos.api.v2.WorkspaceService.GetWorkspaceProfile:input_type -> memos.api.v2.GetWorkspaceProfileRequest - 3, // 5: memos.api.v2.WorkspaceService.UpdateWorkspaceProfile:input_type -> memos.api.v2.UpdateWorkspaceProfileRequest - 2, // 6: memos.api.v2.WorkspaceService.GetWorkspaceProfile:output_type -> memos.api.v2.GetWorkspaceProfileResponse - 4, // 7: memos.api.v2.WorkspaceService.UpdateWorkspaceProfile:output_type -> memos.api.v2.UpdateWorkspaceProfileResponse - 6, // [6:8] is the sub-list for method output_type - 4, // [4:6] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 1, // 1: memos.api.v2.WorkspaceService.GetWorkspaceProfile:input_type -> memos.api.v2.GetWorkspaceProfileRequest + 2, // 2: memos.api.v2.WorkspaceService.GetWorkspaceProfile:output_type -> memos.api.v2.GetWorkspaceProfileResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_api_v2_workspace_service_proto_init() } @@ -467,30 +327,6 @@ func file_api_v2_workspace_service_proto_init() { return nil } } - file_api_v2_workspace_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateWorkspaceProfileRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v2_workspace_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateWorkspaceProfileResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -498,7 +334,7 @@ func file_api_v2_workspace_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_api_v2_workspace_service_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 3, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/gen/api/v2/workspace_service.pb.gw.go b/proto/gen/api/v2/workspace_service.pb.gw.go index f830de0a..6a71ab69 100644 --- a/proto/gen/api/v2/workspace_service.pb.gw.go +++ b/proto/gen/api/v2/workspace_service.pb.gw.go @@ -49,72 +49,6 @@ func local_request_WorkspaceService_GetWorkspaceProfile_0(ctx context.Context, m } -var ( - filter_WorkspaceService_UpdateWorkspaceProfile_0 = &utilities.DoubleArray{Encoding: map[string]int{"workspace_profile": 0, "workspaceProfile": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} -) - -func request_WorkspaceService_UpdateWorkspaceProfile_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateWorkspaceProfileRequest - var metadata runtime.ServerMetadata - - 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.WorkspaceProfile); err != nil && 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.WorkspaceProfile); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } else { - protoReq.UpdateMask = fieldMask - } - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WorkspaceService_UpdateWorkspaceProfile_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.UpdateWorkspaceProfile(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_WorkspaceService_UpdateWorkspaceProfile_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateWorkspaceProfileRequest - var metadata runtime.ServerMetadata - - 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.WorkspaceProfile); err != nil && 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.WorkspaceProfile); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } else { - protoReq.UpdateMask = fieldMask - } - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WorkspaceService_UpdateWorkspaceProfile_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.UpdateWorkspaceProfile(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. @@ -146,31 +80,6 @@ func RegisterWorkspaceServiceHandlerServer(ctx context.Context, mux *runtime.Ser }) - mux.Handle("PATCH", pattern_WorkspaceService_UpdateWorkspaceProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.WorkspaceService/UpdateWorkspaceProfile", runtime.WithHTTPPathPattern("/api/v2/workspace/profile")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_WorkspaceService_UpdateWorkspaceProfile_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_UpdateWorkspaceProfile_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -234,39 +143,13 @@ func RegisterWorkspaceServiceHandlerClient(ctx context.Context, mux *runtime.Ser }) - mux.Handle("PATCH", pattern_WorkspaceService_UpdateWorkspaceProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.WorkspaceService/UpdateWorkspaceProfile", runtime.WithHTTPPathPattern("/api/v2/workspace/profile")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_WorkspaceService_UpdateWorkspaceProfile_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_UpdateWorkspaceProfile_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", "v2", "workspace", "profile"}, "")) - - pattern_WorkspaceService_UpdateWorkspaceProfile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v2", "workspace", "profile"}, "")) ) var ( forward_WorkspaceService_GetWorkspaceProfile_0 = runtime.ForwardResponseMessage - - forward_WorkspaceService_UpdateWorkspaceProfile_0 = runtime.ForwardResponseMessage ) diff --git a/proto/gen/api/v2/workspace_service_grpc.pb.go b/proto/gen/api/v2/workspace_service_grpc.pb.go index 6fda09cb..09ccf19a 100644 --- a/proto/gen/api/v2/workspace_service_grpc.pb.go +++ b/proto/gen/api/v2/workspace_service_grpc.pb.go @@ -19,8 +19,7 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - WorkspaceService_GetWorkspaceProfile_FullMethodName = "/memos.api.v2.WorkspaceService/GetWorkspaceProfile" - WorkspaceService_UpdateWorkspaceProfile_FullMethodName = "/memos.api.v2.WorkspaceService/UpdateWorkspaceProfile" + WorkspaceService_GetWorkspaceProfile_FullMethodName = "/memos.api.v2.WorkspaceService/GetWorkspaceProfile" ) // WorkspaceServiceClient is the client API for WorkspaceService service. @@ -29,8 +28,6 @@ const ( type WorkspaceServiceClient interface { // GetWorkspaceProfile returns the workspace profile. GetWorkspaceProfile(ctx context.Context, in *GetWorkspaceProfileRequest, opts ...grpc.CallOption) (*GetWorkspaceProfileResponse, error) - // UpdateWorkspaceProfile updates the workspace profile. - UpdateWorkspaceProfile(ctx context.Context, in *UpdateWorkspaceProfileRequest, opts ...grpc.CallOption) (*UpdateWorkspaceProfileResponse, error) } type workspaceServiceClient struct { @@ -50,23 +47,12 @@ func (c *workspaceServiceClient) GetWorkspaceProfile(ctx context.Context, in *Ge return out, nil } -func (c *workspaceServiceClient) UpdateWorkspaceProfile(ctx context.Context, in *UpdateWorkspaceProfileRequest, opts ...grpc.CallOption) (*UpdateWorkspaceProfileResponse, error) { - out := new(UpdateWorkspaceProfileResponse) - err := c.cc.Invoke(ctx, WorkspaceService_UpdateWorkspaceProfile_FullMethodName, in, out, opts...) - 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 { // GetWorkspaceProfile returns the workspace profile. GetWorkspaceProfile(context.Context, *GetWorkspaceProfileRequest) (*GetWorkspaceProfileResponse, error) - // UpdateWorkspaceProfile updates the workspace profile. - UpdateWorkspaceProfile(context.Context, *UpdateWorkspaceProfileRequest) (*UpdateWorkspaceProfileResponse, error) mustEmbedUnimplementedWorkspaceServiceServer() } @@ -77,9 +63,6 @@ type UnimplementedWorkspaceServiceServer struct { func (UnimplementedWorkspaceServiceServer) GetWorkspaceProfile(context.Context, *GetWorkspaceProfileRequest) (*GetWorkspaceProfileResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceProfile not implemented") } -func (UnimplementedWorkspaceServiceServer) UpdateWorkspaceProfile(context.Context, *UpdateWorkspaceProfileRequest) (*UpdateWorkspaceProfileResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateWorkspaceProfile not implemented") -} func (UnimplementedWorkspaceServiceServer) mustEmbedUnimplementedWorkspaceServiceServer() {} // UnsafeWorkspaceServiceServer may be embedded to opt out of forward compatibility for this service. @@ -111,24 +94,6 @@ func _WorkspaceService_GetWorkspaceProfile_Handler(srv interface{}, ctx context. return interceptor(ctx, in, info, handler) } -func _WorkspaceService_UpdateWorkspaceProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateWorkspaceProfileRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WorkspaceServiceServer).UpdateWorkspaceProfile(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: WorkspaceService_UpdateWorkspaceProfile_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WorkspaceServiceServer).UpdateWorkspaceProfile(ctx, req.(*UpdateWorkspaceProfileRequest)) - } - 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) @@ -140,10 +105,6 @@ var WorkspaceService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetWorkspaceProfile", Handler: _WorkspaceService_GetWorkspaceProfile_Handler, }, - { - MethodName: "UpdateWorkspaceProfile", - Handler: _WorkspaceService_UpdateWorkspaceProfile_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/v2/workspace_service.proto", diff --git a/proto/gen/api/v2/workspace_setting_service.pb.go b/proto/gen/api/v2/workspace_setting_service.pb.go new file mode 100644 index 00000000..1431cfbe --- /dev/null +++ b/proto/gen/api/v2/workspace_setting_service.pb.go @@ -0,0 +1,607 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: api/v2/workspace_setting_service.proto + +package apiv2 + +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" +) + +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 GetWorkspaceSettingRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The resource name of the workspace setting. + // Format: settings/{setting} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetWorkspaceSettingRequest) Reset() { + *x = GetWorkspaceSettingRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_workspace_setting_service_proto_msgTypes[0] + 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_v2_workspace_setting_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetWorkspaceSettingRequest.ProtoReflect.Descriptor instead. +func (*GetWorkspaceSettingRequest) Descriptor() ([]byte, []int) { + return file_api_v2_workspace_setting_service_proto_rawDescGZIP(), []int{0} +} + +func (x *GetWorkspaceSettingRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetWorkspaceSettingResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Setting *WorkspaceSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"` +} + +func (x *GetWorkspaceSettingResponse) Reset() { + *x = GetWorkspaceSettingResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_workspace_setting_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetWorkspaceSettingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetWorkspaceSettingResponse) ProtoMessage() {} + +func (x *GetWorkspaceSettingResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_workspace_setting_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetWorkspaceSettingResponse.ProtoReflect.Descriptor instead. +func (*GetWorkspaceSettingResponse) Descriptor() ([]byte, []int) { + return file_api_v2_workspace_setting_service_proto_rawDescGZIP(), []int{1} +} + +func (x *GetWorkspaceSettingResponse) GetSetting() *WorkspaceSetting { + if x != nil { + return x.Setting + } + return nil +} + +type SetWorkspaceSettingRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // setting is the setting to update. + Setting *WorkspaceSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"` +} + +func (x *SetWorkspaceSettingRequest) Reset() { + *x = SetWorkspaceSettingRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_workspace_setting_service_proto_msgTypes[2] + 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_v2_workspace_setting_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetWorkspaceSettingRequest.ProtoReflect.Descriptor instead. +func (*SetWorkspaceSettingRequest) Descriptor() ([]byte, []int) { + return file_api_v2_workspace_setting_service_proto_rawDescGZIP(), []int{2} +} + +func (x *SetWorkspaceSettingRequest) GetSetting() *WorkspaceSetting { + if x != nil { + return x.Setting + } + return nil +} + +type SetWorkspaceSettingResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Setting *WorkspaceSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"` +} + +func (x *SetWorkspaceSettingResponse) Reset() { + *x = SetWorkspaceSettingResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_workspace_setting_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetWorkspaceSettingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetWorkspaceSettingResponse) ProtoMessage() {} + +func (x *SetWorkspaceSettingResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_workspace_setting_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetWorkspaceSettingResponse.ProtoReflect.Descriptor instead. +func (*SetWorkspaceSettingResponse) Descriptor() ([]byte, []int) { + return file_api_v2_workspace_setting_service_proto_rawDescGZIP(), []int{3} +} + +func (x *SetWorkspaceSettingResponse) GetSetting() *WorkspaceSetting { + if x != nil { + return x.Setting + } + return nil +} + +type WorkspaceSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 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 assignable to Value: + // + // *WorkspaceSetting_GeneralSetting + Value isWorkspaceSetting_Value `protobuf_oneof:"value"` +} + +func (x *WorkspaceSetting) Reset() { + *x = WorkspaceSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_workspace_setting_service_proto_msgTypes[4] + 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_v2_workspace_setting_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkspaceSetting.ProtoReflect.Descriptor instead. +func (*WorkspaceSetting) Descriptor() ([]byte, []int) { + return file_api_v2_workspace_setting_service_proto_rawDescGZIP(), []int{4} +} + +func (x *WorkspaceSetting) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (m *WorkspaceSetting) GetValue() isWorkspaceSetting_Value { + if m != nil { + return m.Value + } + return nil +} + +func (x *WorkspaceSetting) GetGeneralSetting() *WorkspaceGeneralSetting { + if x, ok := x.GetValue().(*WorkspaceSetting_GeneralSetting); ok { + return x.GeneralSetting + } + return nil +} + +type isWorkspaceSetting_Value interface { + isWorkspaceSetting_Value() +} + +type WorkspaceSetting_GeneralSetting struct { + // general_setting is the general setting of workspace. + GeneralSetting *WorkspaceGeneralSetting `protobuf:"bytes,2,opt,name=general_setting,json=generalSetting,proto3,oneof"` +} + +func (*WorkspaceSetting_GeneralSetting) isWorkspaceSetting_Value() {} + +type WorkspaceGeneralSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // instance_url is the instance URL. + InstanceUrl string `protobuf:"bytes,1,opt,name=instance_url,json=instanceUrl,proto3" json:"instance_url,omitempty"` + // disallow_signup is the flag to disallow signup. + DisallowSignup bool `protobuf:"varint,2,opt,name=disallow_signup,json=disallowSignup,proto3" json:"disallow_signup,omitempty"` + // disallow_password_login is the flag to disallow password login. + DisallowPasswordLogin bool `protobuf:"varint,3,opt,name=disallow_password_login,json=disallowPasswordLogin,proto3" json:"disallow_password_login,omitempty"` + // additional_script is the additional script. + AdditionalScript string `protobuf:"bytes,5,opt,name=additional_script,json=additionalScript,proto3" json:"additional_script,omitempty"` + // additional_style is the additional style. + AdditionalStyle string `protobuf:"bytes,6,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"` +} + +func (x *WorkspaceGeneralSetting) Reset() { + *x = WorkspaceGeneralSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_workspace_setting_service_proto_msgTypes[5] + 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_v2_workspace_setting_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkspaceGeneralSetting.ProtoReflect.Descriptor instead. +func (*WorkspaceGeneralSetting) Descriptor() ([]byte, []int) { + return file_api_v2_workspace_setting_service_proto_rawDescGZIP(), []int{5} +} + +func (x *WorkspaceGeneralSetting) GetInstanceUrl() string { + if x != nil { + return x.InstanceUrl + } + return "" +} + +func (x *WorkspaceGeneralSetting) GetDisallowSignup() bool { + if x != nil { + return x.DisallowSignup + } + return false +} + +func (x *WorkspaceGeneralSetting) GetDisallowPasswordLogin() bool { + if x != nil { + return x.DisallowPasswordLogin + } + 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 "" +} + +var File_api_v2_workspace_setting_service_proto protoreflect.FileDescriptor + +var file_api_v2_workspace_setting_service_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, + 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, + 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x57, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x56, + 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x07, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x57, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x57, 0x0a, 0x1b, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, + 0x81, 0x01, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x50, 0x0a, 0x0f, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x0e, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0xf5, 0x01, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, + 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x55, + 0x72, 0x6c, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x73, + 0x69, 0x67, 0x6e, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x64, 0x69, 0x73, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x69, 0x67, 0x6e, 0x75, 0x70, 0x12, 0x36, 0x0a, 0x17, 0x64, + 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, + 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x6f, + 0x67, 0x69, 0x6e, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, + 0x6c, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, + 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x12, 0x29, 0x0a, 0x10, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, + 0x74, 0x79, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x64, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x32, 0xef, 0x02, 0x0a, 0x17, + 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9e, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x57, + 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, + 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, + 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x77, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xb2, 0x01, 0x0a, 0x13, 0x53, 0x65, 0x74, + 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, 0xda, 0x41, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x36, 0x3a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x32, 0x2b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x2f, 0x7b, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x6e, 0x61, 0x6d, + 0x65, 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xb4, 0x01, + 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x42, 0x1c, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, + 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, + 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, + 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, + 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, + 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_v2_workspace_setting_service_proto_rawDescOnce sync.Once + file_api_v2_workspace_setting_service_proto_rawDescData = file_api_v2_workspace_setting_service_proto_rawDesc +) + +func file_api_v2_workspace_setting_service_proto_rawDescGZIP() []byte { + file_api_v2_workspace_setting_service_proto_rawDescOnce.Do(func() { + file_api_v2_workspace_setting_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v2_workspace_setting_service_proto_rawDescData) + }) + return file_api_v2_workspace_setting_service_proto_rawDescData +} + +var file_api_v2_workspace_setting_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_api_v2_workspace_setting_service_proto_goTypes = []interface{}{ + (*GetWorkspaceSettingRequest)(nil), // 0: memos.api.v2.GetWorkspaceSettingRequest + (*GetWorkspaceSettingResponse)(nil), // 1: memos.api.v2.GetWorkspaceSettingResponse + (*SetWorkspaceSettingRequest)(nil), // 2: memos.api.v2.SetWorkspaceSettingRequest + (*SetWorkspaceSettingResponse)(nil), // 3: memos.api.v2.SetWorkspaceSettingResponse + (*WorkspaceSetting)(nil), // 4: memos.api.v2.WorkspaceSetting + (*WorkspaceGeneralSetting)(nil), // 5: memos.api.v2.WorkspaceGeneralSetting +} +var file_api_v2_workspace_setting_service_proto_depIdxs = []int32{ + 4, // 0: memos.api.v2.GetWorkspaceSettingResponse.setting:type_name -> memos.api.v2.WorkspaceSetting + 4, // 1: memos.api.v2.SetWorkspaceSettingRequest.setting:type_name -> memos.api.v2.WorkspaceSetting + 4, // 2: memos.api.v2.SetWorkspaceSettingResponse.setting:type_name -> memos.api.v2.WorkspaceSetting + 5, // 3: memos.api.v2.WorkspaceSetting.general_setting:type_name -> memos.api.v2.WorkspaceGeneralSetting + 0, // 4: memos.api.v2.WorkspaceSettingService.GetWorkspaceSetting:input_type -> memos.api.v2.GetWorkspaceSettingRequest + 2, // 5: memos.api.v2.WorkspaceSettingService.SetWorkspaceSetting:input_type -> memos.api.v2.SetWorkspaceSettingRequest + 1, // 6: memos.api.v2.WorkspaceSettingService.GetWorkspaceSetting:output_type -> memos.api.v2.GetWorkspaceSettingResponse + 3, // 7: memos.api.v2.WorkspaceSettingService.SetWorkspaceSetting:output_type -> memos.api.v2.SetWorkspaceSettingResponse + 6, // [6:8] is the sub-list for method output_type + 4, // [4:6] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_api_v2_workspace_setting_service_proto_init() } +func file_api_v2_workspace_setting_service_proto_init() { + if File_api_v2_workspace_setting_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_v2_workspace_setting_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetWorkspaceSettingRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_workspace_setting_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetWorkspaceSettingResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_workspace_setting_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetWorkspaceSettingRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_workspace_setting_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetWorkspaceSettingResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_workspace_setting_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WorkspaceSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_workspace_setting_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WorkspaceGeneralSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_api_v2_workspace_setting_service_proto_msgTypes[4].OneofWrappers = []interface{}{ + (*WorkspaceSetting_GeneralSetting)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_v2_workspace_setting_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_v2_workspace_setting_service_proto_goTypes, + DependencyIndexes: file_api_v2_workspace_setting_service_proto_depIdxs, + MessageInfos: file_api_v2_workspace_setting_service_proto_msgTypes, + }.Build() + File_api_v2_workspace_setting_service_proto = out.File + file_api_v2_workspace_setting_service_proto_rawDesc = nil + file_api_v2_workspace_setting_service_proto_goTypes = nil + file_api_v2_workspace_setting_service_proto_depIdxs = nil +} diff --git a/proto/gen/api/v2/workspace_setting_service.pb.gw.go b/proto/gen/api/v2/workspace_setting_service.pb.gw.go new file mode 100644 index 00000000..e0a685e5 --- /dev/null +++ b/proto/gen/api/v2/workspace_setting_service.pb.gw.go @@ -0,0 +1,308 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: api/v2/workspace_setting_service.proto + +/* +Package apiv2 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package apiv2 + +import ( + "context" + "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 +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = 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 + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + 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 + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + 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 + var metadata runtime.ServerMetadata + + 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 && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = 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 + var metadata runtime.ServerMetadata + + 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 && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = 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. +func RegisterWorkspaceSettingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkspaceSettingServiceServer) error { + + mux.Handle("GET", pattern_WorkspaceSettingService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.WorkspaceSettingService/GetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v2/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("PATCH", 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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.WorkspaceSettingService/SetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v2/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.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("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. +func RegisterWorkspaceSettingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkspaceSettingServiceClient) error { + + mux.Handle("GET", pattern_WorkspaceSettingService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.WorkspaceSettingService/GetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v2/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("PATCH", 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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.WorkspaceSettingService/SetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v2/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", "v2", "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", "v2", "workspace", "settings", "setting.name"}, "")) +) + +var ( + forward_WorkspaceSettingService_GetWorkspaceSetting_0 = runtime.ForwardResponseMessage + + forward_WorkspaceSettingService_SetWorkspaceSetting_0 = runtime.ForwardResponseMessage +) diff --git a/proto/gen/api/v2/workspace_setting_service_grpc.pb.go b/proto/gen/api/v2/workspace_setting_service_grpc.pb.go new file mode 100644 index 00000000..c747d130 --- /dev/null +++ b/proto/gen/api/v2/workspace_setting_service_grpc.pb.go @@ -0,0 +1,151 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: api/v2/workspace_setting_service.proto + +package apiv2 + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + WorkspaceSettingService_GetWorkspaceSetting_FullMethodName = "/memos.api.v2.WorkspaceSettingService/GetWorkspaceSetting" + WorkspaceSettingService_SetWorkspaceSetting_FullMethodName = "/memos.api.v2.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) (*GetWorkspaceSettingResponse, error) + // SetWorkspaceSetting updates the setting. + SetWorkspaceSetting(ctx context.Context, in *SetWorkspaceSettingRequest, opts ...grpc.CallOption) (*SetWorkspaceSettingResponse, 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) (*GetWorkspaceSettingResponse, error) { + out := new(GetWorkspaceSettingResponse) + err := c.cc.Invoke(ctx, WorkspaceSettingService_GetWorkspaceSetting_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *workspaceSettingServiceClient) SetWorkspaceSetting(ctx context.Context, in *SetWorkspaceSettingRequest, opts ...grpc.CallOption) (*SetWorkspaceSettingResponse, error) { + out := new(SetWorkspaceSettingResponse) + err := c.cc.Invoke(ctx, WorkspaceSettingService_SetWorkspaceSetting_FullMethodName, in, out, opts...) + 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) (*GetWorkspaceSettingResponse, error) + // SetWorkspaceSetting updates the setting. + SetWorkspaceSetting(context.Context, *SetWorkspaceSettingRequest) (*SetWorkspaceSettingResponse, error) + mustEmbedUnimplementedWorkspaceSettingServiceServer() +} + +// UnimplementedWorkspaceSettingServiceServer must be embedded to have forward compatible implementations. +type UnimplementedWorkspaceSettingServiceServer struct { +} + +func (UnimplementedWorkspaceSettingServiceServer) GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*GetWorkspaceSettingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceSetting not implemented") +} +func (UnimplementedWorkspaceSettingServiceServer) SetWorkspaceSetting(context.Context, *SetWorkspaceSettingRequest) (*SetWorkspaceSettingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetWorkspaceSetting not implemented") +} +func (UnimplementedWorkspaceSettingServiceServer) mustEmbedUnimplementedWorkspaceSettingServiceServer() { +} + +// 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) { + 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.v2.WorkspaceSettingService", + HandlerType: (*WorkspaceSettingServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetWorkspaceSetting", + Handler: _WorkspaceSettingService_GetWorkspaceSetting_Handler, + }, + { + MethodName: "SetWorkspaceSetting", + Handler: _WorkspaceSettingService_SetWorkspaceSetting_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/v2/workspace_setting_service.proto", +} diff --git a/proto/gen/store/README.md b/proto/gen/store/README.md index b946a980..b37d9c2e 100644 --- a/proto/gen/store/README.md +++ b/proto/gen/store/README.md @@ -33,6 +33,7 @@ - [store/workspace_setting.proto](#store_workspace_setting-proto) - [WorkspaceGeneralSetting](#memos-store-WorkspaceGeneralSetting) + - [WorkspaceSetting](#memos-store-WorkspaceSetting) - [WorkspaceSettingKey](#memos-store-WorkspaceSettingKey) @@ -373,9 +374,27 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| instance_url | [string](#string) | | | -| disallow_signup | [bool](#bool) | | | -| disallow_password_login | [bool](#bool) | | | +| instance_url | [string](#string) | | instance_url is the instance URL. | +| disallow_signup | [bool](#bool) | | disallow_signup is the flag to disallow signup. | +| disallow_password_login | [bool](#bool) | | disallow_password_login is the flag to disallow password login. | +| additional_script | [string](#string) | | additional_script is the additional script. | +| additional_style | [string](#string) | | additional_style is the additional style. | + + + + + + + + +### WorkspaceSetting + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| key | [WorkspaceSettingKey](#memos-store-WorkspaceSettingKey) | | | +| general | [WorkspaceGeneralSetting](#memos-store-WorkspaceGeneralSetting) | | | @@ -392,7 +411,7 @@ | Name | Number | Description | | ---- | ------ | ----------- | | WORKSPACE_SETTING_KEY_UNSPECIFIED | 0 | | -| WORKSPACE_SETTING_GENERAL | 1 | | +| WORKSPACE_SETTING_GENERAL | 1 | WORKSPACE_SETTING_GENERAL is the key for general settings. | diff --git a/proto/gen/store/workspace_setting.pb.go b/proto/gen/store/workspace_setting.pb.go index 1ae1feb2..be1c79c3 100644 --- a/proto/gen/store/workspace_setting.pb.go +++ b/proto/gen/store/workspace_setting.pb.go @@ -24,7 +24,8 @@ type WorkspaceSettingKey int32 const ( WorkspaceSettingKey_WORKSPACE_SETTING_KEY_UNSPECIFIED WorkspaceSettingKey = 0 - WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL WorkspaceSettingKey = 1 + // WORKSPACE_SETTING_GENERAL is the key for general settings. + WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL WorkspaceSettingKey = 1 ) // Enum value maps for WorkspaceSettingKey. @@ -66,20 +67,102 @@ func (WorkspaceSettingKey) EnumDescriptor() ([]byte, []int) { return file_store_workspace_setting_proto_rawDescGZIP(), []int{0} } +type WorkspaceSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key WorkspaceSettingKey `protobuf:"varint,1,opt,name=key,proto3,enum=memos.store.WorkspaceSettingKey" json:"key,omitempty"` + // Types that are assignable to Value: + // + // *WorkspaceSetting_General + Value isWorkspaceSetting_Value `protobuf_oneof:"value"` +} + +func (x *WorkspaceSetting) Reset() { + *x = WorkspaceSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_store_workspace_setting_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_store_workspace_setting_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkspaceSetting.ProtoReflect.Descriptor instead. +func (*WorkspaceSetting) Descriptor() ([]byte, []int) { + return file_store_workspace_setting_proto_rawDescGZIP(), []int{0} +} + +func (x *WorkspaceSetting) GetKey() WorkspaceSettingKey { + if x != nil { + return x.Key + } + return WorkspaceSettingKey_WORKSPACE_SETTING_KEY_UNSPECIFIED +} + +func (m *WorkspaceSetting) GetValue() isWorkspaceSetting_Value { + if m != nil { + return m.Value + } + return nil +} + +func (x *WorkspaceSetting) GetGeneral() *WorkspaceGeneralSetting { + if x, ok := x.GetValue().(*WorkspaceSetting_General); ok { + return x.General + } + return nil +} + +type isWorkspaceSetting_Value interface { + isWorkspaceSetting_Value() +} + +type WorkspaceSetting_General struct { + General *WorkspaceGeneralSetting `protobuf:"bytes,2,opt,name=general,proto3,oneof"` +} + +func (*WorkspaceSetting_General) isWorkspaceSetting_Value() {} + type WorkspaceGeneralSetting struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - InstanceUrl string `protobuf:"bytes,1,opt,name=instance_url,json=instanceUrl,proto3" json:"instance_url,omitempty"` - DisallowSignup bool `protobuf:"varint,2,opt,name=disallow_signup,json=disallowSignup,proto3" json:"disallow_signup,omitempty"` - DisallowPasswordLogin bool `protobuf:"varint,3,opt,name=disallow_password_login,json=disallowPasswordLogin,proto3" json:"disallow_password_login,omitempty"` + // instance_url is the instance URL. + InstanceUrl string `protobuf:"bytes,1,opt,name=instance_url,json=instanceUrl,proto3" json:"instance_url,omitempty"` + // disallow_signup is the flag to disallow signup. + DisallowSignup bool `protobuf:"varint,2,opt,name=disallow_signup,json=disallowSignup,proto3" json:"disallow_signup,omitempty"` + // disallow_password_login is the flag to disallow password login. + DisallowPasswordLogin bool `protobuf:"varint,3,opt,name=disallow_password_login,json=disallowPasswordLogin,proto3" json:"disallow_password_login,omitempty"` + // additional_script is the additional script. + AdditionalScript string `protobuf:"bytes,5,opt,name=additional_script,json=additionalScript,proto3" json:"additional_script,omitempty"` + // additional_style is the additional style. + AdditionalStyle string `protobuf:"bytes,6,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"` } func (x *WorkspaceGeneralSetting) Reset() { *x = WorkspaceGeneralSetting{} if protoimpl.UnsafeEnabled { - mi := &file_store_workspace_setting_proto_msgTypes[0] + mi := &file_store_workspace_setting_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92,7 +175,7 @@ func (x *WorkspaceGeneralSetting) String() string { func (*WorkspaceGeneralSetting) ProtoMessage() {} func (x *WorkspaceGeneralSetting) ProtoReflect() protoreflect.Message { - mi := &file_store_workspace_setting_proto_msgTypes[0] + mi := &file_store_workspace_setting_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105,7 +188,7 @@ func (x *WorkspaceGeneralSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkspaceGeneralSetting.ProtoReflect.Descriptor instead. func (*WorkspaceGeneralSetting) Descriptor() ([]byte, []int) { - return file_store_workspace_setting_proto_rawDescGZIP(), []int{0} + return file_store_workspace_setting_proto_rawDescGZIP(), []int{1} } func (x *WorkspaceGeneralSetting) GetInstanceUrl() string { @@ -129,39 +212,67 @@ func (x *WorkspaceGeneralSetting) GetDisallowPasswordLogin() bool { 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 "" +} + var File_store_workspace_setting_proto protoreflect.FileDescriptor var file_store_workspace_setting_proto_rawDesc = []byte{ 0x0a, 0x1d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x9d, 0x01, 0x0a, - 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x27, 0x0a, 0x0f, 0x64, - 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x75, 0x70, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x69, - 0x67, 0x6e, 0x75, 0x70, 0x12, 0x36, 0x0a, 0x17, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, - 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x50, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x2a, 0x5b, 0x0a, 0x13, - 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, - 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x57, 0x4f, - 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, - 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x01, 0x42, 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x6f, - 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x15, 0x57, - 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, - 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, - 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x91, 0x01, 0x0a, + 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x12, 0x32, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x40, 0x0a, 0x07, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x07, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0xf5, 0x01, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x21, 0x0a, 0x0c, + 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x72, 0x6c, 0x12, + 0x27, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x69, 0x67, 0x6e, + 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x53, 0x69, 0x67, 0x6e, 0x75, 0x70, 0x12, 0x36, 0x0a, 0x17, 0x64, 0x69, 0x73, 0x61, + 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x6c, 0x6f, + 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x61, 0x6c, + 0x6c, 0x6f, 0x77, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e, + 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x64, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x29, 0x0a, + 0x10, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x79, 0x6c, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x2a, 0x5b, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, + 0x25, 0x0a, 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, + 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, + 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x47, 0x45, 0x4e, 0x45, + 0x52, 0x41, 0x4c, 0x10, 0x01, 0x42, 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, + 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, + 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, + 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, + 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -177,17 +288,20 @@ func file_store_workspace_setting_proto_rawDescGZIP() []byte { } var file_store_workspace_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_store_workspace_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_store_workspace_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_store_workspace_setting_proto_goTypes = []interface{}{ (WorkspaceSettingKey)(0), // 0: memos.store.WorkspaceSettingKey - (*WorkspaceGeneralSetting)(nil), // 1: memos.store.WorkspaceGeneralSetting + (*WorkspaceSetting)(nil), // 1: memos.store.WorkspaceSetting + (*WorkspaceGeneralSetting)(nil), // 2: memos.store.WorkspaceGeneralSetting } var file_store_workspace_setting_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 + 0, // 0: memos.store.WorkspaceSetting.key:type_name -> memos.store.WorkspaceSettingKey + 2, // 1: memos.store.WorkspaceSetting.general:type_name -> memos.store.WorkspaceGeneralSetting + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_store_workspace_setting_proto_init() } @@ -197,6 +311,18 @@ func file_store_workspace_setting_proto_init() { } if !protoimpl.UnsafeEnabled { file_store_workspace_setting_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WorkspaceSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_store_workspace_setting_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WorkspaceGeneralSetting); i { case 0: return &v.state @@ -209,13 +335,16 @@ func file_store_workspace_setting_proto_init() { } } } + file_store_workspace_setting_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*WorkspaceSetting_General)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_store_workspace_setting_proto_rawDesc, NumEnums: 1, - NumMessages: 1, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/store/user_setting.proto b/proto/store/user_setting.proto index 534b339e..b6df97bb 100644 --- a/proto/store/user_setting.proto +++ b/proto/store/user_setting.proto @@ -4,11 +4,25 @@ package memos.store; option go_package = "gen/store"; +enum UserSettingKey { + USER_SETTING_KEY_UNSPECIFIED = 0; + // Access tokens for the user. + USER_SETTING_ACCESS_TOKENS = 1; + // The locale of the user. + USER_SETTING_LOCALE = 2; + // The appearance of the user. + USER_SETTING_APPEARANCE = 3; + // The visibility of the memo. + USER_SETTING_MEMO_VISIBILITY = 4; + // The telegram user id of the user. + USER_SETTING_TELEGRAM_USER_ID = 5; + // The compact view for a memo. + USER_SETTING_COMPACT_VIEW = 6; +} + message UserSetting { int32 user_id = 1; - UserSettingKey key = 2; - oneof value { AccessTokensUserSetting access_tokens = 3; string locale = 4; @@ -19,28 +33,6 @@ message UserSetting { } } -enum UserSettingKey { - USER_SETTING_KEY_UNSPECIFIED = 0; - - // Access tokens for the user. - USER_SETTING_ACCESS_TOKENS = 1; - - // The locale of the user. - USER_SETTING_LOCALE = 2; - - // The appearance of the user. - USER_SETTING_APPEARANCE = 3; - - // The visibility of the memo. - USER_SETTING_MEMO_VISIBILITY = 4; - - // The telegram user id of the user. - USER_SETTING_TELEGRAM_USER_ID = 5; - - // The compact view for a memo. - USER_SETTING_COMPACT_VIEW = 6; -} - message AccessTokensUserSetting { message AccessToken { // The access token is a JWT token. diff --git a/proto/store/workspace_setting.proto b/proto/store/workspace_setting.proto index 2051c62f..8d93d9a5 100644 --- a/proto/store/workspace_setting.proto +++ b/proto/store/workspace_setting.proto @@ -6,13 +6,26 @@ option go_package = "gen/store"; enum WorkspaceSettingKey { WORKSPACE_SETTING_KEY_UNSPECIFIED = 0; + // WORKSPACE_SETTING_GENERAL is the key for general settings. WORKSPACE_SETTING_GENERAL = 1; } -message WorkspaceGeneralSetting { - string instance_url = 1; - - bool disallow_signup = 2; - - bool disallow_password_login = 3; +message WorkspaceSetting { + WorkspaceSettingKey key = 1; + oneof value { + WorkspaceGeneralSetting general = 2; + } +} + +message WorkspaceGeneralSetting { + // instance_url is the instance URL. + string instance_url = 1; + // disallow_signup is the flag to disallow signup. + bool disallow_signup = 2; + // disallow_password_login is the flag to disallow password login. + bool disallow_password_login = 3; + // additional_script is the additional script. + string additional_script = 5; + // additional_style is the additional style. + string additional_style = 6; } diff --git a/server/integration/telegram.go b/server/integration/telegram.go index 71830281..f69cff14 100644 --- a/server/integration/telegram.go +++ b/server/integration/telegram.go @@ -29,7 +29,12 @@ func NewTelegramHandler(store *store.Store) *TelegramHandler { } func (t *TelegramHandler) BotToken(ctx context.Context) string { - return t.store.GetWorkspaceSettingWithDefaultValue(ctx, apiv1.SystemSettingTelegramBotTokenName.String(), "") + if setting, err := t.store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ + Name: apiv1.SystemSettingTelegramBotTokenName.String(), + }); err == nil && setting != nil { + return setting.Value + } + return "" } const ( diff --git a/server/profile/profile.go b/server/profile/profile.go index 1c21e9df..e277f136 100644 --- a/server/profile/profile.go +++ b/server/profile/profile.go @@ -30,6 +30,8 @@ type Profile struct { Driver string `json:"-"` // Version is the current version of server Version string `json:"version"` + // ServeFrontend indicate the frontend is enabled or not + ServeFrontend bool `json:"frontend"` // Metric indicate the metric collection is enabled or not Metric bool `json:"-"` } diff --git a/server/server.go b/server/server.go index 80198169..123fb1b1 100644 --- a/server/server.go +++ b/server/server.go @@ -69,9 +69,11 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store } s.ID = serverID - // Register frontend service. - frontendService := frontend.NewFrontendService(profile, store) - frontendService.Serve(ctx, e) + if profile.ServeFrontend { + // Register frontend service. + frontendService := frontend.NewFrontendService(profile, store) + frontendService.Serve(ctx, e) + } secret := "usememos" if profile.Mode == "prod" { diff --git a/store/db/mysql/migrator.go b/store/db/mysql/migrator.go index 0a9d88ad..0c54e4ab 100644 --- a/store/db/mysql/migrator.go +++ b/store/db/mysql/migrator.go @@ -96,17 +96,17 @@ func (d *DB) prodMigrate(ctx context.Context) error { return nil } - println("start to migrate database schema") + fmt.Println("start to migrate database schema") for _, minorVersion := range getMinorVersionList() { normalizedVersion := minorVersion + ".0" if version.IsVersionGreaterThan(normalizedVersion, latestMigrationHistoryVersion) && version.IsVersionGreaterOrEqualThan(currentVersion, normalizedVersion) { - println("applying migration of", normalizedVersion) + fmt.Println("applying migration of", normalizedVersion) if err := d.applyMigrationForMinorVersion(ctx, minorVersion); err != nil { return errors.Wrap(err, "failed to apply minor version migration") } } } - println("end migrate") + fmt.Println("end migrate") return nil } diff --git a/store/db/mysql/workspace_setting.go b/store/db/mysql/workspace_setting.go index 1f46fea9..36d185ca 100644 --- a/store/db/mysql/workspace_setting.go +++ b/store/db/mysql/workspace_setting.go @@ -4,6 +4,9 @@ import ( "context" "strings" + "google.golang.org/protobuf/encoding/protojson" + + storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -57,3 +60,66 @@ func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspac return list, nil } + +func (d *DB) UpsertWorkspaceSettingV1(ctx context.Context, upsert *storepb.WorkspaceSetting) (*storepb.WorkspaceSetting, error) { + stmt := ` + INSERT INTO system_setting (name, value, description) + VALUES (?, ?, '') + ON DUPLICATE KEY UPDATE value = ?` + var valueString string + if upsert.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL { + valueBytes, err := protojson.Marshal(upsert.GetGeneral()) + if err != nil { + return nil, err + } + valueString = string(valueBytes) + } + if _, err := d.db.ExecContext(ctx, stmt, upsert.Key.String(), valueString, valueString); err != nil { + return nil, err + } + return upsert, nil +} + +func (d *DB) ListWorkspaceSettingsV1(ctx context.Context, find *store.FindWorkspaceSettingV1) ([]*storepb.WorkspaceSetting, error) { + where, args := []string{"1 = 1"}, []any{} + if find.Key != storepb.WorkspaceSettingKey_WORKSPACE_SETTING_KEY_UNSPECIFIED { + where, args = append(where, "name = ?"), append(args, find.Key.String()) + } + + query := `SELECT name, value FROM system_setting WHERE ` + strings.Join(where, " AND ") + + rows, err := d.db.QueryContext(ctx, query, args...) + if err != nil { + return nil, err + } + defer rows.Close() + + list := []*storepb.WorkspaceSetting{} + for rows.Next() { + workspaceSetting := &storepb.WorkspaceSetting{} + var keyString, valueString string + if err := rows.Scan( + &keyString, + &valueString, + ); err != nil { + return nil, err + } + workspaceSetting.Key = storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[keyString]) + if workspaceSetting.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL { + generalSetting := &storepb.WorkspaceGeneralSetting{} + if err := protojson.Unmarshal([]byte(valueString), generalSetting); err != nil { + return nil, err + } + workspaceSetting.Value = &storepb.WorkspaceSetting_General{General: generalSetting} + } else { + // Skip unknown workspace setting key. + continue + } + list = append(list, workspaceSetting) + } + if err := rows.Err(); err != nil { + return nil, err + } + + return list, nil +} diff --git a/store/db/postgres/migrator.go b/store/db/postgres/migrator.go index 4c74d4b6..21eeddb1 100644 --- a/store/db/postgres/migrator.go +++ b/store/db/postgres/migrator.go @@ -99,17 +99,17 @@ func (d *DB) prodMigrate(ctx context.Context) error { return nil } - println("start migrate") + fmt.Println("start migrate") for _, minorVersion := range getMinorVersionList() { normalizedVersion := minorVersion + ".0" if version.IsVersionGreaterThan(normalizedVersion, latestMigrationHistoryVersion) && version.IsVersionGreaterOrEqualThan(currentVersion, normalizedVersion) { - println("applying migration for", normalizedVersion) + fmt.Println("applying migration for", normalizedVersion) if err := d.applyMigrationForMinorVersion(ctx, minorVersion); err != nil { return errors.Wrap(err, "failed to apply minor version migration") } } } - println("end migrate") + fmt.Println("end migrate") return nil } diff --git a/store/db/postgres/workspace_setting.go b/store/db/postgres/workspace_setting.go index 061f30e5..ed2add3d 100644 --- a/store/db/postgres/workspace_setting.go +++ b/store/db/postgres/workspace_setting.go @@ -4,7 +4,9 @@ import ( "context" "strings" + storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" + "google.golang.org/protobuf/encoding/protojson" ) func (d *DB) UpsertWorkspaceSetting(ctx context.Context, upsert *store.WorkspaceSetting) (*store.WorkspaceSetting, error) { @@ -64,3 +66,69 @@ func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspac return list, nil } + +func (d *DB) UpsertWorkspaceSettingV1(ctx context.Context, upsert *storepb.WorkspaceSetting) (*storepb.WorkspaceSetting, error) { + stmt := ` + INSERT INTO system_setting ( + name, value, description + ) + VALUES ($1, $2, '') + ON CONFLICT(name) DO UPDATE + SET value = EXCLUDED.value` + var valueString string + if upsert.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL { + valueBytes, err := protojson.Marshal(upsert.GetGeneral()) + if err != nil { + return nil, err + } + valueString = string(valueBytes) + } + if _, err := d.db.ExecContext(ctx, stmt, upsert.Key.String(), valueString); err != nil { + return nil, err + } + return upsert, nil +} + +func (d *DB) ListWorkspaceSettingsV1(ctx context.Context, find *store.FindWorkspaceSettingV1) ([]*storepb.WorkspaceSetting, error) { + where, args := []string{"1 = 1"}, []any{} + if find.Key != storepb.WorkspaceSettingKey_WORKSPACE_SETTING_KEY_UNSPECIFIED { + where, args = append(where, "name = "+placeholder(len(args)+1)), append(args, find.Key.String()) + } + + query := `SELECT name, value FROM system_setting WHERE ` + strings.Join(where, " AND ") + + rows, err := d.db.QueryContext(ctx, query, args...) + if err != nil { + return nil, err + } + defer rows.Close() + + list := []*storepb.WorkspaceSetting{} + for rows.Next() { + workspaceSetting := &storepb.WorkspaceSetting{} + var keyString, valueString string + if err := rows.Scan( + &keyString, + &valueString, + ); err != nil { + return nil, err + } + workspaceSetting.Key = storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[keyString]) + if workspaceSetting.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL { + generalSetting := &storepb.WorkspaceGeneralSetting{} + if err := protojson.Unmarshal([]byte(valueString), generalSetting); err != nil { + return nil, err + } + workspaceSetting.Value = &storepb.WorkspaceSetting_General{General: generalSetting} + } else { + // Skip unknown workspace setting key. + continue + } + list = append(list, workspaceSetting) + } + if err := rows.Err(); err != nil { + return nil, err + } + + return list, nil +} diff --git a/store/db/sqlite/migrator.go b/store/db/sqlite/migrator.go index 106183a4..f174819d 100644 --- a/store/db/sqlite/migrator.go +++ b/store/db/sqlite/migrator.go @@ -81,22 +81,22 @@ func (d *DB) Migrate(ctx context.Context) error { if err := os.WriteFile(backupDBFilePath, rawBytes, 0644); err != nil { return errors.Wrap(err, "failed to write raw database file") } - println("succeed to copy a backup database file") - println("start migrate") + fmt.Println("succeed to copy a backup database file") + fmt.Println("start migrate") for _, minorVersion := range minorVersionList { normalizedVersion := minorVersion + ".0" if version.IsVersionGreaterThan(normalizedVersion, latestMigrationHistoryVersion) && version.IsVersionGreaterOrEqualThan(currentVersion, normalizedVersion) { - println("applying migration for", normalizedVersion) + fmt.Println("applying migration for", normalizedVersion) if err := d.applyMigrationForMinorVersion(ctx, minorVersion); err != nil { return errors.Wrap(err, "failed to apply minor version migration") } } } - println("end migrate") + fmt.Println("end migrate") // Remove the created backup db file after migrate succeed. if err := os.Remove(backupDBFilePath); err != nil { - println(fmt.Sprintf("Failed to remove temp database file, err %v", err)) + fmt.Printf("Failed to remove temp database file, err %v", err) } } } diff --git a/store/db/sqlite/user_setting.go b/store/db/sqlite/user_setting.go index 9918d36d..3a1c79bb 100644 --- a/store/db/sqlite/user_setting.go +++ b/store/db/sqlite/user_setting.go @@ -123,7 +123,6 @@ func (d *DB) ListUserSettings(ctx context.Context, find *store.FindUserSetting) } userSettingList = append(userSettingList, userSetting) } - if err := rows.Err(); err != nil { return nil, err } diff --git a/store/db/sqlite/workspace_setting.go b/store/db/sqlite/workspace_setting.go index f485f1b9..60be4f32 100644 --- a/store/db/sqlite/workspace_setting.go +++ b/store/db/sqlite/workspace_setting.go @@ -4,6 +4,9 @@ import ( "context" "strings" + "google.golang.org/protobuf/encoding/protojson" + + storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -64,3 +67,68 @@ func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspac return list, nil } + +func (d *DB) UpsertWorkspaceSettingV1(ctx context.Context, upsert *storepb.WorkspaceSetting) (*storepb.WorkspaceSetting, error) { + stmt := ` + INSERT INTO system_setting ( + name, value + ) + VALUES (?, ?) + ON CONFLICT(name) DO UPDATE + SET value = EXCLUDED.value` + var valueString string + if upsert.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL { + valueBytes, err := protojson.Marshal(upsert.GetGeneral()) + if err != nil { + return nil, err + } + valueString = string(valueBytes) + } + if _, err := d.db.ExecContext(ctx, stmt, upsert.Key.String(), valueString); err != nil { + return nil, err + } + return upsert, nil +} + +func (d *DB) ListWorkspaceSettingsV1(ctx context.Context, find *store.FindWorkspaceSettingV1) ([]*storepb.WorkspaceSetting, error) { + where, args := []string{"1 = 1"}, []any{} + if find.Key != storepb.WorkspaceSettingKey_WORKSPACE_SETTING_KEY_UNSPECIFIED { + where, args = append(where, "name = ?"), append(args, find.Key.String()) + } + + query := `SELECT name, value FROM system_setting WHERE ` + strings.Join(where, " AND ") + rows, err := d.db.QueryContext(ctx, query, args...) + if err != nil { + return nil, err + } + defer rows.Close() + + list := []*storepb.WorkspaceSetting{} + for rows.Next() { + workspaceSetting := &storepb.WorkspaceSetting{} + var keyString, valueString string + if err := rows.Scan( + &keyString, + &valueString, + ); err != nil { + return nil, err + } + workspaceSetting.Key = storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[keyString]) + if workspaceSetting.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL { + generalSetting := &storepb.WorkspaceGeneralSetting{} + if err := protojson.Unmarshal([]byte(valueString), generalSetting); err != nil { + return nil, err + } + workspaceSetting.Value = &storepb.WorkspaceSetting_General{General: generalSetting} + } else { + // Skip unknown workspace setting key. + continue + } + list = append(list, workspaceSetting) + } + if err := rows.Err(); err != nil { + return nil, err + } + + return list, nil +} diff --git a/store/driver.go b/store/driver.go index 909aab10..6014201e 100644 --- a/store/driver.go +++ b/store/driver.go @@ -52,6 +52,8 @@ type Driver interface { // WorkspaceSetting model related methods. UpsertWorkspaceSetting(ctx context.Context, upsert *WorkspaceSetting) (*WorkspaceSetting, error) ListWorkspaceSettings(ctx context.Context, find *FindWorkspaceSetting) ([]*WorkspaceSetting, error) + UpsertWorkspaceSettingV1(ctx context.Context, upsert *storepb.WorkspaceSetting) (*storepb.WorkspaceSetting, error) + ListWorkspaceSettingsV1(ctx context.Context, find *FindWorkspaceSettingV1) ([]*storepb.WorkspaceSetting, error) // User model related methods. CreateUser(ctx context.Context, create *User) (*User, error) diff --git a/store/store.go b/store/store.go index dcaf36b6..9c72d33a 100644 --- a/store/store.go +++ b/store/store.go @@ -9,12 +9,13 @@ import ( // Store provides database access to all raw objects. type Store struct { - Profile *profile.Profile - driver Driver - systemSettingCache sync.Map // map[string]*SystemSetting - userCache sync.Map // map[int]*User - userSettingCache sync.Map // map[string]*UserSetting - idpCache sync.Map // map[int]*IdentityProvider + Profile *profile.Profile + driver Driver + workspaceSettingCache sync.Map // map[string]*WorkspaceSetting + workspaceSettingV1Cache sync.Map // map[string]*storepb.WorkspaceSetting + userCache sync.Map // map[int]*User + userSettingCache sync.Map // map[string]*UserSetting + idpCache sync.Map // map[int]*IdentityProvider } // New creates a new instance of Store. diff --git a/store/workspace_setting.go b/store/workspace_setting.go index bea19052..4e17ab0a 100644 --- a/store/workspace_setting.go +++ b/store/workspace_setting.go @@ -2,6 +2,10 @@ package store import ( "context" + + "github.com/pkg/errors" + + storepb "github.com/usememos/memos/proto/gen/store" ) type WorkspaceSetting struct { @@ -25,14 +29,14 @@ func (s *Store) ListWorkspaceSettings(ctx context.Context, find *FindWorkspaceSe } for _, systemSettingMessage := range list { - s.systemSettingCache.Store(systemSettingMessage.Name, systemSettingMessage) + s.workspaceSettingCache.Store(systemSettingMessage.Name, systemSettingMessage) } return list, nil } func (s *Store) GetWorkspaceSetting(ctx context.Context, find *FindWorkspaceSetting) (*WorkspaceSetting, error) { if find.Name != "" { - if cache, ok := s.systemSettingCache.Load(find.Name); ok { + if cache, ok := s.workspaceSettingCache.Load(find.Name); ok { return cache.(*WorkspaceSetting), nil } } @@ -47,15 +51,51 @@ func (s *Store) GetWorkspaceSetting(ctx context.Context, find *FindWorkspaceSett } systemSettingMessage := list[0] - s.systemSettingCache.Store(systemSettingMessage.Name, systemSettingMessage) + s.workspaceSettingCache.Store(systemSettingMessage.Name, systemSettingMessage) return systemSettingMessage, nil } -func (s *Store) GetWorkspaceSettingWithDefaultValue(ctx context.Context, settingName string, defaultValue string) string { - if setting, err := s.GetWorkspaceSetting(ctx, &FindWorkspaceSetting{ - Name: settingName, - }); err == nil && setting != nil { - return setting.Value - } - return defaultValue +type FindWorkspaceSettingV1 struct { + Key storepb.WorkspaceSettingKey +} + +func (s *Store) UpsertWorkspaceSettingV1(ctx context.Context, upsert *storepb.WorkspaceSetting) (*storepb.WorkspaceSetting, error) { + workspaceSetting, err := s.driver.UpsertWorkspaceSettingV1(ctx, upsert) + if err != nil { + return nil, errors.Wrap(err, "Failed to upsert workspace setting") + } + s.workspaceSettingV1Cache.Store(workspaceSetting.Key.String(), workspaceSetting) + return workspaceSetting, nil +} + +func (s *Store) ListWorkspaceSettingsV1(ctx context.Context, find *FindWorkspaceSettingV1) ([]*storepb.WorkspaceSetting, error) { + list, err := s.driver.ListWorkspaceSettingsV1(ctx, find) + if err != nil { + return nil, err + } + + for _, workspaceSetting := range list { + s.workspaceSettingV1Cache.Store(workspaceSetting.Key.String(), workspaceSetting) + } + return list, nil +} + +func (s *Store) GetWorkspaceSettingV1(ctx context.Context, find *FindWorkspaceSettingV1) (*storepb.WorkspaceSetting, error) { + if find.Key != storepb.WorkspaceSettingKey_WORKSPACE_SETTING_KEY_UNSPECIFIED { + if cache, ok := s.workspaceSettingV1Cache.Load(find.Key.String()); ok { + return cache.(*storepb.WorkspaceSetting), nil + } + } + + list, err := s.ListWorkspaceSettingsV1(ctx, find) + if err != nil { + return nil, err + } + if len(list) == 0 { + return nil, nil + } + + workspaceSetting := list[0] + s.workspaceSettingV1Cache.Store(workspaceSetting.Key.String(), workspaceSetting) + return workspaceSetting, nil } diff --git a/test/store/workspace_setting_test.go b/test/store/workspace_setting_test.go index f032ce90..86e8cfcd 100644 --- a/test/store/workspace_setting_test.go +++ b/test/store/workspace_setting_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/require" apiv1 "github.com/usememos/memos/api/v1" + storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -38,3 +39,22 @@ func TestWorkspaceSettingStore(t *testing.T) { require.Equal(t, 4, len(list)) ts.Close() } + +func TestWorkspaceSettingV1Store(t *testing.T) { + ctx := context.Background() + ts := NewTestingStore(ctx, t) + workspaceSetting, err := ts.UpsertWorkspaceSettingV1(ctx, &storepb.WorkspaceSetting{ + Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL, + Value: &storepb.WorkspaceSetting_General{ + General: &storepb.WorkspaceGeneralSetting{ + DisallowSignup: true, + }, + }, + }) + require.NoError(t, err) + list, err := ts.ListWorkspaceSettingsV1(ctx, &store.FindWorkspaceSettingV1{}) + require.NoError(t, err) + require.Equal(t, 1, len(list)) + require.Equal(t, workspaceSetting, list[0]) + ts.Close() +} diff --git a/web/src/components/Settings/SystemSection.tsx b/web/src/components/Settings/SystemSection.tsx index f051d471..6eb65ca7 100644 --- a/web/src/components/Settings/SystemSection.tsx +++ b/web/src/components/Settings/SystemSection.tsx @@ -2,20 +2,18 @@ import { Button, Divider, Input, Switch, Textarea, Tooltip } from "@mui/joy"; import { useEffect, useState } from "react"; import { toast } from "react-hot-toast"; import { Link } from "react-router-dom"; +import { workspaceSettingServiceClient } from "@/grpcweb"; import * as api from "@/helpers/api"; import { useGlobalStore } from "@/store/module"; +import { WorkspaceSettingPrefix } from "@/store/v1"; +import { WorkspaceGeneralSetting } from "@/types/proto/api/v2/workspace_setting_service"; +import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; -import { showCommonDialog } from "../Dialog/CommonDialog"; -import showDisablePasswordLoginDialog from "../DisablePasswordLoginDialog"; import Icon from "../Icon"; import showUpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog"; interface State { - allowSignUp: boolean; - disablePasswordLogin: boolean; disablePublicMemos: boolean; - additionalStyle: string; - additionalScript: string; maxUploadSizeMiB: number; memoDisplayWithUpdatedTs: boolean; } @@ -25,19 +23,23 @@ const SystemSection = () => { const globalStore = useGlobalStore(); const systemStatus = globalStore.state.systemStatus; const [state, setState] = useState({ - allowSignUp: systemStatus.allowSignUp, - disablePasswordLogin: systemStatus.disablePasswordLogin, - additionalStyle: systemStatus.additionalStyle, - additionalScript: systemStatus.additionalScript, disablePublicMemos: systemStatus.disablePublicMemos, maxUploadSizeMiB: systemStatus.maxUploadSizeMiB, memoDisplayWithUpdatedTs: systemStatus.memoDisplayWithUpdatedTs, }); + const [workspaceGeneralSetting, setWorkspaceGeneralSetting] = useState(WorkspaceGeneralSetting.fromPartial({})); const [telegramBotToken, setTelegramBotToken] = useState(""); - const [instanceUrl, setInstanceUrl] = useState(""); useEffect(() => { - globalStore.fetchSystemStatus(); + (async () => { + await globalStore.fetchSystemStatus(); + const { setting } = await workspaceSettingServiceClient.getWorkspaceSetting({ + name: `${WorkspaceSettingPrefix}${WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL}`, + }); + if (setting && setting.generalSetting) { + setWorkspaceGeneralSetting(WorkspaceGeneralSetting.fromPartial(setting.generalSetting)); + } + })(); }, []); useEffect(() => { @@ -46,20 +48,12 @@ const SystemSection = () => { if (telegramBotSetting) { setTelegramBotToken(telegramBotSetting.value); } - const instanceUrlSetting = systemSettings.find((setting) => setting.name === "instance-url"); - if (instanceUrlSetting) { - setInstanceUrl(instanceUrlSetting.value); - } }); }, []); useEffect(() => { setState({ ...state, - allowSignUp: systemStatus.allowSignUp, - disablePasswordLogin: systemStatus.disablePasswordLogin, - additionalStyle: systemStatus.additionalStyle, - additionalScript: systemStatus.additionalScript, disablePublicMemos: systemStatus.disablePublicMemos, maxUploadSizeMiB: systemStatus.maxUploadSizeMiB, memoDisplayWithUpdatedTs: systemStatus.memoDisplayWithUpdatedTs, @@ -67,36 +61,24 @@ const SystemSection = () => { }, [systemStatus]); const handleAllowSignUpChanged = async (value: boolean) => { - setState({ - ...state, - allowSignUp: value, - }); - globalStore.setSystemStatus({ allowSignUp: value }); - await api.upsertSystemSetting({ - name: "allow-signup", - value: JSON.stringify(value), + const setting = { ...workspaceGeneralSetting, disallowSignup: !value }; + await workspaceSettingServiceClient.setWorkspaceSetting({ + setting: { + name: `${WorkspaceSettingPrefix}${WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL}`, + generalSetting: setting, + }, }); + setWorkspaceGeneralSetting(setting); }; const handleDisablePasswordLoginChanged = async (value: boolean) => { - if (value) { - showDisablePasswordLoginDialog(); - } else { - showCommonDialog({ - title: t("setting.system-section.enable-password-login"), - content: t("setting.system-section.enable-password-login-warning"), - style: "danger", - dialogName: "enable-password-login-dialog", - onConfirm: async () => { - setState({ ...state, disablePasswordLogin: value }); - globalStore.setSystemStatus({ disablePasswordLogin: value }); - await api.upsertSystemSetting({ - name: "disable-password-login", - value: JSON.stringify(value), - }); - }, - }); - } + setWorkspaceGeneralSetting({ ...workspaceGeneralSetting, disallowPasswordLogin: value }); + await workspaceSettingServiceClient.setWorkspaceSetting({ + setting: { + name: `${WorkspaceSettingPrefix}${WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL}`, + generalSetting: workspaceGeneralSetting, + }, + }); }; const handleUpdateCustomizedProfileButtonClick = () => { @@ -104,14 +86,16 @@ const SystemSection = () => { }; const handleInstanceUrlChanged = (value: string) => { - setInstanceUrl(value); + setWorkspaceGeneralSetting({ ...workspaceGeneralSetting, instanceUrl: value }); }; const handleSaveInstanceUrl = async () => { try { - await api.upsertSystemSetting({ - name: "instance-url", - value: instanceUrl, + await workspaceSettingServiceClient.setWorkspaceSetting({ + setting: { + name: `${WorkspaceSettingPrefix}${WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL}`, + generalSetting: workspaceGeneralSetting, + }, }); } catch (error: any) { console.error(error); @@ -140,17 +124,16 @@ const SystemSection = () => { }; const handleAdditionalStyleChanged = (value: string) => { - setState({ - ...state, - additionalStyle: value, - }); + setWorkspaceGeneralSetting({ ...workspaceGeneralSetting, additionalStyle: value }); }; const handleSaveAdditionalStyle = async () => { try { - await api.upsertSystemSetting({ - name: "additional-style", - value: JSON.stringify(state.additionalStyle), + await workspaceSettingServiceClient.setWorkspaceSetting({ + setting: { + name: `${WorkspaceSettingPrefix}${WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL}`, + generalSetting: workspaceGeneralSetting, + }, }); } catch (error: any) { toast.error(error.response.data.message); @@ -161,17 +144,16 @@ const SystemSection = () => { }; const handleAdditionalScriptChanged = (value: string) => { - setState({ - ...state, - additionalScript: value, - }); + setWorkspaceGeneralSetting({ ...workspaceGeneralSetting, additionalScript: value }); }; const handleSaveAdditionalScript = async () => { try { - await api.upsertSystemSetting({ - name: "additional-script", - value: JSON.stringify(state.additionalScript), + await workspaceSettingServiceClient.setWorkspaceSetting({ + setting: { + name: `${WorkspaceSettingPrefix}${WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL}`, + generalSetting: workspaceGeneralSetting, + }, }); } catch (error: any) { toast.error(error.response.data.message); @@ -241,11 +223,14 @@ const SystemSection = () => {

{t("common.settings")}

{t("setting.system-section.allow-user-signup")} - handleAllowSignUpChanged(event.target.checked)} /> + handleAllowSignUpChanged(event.target.checked)} />
{t("setting.system-section.disable-password-login")} - handleDisablePasswordLoginChanged(event.target.checked)} /> + handleDisablePasswordLoginChanged(event.target.checked)} + />
{t("setting.system-section.disable-public-memos")} @@ -290,7 +275,7 @@ const SystemSection = () => { fontSize: "14px", }} placeholder={"Should be started with http:// or https://"} - value={instanceUrl} + value={workspaceGeneralSetting.instanceUrl} onChange={(event) => handleInstanceUrlChanged(event.target.value)} />
@@ -350,7 +335,7 @@ const SystemSection = () => { minRows={2} maxRows={4} placeholder={t("setting.system-section.additional-style-placeholder")} - value={state.additionalStyle} + value={workspaceGeneralSetting.additionalStyle} onChange={(event) => handleAdditionalStyleChanged(event.target.value)} />
@@ -369,7 +354,7 @@ const SystemSection = () => { minRows={2} maxRows={4} placeholder={t("setting.system-section.additional-script-placeholder")} - value={state.additionalScript} + value={workspaceGeneralSetting.additionalScript} onChange={(event) => handleAdditionalScriptChanged(event.target.value)} />
diff --git a/web/src/grpcweb.ts b/web/src/grpcweb.ts index a42ebab9..a3613ce1 100644 --- a/web/src/grpcweb.ts +++ b/web/src/grpcweb.ts @@ -8,6 +8,7 @@ import { TagServiceDefinition } from "./types/proto/api/v2/tag_service"; import { UserServiceDefinition } from "./types/proto/api/v2/user_service"; import { WebhookServiceDefinition } from "./types/proto/api/v2/webhook_service"; import { WorkspaceServiceDefinition } from "./types/proto/api/v2/workspace_service"; +import { WorkspaceSettingServiceDefinition } from "./types/proto/api/v2/workspace_setting_service"; const channel = createChannel( import.meta.env.VITE_API_BASE_URL || window.location.origin, @@ -20,6 +21,8 @@ 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); diff --git a/web/src/store/v1/resourceName.ts b/web/src/store/v1/resourceName.ts index 80596d0e..b1ac00a4 100644 --- a/web/src/store/v1/resourceName.ts +++ b/web/src/store/v1/resourceName.ts @@ -1,3 +1,4 @@ +export const WorkspaceSettingPrefix = "settings/"; export const UserNamePrefix = "users/"; export const MemoNamePrefix = "memos/";