diff --git a/CLAUDE.md b/CLAUDE.md
index 71929b9e9..89b276df2 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -122,7 +122,7 @@ The server uses `cmux` (connection multiplexer) to serve both gRPC and HTTP on t
- **HTTP/1.1** → Echo server (REST API via gRPC-Gateway, static files, RSS)
**API Services** (defined in `proto/api/v1/*.proto`):
-- `WorkspaceService` - Workspace settings and profiles
+- `InstanceService` - Instance settings and profiles
- `AuthService` - Authentication and session management
- `UserService` - User management
- `MemoService` - Core memo CRUD operations
@@ -147,7 +147,7 @@ The `store.Driver` interface (`store/driver.go`) defines all data access methods
- `store/db/postgres/` - PostgreSQL driver
**Migrations:**
-Each driver contains its own migration files in subdirectories. Schema version tracking is stored in `workspace_setting` (key: `bb.general.version`). The `store/migrator.go` orchestrates migrations across all drivers.
+Each driver contains its own migration files in subdirectories. Schema version tracking is stored in `instance_setting` (key: `bb.general.version`). The `store/migrator.go` orchestrates migrations across all drivers.
**Key Models:**
- `Memo` - Core note/memo entity
@@ -157,7 +157,7 @@ Each driver contains its own migration files in subdirectories. Schema version t
- `Activity` - Activity log entries
- `Inbox` - Inbox items
- `Reaction` - Emoji reactions
-- `WorkspaceSetting` - Workspace-level configuration
+- `InstanceSetting` - Instance-level configuration
- `UserSetting` - User preferences
- `IdentityProvider` - OAuth/SSO provider configs
diff --git a/proto/api/v1/workspace_service.proto b/proto/api/v1/instance_service.proto
similarity index 72%
rename from proto/api/v1/workspace_service.proto
rename to proto/api/v1/instance_service.proto
index 110849430..55303a688 100644
--- a/proto/api/v1/workspace_service.proto
+++ b/proto/api/v1/instance_service.proto
@@ -10,30 +10,30 @@ import "google/protobuf/field_mask.proto";
option go_package = "gen/api/v1";
-service WorkspaceService {
- // Gets the workspace profile.
- rpc GetWorkspaceProfile(GetWorkspaceProfileRequest) returns (WorkspaceProfile) {
- option (google.api.http) = {get: "/api/v1/workspace/profile"};
+service InstanceService {
+ // Gets the instance profile.
+ rpc GetInstanceProfile(GetInstanceProfileRequest) returns (InstanceProfile) {
+ option (google.api.http) = {get: "/api/v1/instance/profile"};
}
- // Gets a workspace setting.
- rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (WorkspaceSetting) {
- option (google.api.http) = {get: "/api/v1/{name=workspace/settings/*}"};
+ // Gets an instance setting.
+ rpc GetInstanceSetting(GetInstanceSettingRequest) returns (InstanceSetting) {
+ option (google.api.http) = {get: "/api/v1/{name=instance/settings/*}"};
option (google.api.method_signature) = "name";
}
- // Updates a workspace setting.
- rpc UpdateWorkspaceSetting(UpdateWorkspaceSettingRequest) returns (WorkspaceSetting) {
+ // Updates an instance setting.
+ rpc UpdateInstanceSetting(UpdateInstanceSettingRequest) returns (InstanceSetting) {
option (google.api.http) = {
- patch: "/api/v1/{setting.name=workspace/settings/*}"
+ patch: "/api/v1/{setting.name=instance/settings/*}"
body: "setting"
};
option (google.api.method_signature) = "setting,update_mask";
}
}
-// Workspace profile message containing basic workspace information.
-message WorkspaceProfile {
+// Instance profile message containing basic instance information.
+message InstanceProfile {
// The name of instance owner.
// Format: users/{user}
string owner = 1;
@@ -48,20 +48,20 @@ message WorkspaceProfile {
string instance_url = 6;
}
-// Request for workspace profile.
-message GetWorkspaceProfileRequest {}
+// Request for instance profile.
+message GetInstanceProfileRequest {}
-// A workspace setting resource.
-message WorkspaceSetting {
+// An instance setting resource.
+message InstanceSetting {
option (google.api.resource) = {
- type: "memos.api.v1/WorkspaceSetting"
- pattern: "workspace/settings/{setting}"
- singular: "workspaceSetting"
- plural: "workspaceSettings"
+ type: "memos.api.v1/InstanceSetting"
+ pattern: "instance/settings/{setting}"
+ singular: "instanceSetting"
+ plural: "instanceSettings"
};
- // The name of the workspace setting.
- // Format: workspace/settings/{setting}
+ // The name of the instance setting.
+ // Format: instance/settings/{setting}
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
oneof value {
@@ -70,7 +70,7 @@ message WorkspaceSetting {
MemoRelatedSetting memo_related_setting = 4;
}
- // Enumeration of workspace setting keys.
+ // Enumeration of instance setting keys.
enum Key {
KEY_UNSPECIFIED = 0;
// GENERAL is the key for general settings.
@@ -81,7 +81,7 @@ message WorkspaceSetting {
MEMO_RELATED = 3;
}
- // General workspace settings configuration.
+ // General instance settings configuration.
message GeneralSetting {
// theme is the name of the selected theme.
// This references a CSS file in the web/public/themes/ directory.
@@ -106,7 +106,7 @@ message WorkspaceSetting {
// disallow_change_nickname disallows changing nickname.
bool disallow_change_nickname = 9;
- // Custom profile configuration for workspace branding.
+ // Custom profile configuration for instance branding.
message CustomProfile {
string title = 1;
string description = 2;
@@ -115,7 +115,7 @@ message WorkspaceSetting {
}
}
- // Storage configuration settings for workspace attachments.
+ // Storage configuration settings for instance attachments.
message StorageSetting {
// Storage type enumeration for different storage backends.
enum StorageType {
@@ -149,7 +149,7 @@ message WorkspaceSetting {
S3Config s3_config = 4;
}
- // Memo-related workspace settings and policies.
+ // Memo-related instance settings and policies.
message MemoRelatedSetting {
// disallow_public_visibility disallows set memo as public visibility.
bool disallow_public_visibility = 1;
@@ -172,20 +172,20 @@ message WorkspaceSetting {
}
}
-// Request message for GetWorkspaceSetting method.
-message GetWorkspaceSettingRequest {
- // The resource name of the workspace setting.
- // Format: workspace/settings/{setting}
+// Request message for GetInstanceSetting method.
+message GetInstanceSettingRequest {
+ // The resource name of the instance setting.
+ // Format: instance/settings/{setting}
string name = 1 [
(google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "memos.api.v1/WorkspaceSetting"}
+ (google.api.resource_reference) = {type: "memos.api.v1/InstanceSetting"}
];
}
-// Request message for UpdateWorkspaceSetting method.
-message UpdateWorkspaceSettingRequest {
- // The workspace setting resource which replaces the resource on the server.
- WorkspaceSetting setting = 1 [(google.api.field_behavior) = REQUIRED];
+// Request message for UpdateInstanceSetting method.
+message UpdateInstanceSettingRequest {
+ // The instance setting resource which replaces the resource on the server.
+ InstanceSetting setting = 1 [(google.api.field_behavior) = REQUIRED];
// The list of fields to update.
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
diff --git a/proto/gen/api/v1/idp_service.pb.go b/proto/gen/api/v1/idp_service.pb.go
index 2e85a7cb5..600219a00 100644
--- a/proto/gen/api/v1/idp_service.pb.go
+++ b/proto/gen/api/v1/idp_service.pb.go
@@ -74,7 +74,7 @@ func (IdentityProvider_Type) EnumDescriptor() ([]byte, []int) {
type IdentityProvider struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The resource name of the identity provider.
- // Format: identityProviders/{idp}
+ // Format: identity-providers/{idp}
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Required. The type of the identity provider.
Type IdentityProvider_Type `protobuf:"varint,2,opt,name=type,proto3,enum=memos.api.v1.IdentityProvider_Type" json:"type,omitempty"`
@@ -463,7 +463,7 @@ func (x *ListIdentityProvidersResponse) GetIdentityProviders() []*IdentityProvid
type GetIdentityProviderRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Required. The resource name of the identity provider to get.
- // Format: identityProviders/{idp}
+ // Format: identity-providers/{idp}
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@@ -619,7 +619,7 @@ func (x *UpdateIdentityProviderRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
type DeleteIdentityProviderRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Required. The resource name of the identity provider to delete.
- // Format: identityProviders/{idp}
+ // Format: identity-providers/{idp}
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@@ -666,7 +666,7 @@ var File_api_v1_idp_service_proto protoreflect.FileDescriptor
const file_api_v1_idp_service_proto_rawDesc = "" +
"\n" +
- "\x18api/v1/idp_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\x8b\x03\n" +
+ "\x18api/v1/idp_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\x8c\x03\n" +
"\x10IdentityProvider\x12\x17\n" +
"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12<\n" +
"\x04type\x18\x02 \x01(\x0e2#.memos.api.v1.IdentityProvider.TypeB\x03\xe0A\x02R\x04type\x12\x19\n" +
@@ -676,8 +676,8 @@ const file_api_v1_idp_service_proto_rawDesc = "" +
"\x04Type\x12\x14\n" +
"\x10TYPE_UNSPECIFIED\x10\x00\x12\n" +
"\n" +
- "\x06OAUTH2\x10\x01:f\xeaAc\n" +
- "\x1dmemos.api.v1/IdentityProvider\x12\x17identityProviders/{idp}\x1a\x04name*\x11identityProviders2\x10identityProvider\"e\n" +
+ "\x06OAUTH2\x10\x01:g\xeaAd\n" +
+ "\x1dmemos.api.v1/IdentityProvider\x12\x18identity-providers/{idp}\x1a\x04name*\x11identityProviders2\x10identityProvider\"e\n" +
"\x16IdentityProviderConfig\x12A\n" +
"\roauth2_config\x18\x01 \x01(\v2\x1a.memos.api.v1.OAuth2ConfigH\x00R\foauth2ConfigB\b\n" +
"\x06config\"\x86\x01\n" +
@@ -712,13 +712,13 @@ const file_api_v1_idp_service_proto_rawDesc = "" +
"updateMask\"Z\n" +
"\x1dDeleteIdentityProviderRequest\x129\n" +
"\x04name\x18\x01 \x01(\tB%\xe0A\x02\xfaA\x1f\n" +
- "\x1dmemos.api.v1/IdentityProviderR\x04name2\xe2\x06\n" +
- "\x17IdentityProviderService\x12\x93\x01\n" +
- "\x15ListIdentityProviders\x12*.memos.api.v1.ListIdentityProvidersRequest\x1a+.memos.api.v1.ListIdentityProvidersResponse\"!\x82\xd3\xe4\x93\x02\x1b\x12\x19/api/v1/identityProviders\x12\x92\x01\n" +
- "\x13GetIdentityProvider\x12(.memos.api.v1.GetIdentityProviderRequest\x1a\x1e.memos.api.v1.IdentityProvider\"1\xdaA\x04name\x82\xd3\xe4\x93\x02$\x12\"/api/v1/{name=identityProviders/*}\x12\xaf\x01\n" +
- "\x16CreateIdentityProvider\x12+.memos.api.v1.CreateIdentityProviderRequest\x1a\x1e.memos.api.v1.IdentityProvider\"H\xdaA\x11identity_provider\x82\xd3\xe4\x93\x02.:\x11identity_provider\"\x19/api/v1/identityProviders\x12\xd6\x01\n" +
- "\x16UpdateIdentityProvider\x12+.memos.api.v1.UpdateIdentityProviderRequest\x1a\x1e.memos.api.v1.IdentityProvider\"o\xdaA\x1didentity_provider,update_mask\x82\xd3\xe4\x93\x02I:\x11identity_provider24/api/v1/{identity_provider.name=identityProviders/*}\x12\x90\x01\n" +
- "\x16DeleteIdentityProvider\x12+.memos.api.v1.DeleteIdentityProviderRequest\x1a\x16.google.protobuf.Empty\"1\xdaA\x04name\x82\xd3\xe4\x93\x02$*\"/api/v1/{name=identityProviders/*}B\xa7\x01\n" +
+ "\x1dmemos.api.v1/IdentityProviderR\x04name2\xe7\x06\n" +
+ "\x17IdentityProviderService\x12\x94\x01\n" +
+ "\x15ListIdentityProviders\x12*.memos.api.v1.ListIdentityProvidersRequest\x1a+.memos.api.v1.ListIdentityProvidersResponse\"\"\x82\xd3\xe4\x93\x02\x1c\x12\x1a/api/v1/identity-providers\x12\x93\x01\n" +
+ "\x13GetIdentityProvider\x12(.memos.api.v1.GetIdentityProviderRequest\x1a\x1e.memos.api.v1.IdentityProvider\"2\xdaA\x04name\x82\xd3\xe4\x93\x02%\x12#/api/v1/{name=identity-providers/*}\x12\xb0\x01\n" +
+ "\x16CreateIdentityProvider\x12+.memos.api.v1.CreateIdentityProviderRequest\x1a\x1e.memos.api.v1.IdentityProvider\"I\xdaA\x11identity_provider\x82\xd3\xe4\x93\x02/:\x11identity_provider\"\x1a/api/v1/identity-providers\x12\xd7\x01\n" +
+ "\x16UpdateIdentityProvider\x12+.memos.api.v1.UpdateIdentityProviderRequest\x1a\x1e.memos.api.v1.IdentityProvider\"p\xdaA\x1didentity_provider,update_mask\x82\xd3\xe4\x93\x02J:\x11identity_provider25/api/v1/{identity_provider.name=identity-providers/*}\x12\x91\x01\n" +
+ "\x16DeleteIdentityProvider\x12+.memos.api.v1.DeleteIdentityProviderRequest\x1a\x16.google.protobuf.Empty\"2\xdaA\x04name\x82\xd3\xe4\x93\x02%*#/api/v1/{name=identity-providers/*}B\xa7\x01\n" +
"\x10com.memos.api.v1B\x0fIdpServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
var (
diff --git a/proto/gen/api/v1/idp_service.pb.gw.go b/proto/gen/api/v1/idp_service.pb.gw.go
index 94d74df83..1c198c5a2 100644
--- a/proto/gen/api/v1/idp_service.pb.gw.go
+++ b/proto/gen/api/v1/idp_service.pb.gw.go
@@ -268,7 +268,7 @@ func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runt
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/ListIdentityProviders", runtime.WithHTTPPathPattern("/api/v1/identityProviders"))
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/ListIdentityProviders", runtime.WithHTTPPathPattern("/api/v1/identity-providers"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -288,7 +288,7 @@ func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runt
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/GetIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identityProviders/*}"))
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/GetIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identity-providers/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -308,7 +308,7 @@ func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runt
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/CreateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/identityProviders"))
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/CreateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/identity-providers"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -328,7 +328,7 @@ func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runt
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/UpdateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{identity_provider.name=identityProviders/*}"))
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/UpdateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{identity_provider.name=identity-providers/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -348,7 +348,7 @@ func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runt
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/DeleteIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identityProviders/*}"))
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/DeleteIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identity-providers/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -406,7 +406,7 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/ListIdentityProviders", runtime.WithHTTPPathPattern("/api/v1/identityProviders"))
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/ListIdentityProviders", runtime.WithHTTPPathPattern("/api/v1/identity-providers"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -423,7 +423,7 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/GetIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identityProviders/*}"))
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/GetIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identity-providers/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -440,7 +440,7 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/CreateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/identityProviders"))
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/CreateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/identity-providers"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -457,7 +457,7 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/UpdateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{identity_provider.name=identityProviders/*}"))
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/UpdateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{identity_provider.name=identity-providers/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -474,7 +474,7 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/DeleteIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identityProviders/*}"))
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/DeleteIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identity-providers/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -491,11 +491,11 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt
}
var (
- pattern_IdentityProviderService_ListIdentityProviders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "identityProviders"}, ""))
- pattern_IdentityProviderService_GetIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identityProviders", "name"}, ""))
- pattern_IdentityProviderService_CreateIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "identityProviders"}, ""))
- pattern_IdentityProviderService_UpdateIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identityProviders", "identity_provider.name"}, ""))
- pattern_IdentityProviderService_DeleteIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identityProviders", "name"}, ""))
+ pattern_IdentityProviderService_ListIdentityProviders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "identity-providers"}, ""))
+ pattern_IdentityProviderService_GetIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identity-providers", "name"}, ""))
+ pattern_IdentityProviderService_CreateIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "identity-providers"}, ""))
+ pattern_IdentityProviderService_UpdateIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identity-providers", "identity_provider.name"}, ""))
+ pattern_IdentityProviderService_DeleteIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identity-providers", "name"}, ""))
)
var (
diff --git a/proto/gen/api/v1/inbox_service.pb.go b/proto/gen/api/v1/inbox_service.pb.go
deleted file mode 100644
index fdcdc527c..000000000
--- a/proto/gen/api/v1/inbox_service.pb.go
+++ /dev/null
@@ -1,617 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.36.10
-// protoc (unknown)
-// source: api/v1/inbox_service.proto
-
-package apiv1
-
-import (
- _ "google.golang.org/genproto/googleapis/api/annotations"
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- emptypb "google.golang.org/protobuf/types/known/emptypb"
- fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
- timestamppb "google.golang.org/protobuf/types/known/timestamppb"
- reflect "reflect"
- sync "sync"
- unsafe "unsafe"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-// Status enumeration for inbox notifications.
-type Inbox_Status int32
-
-const (
- // Unspecified status.
- Inbox_STATUS_UNSPECIFIED Inbox_Status = 0
- // The notification is unread.
- Inbox_UNREAD Inbox_Status = 1
- // The notification is archived.
- Inbox_ARCHIVED Inbox_Status = 2
-)
-
-// Enum value maps for Inbox_Status.
-var (
- Inbox_Status_name = map[int32]string{
- 0: "STATUS_UNSPECIFIED",
- 1: "UNREAD",
- 2: "ARCHIVED",
- }
- Inbox_Status_value = map[string]int32{
- "STATUS_UNSPECIFIED": 0,
- "UNREAD": 1,
- "ARCHIVED": 2,
- }
-)
-
-func (x Inbox_Status) Enum() *Inbox_Status {
- p := new(Inbox_Status)
- *p = x
- return p
-}
-
-func (x Inbox_Status) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (Inbox_Status) Descriptor() protoreflect.EnumDescriptor {
- return file_api_v1_inbox_service_proto_enumTypes[0].Descriptor()
-}
-
-func (Inbox_Status) Type() protoreflect.EnumType {
- return &file_api_v1_inbox_service_proto_enumTypes[0]
-}
-
-func (x Inbox_Status) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use Inbox_Status.Descriptor instead.
-func (Inbox_Status) EnumDescriptor() ([]byte, []int) {
- return file_api_v1_inbox_service_proto_rawDescGZIP(), []int{0, 0}
-}
-
-// Type enumeration for inbox notifications.
-type Inbox_Type int32
-
-const (
- // Unspecified type.
- Inbox_TYPE_UNSPECIFIED Inbox_Type = 0
- // Memo comment notification.
- Inbox_MEMO_COMMENT Inbox_Type = 1
-)
-
-// Enum value maps for Inbox_Type.
-var (
- Inbox_Type_name = map[int32]string{
- 0: "TYPE_UNSPECIFIED",
- 1: "MEMO_COMMENT",
- }
- Inbox_Type_value = map[string]int32{
- "TYPE_UNSPECIFIED": 0,
- "MEMO_COMMENT": 1,
- }
-)
-
-func (x Inbox_Type) Enum() *Inbox_Type {
- p := new(Inbox_Type)
- *p = x
- return p
-}
-
-func (x Inbox_Type) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (Inbox_Type) Descriptor() protoreflect.EnumDescriptor {
- return file_api_v1_inbox_service_proto_enumTypes[1].Descriptor()
-}
-
-func (Inbox_Type) Type() protoreflect.EnumType {
- return &file_api_v1_inbox_service_proto_enumTypes[1]
-}
-
-func (x Inbox_Type) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use Inbox_Type.Descriptor instead.
-func (Inbox_Type) EnumDescriptor() ([]byte, []int) {
- return file_api_v1_inbox_service_proto_rawDescGZIP(), []int{0, 1}
-}
-
-type Inbox struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The resource name of the inbox.
- // Format: inboxes/{inbox}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // The sender of the inbox notification.
- // Format: users/{user}
- Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"`
- // The receiver of the inbox notification.
- // Format: users/{user}
- Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"`
- // The status of the inbox notification.
- Status Inbox_Status `protobuf:"varint,4,opt,name=status,proto3,enum=memos.api.v1.Inbox_Status" json:"status,omitempty"`
- // Output only. The creation timestamp.
- CreateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
- // The type of the inbox notification.
- Type Inbox_Type `protobuf:"varint,6,opt,name=type,proto3,enum=memos.api.v1.Inbox_Type" json:"type,omitempty"`
- // Optional. The activity ID associated with this inbox notification.
- ActivityId *int32 `protobuf:"varint,7,opt,name=activity_id,json=activityId,proto3,oneof" json:"activity_id,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *Inbox) Reset() {
- *x = Inbox{}
- mi := &file_api_v1_inbox_service_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *Inbox) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Inbox) ProtoMessage() {}
-
-func (x *Inbox) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_inbox_service_proto_msgTypes[0]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Inbox.ProtoReflect.Descriptor instead.
-func (*Inbox) Descriptor() ([]byte, []int) {
- return file_api_v1_inbox_service_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *Inbox) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-func (x *Inbox) GetSender() string {
- if x != nil {
- return x.Sender
- }
- return ""
-}
-
-func (x *Inbox) GetReceiver() string {
- if x != nil {
- return x.Receiver
- }
- return ""
-}
-
-func (x *Inbox) GetStatus() Inbox_Status {
- if x != nil {
- return x.Status
- }
- return Inbox_STATUS_UNSPECIFIED
-}
-
-func (x *Inbox) GetCreateTime() *timestamppb.Timestamp {
- if x != nil {
- return x.CreateTime
- }
- return nil
-}
-
-func (x *Inbox) GetType() Inbox_Type {
- if x != nil {
- return x.Type
- }
- return Inbox_TYPE_UNSPECIFIED
-}
-
-func (x *Inbox) GetActivityId() int32 {
- if x != nil && x.ActivityId != nil {
- return *x.ActivityId
- }
- return 0
-}
-
-type ListInboxesRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The parent resource whose inboxes will be listed.
- // Format: users/{user}
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
- // Optional. The maximum number of inboxes to return.
- // The service may return fewer than this value.
- // If unspecified, at most 50 inboxes will be returned.
- // The maximum value is 1000; values above 1000 will be coerced to 1000.
- PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
- // Optional. A page token, received from a previous `ListInboxes` call.
- // Provide this to retrieve the subsequent page.
- PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
- // Optional. Filter to apply to the list results.
- // Example: "status=UNREAD" or "type=MEMO_COMMENT"
- // Supported operators: =, !=
- // Supported fields: status, type, sender, create_time
- Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"`
- // Optional. The order to sort results by.
- // Example: "create_time desc" or "status asc"
- OrderBy string `protobuf:"bytes,5,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *ListInboxesRequest) Reset() {
- *x = ListInboxesRequest{}
- mi := &file_api_v1_inbox_service_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *ListInboxesRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListInboxesRequest) ProtoMessage() {}
-
-func (x *ListInboxesRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_inbox_service_proto_msgTypes[1]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ListInboxesRequest.ProtoReflect.Descriptor instead.
-func (*ListInboxesRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_inbox_service_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *ListInboxesRequest) GetParent() string {
- if x != nil {
- return x.Parent
- }
- return ""
-}
-
-func (x *ListInboxesRequest) GetPageSize() int32 {
- if x != nil {
- return x.PageSize
- }
- return 0
-}
-
-func (x *ListInboxesRequest) GetPageToken() string {
- if x != nil {
- return x.PageToken
- }
- return ""
-}
-
-func (x *ListInboxesRequest) GetFilter() string {
- if x != nil {
- return x.Filter
- }
- return ""
-}
-
-func (x *ListInboxesRequest) GetOrderBy() string {
- if x != nil {
- return x.OrderBy
- }
- return ""
-}
-
-type ListInboxesResponse struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The list of inboxes.
- Inboxes []*Inbox `protobuf:"bytes,1,rep,name=inboxes,proto3" json:"inboxes,omitempty"`
- // A token that can be sent as `page_token` to retrieve the next page.
- // If this field is omitted, there are no subsequent pages.
- NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
- // The total count of inboxes (may be approximate).
- TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *ListInboxesResponse) Reset() {
- *x = ListInboxesResponse{}
- mi := &file_api_v1_inbox_service_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *ListInboxesResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListInboxesResponse) ProtoMessage() {}
-
-func (x *ListInboxesResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_inbox_service_proto_msgTypes[2]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ListInboxesResponse.ProtoReflect.Descriptor instead.
-func (*ListInboxesResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_inbox_service_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *ListInboxesResponse) GetInboxes() []*Inbox {
- if x != nil {
- return x.Inboxes
- }
- return nil
-}
-
-func (x *ListInboxesResponse) GetNextPageToken() string {
- if x != nil {
- return x.NextPageToken
- }
- return ""
-}
-
-func (x *ListInboxesResponse) GetTotalSize() int32 {
- if x != nil {
- return x.TotalSize
- }
- return 0
-}
-
-type UpdateInboxRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The inbox to update.
- Inbox *Inbox `protobuf:"bytes,1,opt,name=inbox,proto3" json:"inbox,omitempty"`
- // Required. The list of fields to update.
- UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
- // Optional. If set to true, allows updating missing fields.
- AllowMissing bool `protobuf:"varint,3,opt,name=allow_missing,json=allowMissing,proto3" json:"allow_missing,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *UpdateInboxRequest) Reset() {
- *x = UpdateInboxRequest{}
- mi := &file_api_v1_inbox_service_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *UpdateInboxRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*UpdateInboxRequest) ProtoMessage() {}
-
-func (x *UpdateInboxRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_inbox_service_proto_msgTypes[3]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use UpdateInboxRequest.ProtoReflect.Descriptor instead.
-func (*UpdateInboxRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_inbox_service_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *UpdateInboxRequest) GetInbox() *Inbox {
- if x != nil {
- return x.Inbox
- }
- return nil
-}
-
-func (x *UpdateInboxRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
- if x != nil {
- return x.UpdateMask
- }
- return nil
-}
-
-func (x *UpdateInboxRequest) GetAllowMissing() bool {
- if x != nil {
- return x.AllowMissing
- }
- return false
-}
-
-type DeleteInboxRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The resource name of the inbox to delete.
- // Format: inboxes/{inbox}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *DeleteInboxRequest) Reset() {
- *x = DeleteInboxRequest{}
- mi := &file_api_v1_inbox_service_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *DeleteInboxRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*DeleteInboxRequest) ProtoMessage() {}
-
-func (x *DeleteInboxRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_inbox_service_proto_msgTypes[4]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use DeleteInboxRequest.ProtoReflect.Descriptor instead.
-func (*DeleteInboxRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_inbox_service_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *DeleteInboxRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-var File_api_v1_inbox_service_proto protoreflect.FileDescriptor
-
-const file_api_v1_inbox_service_proto_rawDesc = "" +
- "\n" +
- "\x1aapi/v1/inbox_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xf3\x03\n" +
- "\x05Inbox\x12\x17\n" +
- "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x1b\n" +
- "\x06sender\x18\x02 \x01(\tB\x03\xe0A\x03R\x06sender\x12\x1f\n" +
- "\breceiver\x18\x03 \x01(\tB\x03\xe0A\x03R\breceiver\x127\n" +
- "\x06status\x18\x04 \x01(\x0e2\x1a.memos.api.v1.Inbox.StatusB\x03\xe0A\x01R\x06status\x12@\n" +
- "\vcreate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
- "createTime\x121\n" +
- "\x04type\x18\x06 \x01(\x0e2\x18.memos.api.v1.Inbox.TypeB\x03\xe0A\x03R\x04type\x12)\n" +
- "\vactivity_id\x18\a \x01(\x05B\x03\xe0A\x01H\x00R\n" +
- "activityId\x88\x01\x01\":\n" +
- "\x06Status\x12\x16\n" +
- "\x12STATUS_UNSPECIFIED\x10\x00\x12\n" +
- "\n" +
- "\x06UNREAD\x10\x01\x12\f\n" +
- "\bARCHIVED\x10\x02\".\n" +
- "\x04Type\x12\x14\n" +
- "\x10TYPE_UNSPECIFIED\x10\x00\x12\x10\n" +
- "\fMEMO_COMMENT\x10\x01:>\xeaA;\n" +
- "\x12memos.api.v1/Inbox\x12\x0finboxes/{inbox}\x1a\x04name*\ainboxes2\x05inboxB\x0e\n" +
- "\f_activity_id\"\xca\x01\n" +
- "\x12ListInboxesRequest\x121\n" +
- "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" +
- "\x11memos.api.v1/UserR\x06parent\x12 \n" +
- "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" +
- "\n" +
- "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\x12\x1b\n" +
- "\x06filter\x18\x04 \x01(\tB\x03\xe0A\x01R\x06filter\x12\x1e\n" +
- "\border_by\x18\x05 \x01(\tB\x03\xe0A\x01R\aorderBy\"\x8b\x01\n" +
- "\x13ListInboxesResponse\x12-\n" +
- "\ainboxes\x18\x01 \x03(\v2\x13.memos.api.v1.InboxR\ainboxes\x12&\n" +
- "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" +
- "\n" +
- "total_size\x18\x03 \x01(\x05R\ttotalSize\"\xb0\x01\n" +
- "\x12UpdateInboxRequest\x12.\n" +
- "\x05inbox\x18\x01 \x01(\v2\x13.memos.api.v1.InboxB\x03\xe0A\x02R\x05inbox\x12@\n" +
- "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" +
- "updateMask\x12(\n" +
- "\rallow_missing\x18\x03 \x01(\bB\x03\xe0A\x01R\fallowMissing\"D\n" +
- "\x12DeleteInboxRequest\x12.\n" +
- "\x04name\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\n" +
- "\x12memos.api.v1/InboxR\x04name2\x92\x03\n" +
- "\fInboxService\x12\x85\x01\n" +
- "\vListInboxes\x12 .memos.api.v1.ListInboxesRequest\x1a!.memos.api.v1.ListInboxesResponse\"1\xdaA\x06parent\x82\xd3\xe4\x93\x02\"\x12 /api/v1/{parent=users/*}/inboxes\x12\x87\x01\n" +
- "\vUpdateInbox\x12 .memos.api.v1.UpdateInboxRequest\x1a\x13.memos.api.v1.Inbox\"A\xdaA\x11inbox,update_mask\x82\xd3\xe4\x93\x02':\x05inbox2\x1e/api/v1/{inbox.name=inboxes/*}\x12p\n" +
- "\vDeleteInbox\x12 .memos.api.v1.DeleteInboxRequest\x1a\x16.google.protobuf.Empty\"'\xdaA\x04name\x82\xd3\xe4\x93\x02\x1a*\x18/api/v1/{name=inboxes/*}B\xa9\x01\n" +
- "\x10com.memos.api.v1B\x11InboxServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
-
-var (
- file_api_v1_inbox_service_proto_rawDescOnce sync.Once
- file_api_v1_inbox_service_proto_rawDescData []byte
-)
-
-func file_api_v1_inbox_service_proto_rawDescGZIP() []byte {
- file_api_v1_inbox_service_proto_rawDescOnce.Do(func() {
- file_api_v1_inbox_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_inbox_service_proto_rawDesc), len(file_api_v1_inbox_service_proto_rawDesc)))
- })
- return file_api_v1_inbox_service_proto_rawDescData
-}
-
-var file_api_v1_inbox_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
-var file_api_v1_inbox_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
-var file_api_v1_inbox_service_proto_goTypes = []any{
- (Inbox_Status)(0), // 0: memos.api.v1.Inbox.Status
- (Inbox_Type)(0), // 1: memos.api.v1.Inbox.Type
- (*Inbox)(nil), // 2: memos.api.v1.Inbox
- (*ListInboxesRequest)(nil), // 3: memos.api.v1.ListInboxesRequest
- (*ListInboxesResponse)(nil), // 4: memos.api.v1.ListInboxesResponse
- (*UpdateInboxRequest)(nil), // 5: memos.api.v1.UpdateInboxRequest
- (*DeleteInboxRequest)(nil), // 6: memos.api.v1.DeleteInboxRequest
- (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp
- (*fieldmaskpb.FieldMask)(nil), // 8: google.protobuf.FieldMask
- (*emptypb.Empty)(nil), // 9: google.protobuf.Empty
-}
-var file_api_v1_inbox_service_proto_depIdxs = []int32{
- 0, // 0: memos.api.v1.Inbox.status:type_name -> memos.api.v1.Inbox.Status
- 7, // 1: memos.api.v1.Inbox.create_time:type_name -> google.protobuf.Timestamp
- 1, // 2: memos.api.v1.Inbox.type:type_name -> memos.api.v1.Inbox.Type
- 2, // 3: memos.api.v1.ListInboxesResponse.inboxes:type_name -> memos.api.v1.Inbox
- 2, // 4: memos.api.v1.UpdateInboxRequest.inbox:type_name -> memos.api.v1.Inbox
- 8, // 5: memos.api.v1.UpdateInboxRequest.update_mask:type_name -> google.protobuf.FieldMask
- 3, // 6: memos.api.v1.InboxService.ListInboxes:input_type -> memos.api.v1.ListInboxesRequest
- 5, // 7: memos.api.v1.InboxService.UpdateInbox:input_type -> memos.api.v1.UpdateInboxRequest
- 6, // 8: memos.api.v1.InboxService.DeleteInbox:input_type -> memos.api.v1.DeleteInboxRequest
- 4, // 9: memos.api.v1.InboxService.ListInboxes:output_type -> memos.api.v1.ListInboxesResponse
- 2, // 10: memos.api.v1.InboxService.UpdateInbox:output_type -> memos.api.v1.Inbox
- 9, // 11: memos.api.v1.InboxService.DeleteInbox:output_type -> google.protobuf.Empty
- 9, // [9:12] is the sub-list for method output_type
- 6, // [6:9] is the sub-list for method input_type
- 6, // [6:6] is the sub-list for extension type_name
- 6, // [6:6] is the sub-list for extension extendee
- 0, // [0:6] is the sub-list for field type_name
-}
-
-func init() { file_api_v1_inbox_service_proto_init() }
-func file_api_v1_inbox_service_proto_init() {
- if File_api_v1_inbox_service_proto != nil {
- return
- }
- file_api_v1_inbox_service_proto_msgTypes[0].OneofWrappers = []any{}
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_inbox_service_proto_rawDesc), len(file_api_v1_inbox_service_proto_rawDesc)),
- NumEnums: 2,
- NumMessages: 5,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_api_v1_inbox_service_proto_goTypes,
- DependencyIndexes: file_api_v1_inbox_service_proto_depIdxs,
- EnumInfos: file_api_v1_inbox_service_proto_enumTypes,
- MessageInfos: file_api_v1_inbox_service_proto_msgTypes,
- }.Build()
- File_api_v1_inbox_service_proto = out.File
- file_api_v1_inbox_service_proto_goTypes = nil
- file_api_v1_inbox_service_proto_depIdxs = nil
-}
diff --git a/proto/gen/api/v1/inbox_service.pb.gw.go b/proto/gen/api/v1/inbox_service.pb.gw.go
deleted file mode 100644
index 99d6f955e..000000000
--- a/proto/gen/api/v1/inbox_service.pb.gw.go
+++ /dev/null
@@ -1,381 +0,0 @@
-// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
-// source: api/v1/inbox_service.proto
-
-/*
-Package apiv1 is a reverse proxy.
-
-It translates gRPC into RESTful JSON APIs.
-*/
-package apiv1
-
-import (
- "context"
- "errors"
- "io"
- "net/http"
-
- "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
- "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/grpclog"
- "google.golang.org/grpc/metadata"
- "google.golang.org/grpc/status"
- "google.golang.org/protobuf/proto"
-)
-
-// Suppress "imported and not used" errors
-var (
- _ codes.Code
- _ io.Reader
- _ status.Status
- _ = errors.New
- _ = runtime.String
- _ = utilities.NewDoubleArray
- _ = metadata.Join
-)
-
-var filter_InboxService_ListInboxes_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
-
-func request_InboxService_ListInboxes_0(ctx context.Context, marshaler runtime.Marshaler, client InboxServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq ListInboxesRequest
- metadata runtime.ServerMetadata
- err error
- )
- if req.Body != nil {
- _, _ = io.Copy(io.Discard, req.Body)
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InboxService_ListInboxes_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.ListInboxes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_InboxService_ListInboxes_0(ctx context.Context, marshaler runtime.Marshaler, server InboxServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq ListInboxesRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InboxService_ListInboxes_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.ListInboxes(ctx, &protoReq)
- return msg, metadata, err
-}
-
-var filter_InboxService_UpdateInbox_0 = &utilities.DoubleArray{Encoding: map[string]int{"inbox": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
-
-func request_InboxService_UpdateInbox_0(ctx context.Context, marshaler runtime.Marshaler, client InboxServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq UpdateInboxRequest
- metadata runtime.ServerMetadata
- err error
- )
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Inbox); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if req.Body != nil {
- _, _ = io.Copy(io.Discard, req.Body)
- }
- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Inbox); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
- val, ok := pathParams["inbox.name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "inbox.name")
- }
- err = runtime.PopulateFieldFromPath(&protoReq, "inbox.name", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "inbox.name", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InboxService_UpdateInbox_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.UpdateInbox(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_InboxService_UpdateInbox_0(ctx context.Context, marshaler runtime.Marshaler, server InboxServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq UpdateInboxRequest
- metadata runtime.ServerMetadata
- err error
- )
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Inbox); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Inbox); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
- val, ok := pathParams["inbox.name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "inbox.name")
- }
- err = runtime.PopulateFieldFromPath(&protoReq, "inbox.name", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "inbox.name", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InboxService_UpdateInbox_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.UpdateInbox(ctx, &protoReq)
- return msg, metadata, err
-}
-
-func request_InboxService_DeleteInbox_0(ctx context.Context, marshaler runtime.Marshaler, client InboxServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq DeleteInboxRequest
- metadata runtime.ServerMetadata
- err error
- )
- if req.Body != nil {
- _, _ = io.Copy(io.Discard, req.Body)
- }
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
- }
- msg, err := client.DeleteInbox(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_InboxService_DeleteInbox_0(ctx context.Context, marshaler runtime.Marshaler, server InboxServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq DeleteInboxRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
- }
- msg, err := server.DeleteInbox(ctx, &protoReq)
- return msg, metadata, err
-}
-
-// RegisterInboxServiceHandlerServer registers the http handlers for service InboxService to "mux".
-// UnaryRPC :call InboxServiceServer 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 RegisterInboxServiceHandlerFromEndpoint instead.
-// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
-func RegisterInboxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InboxServiceServer) error {
- mux.Handle(http.MethodGet, pattern_InboxService_ListInboxes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InboxService/ListInboxes", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/inboxes"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_InboxService_ListInboxes_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_InboxService_ListInboxes_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPatch, pattern_InboxService_UpdateInbox_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InboxService/UpdateInbox", runtime.WithHTTPPathPattern("/api/v1/{inbox.name=inboxes/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_InboxService_UpdateInbox_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_InboxService_UpdateInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodDelete, pattern_InboxService_DeleteInbox_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InboxService/DeleteInbox", runtime.WithHTTPPathPattern("/api/v1/{name=inboxes/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_InboxService_DeleteInbox_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_InboxService_DeleteInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
-
- return nil
-}
-
-// RegisterInboxServiceHandlerFromEndpoint is same as RegisterInboxServiceHandler but
-// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterInboxServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
- conn, err := grpc.NewClient(endpoint, opts...)
- if err != nil {
- return err
- }
- defer func() {
- if err != nil {
- if cerr := conn.Close(); cerr != nil {
- grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- return
- }
- go func() {
- <-ctx.Done()
- if cerr := conn.Close(); cerr != nil {
- grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- }()
- }()
- return RegisterInboxServiceHandler(ctx, mux, conn)
-}
-
-// RegisterInboxServiceHandler registers the http handlers for service InboxService to "mux".
-// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterInboxServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- return RegisterInboxServiceHandlerClient(ctx, mux, NewInboxServiceClient(conn))
-}
-
-// RegisterInboxServiceHandlerClient registers the http handlers for service InboxService
-// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "InboxServiceClient".
-// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "InboxServiceClient"
-// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
-// "InboxServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
-func RegisterInboxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InboxServiceClient) error {
- mux.Handle(http.MethodGet, pattern_InboxService_ListInboxes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InboxService/ListInboxes", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/inboxes"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_InboxService_ListInboxes_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_InboxService_ListInboxes_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPatch, pattern_InboxService_UpdateInbox_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InboxService/UpdateInbox", runtime.WithHTTPPathPattern("/api/v1/{inbox.name=inboxes/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_InboxService_UpdateInbox_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_InboxService_UpdateInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodDelete, pattern_InboxService_DeleteInbox_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InboxService/DeleteInbox", runtime.WithHTTPPathPattern("/api/v1/{name=inboxes/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_InboxService_DeleteInbox_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_InboxService_DeleteInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- return nil
-}
-
-var (
- pattern_InboxService_ListInboxes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "inboxes"}, ""))
- pattern_InboxService_UpdateInbox_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "inboxes", "inbox.name"}, ""))
- pattern_InboxService_DeleteInbox_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "inboxes", "name"}, ""))
-)
-
-var (
- forward_InboxService_ListInboxes_0 = runtime.ForwardResponseMessage
- forward_InboxService_UpdateInbox_0 = runtime.ForwardResponseMessage
- forward_InboxService_DeleteInbox_0 = runtime.ForwardResponseMessage
-)
diff --git a/proto/gen/api/v1/inbox_service_grpc.pb.go b/proto/gen/api/v1/inbox_service_grpc.pb.go
deleted file mode 100644
index d74a2625f..000000000
--- a/proto/gen/api/v1/inbox_service_grpc.pb.go
+++ /dev/null
@@ -1,204 +0,0 @@
-// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-grpc v1.5.1
-// - protoc (unknown)
-// source: api/v1/inbox_service.proto
-
-package apiv1
-
-import (
- context "context"
- grpc "google.golang.org/grpc"
- codes "google.golang.org/grpc/codes"
- status "google.golang.org/grpc/status"
- emptypb "google.golang.org/protobuf/types/known/emptypb"
-)
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-// Requires gRPC-Go v1.64.0 or later.
-const _ = grpc.SupportPackageIsVersion9
-
-const (
- InboxService_ListInboxes_FullMethodName = "/memos.api.v1.InboxService/ListInboxes"
- InboxService_UpdateInbox_FullMethodName = "/memos.api.v1.InboxService/UpdateInbox"
- InboxService_DeleteInbox_FullMethodName = "/memos.api.v1.InboxService/DeleteInbox"
-)
-
-// InboxServiceClient is the client API for InboxService 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 InboxServiceClient interface {
- // ListInboxes lists inboxes for a user.
- ListInboxes(ctx context.Context, in *ListInboxesRequest, opts ...grpc.CallOption) (*ListInboxesResponse, error)
- // UpdateInbox updates an inbox.
- UpdateInbox(ctx context.Context, in *UpdateInboxRequest, opts ...grpc.CallOption) (*Inbox, error)
- // DeleteInbox deletes an inbox.
- DeleteInbox(ctx context.Context, in *DeleteInboxRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
-}
-
-type inboxServiceClient struct {
- cc grpc.ClientConnInterface
-}
-
-func NewInboxServiceClient(cc grpc.ClientConnInterface) InboxServiceClient {
- return &inboxServiceClient{cc}
-}
-
-func (c *inboxServiceClient) ListInboxes(ctx context.Context, in *ListInboxesRequest, opts ...grpc.CallOption) (*ListInboxesResponse, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(ListInboxesResponse)
- err := c.cc.Invoke(ctx, InboxService_ListInboxes_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *inboxServiceClient) UpdateInbox(ctx context.Context, in *UpdateInboxRequest, opts ...grpc.CallOption) (*Inbox, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(Inbox)
- err := c.cc.Invoke(ctx, InboxService_UpdateInbox_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *inboxServiceClient) DeleteInbox(ctx context.Context, in *DeleteInboxRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(emptypb.Empty)
- err := c.cc.Invoke(ctx, InboxService_DeleteInbox_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// InboxServiceServer is the server API for InboxService service.
-// All implementations must embed UnimplementedInboxServiceServer
-// for forward compatibility.
-type InboxServiceServer interface {
- // ListInboxes lists inboxes for a user.
- ListInboxes(context.Context, *ListInboxesRequest) (*ListInboxesResponse, error)
- // UpdateInbox updates an inbox.
- UpdateInbox(context.Context, *UpdateInboxRequest) (*Inbox, error)
- // DeleteInbox deletes an inbox.
- DeleteInbox(context.Context, *DeleteInboxRequest) (*emptypb.Empty, error)
- mustEmbedUnimplementedInboxServiceServer()
-}
-
-// UnimplementedInboxServiceServer must be embedded to have
-// forward compatible implementations.
-//
-// NOTE: this should be embedded by value instead of pointer to avoid a nil
-// pointer dereference when methods are called.
-type UnimplementedInboxServiceServer struct{}
-
-func (UnimplementedInboxServiceServer) ListInboxes(context.Context, *ListInboxesRequest) (*ListInboxesResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ListInboxes not implemented")
-}
-func (UnimplementedInboxServiceServer) UpdateInbox(context.Context, *UpdateInboxRequest) (*Inbox, error) {
- return nil, status.Errorf(codes.Unimplemented, "method UpdateInbox not implemented")
-}
-func (UnimplementedInboxServiceServer) DeleteInbox(context.Context, *DeleteInboxRequest) (*emptypb.Empty, error) {
- return nil, status.Errorf(codes.Unimplemented, "method DeleteInbox not implemented")
-}
-func (UnimplementedInboxServiceServer) mustEmbedUnimplementedInboxServiceServer() {}
-func (UnimplementedInboxServiceServer) testEmbeddedByValue() {}
-
-// UnsafeInboxServiceServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to InboxServiceServer will
-// result in compilation errors.
-type UnsafeInboxServiceServer interface {
- mustEmbedUnimplementedInboxServiceServer()
-}
-
-func RegisterInboxServiceServer(s grpc.ServiceRegistrar, srv InboxServiceServer) {
- // If the following call pancis, it indicates UnimplementedInboxServiceServer was
- // embedded by pointer and is nil. This will cause panics if an
- // unimplemented method is ever invoked, so we test this at initialization
- // time to prevent it from happening at runtime later due to I/O.
- if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
- t.testEmbeddedByValue()
- }
- s.RegisterService(&InboxService_ServiceDesc, srv)
-}
-
-func _InboxService_ListInboxes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(ListInboxesRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(InboxServiceServer).ListInboxes(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: InboxService_ListInboxes_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(InboxServiceServer).ListInboxes(ctx, req.(*ListInboxesRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _InboxService_UpdateInbox_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(UpdateInboxRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(InboxServiceServer).UpdateInbox(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: InboxService_UpdateInbox_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(InboxServiceServer).UpdateInbox(ctx, req.(*UpdateInboxRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _InboxService_DeleteInbox_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DeleteInboxRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(InboxServiceServer).DeleteInbox(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: InboxService_DeleteInbox_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(InboxServiceServer).DeleteInbox(ctx, req.(*DeleteInboxRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-// InboxService_ServiceDesc is the grpc.ServiceDesc for InboxService service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var InboxService_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "memos.api.v1.InboxService",
- HandlerType: (*InboxServiceServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "ListInboxes",
- Handler: _InboxService_ListInboxes_Handler,
- },
- {
- MethodName: "UpdateInbox",
- Handler: _InboxService_UpdateInbox_Handler,
- },
- {
- MethodName: "DeleteInbox",
- Handler: _InboxService_DeleteInbox_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "api/v1/inbox_service.proto",
-}
diff --git a/proto/gen/api/v1/instance_service.pb.go b/proto/gen/api/v1/instance_service.pb.go
new file mode 100644
index 000000000..b7530da46
--- /dev/null
+++ b/proto/gen/api/v1/instance_service.pb.go
@@ -0,0 +1,1086 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.36.10
+// protoc (unknown)
+// source: api/v1/instance_service.proto
+
+package apiv1
+
+import (
+ _ "google.golang.org/genproto/googleapis/api/annotations"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+ reflect "reflect"
+ sync "sync"
+ unsafe "unsafe"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// Enumeration of instance setting keys.
+type InstanceSetting_Key int32
+
+const (
+ InstanceSetting_KEY_UNSPECIFIED InstanceSetting_Key = 0
+ // GENERAL is the key for general settings.
+ InstanceSetting_GENERAL InstanceSetting_Key = 1
+ // STORAGE is the key for storage settings.
+ InstanceSetting_STORAGE InstanceSetting_Key = 2
+ // MEMO_RELATED is the key for memo related settings.
+ InstanceSetting_MEMO_RELATED InstanceSetting_Key = 3
+)
+
+// Enum value maps for InstanceSetting_Key.
+var (
+ InstanceSetting_Key_name = map[int32]string{
+ 0: "KEY_UNSPECIFIED",
+ 1: "GENERAL",
+ 2: "STORAGE",
+ 3: "MEMO_RELATED",
+ }
+ InstanceSetting_Key_value = map[string]int32{
+ "KEY_UNSPECIFIED": 0,
+ "GENERAL": 1,
+ "STORAGE": 2,
+ "MEMO_RELATED": 3,
+ }
+)
+
+func (x InstanceSetting_Key) Enum() *InstanceSetting_Key {
+ p := new(InstanceSetting_Key)
+ *p = x
+ return p
+}
+
+func (x InstanceSetting_Key) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (InstanceSetting_Key) Descriptor() protoreflect.EnumDescriptor {
+ return file_api_v1_instance_service_proto_enumTypes[0].Descriptor()
+}
+
+func (InstanceSetting_Key) Type() protoreflect.EnumType {
+ return &file_api_v1_instance_service_proto_enumTypes[0]
+}
+
+func (x InstanceSetting_Key) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use InstanceSetting_Key.Descriptor instead.
+func (InstanceSetting_Key) EnumDescriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 0}
+}
+
+// Storage type enumeration for different storage backends.
+type InstanceSetting_StorageSetting_StorageType int32
+
+const (
+ InstanceSetting_StorageSetting_STORAGE_TYPE_UNSPECIFIED InstanceSetting_StorageSetting_StorageType = 0
+ // DATABASE is the database storage type.
+ InstanceSetting_StorageSetting_DATABASE InstanceSetting_StorageSetting_StorageType = 1
+ // LOCAL is the local storage type.
+ InstanceSetting_StorageSetting_LOCAL InstanceSetting_StorageSetting_StorageType = 2
+ // S3 is the S3 storage type.
+ InstanceSetting_StorageSetting_S3 InstanceSetting_StorageSetting_StorageType = 3
+)
+
+// Enum value maps for InstanceSetting_StorageSetting_StorageType.
+var (
+ InstanceSetting_StorageSetting_StorageType_name = map[int32]string{
+ 0: "STORAGE_TYPE_UNSPECIFIED",
+ 1: "DATABASE",
+ 2: "LOCAL",
+ 3: "S3",
+ }
+ InstanceSetting_StorageSetting_StorageType_value = map[string]int32{
+ "STORAGE_TYPE_UNSPECIFIED": 0,
+ "DATABASE": 1,
+ "LOCAL": 2,
+ "S3": 3,
+ }
+)
+
+func (x InstanceSetting_StorageSetting_StorageType) Enum() *InstanceSetting_StorageSetting_StorageType {
+ p := new(InstanceSetting_StorageSetting_StorageType)
+ *p = x
+ return p
+}
+
+func (x InstanceSetting_StorageSetting_StorageType) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (InstanceSetting_StorageSetting_StorageType) Descriptor() protoreflect.EnumDescriptor {
+ return file_api_v1_instance_service_proto_enumTypes[1].Descriptor()
+}
+
+func (InstanceSetting_StorageSetting_StorageType) Type() protoreflect.EnumType {
+ return &file_api_v1_instance_service_proto_enumTypes[1]
+}
+
+func (x InstanceSetting_StorageSetting_StorageType) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use InstanceSetting_StorageSetting_StorageType.Descriptor instead.
+func (InstanceSetting_StorageSetting_StorageType) EnumDescriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 1, 0}
+}
+
+// Instance profile message containing basic instance information.
+type InstanceProfile struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The name of instance owner.
+ // Format: users/{user}
+ Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`
+ // Version is the current version of instance.
+ Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
+ // Mode is the instance mode (e.g. "prod", "dev" or "demo").
+ Mode string `protobuf:"bytes,3,opt,name=mode,proto3" json:"mode,omitempty"`
+ // Instance URL is the URL of the instance.
+ InstanceUrl string `protobuf:"bytes,6,opt,name=instance_url,json=instanceUrl,proto3" json:"instance_url,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *InstanceProfile) Reset() {
+ *x = InstanceProfile{}
+ mi := &file_api_v1_instance_service_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *InstanceProfile) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*InstanceProfile) ProtoMessage() {}
+
+func (x *InstanceProfile) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_instance_service_proto_msgTypes[0]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use InstanceProfile.ProtoReflect.Descriptor instead.
+func (*InstanceProfile) Descriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *InstanceProfile) GetOwner() string {
+ if x != nil {
+ return x.Owner
+ }
+ return ""
+}
+
+func (x *InstanceProfile) GetVersion() string {
+ if x != nil {
+ return x.Version
+ }
+ return ""
+}
+
+func (x *InstanceProfile) GetMode() string {
+ if x != nil {
+ return x.Mode
+ }
+ return ""
+}
+
+func (x *InstanceProfile) GetInstanceUrl() string {
+ if x != nil {
+ return x.InstanceUrl
+ }
+ return ""
+}
+
+// Request for instance profile.
+type GetInstanceProfileRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *GetInstanceProfileRequest) Reset() {
+ *x = GetInstanceProfileRequest{}
+ mi := &file_api_v1_instance_service_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *GetInstanceProfileRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetInstanceProfileRequest) ProtoMessage() {}
+
+func (x *GetInstanceProfileRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_instance_service_proto_msgTypes[1]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetInstanceProfileRequest.ProtoReflect.Descriptor instead.
+func (*GetInstanceProfileRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{1}
+}
+
+// An instance setting resource.
+type InstanceSetting struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The name of the instance setting.
+ // Format: instance/settings/{setting}
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Types that are valid to be assigned to Value:
+ //
+ // *InstanceSetting_GeneralSetting_
+ // *InstanceSetting_StorageSetting_
+ // *InstanceSetting_MemoRelatedSetting_
+ Value isInstanceSetting_Value `protobuf_oneof:"value"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *InstanceSetting) Reset() {
+ *x = InstanceSetting{}
+ mi := &file_api_v1_instance_service_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *InstanceSetting) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*InstanceSetting) ProtoMessage() {}
+
+func (x *InstanceSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_instance_service_proto_msgTypes[2]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use InstanceSetting.ProtoReflect.Descriptor instead.
+func (*InstanceSetting) Descriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *InstanceSetting) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *InstanceSetting) GetValue() isInstanceSetting_Value {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+func (x *InstanceSetting) GetGeneralSetting() *InstanceSetting_GeneralSetting {
+ if x != nil {
+ if x, ok := x.Value.(*InstanceSetting_GeneralSetting_); ok {
+ return x.GeneralSetting
+ }
+ }
+ return nil
+}
+
+func (x *InstanceSetting) GetStorageSetting() *InstanceSetting_StorageSetting {
+ if x != nil {
+ if x, ok := x.Value.(*InstanceSetting_StorageSetting_); ok {
+ return x.StorageSetting
+ }
+ }
+ return nil
+}
+
+func (x *InstanceSetting) GetMemoRelatedSetting() *InstanceSetting_MemoRelatedSetting {
+ if x != nil {
+ if x, ok := x.Value.(*InstanceSetting_MemoRelatedSetting_); ok {
+ return x.MemoRelatedSetting
+ }
+ }
+ return nil
+}
+
+type isInstanceSetting_Value interface {
+ isInstanceSetting_Value()
+}
+
+type InstanceSetting_GeneralSetting_ struct {
+ GeneralSetting *InstanceSetting_GeneralSetting `protobuf:"bytes,2,opt,name=general_setting,json=generalSetting,proto3,oneof"`
+}
+
+type InstanceSetting_StorageSetting_ struct {
+ StorageSetting *InstanceSetting_StorageSetting `protobuf:"bytes,3,opt,name=storage_setting,json=storageSetting,proto3,oneof"`
+}
+
+type InstanceSetting_MemoRelatedSetting_ struct {
+ MemoRelatedSetting *InstanceSetting_MemoRelatedSetting `protobuf:"bytes,4,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"`
+}
+
+func (*InstanceSetting_GeneralSetting_) isInstanceSetting_Value() {}
+
+func (*InstanceSetting_StorageSetting_) isInstanceSetting_Value() {}
+
+func (*InstanceSetting_MemoRelatedSetting_) isInstanceSetting_Value() {}
+
+// Request message for GetInstanceSetting method.
+type GetInstanceSettingRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The resource name of the instance setting.
+ // Format: instance/settings/{setting}
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *GetInstanceSettingRequest) Reset() {
+ *x = GetInstanceSettingRequest{}
+ mi := &file_api_v1_instance_service_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *GetInstanceSettingRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetInstanceSettingRequest) ProtoMessage() {}
+
+func (x *GetInstanceSettingRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_instance_service_proto_msgTypes[3]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetInstanceSettingRequest.ProtoReflect.Descriptor instead.
+func (*GetInstanceSettingRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *GetInstanceSettingRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+// Request message for UpdateInstanceSetting method.
+type UpdateInstanceSettingRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The instance setting resource which replaces the resource on the server.
+ Setting *InstanceSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"`
+ // The list of fields to update.
+ UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UpdateInstanceSettingRequest) Reset() {
+ *x = UpdateInstanceSettingRequest{}
+ mi := &file_api_v1_instance_service_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UpdateInstanceSettingRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateInstanceSettingRequest) ProtoMessage() {}
+
+func (x *UpdateInstanceSettingRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_instance_service_proto_msgTypes[4]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateInstanceSettingRequest.ProtoReflect.Descriptor instead.
+func (*UpdateInstanceSettingRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *UpdateInstanceSettingRequest) GetSetting() *InstanceSetting {
+ if x != nil {
+ return x.Setting
+ }
+ return nil
+}
+
+func (x *UpdateInstanceSettingRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
+ if x != nil {
+ return x.UpdateMask
+ }
+ return nil
+}
+
+// General instance settings configuration.
+type InstanceSetting_GeneralSetting struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // theme is the name of the selected theme.
+ // This references a CSS file in the web/public/themes/ directory.
+ Theme string `protobuf:"bytes,1,opt,name=theme,proto3" json:"theme,omitempty"`
+ // disallow_user_registration disallows user registration.
+ DisallowUserRegistration bool `protobuf:"varint,2,opt,name=disallow_user_registration,json=disallowUserRegistration,proto3" json:"disallow_user_registration,omitempty"`
+ // disallow_password_auth disallows password authentication.
+ DisallowPasswordAuth bool `protobuf:"varint,3,opt,name=disallow_password_auth,json=disallowPasswordAuth,proto3" json:"disallow_password_auth,omitempty"`
+ // additional_script is the additional script.
+ AdditionalScript string `protobuf:"bytes,4,opt,name=additional_script,json=additionalScript,proto3" json:"additional_script,omitempty"`
+ // additional_style is the additional style.
+ AdditionalStyle string `protobuf:"bytes,5,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"`
+ // custom_profile is the custom profile.
+ CustomProfile *InstanceSetting_GeneralSetting_CustomProfile `protobuf:"bytes,6,opt,name=custom_profile,json=customProfile,proto3" json:"custom_profile,omitempty"`
+ // week_start_day_offset is the week start day offset from Sunday.
+ // 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
+ // Default is Sunday.
+ WeekStartDayOffset int32 `protobuf:"varint,7,opt,name=week_start_day_offset,json=weekStartDayOffset,proto3" json:"week_start_day_offset,omitempty"`
+ // disallow_change_username disallows changing username.
+ DisallowChangeUsername bool `protobuf:"varint,8,opt,name=disallow_change_username,json=disallowChangeUsername,proto3" json:"disallow_change_username,omitempty"`
+ // disallow_change_nickname disallows changing nickname.
+ DisallowChangeNickname bool `protobuf:"varint,9,opt,name=disallow_change_nickname,json=disallowChangeNickname,proto3" json:"disallow_change_nickname,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *InstanceSetting_GeneralSetting) Reset() {
+ *x = InstanceSetting_GeneralSetting{}
+ mi := &file_api_v1_instance_service_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *InstanceSetting_GeneralSetting) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*InstanceSetting_GeneralSetting) ProtoMessage() {}
+
+func (x *InstanceSetting_GeneralSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_instance_service_proto_msgTypes[5]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use InstanceSetting_GeneralSetting.ProtoReflect.Descriptor instead.
+func (*InstanceSetting_GeneralSetting) Descriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 0}
+}
+
+func (x *InstanceSetting_GeneralSetting) GetTheme() string {
+ if x != nil {
+ return x.Theme
+ }
+ return ""
+}
+
+func (x *InstanceSetting_GeneralSetting) GetDisallowUserRegistration() bool {
+ if x != nil {
+ return x.DisallowUserRegistration
+ }
+ return false
+}
+
+func (x *InstanceSetting_GeneralSetting) GetDisallowPasswordAuth() bool {
+ if x != nil {
+ return x.DisallowPasswordAuth
+ }
+ return false
+}
+
+func (x *InstanceSetting_GeneralSetting) GetAdditionalScript() string {
+ if x != nil {
+ return x.AdditionalScript
+ }
+ return ""
+}
+
+func (x *InstanceSetting_GeneralSetting) GetAdditionalStyle() string {
+ if x != nil {
+ return x.AdditionalStyle
+ }
+ return ""
+}
+
+func (x *InstanceSetting_GeneralSetting) GetCustomProfile() *InstanceSetting_GeneralSetting_CustomProfile {
+ if x != nil {
+ return x.CustomProfile
+ }
+ return nil
+}
+
+func (x *InstanceSetting_GeneralSetting) GetWeekStartDayOffset() int32 {
+ if x != nil {
+ return x.WeekStartDayOffset
+ }
+ return 0
+}
+
+func (x *InstanceSetting_GeneralSetting) GetDisallowChangeUsername() bool {
+ if x != nil {
+ return x.DisallowChangeUsername
+ }
+ return false
+}
+
+func (x *InstanceSetting_GeneralSetting) GetDisallowChangeNickname() bool {
+ if x != nil {
+ return x.DisallowChangeNickname
+ }
+ return false
+}
+
+// Storage configuration settings for instance attachments.
+type InstanceSetting_StorageSetting struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // storage_type is the storage type.
+ StorageType InstanceSetting_StorageSetting_StorageType `protobuf:"varint,1,opt,name=storage_type,json=storageType,proto3,enum=memos.api.v1.InstanceSetting_StorageSetting_StorageType" json:"storage_type,omitempty"`
+ // The template of file path.
+ // e.g. assets/{timestamp}_{filename}
+ FilepathTemplate string `protobuf:"bytes,2,opt,name=filepath_template,json=filepathTemplate,proto3" json:"filepath_template,omitempty"`
+ // The max upload size in megabytes.
+ UploadSizeLimitMb int64 `protobuf:"varint,3,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"`
+ // The S3 config.
+ S3Config *InstanceSetting_StorageSetting_S3Config `protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *InstanceSetting_StorageSetting) Reset() {
+ *x = InstanceSetting_StorageSetting{}
+ mi := &file_api_v1_instance_service_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *InstanceSetting_StorageSetting) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*InstanceSetting_StorageSetting) ProtoMessage() {}
+
+func (x *InstanceSetting_StorageSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_instance_service_proto_msgTypes[6]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use InstanceSetting_StorageSetting.ProtoReflect.Descriptor instead.
+func (*InstanceSetting_StorageSetting) Descriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 1}
+}
+
+func (x *InstanceSetting_StorageSetting) GetStorageType() InstanceSetting_StorageSetting_StorageType {
+ if x != nil {
+ return x.StorageType
+ }
+ return InstanceSetting_StorageSetting_STORAGE_TYPE_UNSPECIFIED
+}
+
+func (x *InstanceSetting_StorageSetting) GetFilepathTemplate() string {
+ if x != nil {
+ return x.FilepathTemplate
+ }
+ return ""
+}
+
+func (x *InstanceSetting_StorageSetting) GetUploadSizeLimitMb() int64 {
+ if x != nil {
+ return x.UploadSizeLimitMb
+ }
+ return 0
+}
+
+func (x *InstanceSetting_StorageSetting) GetS3Config() *InstanceSetting_StorageSetting_S3Config {
+ if x != nil {
+ return x.S3Config
+ }
+ return nil
+}
+
+// Memo-related instance settings and policies.
+type InstanceSetting_MemoRelatedSetting struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // disallow_public_visibility disallows set memo as public visibility.
+ DisallowPublicVisibility bool `protobuf:"varint,1,opt,name=disallow_public_visibility,json=disallowPublicVisibility,proto3" json:"disallow_public_visibility,omitempty"`
+ // display_with_update_time orders and displays memo with update time.
+ DisplayWithUpdateTime bool `protobuf:"varint,2,opt,name=display_with_update_time,json=displayWithUpdateTime,proto3" json:"display_with_update_time,omitempty"`
+ // content_length_limit is the limit of content length. Unit is byte.
+ ContentLengthLimit int32 `protobuf:"varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"`
+ // enable_double_click_edit enables editing on double click.
+ EnableDoubleClickEdit bool `protobuf:"varint,4,opt,name=enable_double_click_edit,json=enableDoubleClickEdit,proto3" json:"enable_double_click_edit,omitempty"`
+ // enable_link_preview enables links preview.
+ EnableLinkPreview bool `protobuf:"varint,5,opt,name=enable_link_preview,json=enableLinkPreview,proto3" json:"enable_link_preview,omitempty"`
+ // reactions is the list of reactions.
+ Reactions []string `protobuf:"bytes,7,rep,name=reactions,proto3" json:"reactions,omitempty"`
+ // disable_markdown_shortcuts disallow the registration of markdown shortcuts.
+ DisableMarkdownShortcuts bool `protobuf:"varint,8,opt,name=disable_markdown_shortcuts,json=disableMarkdownShortcuts,proto3" json:"disable_markdown_shortcuts,omitempty"`
+ // enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW).
+ EnableBlurNsfwContent bool `protobuf:"varint,9,opt,name=enable_blur_nsfw_content,json=enableBlurNsfwContent,proto3" json:"enable_blur_nsfw_content,omitempty"`
+ // nsfw_tags is the list of tags that mark content as NSFW for blurring.
+ NsfwTags []string `protobuf:"bytes,10,rep,name=nsfw_tags,json=nsfwTags,proto3" json:"nsfw_tags,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *InstanceSetting_MemoRelatedSetting) Reset() {
+ *x = InstanceSetting_MemoRelatedSetting{}
+ mi := &file_api_v1_instance_service_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *InstanceSetting_MemoRelatedSetting) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*InstanceSetting_MemoRelatedSetting) ProtoMessage() {}
+
+func (x *InstanceSetting_MemoRelatedSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_instance_service_proto_msgTypes[7]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use InstanceSetting_MemoRelatedSetting.ProtoReflect.Descriptor instead.
+func (*InstanceSetting_MemoRelatedSetting) Descriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 2}
+}
+
+func (x *InstanceSetting_MemoRelatedSetting) GetDisallowPublicVisibility() bool {
+ if x != nil {
+ return x.DisallowPublicVisibility
+ }
+ return false
+}
+
+func (x *InstanceSetting_MemoRelatedSetting) GetDisplayWithUpdateTime() bool {
+ if x != nil {
+ return x.DisplayWithUpdateTime
+ }
+ return false
+}
+
+func (x *InstanceSetting_MemoRelatedSetting) GetContentLengthLimit() int32 {
+ if x != nil {
+ return x.ContentLengthLimit
+ }
+ return 0
+}
+
+func (x *InstanceSetting_MemoRelatedSetting) GetEnableDoubleClickEdit() bool {
+ if x != nil {
+ return x.EnableDoubleClickEdit
+ }
+ return false
+}
+
+func (x *InstanceSetting_MemoRelatedSetting) GetEnableLinkPreview() bool {
+ if x != nil {
+ return x.EnableLinkPreview
+ }
+ return false
+}
+
+func (x *InstanceSetting_MemoRelatedSetting) GetReactions() []string {
+ if x != nil {
+ return x.Reactions
+ }
+ return nil
+}
+
+func (x *InstanceSetting_MemoRelatedSetting) GetDisableMarkdownShortcuts() bool {
+ if x != nil {
+ return x.DisableMarkdownShortcuts
+ }
+ return false
+}
+
+func (x *InstanceSetting_MemoRelatedSetting) GetEnableBlurNsfwContent() bool {
+ if x != nil {
+ return x.EnableBlurNsfwContent
+ }
+ return false
+}
+
+func (x *InstanceSetting_MemoRelatedSetting) GetNsfwTags() []string {
+ if x != nil {
+ return x.NsfwTags
+ }
+ return nil
+}
+
+// Custom profile configuration for instance branding.
+type InstanceSetting_GeneralSetting_CustomProfile struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ LogoUrl string `protobuf:"bytes,3,opt,name=logo_url,json=logoUrl,proto3" json:"logo_url,omitempty"`
+ Locale string `protobuf:"bytes,4,opt,name=locale,proto3" json:"locale,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *InstanceSetting_GeneralSetting_CustomProfile) Reset() {
+ *x = InstanceSetting_GeneralSetting_CustomProfile{}
+ mi := &file_api_v1_instance_service_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *InstanceSetting_GeneralSetting_CustomProfile) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*InstanceSetting_GeneralSetting_CustomProfile) ProtoMessage() {}
+
+func (x *InstanceSetting_GeneralSetting_CustomProfile) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_instance_service_proto_msgTypes[8]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use InstanceSetting_GeneralSetting_CustomProfile.ProtoReflect.Descriptor instead.
+func (*InstanceSetting_GeneralSetting_CustomProfile) Descriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 0, 0}
+}
+
+func (x *InstanceSetting_GeneralSetting_CustomProfile) GetTitle() string {
+ if x != nil {
+ return x.Title
+ }
+ return ""
+}
+
+func (x *InstanceSetting_GeneralSetting_CustomProfile) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *InstanceSetting_GeneralSetting_CustomProfile) GetLogoUrl() string {
+ if x != nil {
+ return x.LogoUrl
+ }
+ return ""
+}
+
+func (x *InstanceSetting_GeneralSetting_CustomProfile) GetLocale() string {
+ if x != nil {
+ return x.Locale
+ }
+ return ""
+}
+
+// S3 configuration for cloud storage backend.
+// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
+type InstanceSetting_StorageSetting_S3Config struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ AccessKeyId string `protobuf:"bytes,1,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"`
+ AccessKeySecret string `protobuf:"bytes,2,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"`
+ Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
+ Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"`
+ Bucket string `protobuf:"bytes,5,opt,name=bucket,proto3" json:"bucket,omitempty"`
+ UsePathStyle bool `protobuf:"varint,6,opt,name=use_path_style,json=usePathStyle,proto3" json:"use_path_style,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *InstanceSetting_StorageSetting_S3Config) Reset() {
+ *x = InstanceSetting_StorageSetting_S3Config{}
+ mi := &file_api_v1_instance_service_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *InstanceSetting_StorageSetting_S3Config) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*InstanceSetting_StorageSetting_S3Config) ProtoMessage() {}
+
+func (x *InstanceSetting_StorageSetting_S3Config) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_instance_service_proto_msgTypes[9]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use InstanceSetting_StorageSetting_S3Config.ProtoReflect.Descriptor instead.
+func (*InstanceSetting_StorageSetting_S3Config) Descriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 1, 0}
+}
+
+func (x *InstanceSetting_StorageSetting_S3Config) GetAccessKeyId() string {
+ if x != nil {
+ return x.AccessKeyId
+ }
+ return ""
+}
+
+func (x *InstanceSetting_StorageSetting_S3Config) GetAccessKeySecret() string {
+ if x != nil {
+ return x.AccessKeySecret
+ }
+ return ""
+}
+
+func (x *InstanceSetting_StorageSetting_S3Config) GetEndpoint() string {
+ if x != nil {
+ return x.Endpoint
+ }
+ return ""
+}
+
+func (x *InstanceSetting_StorageSetting_S3Config) GetRegion() string {
+ if x != nil {
+ return x.Region
+ }
+ return ""
+}
+
+func (x *InstanceSetting_StorageSetting_S3Config) GetBucket() string {
+ if x != nil {
+ return x.Bucket
+ }
+ return ""
+}
+
+func (x *InstanceSetting_StorageSetting_S3Config) GetUsePathStyle() bool {
+ if x != nil {
+ return x.UsePathStyle
+ }
+ return false
+}
+
+var File_api_v1_instance_service_proto protoreflect.FileDescriptor
+
+const file_api_v1_instance_service_proto_rawDesc = "" +
+ "\n" +
+ "\x1dapi/v1/instance_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a google/protobuf/field_mask.proto\"x\n" +
+ "\x0fInstanceProfile\x12\x14\n" +
+ "\x05owner\x18\x01 \x01(\tR\x05owner\x12\x18\n" +
+ "\aversion\x18\x02 \x01(\tR\aversion\x12\x12\n" +
+ "\x04mode\x18\x03 \x01(\tR\x04mode\x12!\n" +
+ "\finstance_url\x18\x06 \x01(\tR\vinstanceUrl\"\x1b\n" +
+ "\x19GetInstanceProfileRequest\"\x8b\x11\n" +
+ "\x0fInstanceSetting\x12\x17\n" +
+ "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12W\n" +
+ "\x0fgeneral_setting\x18\x02 \x01(\v2,.memos.api.v1.InstanceSetting.GeneralSettingH\x00R\x0egeneralSetting\x12W\n" +
+ "\x0fstorage_setting\x18\x03 \x01(\v2,.memos.api.v1.InstanceSetting.StorageSettingH\x00R\x0estorageSetting\x12d\n" +
+ "\x14memo_related_setting\x18\x04 \x01(\v20.memos.api.v1.InstanceSetting.MemoRelatedSettingH\x00R\x12memoRelatedSetting\x1a\xf8\x04\n" +
+ "\x0eGeneralSetting\x12\x14\n" +
+ "\x05theme\x18\x01 \x01(\tR\x05theme\x12<\n" +
+ "\x1adisallow_user_registration\x18\x02 \x01(\bR\x18disallowUserRegistration\x124\n" +
+ "\x16disallow_password_auth\x18\x03 \x01(\bR\x14disallowPasswordAuth\x12+\n" +
+ "\x11additional_script\x18\x04 \x01(\tR\x10additionalScript\x12)\n" +
+ "\x10additional_style\x18\x05 \x01(\tR\x0fadditionalStyle\x12a\n" +
+ "\x0ecustom_profile\x18\x06 \x01(\v2:.memos.api.v1.InstanceSetting.GeneralSetting.CustomProfileR\rcustomProfile\x121\n" +
+ "\x15week_start_day_offset\x18\a \x01(\x05R\x12weekStartDayOffset\x128\n" +
+ "\x18disallow_change_username\x18\b \x01(\bR\x16disallowChangeUsername\x128\n" +
+ "\x18disallow_change_nickname\x18\t \x01(\bR\x16disallowChangeNickname\x1az\n" +
+ "\rCustomProfile\x12\x14\n" +
+ "\x05title\x18\x01 \x01(\tR\x05title\x12 \n" +
+ "\vdescription\x18\x02 \x01(\tR\vdescription\x12\x19\n" +
+ "\blogo_url\x18\x03 \x01(\tR\alogoUrl\x12\x16\n" +
+ "\x06locale\x18\x04 \x01(\tR\x06locale\x1a\xbc\x04\n" +
+ "\x0eStorageSetting\x12[\n" +
+ "\fstorage_type\x18\x01 \x01(\x0e28.memos.api.v1.InstanceSetting.StorageSetting.StorageTypeR\vstorageType\x12+\n" +
+ "\x11filepath_template\x18\x02 \x01(\tR\x10filepathTemplate\x12/\n" +
+ "\x14upload_size_limit_mb\x18\x03 \x01(\x03R\x11uploadSizeLimitMb\x12R\n" +
+ "\ts3_config\x18\x04 \x01(\v25.memos.api.v1.InstanceSetting.StorageSetting.S3ConfigR\bs3Config\x1a\xcc\x01\n" +
+ "\bS3Config\x12\"\n" +
+ "\raccess_key_id\x18\x01 \x01(\tR\vaccessKeyId\x12*\n" +
+ "\x11access_key_secret\x18\x02 \x01(\tR\x0faccessKeySecret\x12\x1a\n" +
+ "\bendpoint\x18\x03 \x01(\tR\bendpoint\x12\x16\n" +
+ "\x06region\x18\x04 \x01(\tR\x06region\x12\x16\n" +
+ "\x06bucket\x18\x05 \x01(\tR\x06bucket\x12$\n" +
+ "\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\"L\n" +
+ "\vStorageType\x12\x1c\n" +
+ "\x18STORAGE_TYPE_UNSPECIFIED\x10\x00\x12\f\n" +
+ "\bDATABASE\x10\x01\x12\t\n" +
+ "\x05LOCAL\x10\x02\x12\x06\n" +
+ "\x02S3\x10\x03\x1a\xd8\x03\n" +
+ "\x12MemoRelatedSetting\x12<\n" +
+ "\x1adisallow_public_visibility\x18\x01 \x01(\bR\x18disallowPublicVisibility\x127\n" +
+ "\x18display_with_update_time\x18\x02 \x01(\bR\x15displayWithUpdateTime\x120\n" +
+ "\x14content_length_limit\x18\x03 \x01(\x05R\x12contentLengthLimit\x127\n" +
+ "\x18enable_double_click_edit\x18\x04 \x01(\bR\x15enableDoubleClickEdit\x12.\n" +
+ "\x13enable_link_preview\x18\x05 \x01(\bR\x11enableLinkPreview\x12\x1c\n" +
+ "\treactions\x18\a \x03(\tR\treactions\x12<\n" +
+ "\x1adisable_markdown_shortcuts\x18\b \x01(\bR\x18disableMarkdownShortcuts\x127\n" +
+ "\x18enable_blur_nsfw_content\x18\t \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" +
+ "\tnsfw_tags\x18\n" +
+ " \x03(\tR\bnsfwTags\"F\n" +
+ "\x03Key\x12\x13\n" +
+ "\x0fKEY_UNSPECIFIED\x10\x00\x12\v\n" +
+ "\aGENERAL\x10\x01\x12\v\n" +
+ "\aSTORAGE\x10\x02\x12\x10\n" +
+ "\fMEMO_RELATED\x10\x03:a\xeaA^\n" +
+ "\x1cmemos.api.v1/InstanceSetting\x12\x1binstance/settings/{setting}*\x10instanceSettings2\x0finstanceSettingB\a\n" +
+ "\x05value\"U\n" +
+ "\x19GetInstanceSettingRequest\x128\n" +
+ "\x04name\x18\x01 \x01(\tB$\xe0A\x02\xfaA\x1e\n" +
+ "\x1cmemos.api.v1/InstanceSettingR\x04name\"\x9e\x01\n" +
+ "\x1cUpdateInstanceSettingRequest\x12<\n" +
+ "\asetting\x18\x01 \x01(\v2\x1d.memos.api.v1.InstanceSettingB\x03\xe0A\x02R\asetting\x12@\n" +
+ "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\n" +
+ "updateMask2\xdb\x03\n" +
+ "\x0fInstanceService\x12~\n" +
+ "\x12GetInstanceProfile\x12'.memos.api.v1.GetInstanceProfileRequest\x1a\x1d.memos.api.v1.InstanceProfile\" \x82\xd3\xe4\x93\x02\x1a\x12\x18/api/v1/instance/profile\x12\x8f\x01\n" +
+ "\x12GetInstanceSetting\x12'.memos.api.v1.GetInstanceSettingRequest\x1a\x1d.memos.api.v1.InstanceSetting\"1\xdaA\x04name\x82\xd3\xe4\x93\x02$\x12\"/api/v1/{name=instance/settings/*}\x12\xb5\x01\n" +
+ "\x15UpdateInstanceSetting\x12*.memos.api.v1.UpdateInstanceSettingRequest\x1a\x1d.memos.api.v1.InstanceSetting\"Q\xdaA\x13setting,update_mask\x82\xd3\xe4\x93\x025:\asetting2*/api/v1/{setting.name=instance/settings/*}B\xac\x01\n" +
+ "\x10com.memos.api.v1B\x14InstanceServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
+
+var (
+ file_api_v1_instance_service_proto_rawDescOnce sync.Once
+ file_api_v1_instance_service_proto_rawDescData []byte
+)
+
+func file_api_v1_instance_service_proto_rawDescGZIP() []byte {
+ file_api_v1_instance_service_proto_rawDescOnce.Do(func() {
+ file_api_v1_instance_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_instance_service_proto_rawDesc), len(file_api_v1_instance_service_proto_rawDesc)))
+ })
+ return file_api_v1_instance_service_proto_rawDescData
+}
+
+var file_api_v1_instance_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
+var file_api_v1_instance_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
+var file_api_v1_instance_service_proto_goTypes = []any{
+ (InstanceSetting_Key)(0), // 0: memos.api.v1.InstanceSetting.Key
+ (InstanceSetting_StorageSetting_StorageType)(0), // 1: memos.api.v1.InstanceSetting.StorageSetting.StorageType
+ (*InstanceProfile)(nil), // 2: memos.api.v1.InstanceProfile
+ (*GetInstanceProfileRequest)(nil), // 3: memos.api.v1.GetInstanceProfileRequest
+ (*InstanceSetting)(nil), // 4: memos.api.v1.InstanceSetting
+ (*GetInstanceSettingRequest)(nil), // 5: memos.api.v1.GetInstanceSettingRequest
+ (*UpdateInstanceSettingRequest)(nil), // 6: memos.api.v1.UpdateInstanceSettingRequest
+ (*InstanceSetting_GeneralSetting)(nil), // 7: memos.api.v1.InstanceSetting.GeneralSetting
+ (*InstanceSetting_StorageSetting)(nil), // 8: memos.api.v1.InstanceSetting.StorageSetting
+ (*InstanceSetting_MemoRelatedSetting)(nil), // 9: memos.api.v1.InstanceSetting.MemoRelatedSetting
+ (*InstanceSetting_GeneralSetting_CustomProfile)(nil), // 10: memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile
+ (*InstanceSetting_StorageSetting_S3Config)(nil), // 11: memos.api.v1.InstanceSetting.StorageSetting.S3Config
+ (*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask
+}
+var file_api_v1_instance_service_proto_depIdxs = []int32{
+ 7, // 0: memos.api.v1.InstanceSetting.general_setting:type_name -> memos.api.v1.InstanceSetting.GeneralSetting
+ 8, // 1: memos.api.v1.InstanceSetting.storage_setting:type_name -> memos.api.v1.InstanceSetting.StorageSetting
+ 9, // 2: memos.api.v1.InstanceSetting.memo_related_setting:type_name -> memos.api.v1.InstanceSetting.MemoRelatedSetting
+ 4, // 3: memos.api.v1.UpdateInstanceSettingRequest.setting:type_name -> memos.api.v1.InstanceSetting
+ 12, // 4: memos.api.v1.UpdateInstanceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 10, // 5: memos.api.v1.InstanceSetting.GeneralSetting.custom_profile:type_name -> memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile
+ 1, // 6: memos.api.v1.InstanceSetting.StorageSetting.storage_type:type_name -> memos.api.v1.InstanceSetting.StorageSetting.StorageType
+ 11, // 7: memos.api.v1.InstanceSetting.StorageSetting.s3_config:type_name -> memos.api.v1.InstanceSetting.StorageSetting.S3Config
+ 3, // 8: memos.api.v1.InstanceService.GetInstanceProfile:input_type -> memos.api.v1.GetInstanceProfileRequest
+ 5, // 9: memos.api.v1.InstanceService.GetInstanceSetting:input_type -> memos.api.v1.GetInstanceSettingRequest
+ 6, // 10: memos.api.v1.InstanceService.UpdateInstanceSetting:input_type -> memos.api.v1.UpdateInstanceSettingRequest
+ 2, // 11: memos.api.v1.InstanceService.GetInstanceProfile:output_type -> memos.api.v1.InstanceProfile
+ 4, // 12: memos.api.v1.InstanceService.GetInstanceSetting:output_type -> memos.api.v1.InstanceSetting
+ 4, // 13: memos.api.v1.InstanceService.UpdateInstanceSetting:output_type -> memos.api.v1.InstanceSetting
+ 11, // [11:14] is the sub-list for method output_type
+ 8, // [8:11] is the sub-list for method input_type
+ 8, // [8:8] is the sub-list for extension type_name
+ 8, // [8:8] is the sub-list for extension extendee
+ 0, // [0:8] is the sub-list for field type_name
+}
+
+func init() { file_api_v1_instance_service_proto_init() }
+func file_api_v1_instance_service_proto_init() {
+ if File_api_v1_instance_service_proto != nil {
+ return
+ }
+ file_api_v1_instance_service_proto_msgTypes[2].OneofWrappers = []any{
+ (*InstanceSetting_GeneralSetting_)(nil),
+ (*InstanceSetting_StorageSetting_)(nil),
+ (*InstanceSetting_MemoRelatedSetting_)(nil),
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_instance_service_proto_rawDesc), len(file_api_v1_instance_service_proto_rawDesc)),
+ NumEnums: 2,
+ NumMessages: 10,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_api_v1_instance_service_proto_goTypes,
+ DependencyIndexes: file_api_v1_instance_service_proto_depIdxs,
+ EnumInfos: file_api_v1_instance_service_proto_enumTypes,
+ MessageInfos: file_api_v1_instance_service_proto_msgTypes,
+ }.Build()
+ File_api_v1_instance_service_proto = out.File
+ file_api_v1_instance_service_proto_goTypes = nil
+ file_api_v1_instance_service_proto_depIdxs = nil
+}
diff --git a/proto/gen/api/v1/workspace_service.pb.gw.go b/proto/gen/api/v1/instance_service.pb.gw.go
similarity index 54%
rename from proto/gen/api/v1/workspace_service.pb.gw.go
rename to proto/gen/api/v1/instance_service.pb.gw.go
index acfb832bd..76753c780 100644
--- a/proto/gen/api/v1/workspace_service.pb.gw.go
+++ b/proto/gen/api/v1/instance_service.pb.gw.go
@@ -1,5 +1,5 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
-// source: api/v1/workspace_service.proto
+// source: api/v1/instance_service.proto
/*
Package apiv1 is a reverse proxy.
@@ -35,30 +35,30 @@ var (
_ = metadata.Join
)
-func request_WorkspaceService_GetWorkspaceProfile_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+func request_InstanceService_GetInstanceProfile_0(ctx context.Context, marshaler runtime.Marshaler, client InstanceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
- protoReq GetWorkspaceProfileRequest
+ protoReq GetInstanceProfileRequest
metadata runtime.ServerMetadata
)
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
- msg, err := client.GetWorkspaceProfile(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ msg, err := client.GetInstanceProfile(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
-func local_request_WorkspaceService_GetWorkspaceProfile_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+func local_request_InstanceService_GetInstanceProfile_0(ctx context.Context, marshaler runtime.Marshaler, server InstanceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
- protoReq GetWorkspaceProfileRequest
+ protoReq GetInstanceProfileRequest
metadata runtime.ServerMetadata
)
- msg, err := server.GetWorkspaceProfile(ctx, &protoReq)
+ msg, err := server.GetInstanceProfile(ctx, &protoReq)
return msg, metadata, err
}
-func request_WorkspaceService_GetWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+func request_InstanceService_GetInstanceSetting_0(ctx context.Context, marshaler runtime.Marshaler, client InstanceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
- protoReq GetWorkspaceSettingRequest
+ protoReq GetInstanceSettingRequest
metadata runtime.ServerMetadata
err error
)
@@ -73,13 +73,13 @@ func request_WorkspaceService_GetWorkspaceSetting_0(ctx context.Context, marshal
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))
+ msg, err := client.GetInstanceSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
-func local_request_WorkspaceService_GetWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+func local_request_InstanceService_GetInstanceSetting_0(ctx context.Context, marshaler runtime.Marshaler, server InstanceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
- protoReq GetWorkspaceSettingRequest
+ protoReq GetInstanceSettingRequest
metadata runtime.ServerMetadata
err error
)
@@ -91,15 +91,15 @@ func local_request_WorkspaceService_GetWorkspaceSetting_0(ctx context.Context, m
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
}
- msg, err := server.GetWorkspaceSetting(ctx, &protoReq)
+ msg, err := server.GetInstanceSetting(ctx, &protoReq)
return msg, metadata, err
}
-var filter_WorkspaceService_UpdateWorkspaceSetting_0 = &utilities.DoubleArray{Encoding: map[string]int{"setting": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
+var filter_InstanceService_UpdateInstanceSetting_0 = &utilities.DoubleArray{Encoding: map[string]int{"setting": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
-func request_WorkspaceService_UpdateWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+func request_InstanceService_UpdateInstanceSetting_0(ctx context.Context, marshaler runtime.Marshaler, client InstanceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
- protoReq UpdateWorkspaceSettingRequest
+ protoReq UpdateInstanceSettingRequest
metadata runtime.ServerMetadata
err error
)
@@ -131,16 +131,16 @@ func request_WorkspaceService_UpdateWorkspaceSetting_0(ctx context.Context, mars
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WorkspaceService_UpdateWorkspaceSetting_0); err != nil {
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InstanceService_UpdateInstanceSetting_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
- msg, err := client.UpdateWorkspaceSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ msg, err := client.UpdateInstanceSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
-func local_request_WorkspaceService_UpdateWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+func local_request_InstanceService_UpdateInstanceSetting_0(ctx context.Context, marshaler runtime.Marshaler, server InstanceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
- protoReq UpdateWorkspaceSettingRequest
+ protoReq UpdateInstanceSettingRequest
metadata runtime.ServerMetadata
err error
)
@@ -169,86 +169,86 @@ func local_request_WorkspaceService_UpdateWorkspaceSetting_0(ctx context.Context
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WorkspaceService_UpdateWorkspaceSetting_0); err != nil {
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InstanceService_UpdateInstanceSetting_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
- msg, err := server.UpdateWorkspaceSetting(ctx, &protoReq)
+ msg, err := server.UpdateInstanceSetting(ctx, &protoReq)
return msg, metadata, err
}
-// RegisterWorkspaceServiceHandlerServer registers the http handlers for service WorkspaceService to "mux".
-// UnaryRPC :call WorkspaceServiceServer directly.
+// RegisterInstanceServiceHandlerServer registers the http handlers for service InstanceService to "mux".
+// UnaryRPC :call InstanceServiceServer 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 RegisterWorkspaceServiceHandlerFromEndpoint instead.
+// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterInstanceServiceHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
-func RegisterWorkspaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkspaceServiceServer) error {
- mux.Handle(http.MethodGet, pattern_WorkspaceService_GetWorkspaceProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InstanceServiceServer) error {
+ mux.Handle(http.MethodGet, pattern_InstanceService_GetInstanceProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WorkspaceService/GetWorkspaceProfile", runtime.WithHTTPPathPattern("/api/v1/workspace/profile"))
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InstanceService/GetInstanceProfile", runtime.WithHTTPPathPattern("/api/v1/instance/profile"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
- resp, md, err := local_request_WorkspaceService_GetWorkspaceProfile_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ resp, md, err := local_request_InstanceService_GetInstanceProfile_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_GetWorkspaceProfile_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ forward_InstanceService_GetInstanceProfile_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodGet, pattern_WorkspaceService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ mux.Handle(http.MethodGet, pattern_InstanceService_GetInstanceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WorkspaceService/GetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/{name=workspace/settings/*}"))
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InstanceService/GetInstanceSetting", runtime.WithHTTPPathPattern("/api/v1/{name=instance/settings/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
- resp, md, err := local_request_WorkspaceService_GetWorkspaceSetting_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ resp, md, err := local_request_InstanceService_GetInstanceSetting_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
- forward_WorkspaceService_GetWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ forward_InstanceService_GetInstanceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodPatch, pattern_WorkspaceService_UpdateWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ mux.Handle(http.MethodPatch, pattern_InstanceService_UpdateInstanceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WorkspaceService/UpdateWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=workspace/settings/*}"))
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InstanceService/UpdateInstanceSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=instance/settings/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
- resp, md, err := local_request_WorkspaceService_UpdateWorkspaceSetting_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ resp, md, err := local_request_InstanceService_UpdateInstanceSetting_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
- forward_WorkspaceService_UpdateWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ forward_InstanceService_UpdateInstanceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
-// RegisterWorkspaceServiceHandlerFromEndpoint is same as RegisterWorkspaceServiceHandler but
+// RegisterInstanceServiceHandlerFromEndpoint is same as RegisterInstanceServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterWorkspaceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
+func RegisterInstanceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
@@ -267,83 +267,83 @@ func RegisterWorkspaceServiceHandlerFromEndpoint(ctx context.Context, mux *runti
}
}()
}()
- return RegisterWorkspaceServiceHandler(ctx, mux, conn)
+ return RegisterInstanceServiceHandler(ctx, mux, conn)
}
-// RegisterWorkspaceServiceHandler registers the http handlers for service WorkspaceService to "mux".
+// RegisterInstanceServiceHandler registers the http handlers for service InstanceService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterWorkspaceServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- return RegisterWorkspaceServiceHandlerClient(ctx, mux, NewWorkspaceServiceClient(conn))
+func RegisterInstanceServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
+ return RegisterInstanceServiceHandlerClient(ctx, mux, NewInstanceServiceClient(conn))
}
-// RegisterWorkspaceServiceHandlerClient registers the http handlers for service WorkspaceService
-// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WorkspaceServiceClient".
-// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WorkspaceServiceClient"
+// RegisterInstanceServiceHandlerClient registers the http handlers for service InstanceService
+// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "InstanceServiceClient".
+// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "InstanceServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
-// "WorkspaceServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
-func RegisterWorkspaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkspaceServiceClient) error {
- mux.Handle(http.MethodGet, pattern_WorkspaceService_GetWorkspaceProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+// "InstanceServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
+func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InstanceServiceClient) error {
+ mux.Handle(http.MethodGet, pattern_InstanceService_GetInstanceProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WorkspaceService/GetWorkspaceProfile", runtime.WithHTTPPathPattern("/api/v1/workspace/profile"))
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InstanceService/GetInstanceProfile", runtime.WithHTTPPathPattern("/api/v1/instance/profile"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
- resp, md, err := request_WorkspaceService_GetWorkspaceProfile_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ resp, md, err := request_InstanceService_GetInstanceProfile_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_GetWorkspaceProfile_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ forward_InstanceService_GetInstanceProfile_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodGet, pattern_WorkspaceService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ mux.Handle(http.MethodGet, pattern_InstanceService_GetInstanceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WorkspaceService/GetWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/{name=workspace/settings/*}"))
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InstanceService/GetInstanceSetting", runtime.WithHTTPPathPattern("/api/v1/{name=instance/settings/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
- resp, md, err := request_WorkspaceService_GetWorkspaceSetting_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ resp, md, err := request_InstanceService_GetInstanceSetting_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
- forward_WorkspaceService_GetWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ forward_InstanceService_GetInstanceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodPatch, pattern_WorkspaceService_UpdateWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ mux.Handle(http.MethodPatch, pattern_InstanceService_UpdateInstanceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WorkspaceService/UpdateWorkspaceSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=workspace/settings/*}"))
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InstanceService/UpdateInstanceSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=instance/settings/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
- resp, md, err := request_WorkspaceService_UpdateWorkspaceSetting_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ resp, md, err := request_InstanceService_UpdateInstanceSetting_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
- forward_WorkspaceService_UpdateWorkspaceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ forward_InstanceService_UpdateInstanceSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
- pattern_WorkspaceService_GetWorkspaceProfile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "workspace", "profile"}, ""))
- pattern_WorkspaceService_GetWorkspaceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 3, 5, 4}, []string{"api", "v1", "workspace", "settings", "name"}, ""))
- pattern_WorkspaceService_UpdateWorkspaceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 3, 5, 4}, []string{"api", "v1", "workspace", "settings", "setting.name"}, ""))
+ pattern_InstanceService_GetInstanceProfile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "instance", "profile"}, ""))
+ pattern_InstanceService_GetInstanceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 3, 5, 4}, []string{"api", "v1", "instance", "settings", "name"}, ""))
+ pattern_InstanceService_UpdateInstanceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 3, 5, 4}, []string{"api", "v1", "instance", "settings", "setting.name"}, ""))
)
var (
- forward_WorkspaceService_GetWorkspaceProfile_0 = runtime.ForwardResponseMessage
- forward_WorkspaceService_GetWorkspaceSetting_0 = runtime.ForwardResponseMessage
- forward_WorkspaceService_UpdateWorkspaceSetting_0 = runtime.ForwardResponseMessage
+ forward_InstanceService_GetInstanceProfile_0 = runtime.ForwardResponseMessage
+ forward_InstanceService_GetInstanceSetting_0 = runtime.ForwardResponseMessage
+ forward_InstanceService_UpdateInstanceSetting_0 = runtime.ForwardResponseMessage
)
diff --git a/proto/gen/api/v1/instance_service_grpc.pb.go b/proto/gen/api/v1/instance_service_grpc.pb.go
new file mode 100644
index 000000000..a8d544f53
--- /dev/null
+++ b/proto/gen/api/v1/instance_service_grpc.pb.go
@@ -0,0 +1,203 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.5.1
+// - protoc (unknown)
+// source: api/v1/instance_service.proto
+
+package apiv1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.64.0 or later.
+const _ = grpc.SupportPackageIsVersion9
+
+const (
+ InstanceService_GetInstanceProfile_FullMethodName = "/memos.api.v1.InstanceService/GetInstanceProfile"
+ InstanceService_GetInstanceSetting_FullMethodName = "/memos.api.v1.InstanceService/GetInstanceSetting"
+ InstanceService_UpdateInstanceSetting_FullMethodName = "/memos.api.v1.InstanceService/UpdateInstanceSetting"
+)
+
+// InstanceServiceClient is the client API for InstanceService 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 InstanceServiceClient interface {
+ // Gets the instance profile.
+ GetInstanceProfile(ctx context.Context, in *GetInstanceProfileRequest, opts ...grpc.CallOption) (*InstanceProfile, error)
+ // Gets an instance setting.
+ GetInstanceSetting(ctx context.Context, in *GetInstanceSettingRequest, opts ...grpc.CallOption) (*InstanceSetting, error)
+ // Updates an instance setting.
+ UpdateInstanceSetting(ctx context.Context, in *UpdateInstanceSettingRequest, opts ...grpc.CallOption) (*InstanceSetting, error)
+}
+
+type instanceServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewInstanceServiceClient(cc grpc.ClientConnInterface) InstanceServiceClient {
+ return &instanceServiceClient{cc}
+}
+
+func (c *instanceServiceClient) GetInstanceProfile(ctx context.Context, in *GetInstanceProfileRequest, opts ...grpc.CallOption) (*InstanceProfile, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(InstanceProfile)
+ err := c.cc.Invoke(ctx, InstanceService_GetInstanceProfile_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *instanceServiceClient) GetInstanceSetting(ctx context.Context, in *GetInstanceSettingRequest, opts ...grpc.CallOption) (*InstanceSetting, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(InstanceSetting)
+ err := c.cc.Invoke(ctx, InstanceService_GetInstanceSetting_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *instanceServiceClient) UpdateInstanceSetting(ctx context.Context, in *UpdateInstanceSettingRequest, opts ...grpc.CallOption) (*InstanceSetting, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(InstanceSetting)
+ err := c.cc.Invoke(ctx, InstanceService_UpdateInstanceSetting_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// InstanceServiceServer is the server API for InstanceService service.
+// All implementations must embed UnimplementedInstanceServiceServer
+// for forward compatibility.
+type InstanceServiceServer interface {
+ // Gets the instance profile.
+ GetInstanceProfile(context.Context, *GetInstanceProfileRequest) (*InstanceProfile, error)
+ // Gets an instance setting.
+ GetInstanceSetting(context.Context, *GetInstanceSettingRequest) (*InstanceSetting, error)
+ // Updates an instance setting.
+ UpdateInstanceSetting(context.Context, *UpdateInstanceSettingRequest) (*InstanceSetting, error)
+ mustEmbedUnimplementedInstanceServiceServer()
+}
+
+// UnimplementedInstanceServiceServer must be embedded to have
+// forward compatible implementations.
+//
+// NOTE: this should be embedded by value instead of pointer to avoid a nil
+// pointer dereference when methods are called.
+type UnimplementedInstanceServiceServer struct{}
+
+func (UnimplementedInstanceServiceServer) GetInstanceProfile(context.Context, *GetInstanceProfileRequest) (*InstanceProfile, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetInstanceProfile not implemented")
+}
+func (UnimplementedInstanceServiceServer) GetInstanceSetting(context.Context, *GetInstanceSettingRequest) (*InstanceSetting, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetInstanceSetting not implemented")
+}
+func (UnimplementedInstanceServiceServer) UpdateInstanceSetting(context.Context, *UpdateInstanceSettingRequest) (*InstanceSetting, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateInstanceSetting not implemented")
+}
+func (UnimplementedInstanceServiceServer) mustEmbedUnimplementedInstanceServiceServer() {}
+func (UnimplementedInstanceServiceServer) testEmbeddedByValue() {}
+
+// UnsafeInstanceServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to InstanceServiceServer will
+// result in compilation errors.
+type UnsafeInstanceServiceServer interface {
+ mustEmbedUnimplementedInstanceServiceServer()
+}
+
+func RegisterInstanceServiceServer(s grpc.ServiceRegistrar, srv InstanceServiceServer) {
+ // If the following call pancis, it indicates UnimplementedInstanceServiceServer was
+ // embedded by pointer and is nil. This will cause panics if an
+ // unimplemented method is ever invoked, so we test this at initialization
+ // time to prevent it from happening at runtime later due to I/O.
+ if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
+ t.testEmbeddedByValue()
+ }
+ s.RegisterService(&InstanceService_ServiceDesc, srv)
+}
+
+func _InstanceService_GetInstanceProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetInstanceProfileRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(InstanceServiceServer).GetInstanceProfile(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: InstanceService_GetInstanceProfile_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(InstanceServiceServer).GetInstanceProfile(ctx, req.(*GetInstanceProfileRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _InstanceService_GetInstanceSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetInstanceSettingRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(InstanceServiceServer).GetInstanceSetting(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: InstanceService_GetInstanceSetting_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(InstanceServiceServer).GetInstanceSetting(ctx, req.(*GetInstanceSettingRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _InstanceService_UpdateInstanceSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateInstanceSettingRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(InstanceServiceServer).UpdateInstanceSetting(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: InstanceService_UpdateInstanceSetting_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(InstanceServiceServer).UpdateInstanceSetting(ctx, req.(*UpdateInstanceSettingRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// InstanceService_ServiceDesc is the grpc.ServiceDesc for InstanceService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var InstanceService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "memos.api.v1.InstanceService",
+ HandlerType: (*InstanceServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "GetInstanceProfile",
+ Handler: _InstanceService_GetInstanceProfile_Handler,
+ },
+ {
+ MethodName: "GetInstanceSetting",
+ Handler: _InstanceService_GetInstanceSetting_Handler,
+ },
+ {
+ MethodName: "UpdateInstanceSetting",
+ Handler: _InstanceService_UpdateInstanceSetting_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "api/v1/instance_service.proto",
+}
diff --git a/proto/gen/api/v1/workspace_service.pb.go b/proto/gen/api/v1/workspace_service.pb.go
deleted file mode 100644
index e1e9ef4a0..000000000
--- a/proto/gen/api/v1/workspace_service.pb.go
+++ /dev/null
@@ -1,1086 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.36.10
-// protoc (unknown)
-// source: api/v1/workspace_service.proto
-
-package apiv1
-
-import (
- _ "google.golang.org/genproto/googleapis/api/annotations"
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
- reflect "reflect"
- sync "sync"
- unsafe "unsafe"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-// Enumeration of workspace setting keys.
-type WorkspaceSetting_Key int32
-
-const (
- WorkspaceSetting_KEY_UNSPECIFIED WorkspaceSetting_Key = 0
- // GENERAL is the key for general settings.
- WorkspaceSetting_GENERAL WorkspaceSetting_Key = 1
- // STORAGE is the key for storage settings.
- WorkspaceSetting_STORAGE WorkspaceSetting_Key = 2
- // MEMO_RELATED is the key for memo related settings.
- WorkspaceSetting_MEMO_RELATED WorkspaceSetting_Key = 3
-)
-
-// Enum value maps for WorkspaceSetting_Key.
-var (
- WorkspaceSetting_Key_name = map[int32]string{
- 0: "KEY_UNSPECIFIED",
- 1: "GENERAL",
- 2: "STORAGE",
- 3: "MEMO_RELATED",
- }
- WorkspaceSetting_Key_value = map[string]int32{
- "KEY_UNSPECIFIED": 0,
- "GENERAL": 1,
- "STORAGE": 2,
- "MEMO_RELATED": 3,
- }
-)
-
-func (x WorkspaceSetting_Key) Enum() *WorkspaceSetting_Key {
- p := new(WorkspaceSetting_Key)
- *p = x
- return p
-}
-
-func (x WorkspaceSetting_Key) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (WorkspaceSetting_Key) Descriptor() protoreflect.EnumDescriptor {
- return file_api_v1_workspace_service_proto_enumTypes[0].Descriptor()
-}
-
-func (WorkspaceSetting_Key) Type() protoreflect.EnumType {
- return &file_api_v1_workspace_service_proto_enumTypes[0]
-}
-
-func (x WorkspaceSetting_Key) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use WorkspaceSetting_Key.Descriptor instead.
-func (WorkspaceSetting_Key) EnumDescriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{2, 0}
-}
-
-// Storage type enumeration for different storage backends.
-type WorkspaceSetting_StorageSetting_StorageType int32
-
-const (
- WorkspaceSetting_StorageSetting_STORAGE_TYPE_UNSPECIFIED WorkspaceSetting_StorageSetting_StorageType = 0
- // DATABASE is the database storage type.
- WorkspaceSetting_StorageSetting_DATABASE WorkspaceSetting_StorageSetting_StorageType = 1
- // LOCAL is the local storage type.
- WorkspaceSetting_StorageSetting_LOCAL WorkspaceSetting_StorageSetting_StorageType = 2
- // S3 is the S3 storage type.
- WorkspaceSetting_StorageSetting_S3 WorkspaceSetting_StorageSetting_StorageType = 3
-)
-
-// Enum value maps for WorkspaceSetting_StorageSetting_StorageType.
-var (
- WorkspaceSetting_StorageSetting_StorageType_name = map[int32]string{
- 0: "STORAGE_TYPE_UNSPECIFIED",
- 1: "DATABASE",
- 2: "LOCAL",
- 3: "S3",
- }
- WorkspaceSetting_StorageSetting_StorageType_value = map[string]int32{
- "STORAGE_TYPE_UNSPECIFIED": 0,
- "DATABASE": 1,
- "LOCAL": 2,
- "S3": 3,
- }
-)
-
-func (x WorkspaceSetting_StorageSetting_StorageType) Enum() *WorkspaceSetting_StorageSetting_StorageType {
- p := new(WorkspaceSetting_StorageSetting_StorageType)
- *p = x
- return p
-}
-
-func (x WorkspaceSetting_StorageSetting_StorageType) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (WorkspaceSetting_StorageSetting_StorageType) Descriptor() protoreflect.EnumDescriptor {
- return file_api_v1_workspace_service_proto_enumTypes[1].Descriptor()
-}
-
-func (WorkspaceSetting_StorageSetting_StorageType) Type() protoreflect.EnumType {
- return &file_api_v1_workspace_service_proto_enumTypes[1]
-}
-
-func (x WorkspaceSetting_StorageSetting_StorageType) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use WorkspaceSetting_StorageSetting_StorageType.Descriptor instead.
-func (WorkspaceSetting_StorageSetting_StorageType) EnumDescriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{2, 1, 0}
-}
-
-// Workspace profile message containing basic workspace information.
-type WorkspaceProfile struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of instance owner.
- // Format: users/{user}
- Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`
- // Version is the current version of instance.
- Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
- // Mode is the instance mode (e.g. "prod", "dev" or "demo").
- Mode string `protobuf:"bytes,3,opt,name=mode,proto3" json:"mode,omitempty"`
- // Instance URL is the URL of the instance.
- InstanceUrl string `protobuf:"bytes,6,opt,name=instance_url,json=instanceUrl,proto3" json:"instance_url,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *WorkspaceProfile) Reset() {
- *x = WorkspaceProfile{}
- mi := &file_api_v1_workspace_service_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *WorkspaceProfile) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*WorkspaceProfile) ProtoMessage() {}
-
-func (x *WorkspaceProfile) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_service_proto_msgTypes[0]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use WorkspaceProfile.ProtoReflect.Descriptor instead.
-func (*WorkspaceProfile) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *WorkspaceProfile) GetOwner() string {
- if x != nil {
- return x.Owner
- }
- return ""
-}
-
-func (x *WorkspaceProfile) GetVersion() string {
- if x != nil {
- return x.Version
- }
- return ""
-}
-
-func (x *WorkspaceProfile) GetMode() string {
- if x != nil {
- return x.Mode
- }
- return ""
-}
-
-func (x *WorkspaceProfile) GetInstanceUrl() string {
- if x != nil {
- return x.InstanceUrl
- }
- return ""
-}
-
-// Request for workspace profile.
-type GetWorkspaceProfileRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *GetWorkspaceProfileRequest) Reset() {
- *x = GetWorkspaceProfileRequest{}
- mi := &file_api_v1_workspace_service_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *GetWorkspaceProfileRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GetWorkspaceProfileRequest) ProtoMessage() {}
-
-func (x *GetWorkspaceProfileRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_service_proto_msgTypes[1]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GetWorkspaceProfileRequest.ProtoReflect.Descriptor instead.
-func (*GetWorkspaceProfileRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{1}
-}
-
-// A workspace setting resource.
-type WorkspaceSetting struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of the workspace setting.
- // Format: workspace/settings/{setting}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // Types that are valid to be assigned to Value:
- //
- // *WorkspaceSetting_GeneralSetting_
- // *WorkspaceSetting_StorageSetting_
- // *WorkspaceSetting_MemoRelatedSetting_
- Value isWorkspaceSetting_Value `protobuf_oneof:"value"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *WorkspaceSetting) Reset() {
- *x = WorkspaceSetting{}
- mi := &file_api_v1_workspace_service_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *WorkspaceSetting) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*WorkspaceSetting) ProtoMessage() {}
-
-func (x *WorkspaceSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_service_proto_msgTypes[2]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use WorkspaceSetting.ProtoReflect.Descriptor instead.
-func (*WorkspaceSetting) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *WorkspaceSetting) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-func (x *WorkspaceSetting) GetValue() isWorkspaceSetting_Value {
- if x != nil {
- return x.Value
- }
- return nil
-}
-
-func (x *WorkspaceSetting) GetGeneralSetting() *WorkspaceSetting_GeneralSetting {
- if x != nil {
- if x, ok := x.Value.(*WorkspaceSetting_GeneralSetting_); ok {
- return x.GeneralSetting
- }
- }
- return nil
-}
-
-func (x *WorkspaceSetting) GetStorageSetting() *WorkspaceSetting_StorageSetting {
- if x != nil {
- if x, ok := x.Value.(*WorkspaceSetting_StorageSetting_); ok {
- return x.StorageSetting
- }
- }
- return nil
-}
-
-func (x *WorkspaceSetting) GetMemoRelatedSetting() *WorkspaceSetting_MemoRelatedSetting {
- if x != nil {
- if x, ok := x.Value.(*WorkspaceSetting_MemoRelatedSetting_); ok {
- return x.MemoRelatedSetting
- }
- }
- return nil
-}
-
-type isWorkspaceSetting_Value interface {
- isWorkspaceSetting_Value()
-}
-
-type WorkspaceSetting_GeneralSetting_ struct {
- GeneralSetting *WorkspaceSetting_GeneralSetting `protobuf:"bytes,2,opt,name=general_setting,json=generalSetting,proto3,oneof"`
-}
-
-type WorkspaceSetting_StorageSetting_ struct {
- StorageSetting *WorkspaceSetting_StorageSetting `protobuf:"bytes,3,opt,name=storage_setting,json=storageSetting,proto3,oneof"`
-}
-
-type WorkspaceSetting_MemoRelatedSetting_ struct {
- MemoRelatedSetting *WorkspaceSetting_MemoRelatedSetting `protobuf:"bytes,4,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"`
-}
-
-func (*WorkspaceSetting_GeneralSetting_) isWorkspaceSetting_Value() {}
-
-func (*WorkspaceSetting_StorageSetting_) isWorkspaceSetting_Value() {}
-
-func (*WorkspaceSetting_MemoRelatedSetting_) isWorkspaceSetting_Value() {}
-
-// Request message for GetWorkspaceSetting method.
-type GetWorkspaceSettingRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The resource name of the workspace setting.
- // Format: workspace/settings/{setting}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *GetWorkspaceSettingRequest) Reset() {
- *x = GetWorkspaceSettingRequest{}
- mi := &file_api_v1_workspace_service_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *GetWorkspaceSettingRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GetWorkspaceSettingRequest) ProtoMessage() {}
-
-func (x *GetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_service_proto_msgTypes[3]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GetWorkspaceSettingRequest.ProtoReflect.Descriptor instead.
-func (*GetWorkspaceSettingRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *GetWorkspaceSettingRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-// Request message for UpdateWorkspaceSetting method.
-type UpdateWorkspaceSettingRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The workspace setting resource which replaces the resource on the server.
- Setting *WorkspaceSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"`
- // The list of fields to update.
- UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *UpdateWorkspaceSettingRequest) Reset() {
- *x = UpdateWorkspaceSettingRequest{}
- mi := &file_api_v1_workspace_service_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *UpdateWorkspaceSettingRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*UpdateWorkspaceSettingRequest) ProtoMessage() {}
-
-func (x *UpdateWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_service_proto_msgTypes[4]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use UpdateWorkspaceSettingRequest.ProtoReflect.Descriptor instead.
-func (*UpdateWorkspaceSettingRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *UpdateWorkspaceSettingRequest) GetSetting() *WorkspaceSetting {
- if x != nil {
- return x.Setting
- }
- return nil
-}
-
-func (x *UpdateWorkspaceSettingRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
- if x != nil {
- return x.UpdateMask
- }
- return nil
-}
-
-// General workspace settings configuration.
-type WorkspaceSetting_GeneralSetting struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // theme is the name of the selected theme.
- // This references a CSS file in the web/public/themes/ directory.
- Theme string `protobuf:"bytes,1,opt,name=theme,proto3" json:"theme,omitempty"`
- // disallow_user_registration disallows user registration.
- DisallowUserRegistration bool `protobuf:"varint,2,opt,name=disallow_user_registration,json=disallowUserRegistration,proto3" json:"disallow_user_registration,omitempty"`
- // disallow_password_auth disallows password authentication.
- DisallowPasswordAuth bool `protobuf:"varint,3,opt,name=disallow_password_auth,json=disallowPasswordAuth,proto3" json:"disallow_password_auth,omitempty"`
- // additional_script is the additional script.
- AdditionalScript string `protobuf:"bytes,4,opt,name=additional_script,json=additionalScript,proto3" json:"additional_script,omitempty"`
- // additional_style is the additional style.
- AdditionalStyle string `protobuf:"bytes,5,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"`
- // custom_profile is the custom profile.
- CustomProfile *WorkspaceSetting_GeneralSetting_CustomProfile `protobuf:"bytes,6,opt,name=custom_profile,json=customProfile,proto3" json:"custom_profile,omitempty"`
- // week_start_day_offset is the week start day offset from Sunday.
- // 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
- // Default is Sunday.
- WeekStartDayOffset int32 `protobuf:"varint,7,opt,name=week_start_day_offset,json=weekStartDayOffset,proto3" json:"week_start_day_offset,omitempty"`
- // disallow_change_username disallows changing username.
- DisallowChangeUsername bool `protobuf:"varint,8,opt,name=disallow_change_username,json=disallowChangeUsername,proto3" json:"disallow_change_username,omitempty"`
- // disallow_change_nickname disallows changing nickname.
- DisallowChangeNickname bool `protobuf:"varint,9,opt,name=disallow_change_nickname,json=disallowChangeNickname,proto3" json:"disallow_change_nickname,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *WorkspaceSetting_GeneralSetting) Reset() {
- *x = WorkspaceSetting_GeneralSetting{}
- mi := &file_api_v1_workspace_service_proto_msgTypes[5]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *WorkspaceSetting_GeneralSetting) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*WorkspaceSetting_GeneralSetting) ProtoMessage() {}
-
-func (x *WorkspaceSetting_GeneralSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_service_proto_msgTypes[5]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use WorkspaceSetting_GeneralSetting.ProtoReflect.Descriptor instead.
-func (*WorkspaceSetting_GeneralSetting) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{2, 0}
-}
-
-func (x *WorkspaceSetting_GeneralSetting) GetTheme() string {
- if x != nil {
- return x.Theme
- }
- return ""
-}
-
-func (x *WorkspaceSetting_GeneralSetting) GetDisallowUserRegistration() bool {
- if x != nil {
- return x.DisallowUserRegistration
- }
- return false
-}
-
-func (x *WorkspaceSetting_GeneralSetting) GetDisallowPasswordAuth() bool {
- if x != nil {
- return x.DisallowPasswordAuth
- }
- return false
-}
-
-func (x *WorkspaceSetting_GeneralSetting) GetAdditionalScript() string {
- if x != nil {
- return x.AdditionalScript
- }
- return ""
-}
-
-func (x *WorkspaceSetting_GeneralSetting) GetAdditionalStyle() string {
- if x != nil {
- return x.AdditionalStyle
- }
- return ""
-}
-
-func (x *WorkspaceSetting_GeneralSetting) GetCustomProfile() *WorkspaceSetting_GeneralSetting_CustomProfile {
- if x != nil {
- return x.CustomProfile
- }
- return nil
-}
-
-func (x *WorkspaceSetting_GeneralSetting) GetWeekStartDayOffset() int32 {
- if x != nil {
- return x.WeekStartDayOffset
- }
- return 0
-}
-
-func (x *WorkspaceSetting_GeneralSetting) GetDisallowChangeUsername() bool {
- if x != nil {
- return x.DisallowChangeUsername
- }
- return false
-}
-
-func (x *WorkspaceSetting_GeneralSetting) GetDisallowChangeNickname() bool {
- if x != nil {
- return x.DisallowChangeNickname
- }
- return false
-}
-
-// Storage configuration settings for workspace attachments.
-type WorkspaceSetting_StorageSetting struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // storage_type is the storage type.
- StorageType WorkspaceSetting_StorageSetting_StorageType `protobuf:"varint,1,opt,name=storage_type,json=storageType,proto3,enum=memos.api.v1.WorkspaceSetting_StorageSetting_StorageType" json:"storage_type,omitempty"`
- // The template of file path.
- // e.g. assets/{timestamp}_{filename}
- FilepathTemplate string `protobuf:"bytes,2,opt,name=filepath_template,json=filepathTemplate,proto3" json:"filepath_template,omitempty"`
- // The max upload size in megabytes.
- UploadSizeLimitMb int64 `protobuf:"varint,3,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"`
- // The S3 config.
- S3Config *WorkspaceSetting_StorageSetting_S3Config `protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *WorkspaceSetting_StorageSetting) Reset() {
- *x = WorkspaceSetting_StorageSetting{}
- mi := &file_api_v1_workspace_service_proto_msgTypes[6]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *WorkspaceSetting_StorageSetting) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*WorkspaceSetting_StorageSetting) ProtoMessage() {}
-
-func (x *WorkspaceSetting_StorageSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_service_proto_msgTypes[6]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use WorkspaceSetting_StorageSetting.ProtoReflect.Descriptor instead.
-func (*WorkspaceSetting_StorageSetting) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{2, 1}
-}
-
-func (x *WorkspaceSetting_StorageSetting) GetStorageType() WorkspaceSetting_StorageSetting_StorageType {
- if x != nil {
- return x.StorageType
- }
- return WorkspaceSetting_StorageSetting_STORAGE_TYPE_UNSPECIFIED
-}
-
-func (x *WorkspaceSetting_StorageSetting) GetFilepathTemplate() string {
- if x != nil {
- return x.FilepathTemplate
- }
- return ""
-}
-
-func (x *WorkspaceSetting_StorageSetting) GetUploadSizeLimitMb() int64 {
- if x != nil {
- return x.UploadSizeLimitMb
- }
- return 0
-}
-
-func (x *WorkspaceSetting_StorageSetting) GetS3Config() *WorkspaceSetting_StorageSetting_S3Config {
- if x != nil {
- return x.S3Config
- }
- return nil
-}
-
-// Memo-related workspace settings and policies.
-type WorkspaceSetting_MemoRelatedSetting struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // disallow_public_visibility disallows set memo as public visibility.
- DisallowPublicVisibility bool `protobuf:"varint,1,opt,name=disallow_public_visibility,json=disallowPublicVisibility,proto3" json:"disallow_public_visibility,omitempty"`
- // display_with_update_time orders and displays memo with update time.
- DisplayWithUpdateTime bool `protobuf:"varint,2,opt,name=display_with_update_time,json=displayWithUpdateTime,proto3" json:"display_with_update_time,omitempty"`
- // content_length_limit is the limit of content length. Unit is byte.
- ContentLengthLimit int32 `protobuf:"varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"`
- // enable_double_click_edit enables editing on double click.
- EnableDoubleClickEdit bool `protobuf:"varint,4,opt,name=enable_double_click_edit,json=enableDoubleClickEdit,proto3" json:"enable_double_click_edit,omitempty"`
- // enable_link_preview enables links preview.
- EnableLinkPreview bool `protobuf:"varint,5,opt,name=enable_link_preview,json=enableLinkPreview,proto3" json:"enable_link_preview,omitempty"`
- // reactions is the list of reactions.
- Reactions []string `protobuf:"bytes,7,rep,name=reactions,proto3" json:"reactions,omitempty"`
- // disable_markdown_shortcuts disallow the registration of markdown shortcuts.
- DisableMarkdownShortcuts bool `protobuf:"varint,8,opt,name=disable_markdown_shortcuts,json=disableMarkdownShortcuts,proto3" json:"disable_markdown_shortcuts,omitempty"`
- // enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW).
- EnableBlurNsfwContent bool `protobuf:"varint,9,opt,name=enable_blur_nsfw_content,json=enableBlurNsfwContent,proto3" json:"enable_blur_nsfw_content,omitempty"`
- // nsfw_tags is the list of tags that mark content as NSFW for blurring.
- NsfwTags []string `protobuf:"bytes,10,rep,name=nsfw_tags,json=nsfwTags,proto3" json:"nsfw_tags,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) Reset() {
- *x = WorkspaceSetting_MemoRelatedSetting{}
- mi := &file_api_v1_workspace_service_proto_msgTypes[7]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*WorkspaceSetting_MemoRelatedSetting) ProtoMessage() {}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_service_proto_msgTypes[7]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use WorkspaceSetting_MemoRelatedSetting.ProtoReflect.Descriptor instead.
-func (*WorkspaceSetting_MemoRelatedSetting) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{2, 2}
-}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) GetDisallowPublicVisibility() bool {
- if x != nil {
- return x.DisallowPublicVisibility
- }
- return false
-}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) GetDisplayWithUpdateTime() bool {
- if x != nil {
- return x.DisplayWithUpdateTime
- }
- return false
-}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) GetContentLengthLimit() int32 {
- if x != nil {
- return x.ContentLengthLimit
- }
- return 0
-}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) GetEnableDoubleClickEdit() bool {
- if x != nil {
- return x.EnableDoubleClickEdit
- }
- return false
-}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) GetEnableLinkPreview() bool {
- if x != nil {
- return x.EnableLinkPreview
- }
- return false
-}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) GetReactions() []string {
- if x != nil {
- return x.Reactions
- }
- return nil
-}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) GetDisableMarkdownShortcuts() bool {
- if x != nil {
- return x.DisableMarkdownShortcuts
- }
- return false
-}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) GetEnableBlurNsfwContent() bool {
- if x != nil {
- return x.EnableBlurNsfwContent
- }
- return false
-}
-
-func (x *WorkspaceSetting_MemoRelatedSetting) GetNsfwTags() []string {
- if x != nil {
- return x.NsfwTags
- }
- return nil
-}
-
-// Custom profile configuration for workspace branding.
-type WorkspaceSetting_GeneralSetting_CustomProfile struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
- Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
- LogoUrl string `protobuf:"bytes,3,opt,name=logo_url,json=logoUrl,proto3" json:"logo_url,omitempty"`
- Locale string `protobuf:"bytes,4,opt,name=locale,proto3" json:"locale,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *WorkspaceSetting_GeneralSetting_CustomProfile) Reset() {
- *x = WorkspaceSetting_GeneralSetting_CustomProfile{}
- mi := &file_api_v1_workspace_service_proto_msgTypes[8]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *WorkspaceSetting_GeneralSetting_CustomProfile) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*WorkspaceSetting_GeneralSetting_CustomProfile) ProtoMessage() {}
-
-func (x *WorkspaceSetting_GeneralSetting_CustomProfile) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_service_proto_msgTypes[8]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use WorkspaceSetting_GeneralSetting_CustomProfile.ProtoReflect.Descriptor instead.
-func (*WorkspaceSetting_GeneralSetting_CustomProfile) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{2, 0, 0}
-}
-
-func (x *WorkspaceSetting_GeneralSetting_CustomProfile) GetTitle() string {
- if x != nil {
- return x.Title
- }
- return ""
-}
-
-func (x *WorkspaceSetting_GeneralSetting_CustomProfile) GetDescription() string {
- if x != nil {
- return x.Description
- }
- return ""
-}
-
-func (x *WorkspaceSetting_GeneralSetting_CustomProfile) GetLogoUrl() string {
- if x != nil {
- return x.LogoUrl
- }
- return ""
-}
-
-func (x *WorkspaceSetting_GeneralSetting_CustomProfile) GetLocale() string {
- if x != nil {
- return x.Locale
- }
- return ""
-}
-
-// S3 configuration for cloud storage backend.
-// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
-type WorkspaceSetting_StorageSetting_S3Config struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- AccessKeyId string `protobuf:"bytes,1,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"`
- AccessKeySecret string `protobuf:"bytes,2,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"`
- Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
- Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"`
- Bucket string `protobuf:"bytes,5,opt,name=bucket,proto3" json:"bucket,omitempty"`
- UsePathStyle bool `protobuf:"varint,6,opt,name=use_path_style,json=usePathStyle,proto3" json:"use_path_style,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *WorkspaceSetting_StorageSetting_S3Config) Reset() {
- *x = WorkspaceSetting_StorageSetting_S3Config{}
- mi := &file_api_v1_workspace_service_proto_msgTypes[9]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *WorkspaceSetting_StorageSetting_S3Config) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*WorkspaceSetting_StorageSetting_S3Config) ProtoMessage() {}
-
-func (x *WorkspaceSetting_StorageSetting_S3Config) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_workspace_service_proto_msgTypes[9]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use WorkspaceSetting_StorageSetting_S3Config.ProtoReflect.Descriptor instead.
-func (*WorkspaceSetting_StorageSetting_S3Config) Descriptor() ([]byte, []int) {
- return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{2, 1, 0}
-}
-
-func (x *WorkspaceSetting_StorageSetting_S3Config) GetAccessKeyId() string {
- if x != nil {
- return x.AccessKeyId
- }
- return ""
-}
-
-func (x *WorkspaceSetting_StorageSetting_S3Config) GetAccessKeySecret() string {
- if x != nil {
- return x.AccessKeySecret
- }
- return ""
-}
-
-func (x *WorkspaceSetting_StorageSetting_S3Config) GetEndpoint() string {
- if x != nil {
- return x.Endpoint
- }
- return ""
-}
-
-func (x *WorkspaceSetting_StorageSetting_S3Config) GetRegion() string {
- if x != nil {
- return x.Region
- }
- return ""
-}
-
-func (x *WorkspaceSetting_StorageSetting_S3Config) GetBucket() string {
- if x != nil {
- return x.Bucket
- }
- return ""
-}
-
-func (x *WorkspaceSetting_StorageSetting_S3Config) GetUsePathStyle() bool {
- if x != nil {
- return x.UsePathStyle
- }
- return false
-}
-
-var File_api_v1_workspace_service_proto protoreflect.FileDescriptor
-
-const file_api_v1_workspace_service_proto_rawDesc = "" +
- "\n" +
- "\x1eapi/v1/workspace_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a google/protobuf/field_mask.proto\"y\n" +
- "\x10WorkspaceProfile\x12\x14\n" +
- "\x05owner\x18\x01 \x01(\tR\x05owner\x12\x18\n" +
- "\aversion\x18\x02 \x01(\tR\aversion\x12\x12\n" +
- "\x04mode\x18\x03 \x01(\tR\x04mode\x12!\n" +
- "\finstance_url\x18\x06 \x01(\tR\vinstanceUrl\"\x1c\n" +
- "\x1aGetWorkspaceProfileRequest\"\x97\x11\n" +
- "\x10WorkspaceSetting\x12\x17\n" +
- "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12X\n" +
- "\x0fgeneral_setting\x18\x02 \x01(\v2-.memos.api.v1.WorkspaceSetting.GeneralSettingH\x00R\x0egeneralSetting\x12X\n" +
- "\x0fstorage_setting\x18\x03 \x01(\v2-.memos.api.v1.WorkspaceSetting.StorageSettingH\x00R\x0estorageSetting\x12e\n" +
- "\x14memo_related_setting\x18\x04 \x01(\v21.memos.api.v1.WorkspaceSetting.MemoRelatedSettingH\x00R\x12memoRelatedSetting\x1a\xf9\x04\n" +
- "\x0eGeneralSetting\x12\x14\n" +
- "\x05theme\x18\x01 \x01(\tR\x05theme\x12<\n" +
- "\x1adisallow_user_registration\x18\x02 \x01(\bR\x18disallowUserRegistration\x124\n" +
- "\x16disallow_password_auth\x18\x03 \x01(\bR\x14disallowPasswordAuth\x12+\n" +
- "\x11additional_script\x18\x04 \x01(\tR\x10additionalScript\x12)\n" +
- "\x10additional_style\x18\x05 \x01(\tR\x0fadditionalStyle\x12b\n" +
- "\x0ecustom_profile\x18\x06 \x01(\v2;.memos.api.v1.WorkspaceSetting.GeneralSetting.CustomProfileR\rcustomProfile\x121\n" +
- "\x15week_start_day_offset\x18\a \x01(\x05R\x12weekStartDayOffset\x128\n" +
- "\x18disallow_change_username\x18\b \x01(\bR\x16disallowChangeUsername\x128\n" +
- "\x18disallow_change_nickname\x18\t \x01(\bR\x16disallowChangeNickname\x1az\n" +
- "\rCustomProfile\x12\x14\n" +
- "\x05title\x18\x01 \x01(\tR\x05title\x12 \n" +
- "\vdescription\x18\x02 \x01(\tR\vdescription\x12\x19\n" +
- "\blogo_url\x18\x03 \x01(\tR\alogoUrl\x12\x16\n" +
- "\x06locale\x18\x04 \x01(\tR\x06locale\x1a\xbe\x04\n" +
- "\x0eStorageSetting\x12\\\n" +
- "\fstorage_type\x18\x01 \x01(\x0e29.memos.api.v1.WorkspaceSetting.StorageSetting.StorageTypeR\vstorageType\x12+\n" +
- "\x11filepath_template\x18\x02 \x01(\tR\x10filepathTemplate\x12/\n" +
- "\x14upload_size_limit_mb\x18\x03 \x01(\x03R\x11uploadSizeLimitMb\x12S\n" +
- "\ts3_config\x18\x04 \x01(\v26.memos.api.v1.WorkspaceSetting.StorageSetting.S3ConfigR\bs3Config\x1a\xcc\x01\n" +
- "\bS3Config\x12\"\n" +
- "\raccess_key_id\x18\x01 \x01(\tR\vaccessKeyId\x12*\n" +
- "\x11access_key_secret\x18\x02 \x01(\tR\x0faccessKeySecret\x12\x1a\n" +
- "\bendpoint\x18\x03 \x01(\tR\bendpoint\x12\x16\n" +
- "\x06region\x18\x04 \x01(\tR\x06region\x12\x16\n" +
- "\x06bucket\x18\x05 \x01(\tR\x06bucket\x12$\n" +
- "\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\"L\n" +
- "\vStorageType\x12\x1c\n" +
- "\x18STORAGE_TYPE_UNSPECIFIED\x10\x00\x12\f\n" +
- "\bDATABASE\x10\x01\x12\t\n" +
- "\x05LOCAL\x10\x02\x12\x06\n" +
- "\x02S3\x10\x03\x1a\xd8\x03\n" +
- "\x12MemoRelatedSetting\x12<\n" +
- "\x1adisallow_public_visibility\x18\x01 \x01(\bR\x18disallowPublicVisibility\x127\n" +
- "\x18display_with_update_time\x18\x02 \x01(\bR\x15displayWithUpdateTime\x120\n" +
- "\x14content_length_limit\x18\x03 \x01(\x05R\x12contentLengthLimit\x127\n" +
- "\x18enable_double_click_edit\x18\x04 \x01(\bR\x15enableDoubleClickEdit\x12.\n" +
- "\x13enable_link_preview\x18\x05 \x01(\bR\x11enableLinkPreview\x12\x1c\n" +
- "\treactions\x18\a \x03(\tR\treactions\x12<\n" +
- "\x1adisable_markdown_shortcuts\x18\b \x01(\bR\x18disableMarkdownShortcuts\x127\n" +
- "\x18enable_blur_nsfw_content\x18\t \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" +
- "\tnsfw_tags\x18\n" +
- " \x03(\tR\bnsfwTags\"F\n" +
- "\x03Key\x12\x13\n" +
- "\x0fKEY_UNSPECIFIED\x10\x00\x12\v\n" +
- "\aGENERAL\x10\x01\x12\v\n" +
- "\aSTORAGE\x10\x02\x12\x10\n" +
- "\fMEMO_RELATED\x10\x03:f\xeaAc\n" +
- "\x1eapi.memos.dev/WorkspaceSetting\x12\x1cworkspace/settings/{setting}*\x11workspaceSettings2\x10workspaceSettingB\a\n" +
- "\x05value\"X\n" +
- "\x1aGetWorkspaceSettingRequest\x12:\n" +
- "\x04name\x18\x01 \x01(\tB&\xe0A\x02\xfaA \n" +
- "\x1eapi.memos.dev/WorkspaceSettingR\x04name\"\xa0\x01\n" +
- "\x1dUpdateWorkspaceSettingRequest\x12=\n" +
- "\asetting\x18\x01 \x01(\v2\x1e.memos.api.v1.WorkspaceSettingB\x03\xe0A\x02R\asetting\x12@\n" +
- "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\n" +
- "updateMask2\xe9\x03\n" +
- "\x10WorkspaceService\x12\x82\x01\n" +
- "\x13GetWorkspaceProfile\x12(.memos.api.v1.GetWorkspaceProfileRequest\x1a\x1e.memos.api.v1.WorkspaceProfile\"!\x82\xd3\xe4\x93\x02\x1b\x12\x19/api/v1/workspace/profile\x12\x93\x01\n" +
- "\x13GetWorkspaceSetting\x12(.memos.api.v1.GetWorkspaceSettingRequest\x1a\x1e.memos.api.v1.WorkspaceSetting\"2\xdaA\x04name\x82\xd3\xe4\x93\x02%\x12#/api/v1/{name=workspace/settings/*}\x12\xb9\x01\n" +
- "\x16UpdateWorkspaceSetting\x12+.memos.api.v1.UpdateWorkspaceSettingRequest\x1a\x1e.memos.api.v1.WorkspaceSetting\"R\xdaA\x13setting,update_mask\x82\xd3\xe4\x93\x026:\asetting2+/api/v1/{setting.name=workspace/settings/*}B\xad\x01\n" +
- "\x10com.memos.api.v1B\x15WorkspaceServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
-
-var (
- file_api_v1_workspace_service_proto_rawDescOnce sync.Once
- file_api_v1_workspace_service_proto_rawDescData []byte
-)
-
-func file_api_v1_workspace_service_proto_rawDescGZIP() []byte {
- file_api_v1_workspace_service_proto_rawDescOnce.Do(func() {
- file_api_v1_workspace_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_workspace_service_proto_rawDesc), len(file_api_v1_workspace_service_proto_rawDesc)))
- })
- return file_api_v1_workspace_service_proto_rawDescData
-}
-
-var file_api_v1_workspace_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
-var file_api_v1_workspace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
-var file_api_v1_workspace_service_proto_goTypes = []any{
- (WorkspaceSetting_Key)(0), // 0: memos.api.v1.WorkspaceSetting.Key
- (WorkspaceSetting_StorageSetting_StorageType)(0), // 1: memos.api.v1.WorkspaceSetting.StorageSetting.StorageType
- (*WorkspaceProfile)(nil), // 2: memos.api.v1.WorkspaceProfile
- (*GetWorkspaceProfileRequest)(nil), // 3: memos.api.v1.GetWorkspaceProfileRequest
- (*WorkspaceSetting)(nil), // 4: memos.api.v1.WorkspaceSetting
- (*GetWorkspaceSettingRequest)(nil), // 5: memos.api.v1.GetWorkspaceSettingRequest
- (*UpdateWorkspaceSettingRequest)(nil), // 6: memos.api.v1.UpdateWorkspaceSettingRequest
- (*WorkspaceSetting_GeneralSetting)(nil), // 7: memos.api.v1.WorkspaceSetting.GeneralSetting
- (*WorkspaceSetting_StorageSetting)(nil), // 8: memos.api.v1.WorkspaceSetting.StorageSetting
- (*WorkspaceSetting_MemoRelatedSetting)(nil), // 9: memos.api.v1.WorkspaceSetting.MemoRelatedSetting
- (*WorkspaceSetting_GeneralSetting_CustomProfile)(nil), // 10: memos.api.v1.WorkspaceSetting.GeneralSetting.CustomProfile
- (*WorkspaceSetting_StorageSetting_S3Config)(nil), // 11: memos.api.v1.WorkspaceSetting.StorageSetting.S3Config
- (*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask
-}
-var file_api_v1_workspace_service_proto_depIdxs = []int32{
- 7, // 0: memos.api.v1.WorkspaceSetting.general_setting:type_name -> memos.api.v1.WorkspaceSetting.GeneralSetting
- 8, // 1: memos.api.v1.WorkspaceSetting.storage_setting:type_name -> memos.api.v1.WorkspaceSetting.StorageSetting
- 9, // 2: memos.api.v1.WorkspaceSetting.memo_related_setting:type_name -> memos.api.v1.WorkspaceSetting.MemoRelatedSetting
- 4, // 3: memos.api.v1.UpdateWorkspaceSettingRequest.setting:type_name -> memos.api.v1.WorkspaceSetting
- 12, // 4: memos.api.v1.UpdateWorkspaceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
- 10, // 5: memos.api.v1.WorkspaceSetting.GeneralSetting.custom_profile:type_name -> memos.api.v1.WorkspaceSetting.GeneralSetting.CustomProfile
- 1, // 6: memos.api.v1.WorkspaceSetting.StorageSetting.storage_type:type_name -> memos.api.v1.WorkspaceSetting.StorageSetting.StorageType
- 11, // 7: memos.api.v1.WorkspaceSetting.StorageSetting.s3_config:type_name -> memos.api.v1.WorkspaceSetting.StorageSetting.S3Config
- 3, // 8: memos.api.v1.WorkspaceService.GetWorkspaceProfile:input_type -> memos.api.v1.GetWorkspaceProfileRequest
- 5, // 9: memos.api.v1.WorkspaceService.GetWorkspaceSetting:input_type -> memos.api.v1.GetWorkspaceSettingRequest
- 6, // 10: memos.api.v1.WorkspaceService.UpdateWorkspaceSetting:input_type -> memos.api.v1.UpdateWorkspaceSettingRequest
- 2, // 11: memos.api.v1.WorkspaceService.GetWorkspaceProfile:output_type -> memos.api.v1.WorkspaceProfile
- 4, // 12: memos.api.v1.WorkspaceService.GetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting
- 4, // 13: memos.api.v1.WorkspaceService.UpdateWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting
- 11, // [11:14] is the sub-list for method output_type
- 8, // [8:11] is the sub-list for method input_type
- 8, // [8:8] is the sub-list for extension type_name
- 8, // [8:8] is the sub-list for extension extendee
- 0, // [0:8] is the sub-list for field type_name
-}
-
-func init() { file_api_v1_workspace_service_proto_init() }
-func file_api_v1_workspace_service_proto_init() {
- if File_api_v1_workspace_service_proto != nil {
- return
- }
- file_api_v1_workspace_service_proto_msgTypes[2].OneofWrappers = []any{
- (*WorkspaceSetting_GeneralSetting_)(nil),
- (*WorkspaceSetting_StorageSetting_)(nil),
- (*WorkspaceSetting_MemoRelatedSetting_)(nil),
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_workspace_service_proto_rawDesc), len(file_api_v1_workspace_service_proto_rawDesc)),
- NumEnums: 2,
- NumMessages: 10,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_api_v1_workspace_service_proto_goTypes,
- DependencyIndexes: file_api_v1_workspace_service_proto_depIdxs,
- EnumInfos: file_api_v1_workspace_service_proto_enumTypes,
- MessageInfos: file_api_v1_workspace_service_proto_msgTypes,
- }.Build()
- File_api_v1_workspace_service_proto = out.File
- file_api_v1_workspace_service_proto_goTypes = nil
- file_api_v1_workspace_service_proto_depIdxs = nil
-}
diff --git a/proto/gen/api/v1/workspace_service_grpc.pb.go b/proto/gen/api/v1/workspace_service_grpc.pb.go
deleted file mode 100644
index 36e6f3358..000000000
--- a/proto/gen/api/v1/workspace_service_grpc.pb.go
+++ /dev/null
@@ -1,203 +0,0 @@
-// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-grpc v1.5.1
-// - protoc (unknown)
-// source: api/v1/workspace_service.proto
-
-package apiv1
-
-import (
- context "context"
- grpc "google.golang.org/grpc"
- codes "google.golang.org/grpc/codes"
- status "google.golang.org/grpc/status"
-)
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-// Requires gRPC-Go v1.64.0 or later.
-const _ = grpc.SupportPackageIsVersion9
-
-const (
- WorkspaceService_GetWorkspaceProfile_FullMethodName = "/memos.api.v1.WorkspaceService/GetWorkspaceProfile"
- WorkspaceService_GetWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceService/GetWorkspaceSetting"
- WorkspaceService_UpdateWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceService/UpdateWorkspaceSetting"
-)
-
-// WorkspaceServiceClient is the client API for WorkspaceService service.
-//
-// 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 WorkspaceServiceClient interface {
- // Gets the workspace profile.
- GetWorkspaceProfile(ctx context.Context, in *GetWorkspaceProfileRequest, opts ...grpc.CallOption) (*WorkspaceProfile, error)
- // Gets a workspace setting.
- GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error)
- // Updates a workspace setting.
- UpdateWorkspaceSetting(ctx context.Context, in *UpdateWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error)
-}
-
-type workspaceServiceClient struct {
- cc grpc.ClientConnInterface
-}
-
-func NewWorkspaceServiceClient(cc grpc.ClientConnInterface) WorkspaceServiceClient {
- return &workspaceServiceClient{cc}
-}
-
-func (c *workspaceServiceClient) GetWorkspaceProfile(ctx context.Context, in *GetWorkspaceProfileRequest, opts ...grpc.CallOption) (*WorkspaceProfile, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(WorkspaceProfile)
- err := c.cc.Invoke(ctx, WorkspaceService_GetWorkspaceProfile_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *workspaceServiceClient) GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(WorkspaceSetting)
- err := c.cc.Invoke(ctx, WorkspaceService_GetWorkspaceSetting_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *workspaceServiceClient) UpdateWorkspaceSetting(ctx context.Context, in *UpdateWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(WorkspaceSetting)
- err := c.cc.Invoke(ctx, WorkspaceService_UpdateWorkspaceSetting_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// WorkspaceServiceServer is the server API for WorkspaceService service.
-// All implementations must embed UnimplementedWorkspaceServiceServer
-// for forward compatibility.
-type WorkspaceServiceServer interface {
- // Gets the workspace profile.
- GetWorkspaceProfile(context.Context, *GetWorkspaceProfileRequest) (*WorkspaceProfile, error)
- // Gets a workspace setting.
- GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error)
- // Updates a workspace setting.
- UpdateWorkspaceSetting(context.Context, *UpdateWorkspaceSettingRequest) (*WorkspaceSetting, error)
- mustEmbedUnimplementedWorkspaceServiceServer()
-}
-
-// UnimplementedWorkspaceServiceServer must be embedded to have
-// forward compatible implementations.
-//
-// NOTE: this should be embedded by value instead of pointer to avoid a nil
-// pointer dereference when methods are called.
-type UnimplementedWorkspaceServiceServer struct{}
-
-func (UnimplementedWorkspaceServiceServer) GetWorkspaceProfile(context.Context, *GetWorkspaceProfileRequest) (*WorkspaceProfile, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceProfile not implemented")
-}
-func (UnimplementedWorkspaceServiceServer) GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceSetting not implemented")
-}
-func (UnimplementedWorkspaceServiceServer) UpdateWorkspaceSetting(context.Context, *UpdateWorkspaceSettingRequest) (*WorkspaceSetting, error) {
- return nil, status.Errorf(codes.Unimplemented, "method UpdateWorkspaceSetting not implemented")
-}
-func (UnimplementedWorkspaceServiceServer) mustEmbedUnimplementedWorkspaceServiceServer() {}
-func (UnimplementedWorkspaceServiceServer) testEmbeddedByValue() {}
-
-// UnsafeWorkspaceServiceServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to WorkspaceServiceServer will
-// result in compilation errors.
-type UnsafeWorkspaceServiceServer interface {
- mustEmbedUnimplementedWorkspaceServiceServer()
-}
-
-func RegisterWorkspaceServiceServer(s grpc.ServiceRegistrar, srv WorkspaceServiceServer) {
- // If the following call pancis, it indicates UnimplementedWorkspaceServiceServer was
- // embedded by pointer and is nil. This will cause panics if an
- // unimplemented method is ever invoked, so we test this at initialization
- // time to prevent it from happening at runtime later due to I/O.
- if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
- t.testEmbeddedByValue()
- }
- s.RegisterService(&WorkspaceService_ServiceDesc, srv)
-}
-
-func _WorkspaceService_GetWorkspaceProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(GetWorkspaceProfileRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(WorkspaceServiceServer).GetWorkspaceProfile(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: WorkspaceService_GetWorkspaceProfile_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(WorkspaceServiceServer).GetWorkspaceProfile(ctx, req.(*GetWorkspaceProfileRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _WorkspaceService_GetWorkspaceSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(GetWorkspaceSettingRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(WorkspaceServiceServer).GetWorkspaceSetting(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: WorkspaceService_GetWorkspaceSetting_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(WorkspaceServiceServer).GetWorkspaceSetting(ctx, req.(*GetWorkspaceSettingRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _WorkspaceService_UpdateWorkspaceSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(UpdateWorkspaceSettingRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(WorkspaceServiceServer).UpdateWorkspaceSetting(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: WorkspaceService_UpdateWorkspaceSetting_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(WorkspaceServiceServer).UpdateWorkspaceSetting(ctx, req.(*UpdateWorkspaceSettingRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-// WorkspaceService_ServiceDesc is the grpc.ServiceDesc for WorkspaceService service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var WorkspaceService_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "memos.api.v1.WorkspaceService",
- HandlerType: (*WorkspaceServiceServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "GetWorkspaceProfile",
- Handler: _WorkspaceService_GetWorkspaceProfile_Handler,
- },
- {
- MethodName: "GetWorkspaceSetting",
- Handler: _WorkspaceService_GetWorkspaceSetting_Handler,
- },
- {
- MethodName: "UpdateWorkspaceSetting",
- Handler: _WorkspaceService_UpdateWorkspaceSetting_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "api/v1/workspace_service.proto",
-}
diff --git a/proto/gen/openapi.yaml b/proto/gen/openapi.yaml
index c9dfc653c..150b3a68b 100644
--- a/proto/gen/openapi.yaml
+++ b/proto/gen/openapi.yaml
@@ -304,7 +304,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
- /api/v1/identityProviders:
+ /api/v1/identity-providers:
get:
tags:
- IdentityProviderService
@@ -355,16 +355,16 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
- /api/v1/identityProviders/{identityProvider}:
+ /api/v1/identity-providers/{identity-provider}:
get:
tags:
- IdentityProviderService
description: GetIdentityProvider gets an identity provider.
operationId: IdentityProviderService_GetIdentityProvider
parameters:
- - name: identityProvider
+ - name: identity-provider
in: path
- description: The identityProvider id.
+ description: The identity-provider id.
required: true
schema:
type: string
@@ -387,9 +387,9 @@ paths:
description: DeleteIdentityProvider deletes an identity provider.
operationId: IdentityProviderService_DeleteIdentityProvider
parameters:
- - name: identityProvider
+ - name: identity-provider
in: path
- description: The identityProvider id.
+ description: The identity-provider id.
required: true
schema:
type: string
@@ -409,9 +409,9 @@ paths:
description: UpdateIdentityProvider updates an identity provider.
operationId: IdentityProviderService_UpdateIdentityProvider
parameters:
- - name: identityProvider
+ - name: identity-provider
in: path
- description: The identityProvider id.
+ description: The identity-provider id.
required: true
schema:
type: string
@@ -442,6 +442,88 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
+ /api/v1/instance/profile:
+ get:
+ tags:
+ - InstanceService
+ description: Gets the instance profile.
+ operationId: InstanceService_GetInstanceProfile
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/InstanceProfile'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
+ /api/v1/instance/{instance}/*:
+ get:
+ tags:
+ - InstanceService
+ description: Gets an instance setting.
+ operationId: InstanceService_GetInstanceSetting
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/InstanceSetting'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
+ patch:
+ tags:
+ - InstanceService
+ description: Updates an instance setting.
+ operationId: InstanceService_UpdateInstanceSetting
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: updateMask
+ in: query
+ description: The list of fields to update.
+ schema:
+ type: string
+ format: field-mask
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/InstanceSetting'
+ required: true
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/InstanceSetting'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
/api/v1/memos:
get:
tags:
@@ -1886,88 +1968,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
- /api/v1/workspace/profile:
- get:
- tags:
- - WorkspaceService
- description: Gets the workspace profile.
- operationId: WorkspaceService_GetWorkspaceProfile
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/WorkspaceProfile'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
- /api/v1/workspace/{workspace}/*:
- get:
- tags:
- - WorkspaceService
- description: Gets a workspace setting.
- operationId: WorkspaceService_GetWorkspaceSetting
- parameters:
- - name: workspace
- in: path
- description: The workspace id.
- required: true
- schema:
- type: string
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/WorkspaceSetting'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
- patch:
- tags:
- - WorkspaceService
- description: Updates a workspace setting.
- operationId: WorkspaceService_UpdateWorkspaceSetting
- parameters:
- - name: workspace
- in: path
- description: The workspace id.
- required: true
- schema:
- type: string
- - name: updateMask
- in: query
- description: The list of fields to update.
- schema:
- type: string
- format: field-mask
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/WorkspaceSetting'
- required: true
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/WorkspaceSetting'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
/file/attachments/{attachment}/{filename:
get:
tags:
@@ -2195,7 +2195,7 @@ components:
type: string
locale:
type: string
- description: Custom profile configuration for workspace branding.
+ description: Custom profile configuration for instance branding.
GetCurrentSessionResponse:
type: object
properties:
@@ -2226,7 +2226,7 @@ components:
type: string
description: |-
The resource name of the identity provider.
- Format: identityProviders/{idp}
+ Format: identity-providers/{idp}
type:
enum:
- TYPE_UNSPECIFIED
@@ -2249,6 +2249,138 @@ components:
properties:
oauth2Config:
$ref: '#/components/schemas/OAuth2Config'
+ InstanceProfile:
+ type: object
+ properties:
+ owner:
+ type: string
+ description: |-
+ The name of instance owner.
+ Format: users/{user}
+ version:
+ type: string
+ description: Version is the current version of instance.
+ mode:
+ type: string
+ description: Mode is the instance mode (e.g. "prod", "dev" or "demo").
+ instanceUrl:
+ type: string
+ description: Instance URL is the URL of the instance.
+ description: Instance profile message containing basic instance information.
+ InstanceSetting:
+ type: object
+ properties:
+ name:
+ type: string
+ description: |-
+ The name of the instance setting.
+ Format: instance/settings/{setting}
+ generalSetting:
+ $ref: '#/components/schemas/InstanceSetting_GeneralSetting'
+ storageSetting:
+ $ref: '#/components/schemas/InstanceSetting_StorageSetting'
+ memoRelatedSetting:
+ $ref: '#/components/schemas/InstanceSetting_MemoRelatedSetting'
+ description: An instance setting resource.
+ InstanceSetting_GeneralSetting:
+ type: object
+ properties:
+ theme:
+ type: string
+ description: |-
+ theme is the name of the selected theme.
+ This references a CSS file in the web/public/themes/ directory.
+ disallowUserRegistration:
+ type: boolean
+ description: disallow_user_registration disallows user registration.
+ disallowPasswordAuth:
+ type: boolean
+ description: disallow_password_auth disallows password authentication.
+ additionalScript:
+ type: string
+ description: additional_script is the additional script.
+ additionalStyle:
+ type: string
+ description: additional_style is the additional style.
+ customProfile:
+ allOf:
+ - $ref: '#/components/schemas/GeneralSetting_CustomProfile'
+ description: custom_profile is the custom profile.
+ weekStartDayOffset:
+ type: integer
+ description: |-
+ week_start_day_offset is the week start day offset from Sunday.
+ 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
+ Default is Sunday.
+ format: int32
+ disallowChangeUsername:
+ type: boolean
+ description: disallow_change_username disallows changing username.
+ disallowChangeNickname:
+ type: boolean
+ description: disallow_change_nickname disallows changing nickname.
+ description: General instance settings configuration.
+ InstanceSetting_MemoRelatedSetting:
+ type: object
+ properties:
+ disallowPublicVisibility:
+ type: boolean
+ description: disallow_public_visibility disallows set memo as public visibility.
+ displayWithUpdateTime:
+ type: boolean
+ description: display_with_update_time orders and displays memo with update time.
+ contentLengthLimit:
+ type: integer
+ description: content_length_limit is the limit of content length. Unit is byte.
+ format: int32
+ enableDoubleClickEdit:
+ type: boolean
+ description: enable_double_click_edit enables editing on double click.
+ enableLinkPreview:
+ type: boolean
+ description: enable_link_preview enables links preview.
+ reactions:
+ type: array
+ items:
+ type: string
+ description: reactions is the list of reactions.
+ disableMarkdownShortcuts:
+ type: boolean
+ description: disable_markdown_shortcuts disallow the registration of markdown shortcuts.
+ enableBlurNsfwContent:
+ type: boolean
+ description: enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW).
+ nsfwTags:
+ type: array
+ items:
+ type: string
+ description: nsfw_tags is the list of tags that mark content as NSFW for blurring.
+ description: Memo-related instance settings and policies.
+ InstanceSetting_StorageSetting:
+ type: object
+ properties:
+ storageType:
+ enum:
+ - STORAGE_TYPE_UNSPECIFIED
+ - DATABASE
+ - LOCAL
+ - S3
+ type: string
+ description: storage_type is the storage type.
+ format: enum
+ filepathTemplate:
+ type: string
+ description: |-
+ The template of file path.
+ e.g. assets/{timestamp}_{filename}
+ uploadSizeLimitMb:
+ type: string
+ description: The max upload size in megabytes.
+ s3Config:
+ allOf:
+ - $ref: '#/components/schemas/StorageSetting_S3Config'
+ description: The S3 config.
+ description: Storage configuration settings for instance attachments.
ListActivitiesResponse:
type: object
properties:
@@ -3057,144 +3189,12 @@ components:
description: The last update time of the webhook.
format: date-time
description: UserWebhook represents a webhook owned by a user.
- WorkspaceProfile:
- type: object
- properties:
- owner:
- type: string
- description: |-
- The name of instance owner.
- Format: users/{user}
- version:
- type: string
- description: Version is the current version of instance.
- mode:
- type: string
- description: Mode is the instance mode (e.g. "prod", "dev" or "demo").
- instanceUrl:
- type: string
- description: Instance URL is the URL of the instance.
- description: Workspace profile message containing basic workspace information.
- WorkspaceSetting:
- type: object
- properties:
- name:
- type: string
- description: |-
- The name of the workspace setting.
- Format: workspace/settings/{setting}
- generalSetting:
- $ref: '#/components/schemas/WorkspaceSetting_GeneralSetting'
- storageSetting:
- $ref: '#/components/schemas/WorkspaceSetting_StorageSetting'
- memoRelatedSetting:
- $ref: '#/components/schemas/WorkspaceSetting_MemoRelatedSetting'
- description: A workspace setting resource.
- WorkspaceSetting_GeneralSetting:
- type: object
- properties:
- theme:
- type: string
- description: |-
- theme is the name of the selected theme.
- This references a CSS file in the web/public/themes/ directory.
- disallowUserRegistration:
- type: boolean
- description: disallow_user_registration disallows user registration.
- disallowPasswordAuth:
- type: boolean
- description: disallow_password_auth disallows password authentication.
- additionalScript:
- type: string
- description: additional_script is the additional script.
- additionalStyle:
- type: string
- description: additional_style is the additional style.
- customProfile:
- allOf:
- - $ref: '#/components/schemas/GeneralSetting_CustomProfile'
- description: custom_profile is the custom profile.
- weekStartDayOffset:
- type: integer
- description: |-
- week_start_day_offset is the week start day offset from Sunday.
- 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
- Default is Sunday.
- format: int32
- disallowChangeUsername:
- type: boolean
- description: disallow_change_username disallows changing username.
- disallowChangeNickname:
- type: boolean
- description: disallow_change_nickname disallows changing nickname.
- description: General workspace settings configuration.
- WorkspaceSetting_MemoRelatedSetting:
- type: object
- properties:
- disallowPublicVisibility:
- type: boolean
- description: disallow_public_visibility disallows set memo as public visibility.
- displayWithUpdateTime:
- type: boolean
- description: display_with_update_time orders and displays memo with update time.
- contentLengthLimit:
- type: integer
- description: content_length_limit is the limit of content length. Unit is byte.
- format: int32
- enableDoubleClickEdit:
- type: boolean
- description: enable_double_click_edit enables editing on double click.
- enableLinkPreview:
- type: boolean
- description: enable_link_preview enables links preview.
- reactions:
- type: array
- items:
- type: string
- description: reactions is the list of reactions.
- disableMarkdownShortcuts:
- type: boolean
- description: disable_markdown_shortcuts disallow the registration of markdown shortcuts.
- enableBlurNsfwContent:
- type: boolean
- description: enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW).
- nsfwTags:
- type: array
- items:
- type: string
- description: nsfw_tags is the list of tags that mark content as NSFW for blurring.
- description: Memo-related workspace settings and policies.
- WorkspaceSetting_StorageSetting:
- type: object
- properties:
- storageType:
- enum:
- - STORAGE_TYPE_UNSPECIFIED
- - DATABASE
- - LOCAL
- - S3
- type: string
- description: storage_type is the storage type.
- format: enum
- filepathTemplate:
- type: string
- description: |-
- The template of file path.
- e.g. assets/{timestamp}_{filename}
- uploadSizeLimitMb:
- type: string
- description: The max upload size in megabytes.
- s3Config:
- allOf:
- - $ref: '#/components/schemas/StorageSetting_S3Config'
- description: The S3 config.
- description: Storage configuration settings for workspace attachments.
tags:
- name: ActivityService
- name: AttachmentService
- name: AuthService
- name: IdentityProviderService
+ - name: InstanceService
- name: MemoService
- name: ShortcutService
- name: UserService
- - name: WorkspaceService
diff --git a/proto/gen/store/attachment.pb.go b/proto/gen/store/attachment.pb.go
index 126c75ea4..45c4b2918 100644
--- a/proto/gen/store/attachment.pb.go
+++ b/proto/gen/store/attachment.pb.go
@@ -210,7 +210,7 @@ var File_store_attachment_proto protoreflect.FileDescriptor
const file_store_attachment_proto_rawDesc = "" +
"\n" +
- "\x16store/attachment.proto\x12\vmemos.store\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1dstore/workspace_setting.proto\"\x8c\x02\n" +
+ "\x16store/attachment.proto\x12\vmemos.store\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1cstore/instance_setting.proto\"\x8c\x02\n" +
"\x11AttachmentPayload\x12F\n" +
"\ts3_object\x18\x01 \x01(\v2'.memos.store.AttachmentPayload.S3ObjectH\x00R\bs3Object\x1a\xa3\x01\n" +
"\bS3Object\x129\n" +
@@ -262,7 +262,7 @@ func file_store_attachment_proto_init() {
if File_store_attachment_proto != nil {
return
}
- file_store_workspace_setting_proto_init()
+ file_store_instance_setting_proto_init()
file_store_attachment_proto_msgTypes[0].OneofWrappers = []any{
(*AttachmentPayload_S3Object_)(nil),
}
diff --git a/proto/gen/store/workspace_setting.pb.go b/proto/gen/store/instance_setting.pb.go
similarity index 50%
rename from proto/gen/store/workspace_setting.pb.go
rename to proto/gen/store/instance_setting.pb.go
index 5c09483f5..924d9799b 100644
--- a/proto/gen/store/workspace_setting.pb.go
+++ b/proto/gen/store/instance_setting.pb.go
@@ -2,7 +2,7 @@
// versions:
// protoc-gen-go v1.36.10
// protoc (unknown)
-// source: store/workspace_setting.proto
+// source: store/instance_setting.proto
package store
@@ -21,86 +21,86 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
-type WorkspaceSettingKey int32
+type InstanceSettingKey int32
const (
- WorkspaceSettingKey_WORKSPACE_SETTING_KEY_UNSPECIFIED WorkspaceSettingKey = 0
+ InstanceSettingKey_INSTANCE_SETTING_KEY_UNSPECIFIED InstanceSettingKey = 0
// BASIC is the key for basic settings.
- WorkspaceSettingKey_BASIC WorkspaceSettingKey = 1
+ InstanceSettingKey_BASIC InstanceSettingKey = 1
// GENERAL is the key for general settings.
- WorkspaceSettingKey_GENERAL WorkspaceSettingKey = 2
+ InstanceSettingKey_GENERAL InstanceSettingKey = 2
// STORAGE is the key for storage settings.
- WorkspaceSettingKey_STORAGE WorkspaceSettingKey = 3
+ InstanceSettingKey_STORAGE InstanceSettingKey = 3
// MEMO_RELATED is the key for memo related settings.
- WorkspaceSettingKey_MEMO_RELATED WorkspaceSettingKey = 4
+ InstanceSettingKey_MEMO_RELATED InstanceSettingKey = 4
)
-// Enum value maps for WorkspaceSettingKey.
+// Enum value maps for InstanceSettingKey.
var (
- WorkspaceSettingKey_name = map[int32]string{
- 0: "WORKSPACE_SETTING_KEY_UNSPECIFIED",
+ InstanceSettingKey_name = map[int32]string{
+ 0: "INSTANCE_SETTING_KEY_UNSPECIFIED",
1: "BASIC",
2: "GENERAL",
3: "STORAGE",
4: "MEMO_RELATED",
}
- WorkspaceSettingKey_value = map[string]int32{
- "WORKSPACE_SETTING_KEY_UNSPECIFIED": 0,
- "BASIC": 1,
- "GENERAL": 2,
- "STORAGE": 3,
- "MEMO_RELATED": 4,
+ InstanceSettingKey_value = map[string]int32{
+ "INSTANCE_SETTING_KEY_UNSPECIFIED": 0,
+ "BASIC": 1,
+ "GENERAL": 2,
+ "STORAGE": 3,
+ "MEMO_RELATED": 4,
}
)
-func (x WorkspaceSettingKey) Enum() *WorkspaceSettingKey {
- p := new(WorkspaceSettingKey)
+func (x InstanceSettingKey) Enum() *InstanceSettingKey {
+ p := new(InstanceSettingKey)
*p = x
return p
}
-func (x WorkspaceSettingKey) String() string {
+func (x InstanceSettingKey) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
-func (WorkspaceSettingKey) Descriptor() protoreflect.EnumDescriptor {
- return file_store_workspace_setting_proto_enumTypes[0].Descriptor()
+func (InstanceSettingKey) Descriptor() protoreflect.EnumDescriptor {
+ return file_store_instance_setting_proto_enumTypes[0].Descriptor()
}
-func (WorkspaceSettingKey) Type() protoreflect.EnumType {
- return &file_store_workspace_setting_proto_enumTypes[0]
+func (InstanceSettingKey) Type() protoreflect.EnumType {
+ return &file_store_instance_setting_proto_enumTypes[0]
}
-func (x WorkspaceSettingKey) Number() protoreflect.EnumNumber {
+func (x InstanceSettingKey) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
-// Deprecated: Use WorkspaceSettingKey.Descriptor instead.
-func (WorkspaceSettingKey) EnumDescriptor() ([]byte, []int) {
- return file_store_workspace_setting_proto_rawDescGZIP(), []int{0}
+// Deprecated: Use InstanceSettingKey.Descriptor instead.
+func (InstanceSettingKey) EnumDescriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{0}
}
-type WorkspaceStorageSetting_StorageType int32
+type InstanceStorageSetting_StorageType int32
const (
- WorkspaceStorageSetting_STORAGE_TYPE_UNSPECIFIED WorkspaceStorageSetting_StorageType = 0
+ InstanceStorageSetting_STORAGE_TYPE_UNSPECIFIED InstanceStorageSetting_StorageType = 0
// STORAGE_TYPE_DATABASE is the database storage type.
- WorkspaceStorageSetting_DATABASE WorkspaceStorageSetting_StorageType = 1
+ InstanceStorageSetting_DATABASE InstanceStorageSetting_StorageType = 1
// STORAGE_TYPE_LOCAL is the local storage type.
- WorkspaceStorageSetting_LOCAL WorkspaceStorageSetting_StorageType = 2
+ InstanceStorageSetting_LOCAL InstanceStorageSetting_StorageType = 2
// STORAGE_TYPE_S3 is the S3 storage type.
- WorkspaceStorageSetting_S3 WorkspaceStorageSetting_StorageType = 3
+ InstanceStorageSetting_S3 InstanceStorageSetting_StorageType = 3
)
-// Enum value maps for WorkspaceStorageSetting_StorageType.
+// Enum value maps for InstanceStorageSetting_StorageType.
var (
- WorkspaceStorageSetting_StorageType_name = map[int32]string{
+ InstanceStorageSetting_StorageType_name = map[int32]string{
0: "STORAGE_TYPE_UNSPECIFIED",
1: "DATABASE",
2: "LOCAL",
3: "S3",
}
- WorkspaceStorageSetting_StorageType_value = map[string]int32{
+ InstanceStorageSetting_StorageType_value = map[string]int32{
"STORAGE_TYPE_UNSPECIFIED": 0,
"DATABASE": 1,
"LOCAL": 2,
@@ -108,62 +108,62 @@ var (
}
)
-func (x WorkspaceStorageSetting_StorageType) Enum() *WorkspaceStorageSetting_StorageType {
- p := new(WorkspaceStorageSetting_StorageType)
+func (x InstanceStorageSetting_StorageType) Enum() *InstanceStorageSetting_StorageType {
+ p := new(InstanceStorageSetting_StorageType)
*p = x
return p
}
-func (x WorkspaceStorageSetting_StorageType) String() string {
+func (x InstanceStorageSetting_StorageType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
-func (WorkspaceStorageSetting_StorageType) Descriptor() protoreflect.EnumDescriptor {
- return file_store_workspace_setting_proto_enumTypes[1].Descriptor()
+func (InstanceStorageSetting_StorageType) Descriptor() protoreflect.EnumDescriptor {
+ return file_store_instance_setting_proto_enumTypes[1].Descriptor()
}
-func (WorkspaceStorageSetting_StorageType) Type() protoreflect.EnumType {
- return &file_store_workspace_setting_proto_enumTypes[1]
+func (InstanceStorageSetting_StorageType) Type() protoreflect.EnumType {
+ return &file_store_instance_setting_proto_enumTypes[1]
}
-func (x WorkspaceStorageSetting_StorageType) Number() protoreflect.EnumNumber {
+func (x InstanceStorageSetting_StorageType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
-// Deprecated: Use WorkspaceStorageSetting_StorageType.Descriptor instead.
-func (WorkspaceStorageSetting_StorageType) EnumDescriptor() ([]byte, []int) {
- return file_store_workspace_setting_proto_rawDescGZIP(), []int{4, 0}
+// Deprecated: Use InstanceStorageSetting_StorageType.Descriptor instead.
+func (InstanceStorageSetting_StorageType) EnumDescriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{4, 0}
}
-type WorkspaceSetting struct {
+type InstanceSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
- Key WorkspaceSettingKey `protobuf:"varint,1,opt,name=key,proto3,enum=memos.store.WorkspaceSettingKey" json:"key,omitempty"`
+ Key InstanceSettingKey `protobuf:"varint,1,opt,name=key,proto3,enum=memos.store.InstanceSettingKey" json:"key,omitempty"`
// Types that are valid to be assigned to Value:
//
- // *WorkspaceSetting_BasicSetting
- // *WorkspaceSetting_GeneralSetting
- // *WorkspaceSetting_StorageSetting
- // *WorkspaceSetting_MemoRelatedSetting
- Value isWorkspaceSetting_Value `protobuf_oneof:"value"`
+ // *InstanceSetting_BasicSetting
+ // *InstanceSetting_GeneralSetting
+ // *InstanceSetting_StorageSetting
+ // *InstanceSetting_MemoRelatedSetting
+ Value isInstanceSetting_Value `protobuf_oneof:"value"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
-func (x *WorkspaceSetting) Reset() {
- *x = WorkspaceSetting{}
- mi := &file_store_workspace_setting_proto_msgTypes[0]
+func (x *InstanceSetting) Reset() {
+ *x = InstanceSetting{}
+ mi := &file_store_instance_setting_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *WorkspaceSetting) String() string {
+func (x *InstanceSetting) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*WorkspaceSetting) ProtoMessage() {}
+func (*InstanceSetting) ProtoMessage() {}
-func (x *WorkspaceSetting) ProtoReflect() protoreflect.Message {
- mi := &file_store_workspace_setting_proto_msgTypes[0]
+func (x *InstanceSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_store_instance_setting_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -174,92 +174,92 @@ func (x *WorkspaceSetting) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use WorkspaceSetting.ProtoReflect.Descriptor instead.
-func (*WorkspaceSetting) Descriptor() ([]byte, []int) {
- return file_store_workspace_setting_proto_rawDescGZIP(), []int{0}
+// Deprecated: Use InstanceSetting.ProtoReflect.Descriptor instead.
+func (*InstanceSetting) Descriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{0}
}
-func (x *WorkspaceSetting) GetKey() WorkspaceSettingKey {
+func (x *InstanceSetting) GetKey() InstanceSettingKey {
if x != nil {
return x.Key
}
- return WorkspaceSettingKey_WORKSPACE_SETTING_KEY_UNSPECIFIED
+ return InstanceSettingKey_INSTANCE_SETTING_KEY_UNSPECIFIED
}
-func (x *WorkspaceSetting) GetValue() isWorkspaceSetting_Value {
+func (x *InstanceSetting) GetValue() isInstanceSetting_Value {
if x != nil {
return x.Value
}
return nil
}
-func (x *WorkspaceSetting) GetBasicSetting() *WorkspaceBasicSetting {
+func (x *InstanceSetting) GetBasicSetting() *InstanceBasicSetting {
if x != nil {
- if x, ok := x.Value.(*WorkspaceSetting_BasicSetting); ok {
+ if x, ok := x.Value.(*InstanceSetting_BasicSetting); ok {
return x.BasicSetting
}
}
return nil
}
-func (x *WorkspaceSetting) GetGeneralSetting() *WorkspaceGeneralSetting {
+func (x *InstanceSetting) GetGeneralSetting() *InstanceGeneralSetting {
if x != nil {
- if x, ok := x.Value.(*WorkspaceSetting_GeneralSetting); ok {
+ if x, ok := x.Value.(*InstanceSetting_GeneralSetting); ok {
return x.GeneralSetting
}
}
return nil
}
-func (x *WorkspaceSetting) GetStorageSetting() *WorkspaceStorageSetting {
+func (x *InstanceSetting) GetStorageSetting() *InstanceStorageSetting {
if x != nil {
- if x, ok := x.Value.(*WorkspaceSetting_StorageSetting); ok {
+ if x, ok := x.Value.(*InstanceSetting_StorageSetting); ok {
return x.StorageSetting
}
}
return nil
}
-func (x *WorkspaceSetting) GetMemoRelatedSetting() *WorkspaceMemoRelatedSetting {
+func (x *InstanceSetting) GetMemoRelatedSetting() *InstanceMemoRelatedSetting {
if x != nil {
- if x, ok := x.Value.(*WorkspaceSetting_MemoRelatedSetting); ok {
+ if x, ok := x.Value.(*InstanceSetting_MemoRelatedSetting); ok {
return x.MemoRelatedSetting
}
}
return nil
}
-type isWorkspaceSetting_Value interface {
- isWorkspaceSetting_Value()
+type isInstanceSetting_Value interface {
+ isInstanceSetting_Value()
}
-type WorkspaceSetting_BasicSetting struct {
- BasicSetting *WorkspaceBasicSetting `protobuf:"bytes,2,opt,name=basic_setting,json=basicSetting,proto3,oneof"`
+type InstanceSetting_BasicSetting struct {
+ BasicSetting *InstanceBasicSetting `protobuf:"bytes,2,opt,name=basic_setting,json=basicSetting,proto3,oneof"`
}
-type WorkspaceSetting_GeneralSetting struct {
- GeneralSetting *WorkspaceGeneralSetting `protobuf:"bytes,3,opt,name=general_setting,json=generalSetting,proto3,oneof"`
+type InstanceSetting_GeneralSetting struct {
+ GeneralSetting *InstanceGeneralSetting `protobuf:"bytes,3,opt,name=general_setting,json=generalSetting,proto3,oneof"`
}
-type WorkspaceSetting_StorageSetting struct {
- StorageSetting *WorkspaceStorageSetting `protobuf:"bytes,4,opt,name=storage_setting,json=storageSetting,proto3,oneof"`
+type InstanceSetting_StorageSetting struct {
+ StorageSetting *InstanceStorageSetting `protobuf:"bytes,4,opt,name=storage_setting,json=storageSetting,proto3,oneof"`
}
-type WorkspaceSetting_MemoRelatedSetting struct {
- MemoRelatedSetting *WorkspaceMemoRelatedSetting `protobuf:"bytes,5,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"`
+type InstanceSetting_MemoRelatedSetting struct {
+ MemoRelatedSetting *InstanceMemoRelatedSetting `protobuf:"bytes,5,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"`
}
-func (*WorkspaceSetting_BasicSetting) isWorkspaceSetting_Value() {}
+func (*InstanceSetting_BasicSetting) isInstanceSetting_Value() {}
-func (*WorkspaceSetting_GeneralSetting) isWorkspaceSetting_Value() {}
+func (*InstanceSetting_GeneralSetting) isInstanceSetting_Value() {}
-func (*WorkspaceSetting_StorageSetting) isWorkspaceSetting_Value() {}
+func (*InstanceSetting_StorageSetting) isInstanceSetting_Value() {}
-func (*WorkspaceSetting_MemoRelatedSetting) isWorkspaceSetting_Value() {}
+func (*InstanceSetting_MemoRelatedSetting) isInstanceSetting_Value() {}
-type WorkspaceBasicSetting struct {
+type InstanceBasicSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // The secret key for workspace. Mainly used for session management.
+ // The secret key for instance. Mainly used for session management.
SecretKey string `protobuf:"bytes,1,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"`
// The current schema version of database.
SchemaVersion string `protobuf:"bytes,2,opt,name=schema_version,json=schemaVersion,proto3" json:"schema_version,omitempty"`
@@ -267,21 +267,21 @@ type WorkspaceBasicSetting struct {
sizeCache protoimpl.SizeCache
}
-func (x *WorkspaceBasicSetting) Reset() {
- *x = WorkspaceBasicSetting{}
- mi := &file_store_workspace_setting_proto_msgTypes[1]
+func (x *InstanceBasicSetting) Reset() {
+ *x = InstanceBasicSetting{}
+ mi := &file_store_instance_setting_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *WorkspaceBasicSetting) String() string {
+func (x *InstanceBasicSetting) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*WorkspaceBasicSetting) ProtoMessage() {}
+func (*InstanceBasicSetting) ProtoMessage() {}
-func (x *WorkspaceBasicSetting) ProtoReflect() protoreflect.Message {
- mi := &file_store_workspace_setting_proto_msgTypes[1]
+func (x *InstanceBasicSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_store_instance_setting_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -292,26 +292,26 @@ func (x *WorkspaceBasicSetting) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use WorkspaceBasicSetting.ProtoReflect.Descriptor instead.
-func (*WorkspaceBasicSetting) Descriptor() ([]byte, []int) {
- return file_store_workspace_setting_proto_rawDescGZIP(), []int{1}
+// Deprecated: Use InstanceBasicSetting.ProtoReflect.Descriptor instead.
+func (*InstanceBasicSetting) Descriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{1}
}
-func (x *WorkspaceBasicSetting) GetSecretKey() string {
+func (x *InstanceBasicSetting) GetSecretKey() string {
if x != nil {
return x.SecretKey
}
return ""
}
-func (x *WorkspaceBasicSetting) GetSchemaVersion() string {
+func (x *InstanceBasicSetting) GetSchemaVersion() string {
if x != nil {
return x.SchemaVersion
}
return ""
}
-type WorkspaceGeneralSetting struct {
+type InstanceGeneralSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
// theme is the name of the selected theme.
// This references a CSS file in the web/public/themes/ directory.
@@ -325,7 +325,7 @@ type WorkspaceGeneralSetting struct {
// additional_style is the additional style.
AdditionalStyle string `protobuf:"bytes,5,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"`
// custom_profile is the custom profile.
- CustomProfile *WorkspaceCustomProfile `protobuf:"bytes,6,opt,name=custom_profile,json=customProfile,proto3" json:"custom_profile,omitempty"`
+ CustomProfile *InstanceCustomProfile `protobuf:"bytes,6,opt,name=custom_profile,json=customProfile,proto3" json:"custom_profile,omitempty"`
// week_start_day_offset is the week start day offset from Sunday.
// 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
// Default is Sunday.
@@ -338,21 +338,21 @@ type WorkspaceGeneralSetting struct {
sizeCache protoimpl.SizeCache
}
-func (x *WorkspaceGeneralSetting) Reset() {
- *x = WorkspaceGeneralSetting{}
- mi := &file_store_workspace_setting_proto_msgTypes[2]
+func (x *InstanceGeneralSetting) Reset() {
+ *x = InstanceGeneralSetting{}
+ mi := &file_store_instance_setting_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *WorkspaceGeneralSetting) String() string {
+func (x *InstanceGeneralSetting) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*WorkspaceGeneralSetting) ProtoMessage() {}
+func (*InstanceGeneralSetting) ProtoMessage() {}
-func (x *WorkspaceGeneralSetting) ProtoReflect() protoreflect.Message {
- mi := &file_store_workspace_setting_proto_msgTypes[2]
+func (x *InstanceGeneralSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_store_instance_setting_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -363,75 +363,75 @@ func (x *WorkspaceGeneralSetting) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use WorkspaceGeneralSetting.ProtoReflect.Descriptor instead.
-func (*WorkspaceGeneralSetting) Descriptor() ([]byte, []int) {
- return file_store_workspace_setting_proto_rawDescGZIP(), []int{2}
+// Deprecated: Use InstanceGeneralSetting.ProtoReflect.Descriptor instead.
+func (*InstanceGeneralSetting) Descriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{2}
}
-func (x *WorkspaceGeneralSetting) GetTheme() string {
+func (x *InstanceGeneralSetting) GetTheme() string {
if x != nil {
return x.Theme
}
return ""
}
-func (x *WorkspaceGeneralSetting) GetDisallowUserRegistration() bool {
+func (x *InstanceGeneralSetting) GetDisallowUserRegistration() bool {
if x != nil {
return x.DisallowUserRegistration
}
return false
}
-func (x *WorkspaceGeneralSetting) GetDisallowPasswordAuth() bool {
+func (x *InstanceGeneralSetting) GetDisallowPasswordAuth() bool {
if x != nil {
return x.DisallowPasswordAuth
}
return false
}
-func (x *WorkspaceGeneralSetting) GetAdditionalScript() string {
+func (x *InstanceGeneralSetting) GetAdditionalScript() string {
if x != nil {
return x.AdditionalScript
}
return ""
}
-func (x *WorkspaceGeneralSetting) GetAdditionalStyle() string {
+func (x *InstanceGeneralSetting) GetAdditionalStyle() string {
if x != nil {
return x.AdditionalStyle
}
return ""
}
-func (x *WorkspaceGeneralSetting) GetCustomProfile() *WorkspaceCustomProfile {
+func (x *InstanceGeneralSetting) GetCustomProfile() *InstanceCustomProfile {
if x != nil {
return x.CustomProfile
}
return nil
}
-func (x *WorkspaceGeneralSetting) GetWeekStartDayOffset() int32 {
+func (x *InstanceGeneralSetting) GetWeekStartDayOffset() int32 {
if x != nil {
return x.WeekStartDayOffset
}
return 0
}
-func (x *WorkspaceGeneralSetting) GetDisallowChangeUsername() bool {
+func (x *InstanceGeneralSetting) GetDisallowChangeUsername() bool {
if x != nil {
return x.DisallowChangeUsername
}
return false
}
-func (x *WorkspaceGeneralSetting) GetDisallowChangeNickname() bool {
+func (x *InstanceGeneralSetting) GetDisallowChangeNickname() bool {
if x != nil {
return x.DisallowChangeNickname
}
return false
}
-type WorkspaceCustomProfile struct {
+type InstanceCustomProfile struct {
state protoimpl.MessageState `protogen:"open.v1"`
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
@@ -441,21 +441,21 @@ type WorkspaceCustomProfile struct {
sizeCache protoimpl.SizeCache
}
-func (x *WorkspaceCustomProfile) Reset() {
- *x = WorkspaceCustomProfile{}
- mi := &file_store_workspace_setting_proto_msgTypes[3]
+func (x *InstanceCustomProfile) Reset() {
+ *x = InstanceCustomProfile{}
+ mi := &file_store_instance_setting_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *WorkspaceCustomProfile) String() string {
+func (x *InstanceCustomProfile) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*WorkspaceCustomProfile) ProtoMessage() {}
+func (*InstanceCustomProfile) ProtoMessage() {}
-func (x *WorkspaceCustomProfile) ProtoReflect() protoreflect.Message {
- mi := &file_store_workspace_setting_proto_msgTypes[3]
+func (x *InstanceCustomProfile) ProtoReflect() protoreflect.Message {
+ mi := &file_store_instance_setting_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -466,43 +466,43 @@ func (x *WorkspaceCustomProfile) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use WorkspaceCustomProfile.ProtoReflect.Descriptor instead.
-func (*WorkspaceCustomProfile) Descriptor() ([]byte, []int) {
- return file_store_workspace_setting_proto_rawDescGZIP(), []int{3}
+// Deprecated: Use InstanceCustomProfile.ProtoReflect.Descriptor instead.
+func (*InstanceCustomProfile) Descriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{3}
}
-func (x *WorkspaceCustomProfile) GetTitle() string {
+func (x *InstanceCustomProfile) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
-func (x *WorkspaceCustomProfile) GetDescription() string {
+func (x *InstanceCustomProfile) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
-func (x *WorkspaceCustomProfile) GetLogoUrl() string {
+func (x *InstanceCustomProfile) GetLogoUrl() string {
if x != nil {
return x.LogoUrl
}
return ""
}
-func (x *WorkspaceCustomProfile) GetLocale() string {
+func (x *InstanceCustomProfile) GetLocale() string {
if x != nil {
return x.Locale
}
return ""
}
-type WorkspaceStorageSetting struct {
+type InstanceStorageSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
// storage_type is the storage type.
- StorageType WorkspaceStorageSetting_StorageType `protobuf:"varint,1,opt,name=storage_type,json=storageType,proto3,enum=memos.store.WorkspaceStorageSetting_StorageType" json:"storage_type,omitempty"`
+ StorageType InstanceStorageSetting_StorageType `protobuf:"varint,1,opt,name=storage_type,json=storageType,proto3,enum=memos.store.InstanceStorageSetting_StorageType" json:"storage_type,omitempty"`
// The template of file path.
// e.g. assets/{timestamp}_{filename}
FilepathTemplate string `protobuf:"bytes,2,opt,name=filepath_template,json=filepathTemplate,proto3" json:"filepath_template,omitempty"`
@@ -514,21 +514,21 @@ type WorkspaceStorageSetting struct {
sizeCache protoimpl.SizeCache
}
-func (x *WorkspaceStorageSetting) Reset() {
- *x = WorkspaceStorageSetting{}
- mi := &file_store_workspace_setting_proto_msgTypes[4]
+func (x *InstanceStorageSetting) Reset() {
+ *x = InstanceStorageSetting{}
+ mi := &file_store_instance_setting_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *WorkspaceStorageSetting) String() string {
+func (x *InstanceStorageSetting) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*WorkspaceStorageSetting) ProtoMessage() {}
+func (*InstanceStorageSetting) ProtoMessage() {}
-func (x *WorkspaceStorageSetting) ProtoReflect() protoreflect.Message {
- mi := &file_store_workspace_setting_proto_msgTypes[4]
+func (x *InstanceStorageSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_store_instance_setting_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -539,33 +539,33 @@ func (x *WorkspaceStorageSetting) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use WorkspaceStorageSetting.ProtoReflect.Descriptor instead.
-func (*WorkspaceStorageSetting) Descriptor() ([]byte, []int) {
- return file_store_workspace_setting_proto_rawDescGZIP(), []int{4}
+// Deprecated: Use InstanceStorageSetting.ProtoReflect.Descriptor instead.
+func (*InstanceStorageSetting) Descriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{4}
}
-func (x *WorkspaceStorageSetting) GetStorageType() WorkspaceStorageSetting_StorageType {
+func (x *InstanceStorageSetting) GetStorageType() InstanceStorageSetting_StorageType {
if x != nil {
return x.StorageType
}
- return WorkspaceStorageSetting_STORAGE_TYPE_UNSPECIFIED
+ return InstanceStorageSetting_STORAGE_TYPE_UNSPECIFIED
}
-func (x *WorkspaceStorageSetting) GetFilepathTemplate() string {
+func (x *InstanceStorageSetting) GetFilepathTemplate() string {
if x != nil {
return x.FilepathTemplate
}
return ""
}
-func (x *WorkspaceStorageSetting) GetUploadSizeLimitMb() int64 {
+func (x *InstanceStorageSetting) GetUploadSizeLimitMb() int64 {
if x != nil {
return x.UploadSizeLimitMb
}
return 0
}
-func (x *WorkspaceStorageSetting) GetS3Config() *StorageS3Config {
+func (x *InstanceStorageSetting) GetS3Config() *StorageS3Config {
if x != nil {
return x.S3Config
}
@@ -587,7 +587,7 @@ type StorageS3Config struct {
func (x *StorageS3Config) Reset() {
*x = StorageS3Config{}
- mi := &file_store_workspace_setting_proto_msgTypes[5]
+ mi := &file_store_instance_setting_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -599,7 +599,7 @@ func (x *StorageS3Config) String() string {
func (*StorageS3Config) ProtoMessage() {}
func (x *StorageS3Config) ProtoReflect() protoreflect.Message {
- mi := &file_store_workspace_setting_proto_msgTypes[5]
+ mi := &file_store_instance_setting_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -612,7 +612,7 @@ func (x *StorageS3Config) ProtoReflect() protoreflect.Message {
// Deprecated: Use StorageS3Config.ProtoReflect.Descriptor instead.
func (*StorageS3Config) Descriptor() ([]byte, []int) {
- return file_store_workspace_setting_proto_rawDescGZIP(), []int{5}
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{5}
}
func (x *StorageS3Config) GetAccessKeyId() string {
@@ -657,7 +657,7 @@ func (x *StorageS3Config) GetUsePathStyle() bool {
return false
}
-type WorkspaceMemoRelatedSetting struct {
+type InstanceMemoRelatedSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
// disallow_public_visibility disallows set memo as public visibility.
DisallowPublicVisibility bool `protobuf:"varint,1,opt,name=disallow_public_visibility,json=disallowPublicVisibility,proto3" json:"disallow_public_visibility,omitempty"`
@@ -681,21 +681,21 @@ type WorkspaceMemoRelatedSetting struct {
sizeCache protoimpl.SizeCache
}
-func (x *WorkspaceMemoRelatedSetting) Reset() {
- *x = WorkspaceMemoRelatedSetting{}
- mi := &file_store_workspace_setting_proto_msgTypes[6]
+func (x *InstanceMemoRelatedSetting) Reset() {
+ *x = InstanceMemoRelatedSetting{}
+ mi := &file_store_instance_setting_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *WorkspaceMemoRelatedSetting) String() string {
+func (x *InstanceMemoRelatedSetting) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*WorkspaceMemoRelatedSetting) ProtoMessage() {}
+func (*InstanceMemoRelatedSetting) ProtoMessage() {}
-func (x *WorkspaceMemoRelatedSetting) ProtoReflect() protoreflect.Message {
- mi := &file_store_workspace_setting_proto_msgTypes[6]
+func (x *InstanceMemoRelatedSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_store_instance_setting_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -706,107 +706,107 @@ func (x *WorkspaceMemoRelatedSetting) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use WorkspaceMemoRelatedSetting.ProtoReflect.Descriptor instead.
-func (*WorkspaceMemoRelatedSetting) Descriptor() ([]byte, []int) {
- return file_store_workspace_setting_proto_rawDescGZIP(), []int{6}
+// Deprecated: Use InstanceMemoRelatedSetting.ProtoReflect.Descriptor instead.
+func (*InstanceMemoRelatedSetting) Descriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{6}
}
-func (x *WorkspaceMemoRelatedSetting) GetDisallowPublicVisibility() bool {
+func (x *InstanceMemoRelatedSetting) GetDisallowPublicVisibility() bool {
if x != nil {
return x.DisallowPublicVisibility
}
return false
}
-func (x *WorkspaceMemoRelatedSetting) GetDisplayWithUpdateTime() bool {
+func (x *InstanceMemoRelatedSetting) GetDisplayWithUpdateTime() bool {
if x != nil {
return x.DisplayWithUpdateTime
}
return false
}
-func (x *WorkspaceMemoRelatedSetting) GetContentLengthLimit() int32 {
+func (x *InstanceMemoRelatedSetting) GetContentLengthLimit() int32 {
if x != nil {
return x.ContentLengthLimit
}
return 0
}
-func (x *WorkspaceMemoRelatedSetting) GetEnableDoubleClickEdit() bool {
+func (x *InstanceMemoRelatedSetting) GetEnableDoubleClickEdit() bool {
if x != nil {
return x.EnableDoubleClickEdit
}
return false
}
-func (x *WorkspaceMemoRelatedSetting) GetEnableLinkPreview() bool {
+func (x *InstanceMemoRelatedSetting) GetEnableLinkPreview() bool {
if x != nil {
return x.EnableLinkPreview
}
return false
}
-func (x *WorkspaceMemoRelatedSetting) GetReactions() []string {
+func (x *InstanceMemoRelatedSetting) GetReactions() []string {
if x != nil {
return x.Reactions
}
return nil
}
-func (x *WorkspaceMemoRelatedSetting) GetDisableMarkdownShortcuts() bool {
+func (x *InstanceMemoRelatedSetting) GetDisableMarkdownShortcuts() bool {
if x != nil {
return x.DisableMarkdownShortcuts
}
return false
}
-func (x *WorkspaceMemoRelatedSetting) GetEnableBlurNsfwContent() bool {
+func (x *InstanceMemoRelatedSetting) GetEnableBlurNsfwContent() bool {
if x != nil {
return x.EnableBlurNsfwContent
}
return false
}
-func (x *WorkspaceMemoRelatedSetting) GetNsfwTags() []string {
+func (x *InstanceMemoRelatedSetting) GetNsfwTags() []string {
if x != nil {
return x.NsfwTags
}
return nil
}
-var File_store_workspace_setting_proto protoreflect.FileDescriptor
+var File_store_instance_setting_proto protoreflect.FileDescriptor
-const file_store_workspace_setting_proto_rawDesc = "" +
+const file_store_instance_setting_proto_rawDesc = "" +
"\n" +
- "\x1dstore/workspace_setting.proto\x12\vmemos.store\"\x9a\x03\n" +
- "\x10WorkspaceSetting\x122\n" +
- "\x03key\x18\x01 \x01(\x0e2 .memos.store.WorkspaceSettingKeyR\x03key\x12I\n" +
- "\rbasic_setting\x18\x02 \x01(\v2\".memos.store.WorkspaceBasicSettingH\x00R\fbasicSetting\x12O\n" +
- "\x0fgeneral_setting\x18\x03 \x01(\v2$.memos.store.WorkspaceGeneralSettingH\x00R\x0egeneralSetting\x12O\n" +
- "\x0fstorage_setting\x18\x04 \x01(\v2$.memos.store.WorkspaceStorageSettingH\x00R\x0estorageSetting\x12\\\n" +
- "\x14memo_related_setting\x18\x05 \x01(\v2(.memos.store.WorkspaceMemoRelatedSettingH\x00R\x12memoRelatedSettingB\a\n" +
- "\x05value\"]\n" +
- "\x15WorkspaceBasicSetting\x12\x1d\n" +
+ "\x1cstore/instance_setting.proto\x12\vmemos.store\"\x94\x03\n" +
+ "\x0fInstanceSetting\x121\n" +
+ "\x03key\x18\x01 \x01(\x0e2\x1f.memos.store.InstanceSettingKeyR\x03key\x12H\n" +
+ "\rbasic_setting\x18\x02 \x01(\v2!.memos.store.InstanceBasicSettingH\x00R\fbasicSetting\x12N\n" +
+ "\x0fgeneral_setting\x18\x03 \x01(\v2#.memos.store.InstanceGeneralSettingH\x00R\x0egeneralSetting\x12N\n" +
+ "\x0fstorage_setting\x18\x04 \x01(\v2#.memos.store.InstanceStorageSettingH\x00R\x0estorageSetting\x12[\n" +
+ "\x14memo_related_setting\x18\x05 \x01(\v2'.memos.store.InstanceMemoRelatedSettingH\x00R\x12memoRelatedSettingB\a\n" +
+ "\x05value\"\\\n" +
+ "\x14InstanceBasicSetting\x12\x1d\n" +
"\n" +
"secret_key\x18\x01 \x01(\tR\tsecretKey\x12%\n" +
- "\x0eschema_version\x18\x02 \x01(\tR\rschemaVersion\"\xee\x03\n" +
- "\x17WorkspaceGeneralSetting\x12\x14\n" +
+ "\x0eschema_version\x18\x02 \x01(\tR\rschemaVersion\"\xec\x03\n" +
+ "\x16InstanceGeneralSetting\x12\x14\n" +
"\x05theme\x18\x01 \x01(\tR\x05theme\x12<\n" +
"\x1adisallow_user_registration\x18\x02 \x01(\bR\x18disallowUserRegistration\x124\n" +
"\x16disallow_password_auth\x18\x03 \x01(\bR\x14disallowPasswordAuth\x12+\n" +
"\x11additional_script\x18\x04 \x01(\tR\x10additionalScript\x12)\n" +
- "\x10additional_style\x18\x05 \x01(\tR\x0fadditionalStyle\x12J\n" +
- "\x0ecustom_profile\x18\x06 \x01(\v2#.memos.store.WorkspaceCustomProfileR\rcustomProfile\x121\n" +
+ "\x10additional_style\x18\x05 \x01(\tR\x0fadditionalStyle\x12I\n" +
+ "\x0ecustom_profile\x18\x06 \x01(\v2\".memos.store.InstanceCustomProfileR\rcustomProfile\x121\n" +
"\x15week_start_day_offset\x18\a \x01(\x05R\x12weekStartDayOffset\x128\n" +
"\x18disallow_change_username\x18\b \x01(\bR\x16disallowChangeUsername\x128\n" +
- "\x18disallow_change_nickname\x18\t \x01(\bR\x16disallowChangeNickname\"\x83\x01\n" +
- "\x16WorkspaceCustomProfile\x12\x14\n" +
+ "\x18disallow_change_nickname\x18\t \x01(\bR\x16disallowChangeNickname\"\x82\x01\n" +
+ "\x15InstanceCustomProfile\x12\x14\n" +
"\x05title\x18\x01 \x01(\tR\x05title\x12 \n" +
"\vdescription\x18\x02 \x01(\tR\vdescription\x12\x19\n" +
"\blogo_url\x18\x03 \x01(\tR\alogoUrl\x12\x16\n" +
- "\x06locale\x18\x04 \x01(\tR\x06locale\"\xd5\x02\n" +
- "\x17WorkspaceStorageSetting\x12S\n" +
- "\fstorage_type\x18\x01 \x01(\x0e20.memos.store.WorkspaceStorageSetting.StorageTypeR\vstorageType\x12+\n" +
+ "\x06locale\x18\x04 \x01(\tR\x06locale\"\xd3\x02\n" +
+ "\x16InstanceStorageSetting\x12R\n" +
+ "\fstorage_type\x18\x01 \x01(\x0e2/.memos.store.InstanceStorageSetting.StorageTypeR\vstorageType\x12+\n" +
"\x11filepath_template\x18\x02 \x01(\tR\x10filepathTemplate\x12/\n" +
"\x14upload_size_limit_mb\x18\x03 \x01(\x03R\x11uploadSizeLimitMb\x129\n" +
"\ts3_config\x18\x04 \x01(\v2\x1c.memos.store.StorageS3ConfigR\bs3Config\"L\n" +
@@ -821,8 +821,8 @@ const file_store_workspace_setting_proto_rawDesc = "" +
"\bendpoint\x18\x03 \x01(\tR\bendpoint\x12\x16\n" +
"\x06region\x18\x04 \x01(\tR\x06region\x12\x16\n" +
"\x06bucket\x18\x05 \x01(\tR\x06bucket\x12$\n" +
- "\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\"\xe1\x03\n" +
- "\x1bWorkspaceMemoRelatedSetting\x12<\n" +
+ "\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\"\xe0\x03\n" +
+ "\x1aInstanceMemoRelatedSetting\x12<\n" +
"\x1adisallow_public_visibility\x18\x01 \x01(\bR\x18disallowPublicVisibility\x127\n" +
"\x18display_with_update_time\x18\x02 \x01(\bR\x15displayWithUpdateTime\x120\n" +
"\x14content_length_limit\x18\x03 \x01(\x05R\x12contentLengthLimit\x127\n" +
@@ -832,49 +832,49 @@ const file_store_workspace_setting_proto_rawDesc = "" +
"\x1adisable_markdown_shortcuts\x18\b \x01(\bR\x18disableMarkdownShortcuts\x127\n" +
"\x18enable_blur_nsfw_content\x18\t \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" +
"\tnsfw_tags\x18\n" +
- " \x03(\tR\bnsfwTags*s\n" +
- "\x13WorkspaceSettingKey\x12%\n" +
- "!WORKSPACE_SETTING_KEY_UNSPECIFIED\x10\x00\x12\t\n" +
+ " \x03(\tR\bnsfwTags*q\n" +
+ "\x12InstanceSettingKey\x12$\n" +
+ " INSTANCE_SETTING_KEY_UNSPECIFIED\x10\x00\x12\t\n" +
"\x05BASIC\x10\x01\x12\v\n" +
"\aGENERAL\x10\x02\x12\v\n" +
"\aSTORAGE\x10\x03\x12\x10\n" +
- "\fMEMO_RELATED\x10\x04B\xa0\x01\n" +
- "\x0fcom.memos.storeB\x15WorkspaceSettingProtoP\x01Z)github.com/usememos/memos/proto/gen/store\xa2\x02\x03MSX\xaa\x02\vMemos.Store\xca\x02\vMemos\\Store\xe2\x02\x17Memos\\Store\\GPBMetadata\xea\x02\fMemos::Storeb\x06proto3"
+ "\fMEMO_RELATED\x10\x04B\x9f\x01\n" +
+ "\x0fcom.memos.storeB\x14InstanceSettingProtoP\x01Z)github.com/usememos/memos/proto/gen/store\xa2\x02\x03MSX\xaa\x02\vMemos.Store\xca\x02\vMemos\\Store\xe2\x02\x17Memos\\Store\\GPBMetadata\xea\x02\fMemos::Storeb\x06proto3"
var (
- file_store_workspace_setting_proto_rawDescOnce sync.Once
- file_store_workspace_setting_proto_rawDescData []byte
+ file_store_instance_setting_proto_rawDescOnce sync.Once
+ file_store_instance_setting_proto_rawDescData []byte
)
-func file_store_workspace_setting_proto_rawDescGZIP() []byte {
- file_store_workspace_setting_proto_rawDescOnce.Do(func() {
- file_store_workspace_setting_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_store_workspace_setting_proto_rawDesc), len(file_store_workspace_setting_proto_rawDesc)))
+func file_store_instance_setting_proto_rawDescGZIP() []byte {
+ file_store_instance_setting_proto_rawDescOnce.Do(func() {
+ file_store_instance_setting_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_store_instance_setting_proto_rawDesc), len(file_store_instance_setting_proto_rawDesc)))
})
- return file_store_workspace_setting_proto_rawDescData
+ return file_store_instance_setting_proto_rawDescData
}
-var file_store_workspace_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
-var file_store_workspace_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
-var file_store_workspace_setting_proto_goTypes = []any{
- (WorkspaceSettingKey)(0), // 0: memos.store.WorkspaceSettingKey
- (WorkspaceStorageSetting_StorageType)(0), // 1: memos.store.WorkspaceStorageSetting.StorageType
- (*WorkspaceSetting)(nil), // 2: memos.store.WorkspaceSetting
- (*WorkspaceBasicSetting)(nil), // 3: memos.store.WorkspaceBasicSetting
- (*WorkspaceGeneralSetting)(nil), // 4: memos.store.WorkspaceGeneralSetting
- (*WorkspaceCustomProfile)(nil), // 5: memos.store.WorkspaceCustomProfile
- (*WorkspaceStorageSetting)(nil), // 6: memos.store.WorkspaceStorageSetting
- (*StorageS3Config)(nil), // 7: memos.store.StorageS3Config
- (*WorkspaceMemoRelatedSetting)(nil), // 8: memos.store.WorkspaceMemoRelatedSetting
+var file_store_instance_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
+var file_store_instance_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
+var file_store_instance_setting_proto_goTypes = []any{
+ (InstanceSettingKey)(0), // 0: memos.store.InstanceSettingKey
+ (InstanceStorageSetting_StorageType)(0), // 1: memos.store.InstanceStorageSetting.StorageType
+ (*InstanceSetting)(nil), // 2: memos.store.InstanceSetting
+ (*InstanceBasicSetting)(nil), // 3: memos.store.InstanceBasicSetting
+ (*InstanceGeneralSetting)(nil), // 4: memos.store.InstanceGeneralSetting
+ (*InstanceCustomProfile)(nil), // 5: memos.store.InstanceCustomProfile
+ (*InstanceStorageSetting)(nil), // 6: memos.store.InstanceStorageSetting
+ (*StorageS3Config)(nil), // 7: memos.store.StorageS3Config
+ (*InstanceMemoRelatedSetting)(nil), // 8: memos.store.InstanceMemoRelatedSetting
}
-var file_store_workspace_setting_proto_depIdxs = []int32{
- 0, // 0: memos.store.WorkspaceSetting.key:type_name -> memos.store.WorkspaceSettingKey
- 3, // 1: memos.store.WorkspaceSetting.basic_setting:type_name -> memos.store.WorkspaceBasicSetting
- 4, // 2: memos.store.WorkspaceSetting.general_setting:type_name -> memos.store.WorkspaceGeneralSetting
- 6, // 3: memos.store.WorkspaceSetting.storage_setting:type_name -> memos.store.WorkspaceStorageSetting
- 8, // 4: memos.store.WorkspaceSetting.memo_related_setting:type_name -> memos.store.WorkspaceMemoRelatedSetting
- 5, // 5: memos.store.WorkspaceGeneralSetting.custom_profile:type_name -> memos.store.WorkspaceCustomProfile
- 1, // 6: memos.store.WorkspaceStorageSetting.storage_type:type_name -> memos.store.WorkspaceStorageSetting.StorageType
- 7, // 7: memos.store.WorkspaceStorageSetting.s3_config:type_name -> memos.store.StorageS3Config
+var file_store_instance_setting_proto_depIdxs = []int32{
+ 0, // 0: memos.store.InstanceSetting.key:type_name -> memos.store.InstanceSettingKey
+ 3, // 1: memos.store.InstanceSetting.basic_setting:type_name -> memos.store.InstanceBasicSetting
+ 4, // 2: memos.store.InstanceSetting.general_setting:type_name -> memos.store.InstanceGeneralSetting
+ 6, // 3: memos.store.InstanceSetting.storage_setting:type_name -> memos.store.InstanceStorageSetting
+ 8, // 4: memos.store.InstanceSetting.memo_related_setting:type_name -> memos.store.InstanceMemoRelatedSetting
+ 5, // 5: memos.store.InstanceGeneralSetting.custom_profile:type_name -> memos.store.InstanceCustomProfile
+ 1, // 6: memos.store.InstanceStorageSetting.storage_type:type_name -> memos.store.InstanceStorageSetting.StorageType
+ 7, // 7: memos.store.InstanceStorageSetting.s3_config:type_name -> memos.store.StorageS3Config
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
@@ -882,33 +882,33 @@ var file_store_workspace_setting_proto_depIdxs = []int32{
0, // [0:8] is the sub-list for field type_name
}
-func init() { file_store_workspace_setting_proto_init() }
-func file_store_workspace_setting_proto_init() {
- if File_store_workspace_setting_proto != nil {
+func init() { file_store_instance_setting_proto_init() }
+func file_store_instance_setting_proto_init() {
+ if File_store_instance_setting_proto != nil {
return
}
- file_store_workspace_setting_proto_msgTypes[0].OneofWrappers = []any{
- (*WorkspaceSetting_BasicSetting)(nil),
- (*WorkspaceSetting_GeneralSetting)(nil),
- (*WorkspaceSetting_StorageSetting)(nil),
- (*WorkspaceSetting_MemoRelatedSetting)(nil),
+ file_store_instance_setting_proto_msgTypes[0].OneofWrappers = []any{
+ (*InstanceSetting_BasicSetting)(nil),
+ (*InstanceSetting_GeneralSetting)(nil),
+ (*InstanceSetting_StorageSetting)(nil),
+ (*InstanceSetting_MemoRelatedSetting)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_workspace_setting_proto_rawDesc), len(file_store_workspace_setting_proto_rawDesc)),
+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_instance_setting_proto_rawDesc), len(file_store_instance_setting_proto_rawDesc)),
NumEnums: 2,
NumMessages: 7,
NumExtensions: 0,
NumServices: 0,
},
- GoTypes: file_store_workspace_setting_proto_goTypes,
- DependencyIndexes: file_store_workspace_setting_proto_depIdxs,
- EnumInfos: file_store_workspace_setting_proto_enumTypes,
- MessageInfos: file_store_workspace_setting_proto_msgTypes,
+ GoTypes: file_store_instance_setting_proto_goTypes,
+ DependencyIndexes: file_store_instance_setting_proto_depIdxs,
+ EnumInfos: file_store_instance_setting_proto_enumTypes,
+ MessageInfos: file_store_instance_setting_proto_msgTypes,
}.Build()
- File_store_workspace_setting_proto = out.File
- file_store_workspace_setting_proto_goTypes = nil
- file_store_workspace_setting_proto_depIdxs = nil
+ File_store_instance_setting_proto = out.File
+ file_store_instance_setting_proto_goTypes = nil
+ file_store_instance_setting_proto_depIdxs = nil
}
diff --git a/proto/store/attachment.proto b/proto/store/attachment.proto
index 4527a8af5..018f854d2 100644
--- a/proto/store/attachment.proto
+++ b/proto/store/attachment.proto
@@ -3,7 +3,7 @@ syntax = "proto3";
package memos.store;
import "google/protobuf/timestamp.proto";
-import "store/workspace_setting.proto";
+import "store/instance_setting.proto";
option go_package = "gen/store";
diff --git a/proto/store/workspace_setting.proto b/proto/store/instance_setting.proto
similarity index 83%
rename from proto/store/workspace_setting.proto
rename to proto/store/instance_setting.proto
index eb86aba5f..0fa0f5b02 100644
--- a/proto/store/workspace_setting.proto
+++ b/proto/store/instance_setting.proto
@@ -4,8 +4,8 @@ package memos.store;
option go_package = "gen/store";
-enum WorkspaceSettingKey {
- WORKSPACE_SETTING_KEY_UNSPECIFIED = 0;
+enum InstanceSettingKey {
+ INSTANCE_SETTING_KEY_UNSPECIFIED = 0;
// BASIC is the key for basic settings.
BASIC = 1;
// GENERAL is the key for general settings.
@@ -16,24 +16,24 @@ enum WorkspaceSettingKey {
MEMO_RELATED = 4;
}
-message WorkspaceSetting {
- WorkspaceSettingKey key = 1;
+message InstanceSetting {
+ InstanceSettingKey key = 1;
oneof value {
- WorkspaceBasicSetting basic_setting = 2;
- WorkspaceGeneralSetting general_setting = 3;
- WorkspaceStorageSetting storage_setting = 4;
- WorkspaceMemoRelatedSetting memo_related_setting = 5;
+ InstanceBasicSetting basic_setting = 2;
+ InstanceGeneralSetting general_setting = 3;
+ InstanceStorageSetting storage_setting = 4;
+ InstanceMemoRelatedSetting memo_related_setting = 5;
}
}
-message WorkspaceBasicSetting {
- // The secret key for workspace. Mainly used for session management.
+message InstanceBasicSetting {
+ // The secret key for instance. Mainly used for session management.
string secret_key = 1;
// The current schema version of database.
string schema_version = 2;
}
-message WorkspaceGeneralSetting {
+message InstanceGeneralSetting {
// theme is the name of the selected theme.
// This references a CSS file in the web/public/themes/ directory.
string theme = 1;
@@ -46,7 +46,7 @@ message WorkspaceGeneralSetting {
// additional_style is the additional style.
string additional_style = 5;
// custom_profile is the custom profile.
- WorkspaceCustomProfile custom_profile = 6;
+ InstanceCustomProfile custom_profile = 6;
// week_start_day_offset is the week start day offset from Sunday.
// 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
// Default is Sunday.
@@ -57,14 +57,14 @@ message WorkspaceGeneralSetting {
bool disallow_change_nickname = 9;
}
-message WorkspaceCustomProfile {
+message InstanceCustomProfile {
string title = 1;
string description = 2;
string logo_url = 3;
string locale = 4;
}
-message WorkspaceStorageSetting {
+message InstanceStorageSetting {
enum StorageType {
STORAGE_TYPE_UNSPECIFIED = 0;
// STORAGE_TYPE_DATABASE is the database storage type.
@@ -95,7 +95,7 @@ message StorageS3Config {
bool use_path_style = 6;
}
-message WorkspaceMemoRelatedSetting {
+message InstanceMemoRelatedSetting {
// disallow_public_visibility disallows set memo as public visibility.
bool disallow_public_visibility = 1;
// display_with_update_time orders and displays memo with update time.
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 451b2d91a..c58a6347c 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -9,7 +9,6 @@ RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -ldflags="-s -w" -o memos ./cmd/memos
-# Make workspace with above generated files.
FROM alpine:latest AS monolithic
WORKDIR /usr/local/memos
diff --git a/server/router/api/v1/acl_config.go b/server/router/api/v1/acl_config.go
index c0274f764..54745bcd9 100644
--- a/server/router/api/v1/acl_config.go
+++ b/server/router/api/v1/acl_config.go
@@ -1,8 +1,8 @@
package v1
var authenticationAllowlistMethods = map[string]bool{
- "/memos.api.v1.WorkspaceService/GetWorkspaceProfile": true,
- "/memos.api.v1.WorkspaceService/GetWorkspaceSetting": true,
+ "/memos.api.v1.InstanceService/GetInstanceProfile": true,
+ "/memos.api.v1.InstanceService/GetInstanceSetting": true,
"/memos.api.v1.IdentityProviderService/ListIdentityProviders": true,
"/memos.api.v1.AuthService/CreateSession": true,
"/memos.api.v1.AuthService/GetCurrentSession": true,
@@ -23,8 +23,8 @@ func isUnauthorizeAllowedMethod(fullMethodName string) bool {
}
var allowedMethodsOnlyForAdmin = map[string]bool{
- "/memos.api.v1.UserService/CreateUser": true,
- "/memos.api.v1.WorkspaceService/UpdateWorkspaceSetting": true,
+ "/memos.api.v1.UserService/CreateUser": true,
+ "/memos.api.v1.InstanceService/UpdateInstanceSetting": true,
}
// isOnlyForAdminAllowedMethod returns true if the method is allowed to be called only by admin.
diff --git a/server/router/api/v1/attachment_service.go b/server/router/api/v1/attachment_service.go
index 80c32c76b..e02412713 100644
--- a/server/router/api/v1/attachment_service.go
+++ b/server/router/api/v1/attachment_service.go
@@ -84,12 +84,12 @@ func (s *APIV1Service) CreateAttachment(ctx context.Context, request *v1pb.Creat
Type: request.Attachment.Type,
}
- workspaceStorageSetting, err := s.Store.GetWorkspaceStorageSetting(ctx)
+ instanceStorageSetting, err := s.Store.GetInstanceStorageSetting(ctx)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace storage setting: %v", err)
+ return nil, status.Errorf(codes.Internal, "failed to get instance storage setting: %v", err)
}
size := binary.Size(request.Attachment.Content)
- uploadSizeLimit := int(workspaceStorageSetting.UploadSizeLimitMb) * MebiByte
+ uploadSizeLimit := int(instanceStorageSetting.UploadSizeLimitMb) * MebiByte
if uploadSizeLimit == 0 {
uploadSizeLimit = MaxUploadBufferSizeBytes
}
@@ -395,15 +395,15 @@ func convertAttachmentFromStore(attachment *store.Attachment) *v1pb.Attachment {
// SaveAttachmentBlob save the blob of attachment based on the storage config.
func SaveAttachmentBlob(ctx context.Context, profile *profile.Profile, stores *store.Store, create *store.Attachment) error {
- workspaceStorageSetting, err := stores.GetWorkspaceStorageSetting(ctx)
+ instanceStorageSetting, err := stores.GetInstanceStorageSetting(ctx)
if err != nil {
- return errors.Wrap(err, "Failed to find workspace storage setting")
+ return errors.Wrap(err, "Failed to find instance storage setting")
}
- if workspaceStorageSetting.StorageType == storepb.WorkspaceStorageSetting_LOCAL {
+ if instanceStorageSetting.StorageType == storepb.InstanceStorageSetting_LOCAL {
filepathTemplate := "assets/{timestamp}_{filename}"
- if workspaceStorageSetting.FilepathTemplate != "" {
- filepathTemplate = workspaceStorageSetting.FilepathTemplate
+ if instanceStorageSetting.FilepathTemplate != "" {
+ filepathTemplate = instanceStorageSetting.FilepathTemplate
}
internalPath := filepathTemplate
@@ -435,8 +435,8 @@ func SaveAttachmentBlob(ctx context.Context, profile *profile.Profile, stores *s
create.Reference = internalPath
create.Blob = nil
create.StorageType = storepb.AttachmentStorageType_LOCAL
- } else if workspaceStorageSetting.StorageType == storepb.WorkspaceStorageSetting_S3 {
- s3Config := workspaceStorageSetting.S3Config
+ } else if instanceStorageSetting.StorageType == storepb.InstanceStorageSetting_S3 {
+ s3Config := instanceStorageSetting.S3Config
if s3Config == nil {
return errors.Errorf("No actived external storage found")
}
@@ -445,7 +445,7 @@ func SaveAttachmentBlob(ctx context.Context, profile *profile.Profile, stores *s
return errors.Wrap(err, "Failed to create s3 client")
}
- filepathTemplate := workspaceStorageSetting.FilepathTemplate
+ filepathTemplate := instanceStorageSetting.FilepathTemplate
if !strings.Contains(filepathTemplate, "{filename}") {
filepathTemplate = filepath.Join(filepathTemplate, "{filename}")
}
diff --git a/server/router/api/v1/auth_service.go b/server/router/api/v1/auth_service.go
index 364b87ec2..74ac00299 100644
--- a/server/router/api/v1/auth_service.go
+++ b/server/router/api/v1/auth_service.go
@@ -99,12 +99,12 @@ func (s *APIV1Service) CreateSession(ctx context.Context, request *v1pb.CreateSe
if err := bcrypt.CompareHashAndPassword([]byte(user.PasswordHash), []byte(passwordCredentials.Password)); err != nil {
return nil, status.Errorf(codes.InvalidArgument, unmatchedUsernameAndPasswordError)
}
- workspaceGeneralSetting, err := s.Store.GetWorkspaceGeneralSetting(ctx)
+ instanceGeneralSetting, err := s.Store.GetInstanceGeneralSetting(ctx)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace general setting, error: %v", err)
+ return nil, status.Errorf(codes.Internal, "failed to get instance general setting, error: %v", err)
}
// Check if the password auth in is allowed.
- if workspaceGeneralSetting.DisallowPasswordAuth && user.Role == store.RoleUser {
+ if instanceGeneralSetting.DisallowPasswordAuth && user.Role == store.RoleUser {
return nil, status.Errorf(codes.PermissionDenied, "password signin is not allowed")
}
existingUser = user
@@ -155,11 +155,11 @@ func (s *APIV1Service) CreateSession(ctx context.Context, request *v1pb.CreateSe
}
if user == nil {
// Check if the user is allowed to sign up.
- workspaceGeneralSetting, err := s.Store.GetWorkspaceGeneralSetting(ctx)
+ instanceGeneralSetting, err := s.Store.GetInstanceGeneralSetting(ctx)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace general setting, error: %v", err)
+ return nil, status.Errorf(codes.Internal, "failed to get instance general setting, error: %v", err)
}
- if workspaceGeneralSetting.DisallowUserRegistration {
+ if instanceGeneralSetting.DisallowUserRegistration {
return nil, status.Errorf(codes.PermissionDenied, "user registration is not allowed")
}
diff --git a/server/router/api/v1/workspace_service.go b/server/router/api/v1/instance_service.go
similarity index 50%
rename from server/router/api/v1/workspace_service.go
rename to server/router/api/v1/instance_service.go
index 0af794c62..116107b51 100644
--- a/server/router/api/v1/workspace_service.go
+++ b/server/router/api/v1/instance_service.go
@@ -13,9 +13,9 @@ import (
"github.com/usememos/memos/store"
)
-// GetWorkspaceProfile returns the workspace profile.
-func (s *APIV1Service) GetWorkspaceProfile(ctx context.Context, _ *v1pb.GetWorkspaceProfileRequest) (*v1pb.WorkspaceProfile, error) {
- workspaceProfile := &v1pb.WorkspaceProfile{
+// GetInstanceProfile returns the instance profile.
+func (s *APIV1Service) GetInstanceProfile(ctx context.Context, _ *v1pb.GetInstanceProfileRequest) (*v1pb.InstanceProfile, error) {
+ instanceProfile := &v1pb.InstanceProfile{
Version: s.Profile.Version,
Mode: s.Profile.Mode,
InstanceUrl: s.Profile.InstanceURL,
@@ -25,47 +25,47 @@ func (s *APIV1Service) GetWorkspaceProfile(ctx context.Context, _ *v1pb.GetWorks
return nil, status.Errorf(codes.Internal, "failed to get instance owner: %v", err)
}
if owner != nil {
- workspaceProfile.Owner = owner.Name
+ instanceProfile.Owner = owner.Name
}
- return workspaceProfile, nil
+ return instanceProfile, nil
}
-func (s *APIV1Service) GetWorkspaceSetting(ctx context.Context, request *v1pb.GetWorkspaceSettingRequest) (*v1pb.WorkspaceSetting, error) {
- workspaceSettingKeyString, err := ExtractWorkspaceSettingKeyFromName(request.Name)
+func (s *APIV1Service) GetInstanceSetting(ctx context.Context, request *v1pb.GetInstanceSettingRequest) (*v1pb.InstanceSetting, error) {
+ instanceSettingKeyString, err := ExtractInstanceSettingKeyFromName(request.Name)
if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid workspace setting name: %v", err)
+ return nil, status.Errorf(codes.InvalidArgument, "invalid instance setting name: %v", err)
}
- workspaceSettingKey := storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[workspaceSettingKeyString])
- // Get workspace setting from store with default value.
- switch workspaceSettingKey {
- case storepb.WorkspaceSettingKey_BASIC:
- _, err = s.Store.GetWorkspaceBasicSetting(ctx)
- case storepb.WorkspaceSettingKey_GENERAL:
- _, err = s.Store.GetWorkspaceGeneralSetting(ctx)
- case storepb.WorkspaceSettingKey_MEMO_RELATED:
- _, err = s.Store.GetWorkspaceMemoRelatedSetting(ctx)
- case storepb.WorkspaceSettingKey_STORAGE:
- _, err = s.Store.GetWorkspaceStorageSetting(ctx)
+ instanceSettingKey := storepb.InstanceSettingKey(storepb.InstanceSettingKey_value[instanceSettingKeyString])
+ // Get instance setting from store with default value.
+ switch instanceSettingKey {
+ case storepb.InstanceSettingKey_BASIC:
+ _, err = s.Store.GetInstanceBasicSetting(ctx)
+ case storepb.InstanceSettingKey_GENERAL:
+ _, err = s.Store.GetInstanceGeneralSetting(ctx)
+ case storepb.InstanceSettingKey_MEMO_RELATED:
+ _, err = s.Store.GetInstanceMemoRelatedSetting(ctx)
+ case storepb.InstanceSettingKey_STORAGE:
+ _, err = s.Store.GetInstanceStorageSetting(ctx)
default:
- return nil, status.Errorf(codes.InvalidArgument, "unsupported workspace setting key: %v", workspaceSettingKey)
+ return nil, status.Errorf(codes.InvalidArgument, "unsupported instance setting key: %v", instanceSettingKey)
}
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err)
+ return nil, status.Errorf(codes.Internal, "failed to get instance setting: %v", err)
}
- workspaceSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{
- Name: workspaceSettingKey.String(),
+ instanceSetting, err := s.Store.GetInstanceSetting(ctx, &store.FindInstanceSetting{
+ Name: instanceSettingKey.String(),
})
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err)
+ return nil, status.Errorf(codes.Internal, "failed to get instance setting: %v", err)
}
- if workspaceSetting == nil {
- return nil, status.Errorf(codes.NotFound, "workspace setting not found")
+ if instanceSetting == nil {
+ return nil, status.Errorf(codes.NotFound, "instance setting not found")
}
// For storage setting, only host can get it.
- if workspaceSetting.Key == storepb.WorkspaceSettingKey_STORAGE {
+ if instanceSetting.Key == storepb.InstanceSettingKey_STORAGE {
user, err := s.GetCurrentUser(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
@@ -75,10 +75,10 @@ func (s *APIV1Service) GetWorkspaceSetting(ctx context.Context, request *v1pb.Ge
}
}
- return convertWorkspaceSettingFromStore(workspaceSetting), nil
+ return convertInstanceSettingFromStore(instanceSetting), nil
}
-func (s *APIV1Service) UpdateWorkspaceSetting(ctx context.Context, request *v1pb.UpdateWorkspaceSettingRequest) (*v1pb.WorkspaceSetting, error) {
+func (s *APIV1Service) UpdateInstanceSetting(ctx context.Context, request *v1pb.UpdateInstanceSettingRequest) (*v1pb.InstanceSetting, error) {
user, err := s.GetCurrentUser(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
@@ -93,64 +93,64 @@ func (s *APIV1Service) UpdateWorkspaceSetting(ctx context.Context, request *v1pb
// TODO: Apply update_mask if specified
_ = request.UpdateMask
- updateSetting := convertWorkspaceSettingToStore(request.Setting)
- workspaceSetting, err := s.Store.UpsertWorkspaceSetting(ctx, updateSetting)
+ updateSetting := convertInstanceSettingToStore(request.Setting)
+ instanceSetting, err := s.Store.UpsertInstanceSetting(ctx, updateSetting)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to upsert workspace setting: %v", err)
+ return nil, status.Errorf(codes.Internal, "failed to upsert instance setting: %v", err)
}
- return convertWorkspaceSettingFromStore(workspaceSetting), nil
+ return convertInstanceSettingFromStore(instanceSetting), nil
}
-func convertWorkspaceSettingFromStore(setting *storepb.WorkspaceSetting) *v1pb.WorkspaceSetting {
- workspaceSetting := &v1pb.WorkspaceSetting{
- Name: fmt.Sprintf("workspace/settings/%s", setting.Key.String()),
+func convertInstanceSettingFromStore(setting *storepb.InstanceSetting) *v1pb.InstanceSetting {
+ instanceSetting := &v1pb.InstanceSetting{
+ Name: fmt.Sprintf("instance/settings/%s", setting.Key.String()),
}
switch setting.Value.(type) {
- case *storepb.WorkspaceSetting_GeneralSetting:
- workspaceSetting.Value = &v1pb.WorkspaceSetting_GeneralSetting_{
- GeneralSetting: convertWorkspaceGeneralSettingFromStore(setting.GetGeneralSetting()),
+ case *storepb.InstanceSetting_GeneralSetting:
+ instanceSetting.Value = &v1pb.InstanceSetting_GeneralSetting_{
+ GeneralSetting: convertInstanceGeneralSettingFromStore(setting.GetGeneralSetting()),
}
- case *storepb.WorkspaceSetting_StorageSetting:
- workspaceSetting.Value = &v1pb.WorkspaceSetting_StorageSetting_{
- StorageSetting: convertWorkspaceStorageSettingFromStore(setting.GetStorageSetting()),
+ case *storepb.InstanceSetting_StorageSetting:
+ instanceSetting.Value = &v1pb.InstanceSetting_StorageSetting_{
+ StorageSetting: convertInstanceStorageSettingFromStore(setting.GetStorageSetting()),
}
- case *storepb.WorkspaceSetting_MemoRelatedSetting:
- workspaceSetting.Value = &v1pb.WorkspaceSetting_MemoRelatedSetting_{
- MemoRelatedSetting: convertWorkspaceMemoRelatedSettingFromStore(setting.GetMemoRelatedSetting()),
+ case *storepb.InstanceSetting_MemoRelatedSetting:
+ instanceSetting.Value = &v1pb.InstanceSetting_MemoRelatedSetting_{
+ MemoRelatedSetting: convertInstanceMemoRelatedSettingFromStore(setting.GetMemoRelatedSetting()),
}
}
- return workspaceSetting
+ return instanceSetting
}
-func convertWorkspaceSettingToStore(setting *v1pb.WorkspaceSetting) *storepb.WorkspaceSetting {
- settingKeyString, _ := ExtractWorkspaceSettingKeyFromName(setting.Name)
- workspaceSetting := &storepb.WorkspaceSetting{
- Key: storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[settingKeyString]),
- Value: &storepb.WorkspaceSetting_GeneralSetting{
- GeneralSetting: convertWorkspaceGeneralSettingToStore(setting.GetGeneralSetting()),
+func convertInstanceSettingToStore(setting *v1pb.InstanceSetting) *storepb.InstanceSetting {
+ settingKeyString, _ := ExtractInstanceSettingKeyFromName(setting.Name)
+ instanceSetting := &storepb.InstanceSetting{
+ Key: storepb.InstanceSettingKey(storepb.InstanceSettingKey_value[settingKeyString]),
+ Value: &storepb.InstanceSetting_GeneralSetting{
+ GeneralSetting: convertInstanceGeneralSettingToStore(setting.GetGeneralSetting()),
},
}
- switch workspaceSetting.Key {
- case storepb.WorkspaceSettingKey_GENERAL:
- workspaceSetting.Value = &storepb.WorkspaceSetting_GeneralSetting{
- GeneralSetting: convertWorkspaceGeneralSettingToStore(setting.GetGeneralSetting()),
+ switch instanceSetting.Key {
+ case storepb.InstanceSettingKey_GENERAL:
+ instanceSetting.Value = &storepb.InstanceSetting_GeneralSetting{
+ GeneralSetting: convertInstanceGeneralSettingToStore(setting.GetGeneralSetting()),
}
- case storepb.WorkspaceSettingKey_STORAGE:
- workspaceSetting.Value = &storepb.WorkspaceSetting_StorageSetting{
- StorageSetting: convertWorkspaceStorageSettingToStore(setting.GetStorageSetting()),
+ case storepb.InstanceSettingKey_STORAGE:
+ instanceSetting.Value = &storepb.InstanceSetting_StorageSetting{
+ StorageSetting: convertInstanceStorageSettingToStore(setting.GetStorageSetting()),
}
- case storepb.WorkspaceSettingKey_MEMO_RELATED:
- workspaceSetting.Value = &storepb.WorkspaceSetting_MemoRelatedSetting{
- MemoRelatedSetting: convertWorkspaceMemoRelatedSettingToStore(setting.GetMemoRelatedSetting()),
+ case storepb.InstanceSettingKey_MEMO_RELATED:
+ instanceSetting.Value = &storepb.InstanceSetting_MemoRelatedSetting{
+ MemoRelatedSetting: convertInstanceMemoRelatedSettingToStore(setting.GetMemoRelatedSetting()),
}
default:
// Keep the default GeneralSetting value
}
- return workspaceSetting
+ return instanceSetting
}
-func convertWorkspaceGeneralSettingFromStore(setting *storepb.WorkspaceGeneralSetting) *v1pb.WorkspaceSetting_GeneralSetting {
+func convertInstanceGeneralSettingFromStore(setting *storepb.InstanceGeneralSetting) *v1pb.InstanceSetting_GeneralSetting {
if setting == nil {
return nil
}
@@ -160,7 +160,7 @@ func convertWorkspaceGeneralSettingFromStore(setting *storepb.WorkspaceGeneralSe
theme = "default"
}
- generalSetting := &v1pb.WorkspaceSetting_GeneralSetting{
+ generalSetting := &v1pb.InstanceSetting_GeneralSetting{
Theme: theme,
DisallowUserRegistration: setting.DisallowUserRegistration,
DisallowPasswordAuth: setting.DisallowPasswordAuth,
@@ -171,7 +171,7 @@ func convertWorkspaceGeneralSettingFromStore(setting *storepb.WorkspaceGeneralSe
DisallowChangeNickname: setting.DisallowChangeNickname,
}
if setting.CustomProfile != nil {
- generalSetting.CustomProfile = &v1pb.WorkspaceSetting_GeneralSetting_CustomProfile{
+ generalSetting.CustomProfile = &v1pb.InstanceSetting_GeneralSetting_CustomProfile{
Title: setting.CustomProfile.Title,
Description: setting.CustomProfile.Description,
LogoUrl: setting.CustomProfile.LogoUrl,
@@ -181,11 +181,11 @@ func convertWorkspaceGeneralSettingFromStore(setting *storepb.WorkspaceGeneralSe
return generalSetting
}
-func convertWorkspaceGeneralSettingToStore(setting *v1pb.WorkspaceSetting_GeneralSetting) *storepb.WorkspaceGeneralSetting {
+func convertInstanceGeneralSettingToStore(setting *v1pb.InstanceSetting_GeneralSetting) *storepb.InstanceGeneralSetting {
if setting == nil {
return nil
}
- generalSetting := &storepb.WorkspaceGeneralSetting{
+ generalSetting := &storepb.InstanceGeneralSetting{
Theme: setting.Theme,
DisallowUserRegistration: setting.DisallowUserRegistration,
DisallowPasswordAuth: setting.DisallowPasswordAuth,
@@ -196,7 +196,7 @@ func convertWorkspaceGeneralSettingToStore(setting *v1pb.WorkspaceSetting_Genera
DisallowChangeNickname: setting.DisallowChangeNickname,
}
if setting.CustomProfile != nil {
- generalSetting.CustomProfile = &storepb.WorkspaceCustomProfile{
+ generalSetting.CustomProfile = &storepb.InstanceCustomProfile{
Title: setting.CustomProfile.Title,
Description: setting.CustomProfile.Description,
LogoUrl: setting.CustomProfile.LogoUrl,
@@ -206,17 +206,17 @@ func convertWorkspaceGeneralSettingToStore(setting *v1pb.WorkspaceSetting_Genera
return generalSetting
}
-func convertWorkspaceStorageSettingFromStore(settingpb *storepb.WorkspaceStorageSetting) *v1pb.WorkspaceSetting_StorageSetting {
+func convertInstanceStorageSettingFromStore(settingpb *storepb.InstanceStorageSetting) *v1pb.InstanceSetting_StorageSetting {
if settingpb == nil {
return nil
}
- setting := &v1pb.WorkspaceSetting_StorageSetting{
- StorageType: v1pb.WorkspaceSetting_StorageSetting_StorageType(settingpb.StorageType),
+ setting := &v1pb.InstanceSetting_StorageSetting{
+ StorageType: v1pb.InstanceSetting_StorageSetting_StorageType(settingpb.StorageType),
FilepathTemplate: settingpb.FilepathTemplate,
UploadSizeLimitMb: settingpb.UploadSizeLimitMb,
}
if settingpb.S3Config != nil {
- setting.S3Config = &v1pb.WorkspaceSetting_StorageSetting_S3Config{
+ setting.S3Config = &v1pb.InstanceSetting_StorageSetting_S3Config{
AccessKeyId: settingpb.S3Config.AccessKeyId,
AccessKeySecret: settingpb.S3Config.AccessKeySecret,
Endpoint: settingpb.S3Config.Endpoint,
@@ -228,12 +228,12 @@ func convertWorkspaceStorageSettingFromStore(settingpb *storepb.WorkspaceStorage
return setting
}
-func convertWorkspaceStorageSettingToStore(setting *v1pb.WorkspaceSetting_StorageSetting) *storepb.WorkspaceStorageSetting {
+func convertInstanceStorageSettingToStore(setting *v1pb.InstanceSetting_StorageSetting) *storepb.InstanceStorageSetting {
if setting == nil {
return nil
}
- settingpb := &storepb.WorkspaceStorageSetting{
- StorageType: storepb.WorkspaceStorageSetting_StorageType(setting.StorageType),
+ settingpb := &storepb.InstanceStorageSetting{
+ StorageType: storepb.InstanceStorageSetting_StorageType(setting.StorageType),
FilepathTemplate: setting.FilepathTemplate,
UploadSizeLimitMb: setting.UploadSizeLimitMb,
}
@@ -250,11 +250,11 @@ func convertWorkspaceStorageSettingToStore(setting *v1pb.WorkspaceSetting_Storag
return settingpb
}
-func convertWorkspaceMemoRelatedSettingFromStore(setting *storepb.WorkspaceMemoRelatedSetting) *v1pb.WorkspaceSetting_MemoRelatedSetting {
+func convertInstanceMemoRelatedSettingFromStore(setting *storepb.InstanceMemoRelatedSetting) *v1pb.InstanceSetting_MemoRelatedSetting {
if setting == nil {
return nil
}
- return &v1pb.WorkspaceSetting_MemoRelatedSetting{
+ return &v1pb.InstanceSetting_MemoRelatedSetting{
DisallowPublicVisibility: setting.DisallowPublicVisibility,
DisplayWithUpdateTime: setting.DisplayWithUpdateTime,
ContentLengthLimit: setting.ContentLengthLimit,
@@ -267,11 +267,11 @@ func convertWorkspaceMemoRelatedSettingFromStore(setting *storepb.WorkspaceMemoR
}
}
-func convertWorkspaceMemoRelatedSettingToStore(setting *v1pb.WorkspaceSetting_MemoRelatedSetting) *storepb.WorkspaceMemoRelatedSetting {
+func convertInstanceMemoRelatedSettingToStore(setting *v1pb.InstanceSetting_MemoRelatedSetting) *storepb.InstanceMemoRelatedSetting {
if setting == nil {
return nil
}
- return &storepb.WorkspaceMemoRelatedSetting{
+ return &storepb.InstanceMemoRelatedSetting{
DisallowPublicVisibility: setting.DisallowPublicVisibility,
DisplayWithUpdateTime: setting.DisplayWithUpdateTime,
ContentLengthLimit: setting.ContentLengthLimit,
diff --git a/server/router/api/v1/memo_service.go b/server/router/api/v1/memo_service.go
index a07b5b9a0..5b975c09b 100644
--- a/server/router/api/v1/memo_service.go
+++ b/server/router/api/v1/memo_service.go
@@ -35,11 +35,11 @@ func (s *APIV1Service) CreateMemo(ctx context.Context, request *v1pb.CreateMemoR
Content: request.Memo.Content,
Visibility: convertVisibilityToStore(request.Memo.Visibility),
}
- workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx)
+ instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace memo related setting")
+ return nil, status.Errorf(codes.Internal, "failed to get instance memo related setting")
}
- if workspaceMemoRelatedSetting.DisallowPublicVisibility && create.Visibility == store.Public {
+ if instanceMemoRelatedSetting.DisallowPublicVisibility && create.Visibility == store.Public {
return nil, status.Errorf(codes.PermissionDenied, "disable public memos system setting is enabled")
}
contentLengthLimit, err := s.getContentLengthLimit(ctx)
@@ -147,11 +147,11 @@ func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosReq
}
}
- workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx)
+ instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace memo related setting")
+ return nil, status.Errorf(codes.Internal, "failed to get instance memo related setting")
}
- if workspaceMemoRelatedSetting.DisplayWithUpdateTime {
+ if instanceMemoRelatedSetting.DisplayWithUpdateTime {
memoFind.OrderByUpdatedTs = true
}
@@ -340,12 +340,12 @@ func (s *APIV1Service) UpdateMemo(ctx context.Context, request *v1pb.UpdateMemoR
update.Content = &memo.Content
update.Payload = memo.Payload
} else if path == "visibility" {
- workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx)
+ instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace memo related setting")
+ return nil, status.Errorf(codes.Internal, "failed to get instance memo related setting")
}
visibility := convertVisibilityToStore(request.Memo.Visibility)
- if workspaceMemoRelatedSetting.DisallowPublicVisibility && visibility == store.Public {
+ if instanceMemoRelatedSetting.DisallowPublicVisibility && visibility == store.Public {
return nil, status.Errorf(codes.PermissionDenied, "disable public memos system setting is enabled")
}
update.Visibility = &visibility
@@ -365,9 +365,9 @@ func (s *APIV1Service) UpdateMemo(ctx context.Context, request *v1pb.UpdateMemoR
update.UpdatedTs = &updatedTs
} else if path == "display_time" {
displayTs := request.Memo.DisplayTime.AsTime().Unix()
- memoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx)
+ memoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace memo related setting")
+ return nil, status.Errorf(codes.Internal, "failed to get instance memo related setting")
}
if memoRelatedSetting.DisplayWithUpdateTime {
update.UpdatedTs = &displayTs
@@ -680,11 +680,11 @@ func (s *APIV1Service) ListMemoComments(ctx context.Context, request *v1pb.ListM
}
func (s *APIV1Service) getContentLengthLimit(ctx context.Context) (int, error) {
- workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx)
+ instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
if err != nil {
- return 0, status.Errorf(codes.Internal, "failed to get workspace memo related setting")
+ return 0, status.Errorf(codes.Internal, "failed to get instance memo related setting")
}
- return int(workspaceMemoRelatedSetting.ContentLengthLimit), nil
+ return int(instanceMemoRelatedSetting.ContentLengthLimit), nil
}
// DispatchMemoCreatedWebhook dispatches webhook when memo is created.
diff --git a/server/router/api/v1/memo_service_converter.go b/server/router/api/v1/memo_service_converter.go
index de14e3954..325c1a0b2 100644
--- a/server/router/api/v1/memo_service_converter.go
+++ b/server/router/api/v1/memo_service_converter.go
@@ -15,11 +15,11 @@ import (
func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Memo, reactions []*store.Reaction, attachments []*store.Attachment) (*v1pb.Memo, error) {
displayTs := memo.CreatedTs
- workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx)
+ instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
if err != nil {
- return nil, errors.Wrap(err, "failed to get workspace memo related setting")
+ return nil, errors.Wrap(err, "failed to get instance memo related setting")
}
- if workspaceMemoRelatedSetting.DisplayWithUpdateTime {
+ if instanceMemoRelatedSetting.DisplayWithUpdateTime {
displayTs = memo.UpdatedTs
}
diff --git a/server/router/api/v1/resource_name.go b/server/router/api/v1/resource_name.go
index a44e2f935..bd1f4bf8d 100644
--- a/server/router/api/v1/resource_name.go
+++ b/server/router/api/v1/resource_name.go
@@ -10,7 +10,7 @@ import (
)
const (
- WorkspaceSettingNamePrefix = "workspace/settings/"
+ InstanceSettingNamePrefix = "instance/settings/"
UserNamePrefix = "users/"
MemoNamePrefix = "memos/"
AttachmentNamePrefix = "attachments/"
@@ -41,20 +41,20 @@ func GetNameParentTokens(name string, tokenPrefixes ...string) ([]string, error)
return tokens, nil
}
-func ExtractWorkspaceSettingKeyFromName(name string) (string, error) {
- const prefix = "workspace/settings/"
+func ExtractInstanceSettingKeyFromName(name string) (string, error) {
+ const prefix = "instance/settings/"
if !strings.HasPrefix(name, prefix) {
- return "", errors.Errorf("invalid workspace setting name: expected prefix %q, got %q", prefix, name)
+ return "", errors.Errorf("invalid instance setting name: expected prefix %q, got %q", prefix, name)
}
settingKey := strings.TrimPrefix(name, prefix)
if settingKey == "" {
- return "", errors.Errorf("invalid workspace setting name: empty setting key in %q", name)
+ return "", errors.Errorf("invalid instance setting name: empty setting key in %q", name)
}
// Ensure there are no additional path segments
if strings.Contains(settingKey, "/") {
- return "", errors.Errorf("invalid workspace setting name: setting key cannot contain '/' in %q", name)
+ return "", errors.Errorf("invalid instance setting name: setting key cannot contain '/' in %q", name)
}
return settingKey, nil
diff --git a/server/router/api/v1/test/workspace_service_test.go b/server/router/api/v1/test/instance_service_test.go
similarity index 66%
rename from server/router/api/v1/test/workspace_service_test.go
rename to server/router/api/v1/test/instance_service_test.go
index 90abff4e6..1422907a3 100644
--- a/server/router/api/v1/test/workspace_service_test.go
+++ b/server/router/api/v1/test/instance_service_test.go
@@ -10,17 +10,17 @@ import (
v1pb "github.com/usememos/memos/proto/gen/api/v1"
)
-func TestGetWorkspaceProfile(t *testing.T) {
+func TestGetInstanceProfile(t *testing.T) {
ctx := context.Background()
- t.Run("GetWorkspaceProfile returns workspace profile", func(t *testing.T) {
+ t.Run("GetInstanceProfile returns instance profile", func(t *testing.T) {
// Create test service for this specific test
ts := NewTestService(t)
defer ts.Cleanup()
- // Call GetWorkspaceProfile directly
- req := &v1pb.GetWorkspaceProfileRequest{}
- resp, err := ts.Service.GetWorkspaceProfile(ctx, req)
+ // Call GetInstanceProfile directly
+ req := &v1pb.GetInstanceProfileRequest{}
+ resp, err := ts.Service.GetInstanceProfile(ctx, req)
// Verify response
require.NoError(t, err)
@@ -35,7 +35,7 @@ func TestGetWorkspaceProfile(t *testing.T) {
require.Empty(t, resp.Owner)
})
- t.Run("GetWorkspaceProfile with owner", func(t *testing.T) {
+ t.Run("GetInstanceProfile with owner", func(t *testing.T) {
// Create test service for this specific test
ts := NewTestService(t)
defer ts.Cleanup()
@@ -45,9 +45,9 @@ func TestGetWorkspaceProfile(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, hostUser)
- // Call GetWorkspaceProfile directly
- req := &v1pb.GetWorkspaceProfileRequest{}
- resp, err := ts.Service.GetWorkspaceProfile(ctx, req)
+ // Call GetInstanceProfile directly
+ req := &v1pb.GetInstanceProfileRequest{}
+ resp, err := ts.Service.GetInstanceProfile(ctx, req)
// Verify response
require.NoError(t, err)
@@ -64,7 +64,7 @@ func TestGetWorkspaceProfile(t *testing.T) {
})
}
-func TestGetWorkspaceProfile_Concurrency(t *testing.T) {
+func TestGetInstanceProfile_Concurrency(t *testing.T) {
ctx := context.Background()
t.Run("Concurrent access to service", func(t *testing.T) {
@@ -79,13 +79,13 @@ func TestGetWorkspaceProfile_Concurrency(t *testing.T) {
// Make concurrent requests
numGoroutines := 10
- results := make(chan *v1pb.WorkspaceProfile, numGoroutines)
+ results := make(chan *v1pb.InstanceProfile, numGoroutines)
errors := make(chan error, numGoroutines)
for i := 0; i < numGoroutines; i++ {
go func() {
- req := &v1pb.GetWorkspaceProfileRequest{}
- resp, err := ts.Service.GetWorkspaceProfile(ctx, req)
+ req := &v1pb.GetInstanceProfileRequest{}
+ resp, err := ts.Service.GetInstanceProfile(ctx, req)
if err != nil {
errors <- err
return
@@ -110,24 +110,24 @@ func TestGetWorkspaceProfile_Concurrency(t *testing.T) {
})
}
-func TestGetWorkspaceSetting(t *testing.T) {
+func TestGetInstanceSetting(t *testing.T) {
ctx := context.Background()
- t.Run("GetWorkspaceSetting - general setting", func(t *testing.T) {
+ t.Run("GetInstanceSetting - general setting", func(t *testing.T) {
// Create test service for this specific test
ts := NewTestService(t)
defer ts.Cleanup()
- // Call GetWorkspaceSetting for general setting
- req := &v1pb.GetWorkspaceSettingRequest{
- Name: "workspace/settings/GENERAL",
+ // Call GetInstanceSetting for general setting
+ req := &v1pb.GetInstanceSettingRequest{
+ Name: "instance/settings/GENERAL",
}
- resp, err := ts.Service.GetWorkspaceSetting(ctx, req)
+ resp, err := ts.Service.GetInstanceSetting(ctx, req)
// Verify response
require.NoError(t, err)
require.NotNil(t, resp)
- require.Equal(t, "workspace/settings/GENERAL", resp.Name)
+ require.Equal(t, "instance/settings/GENERAL", resp.Name)
// The general setting should have a general_setting field
generalSetting := resp.GetGeneralSetting()
@@ -139,7 +139,7 @@ func TestGetWorkspaceSetting(t *testing.T) {
require.Empty(t, generalSetting.AdditionalScript)
})
- t.Run("GetWorkspaceSetting - storage setting", func(t *testing.T) {
+ t.Run("GetInstanceSetting - storage setting", func(t *testing.T) {
// Create test service for this specific test
ts := NewTestService(t)
defer ts.Cleanup()
@@ -151,56 +151,56 @@ func TestGetWorkspaceSetting(t *testing.T) {
// Add user to context
userCtx := ts.CreateUserContext(ctx, hostUser.ID)
- // Call GetWorkspaceSetting for storage setting
- req := &v1pb.GetWorkspaceSettingRequest{
- Name: "workspace/settings/STORAGE",
+ // Call GetInstanceSetting for storage setting
+ req := &v1pb.GetInstanceSettingRequest{
+ Name: "instance/settings/STORAGE",
}
- resp, err := ts.Service.GetWorkspaceSetting(userCtx, req)
+ resp, err := ts.Service.GetInstanceSetting(userCtx, req)
// Verify response
require.NoError(t, err)
require.NotNil(t, resp)
- require.Equal(t, "workspace/settings/STORAGE", resp.Name)
+ require.Equal(t, "instance/settings/STORAGE", resp.Name)
// The storage setting should have a storage_setting field
storageSetting := resp.GetStorageSetting()
require.NotNil(t, storageSetting)
})
- t.Run("GetWorkspaceSetting - memo related setting", func(t *testing.T) {
+ t.Run("GetInstanceSetting - memo related setting", func(t *testing.T) {
// Create test service for this specific test
ts := NewTestService(t)
defer ts.Cleanup()
- // Call GetWorkspaceSetting for memo related setting
- req := &v1pb.GetWorkspaceSettingRequest{
- Name: "workspace/settings/MEMO_RELATED",
+ // Call GetInstanceSetting for memo related setting
+ req := &v1pb.GetInstanceSettingRequest{
+ Name: "instance/settings/MEMO_RELATED",
}
- resp, err := ts.Service.GetWorkspaceSetting(ctx, req)
+ resp, err := ts.Service.GetInstanceSetting(ctx, req)
// Verify response
require.NoError(t, err)
require.NotNil(t, resp)
- require.Equal(t, "workspace/settings/MEMO_RELATED", resp.Name)
+ require.Equal(t, "instance/settings/MEMO_RELATED", resp.Name)
// The memo related setting should have a memo_related_setting field
memoRelatedSetting := resp.GetMemoRelatedSetting()
require.NotNil(t, memoRelatedSetting)
})
- t.Run("GetWorkspaceSetting - invalid setting name", func(t *testing.T) {
+ t.Run("GetInstanceSetting - invalid setting name", func(t *testing.T) {
// Create test service for this specific test
ts := NewTestService(t)
defer ts.Cleanup()
- // Call GetWorkspaceSetting with invalid name
- req := &v1pb.GetWorkspaceSettingRequest{
+ // Call GetInstanceSetting with invalid name
+ req := &v1pb.GetInstanceSettingRequest{
Name: "invalid/setting/name",
}
- _, err := ts.Service.GetWorkspaceSetting(ctx, req)
+ _, err := ts.Service.GetInstanceSetting(ctx, req)
// Should return an error
require.Error(t, err)
- require.Contains(t, err.Error(), "invalid workspace setting name")
+ require.Contains(t, err.Error(), "invalid instance setting name")
})
}
diff --git a/server/router/api/v1/user_service.go b/server/router/api/v1/user_service.go
index a836a8c53..2b746e8ce 100644
--- a/server/router/api/v1/user_service.go
+++ b/server/router/api/v1/user_service.go
@@ -241,14 +241,14 @@ func (s *APIV1Service) UpdateUser(ctx context.Context, request *v1pb.UpdateUserR
ID: user.ID,
UpdatedTs: ¤tTs,
}
- workspaceGeneralSetting, err := s.Store.GetWorkspaceGeneralSetting(ctx)
+ instanceGeneralSetting, err := s.Store.GetInstanceGeneralSetting(ctx)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace general setting: %v", err)
+ return nil, status.Errorf(codes.Internal, "failed to get instance general setting: %v", err)
}
for _, field := range request.UpdateMask.Paths {
switch field {
case "username":
- if workspaceGeneralSetting.DisallowChangeUsername {
+ if instanceGeneralSetting.DisallowChangeUsername {
return nil, status.Errorf(codes.PermissionDenied, "permission denied: disallow change username")
}
if !base.UIDMatcher.MatchString(strings.ToLower(request.User.Username)) {
@@ -256,7 +256,7 @@ func (s *APIV1Service) UpdateUser(ctx context.Context, request *v1pb.UpdateUserR
}
update.Username = &request.User.Username
case "display_name":
- if workspaceGeneralSetting.DisallowChangeNickname {
+ if instanceGeneralSetting.DisallowChangeNickname {
return nil, status.Errorf(codes.PermissionDenied, "permission denied: disallow change nickname")
}
update.Nickname = &request.User.DisplayName
diff --git a/server/router/api/v1/user_service_stats.go b/server/router/api/v1/user_service_stats.go
index 95583aceb..9b5ff26f8 100644
--- a/server/router/api/v1/user_service_stats.go
+++ b/server/router/api/v1/user_service_stats.go
@@ -15,9 +15,9 @@ import (
)
func (s *APIV1Service) ListAllUserStats(ctx context.Context, _ *v1pb.ListAllUserStatsRequest) (*v1pb.ListAllUserStatsResponse, error) {
- workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx)
+ instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
if err != nil {
- return nil, errors.Wrap(err, "failed to get workspace memo related setting")
+ return nil, errors.Wrap(err, "failed to get instance memo related setting")
}
normalStatus := store.Normal
@@ -50,7 +50,7 @@ func (s *APIV1Service) ListAllUserStats(ctx context.Context, _ *v1pb.ListAllUser
userMemoStatMap := make(map[int32]*v1pb.UserStats)
for _, memo := range memos {
displayTs := memo.CreatedTs
- if workspaceMemoRelatedSetting.DisplayWithUpdateTime {
+ if instanceMemoRelatedSetting.DisplayWithUpdateTime {
displayTs = memo.UpdatedTs
}
userMemoStatMap[memo.CreatorID] = &v1pb.UserStats{
@@ -101,9 +101,9 @@ func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserSt
return nil, status.Errorf(codes.Internal, "failed to list memos: %v", err)
}
- workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx)
+ instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
if err != nil {
- return nil, errors.Wrap(err, "failed to get workspace memo related setting")
+ return nil, errors.Wrap(err, "failed to get instance memo related setting")
}
displayTimestamps := []*timestamppb.Timestamp{}
@@ -116,7 +116,7 @@ func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserSt
for _, memo := range memos {
displayTs := memo.CreatedTs
- if workspaceMemoRelatedSetting.DisplayWithUpdateTime {
+ if instanceMemoRelatedSetting.DisplayWithUpdateTime {
displayTs = memo.UpdatedTs
}
displayTimestamps = append(displayTimestamps, timestamppb.New(time.Unix(displayTs, 0)))
diff --git a/server/router/api/v1/v1.go b/server/router/api/v1/v1.go
index e3dd5d1e8..9b0c3b743 100644
--- a/server/router/api/v1/v1.go
+++ b/server/router/api/v1/v1.go
@@ -23,7 +23,7 @@ import (
type APIV1Service struct {
grpc_health_v1.UnimplementedHealthServer
- v1pb.UnimplementedWorkspaceServiceServer
+ v1pb.UnimplementedInstanceServiceServer
v1pb.UnimplementedAuthServiceServer
v1pb.UnimplementedUserServiceServer
v1pb.UnimplementedMemoServiceServer
@@ -53,7 +53,7 @@ func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store
grpcServer: grpcServer,
}
grpc_health_v1.RegisterHealthServer(grpcServer, apiv1Service)
- v1pb.RegisterWorkspaceServiceServer(grpcServer, apiv1Service)
+ v1pb.RegisterInstanceServiceServer(grpcServer, apiv1Service)
v1pb.RegisterAuthServiceServer(grpcServer, apiv1Service)
v1pb.RegisterUserServiceServer(grpcServer, apiv1Service)
v1pb.RegisterMemoServiceServer(grpcServer, apiv1Service)
@@ -87,7 +87,7 @@ func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Ech
}
gwMux := runtime.NewServeMux()
- if err := v1pb.RegisterWorkspaceServiceHandler(ctx, gwMux, conn); err != nil {
+ if err := v1pb.RegisterInstanceServiceHandler(ctx, gwMux, conn); err != nil {
return err
}
if err := v1pb.RegisterAuthServiceHandler(ctx, gwMux, conn); err != nil {
diff --git a/server/router/rss/rss.go b/server/router/rss/rss.go
index bc3ce294b..87967ced2 100644
--- a/server/router/rss/rss.go
+++ b/server/router/rss/rss.go
@@ -161,7 +161,7 @@ func (s *RSSService) getRSSItemDescription(content string) (string, error) {
}
func getRSSHeading(ctx context.Context, stores *store.Store) (RSSHeading, error) {
- settings, err := stores.GetWorkspaceGeneralSetting(ctx)
+ settings, err := stores.GetInstanceGeneralSetting(ctx)
if err != nil {
return RSSHeading{}, err
}
diff --git a/server/runner/s3presign/runner.go b/server/runner/s3presign/runner.go
index 582aec1ca..f8df43f25 100644
--- a/server/runner/s3presign/runner.go
+++ b/server/runner/s3presign/runner.go
@@ -44,7 +44,7 @@ func (r *Runner) RunOnce(ctx context.Context) {
}
func (r *Runner) CheckAndPresign(ctx context.Context) {
- workspaceStorageSetting, err := r.Store.GetWorkspaceStorageSetting(ctx)
+ instanceStorageSetting, err := r.Store.GetInstanceStorageSetting(ctx)
if err != nil {
return
}
@@ -88,7 +88,7 @@ func (r *Runner) CheckAndPresign(ctx context.Context) {
}
}
- s3Config := workspaceStorageSetting.GetS3Config()
+ s3Config := instanceStorageSetting.GetS3Config()
if s3ObjectPayload.S3Config != nil {
s3Config = s3ObjectPayload.S3Config
}
diff --git a/server/server.go b/server/server.go
index 03e8b1d67..089a90c74 100644
--- a/server/server.go
+++ b/server/server.go
@@ -60,14 +60,14 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
s.profiler.StartMemoryMonitor(ctx)
}
- workspaceBasicSetting, err := s.getOrUpsertWorkspaceBasicSetting(ctx)
+ instanceBasicSetting, err := s.getOrUpsertInstanceBasicSetting(ctx)
if err != nil {
- return nil, errors.Wrap(err, "failed to get workspace basic setting")
+ return nil, errors.Wrap(err, "failed to get instance basic setting")
}
secret := "usememos"
if profile.Mode == "prod" {
- secret = workspaceBasicSetting.SecretKey
+ secret = instanceBasicSetting.SecretKey
}
s.Secret = secret
@@ -229,27 +229,27 @@ func (s *Server) StartBackgroundRunners(ctx context.Context) {
slog.Info("background runners started", "goroutines", runtime.NumGoroutine())
}
-func (s *Server) getOrUpsertWorkspaceBasicSetting(ctx context.Context) (*storepb.WorkspaceBasicSetting, error) {
- workspaceBasicSetting, err := s.Store.GetWorkspaceBasicSetting(ctx)
+func (s *Server) getOrUpsertInstanceBasicSetting(ctx context.Context) (*storepb.InstanceBasicSetting, error) {
+ instanceBasicSetting, err := s.Store.GetInstanceBasicSetting(ctx)
if err != nil {
- return nil, errors.Wrap(err, "failed to get workspace basic setting")
+ return nil, errors.Wrap(err, "failed to get instance basic setting")
}
modified := false
- if workspaceBasicSetting.SecretKey == "" {
- workspaceBasicSetting.SecretKey = uuid.NewString()
+ if instanceBasicSetting.SecretKey == "" {
+ instanceBasicSetting.SecretKey = uuid.NewString()
modified = true
}
if modified {
- workspaceSetting, err := s.Store.UpsertWorkspaceSetting(ctx, &storepb.WorkspaceSetting{
- Key: storepb.WorkspaceSettingKey_BASIC,
- Value: &storepb.WorkspaceSetting_BasicSetting{BasicSetting: workspaceBasicSetting},
+ instanceSetting, err := s.Store.UpsertInstanceSetting(ctx, &storepb.InstanceSetting{
+ Key: storepb.InstanceSettingKey_BASIC,
+ Value: &storepb.InstanceSetting_BasicSetting{BasicSetting: instanceBasicSetting},
})
if err != nil {
- return nil, errors.Wrap(err, "failed to upsert workspace setting")
+ return nil, errors.Wrap(err, "failed to upsert instance setting")
}
- workspaceBasicSetting = workspaceSetting.GetBasicSetting()
+ instanceBasicSetting = instanceSetting.GetBasicSetting()
}
- return workspaceBasicSetting, nil
+ return instanceBasicSetting, nil
}
// stacktraceError wraps an underlying error and captures the stacktrace. It
diff --git a/store/attachment.go b/store/attachment.go
index 7146f75ca..6b4dcba85 100644
--- a/store/attachment.go
+++ b/store/attachment.go
@@ -141,16 +141,16 @@ func (s *Store) DeleteAttachment(ctx context.Context, delete *DeleteAttachment)
if s3ObjectPayload == nil {
return errors.Errorf("No s3 object found")
}
- workspaceStorageSetting, err := s.GetWorkspaceStorageSetting(ctx)
+ instanceStorageSetting, err := s.GetInstanceStorageSetting(ctx)
if err != nil {
- return errors.Wrap(err, "failed to get workspace storage setting")
+ return errors.Wrap(err, "failed to get instance storage setting")
}
s3Config := s3ObjectPayload.S3Config
if s3Config == nil {
- if workspaceStorageSetting.S3Config == nil {
+ if instanceStorageSetting.S3Config == nil {
return errors.Errorf("S3 config is not found")
}
- s3Config = workspaceStorageSetting.S3Config
+ s3Config = instanceStorageSetting.S3Config
}
s3Client, err := s3.NewClient(ctx, s3Config)
diff --git a/store/db/mysql/workspace_setting.go b/store/db/mysql/instance_setting.go
similarity index 73%
rename from store/db/mysql/workspace_setting.go
rename to store/db/mysql/instance_setting.go
index 0f779d6ff..28c8fe529 100644
--- a/store/db/mysql/workspace_setting.go
+++ b/store/db/mysql/instance_setting.go
@@ -7,7 +7,7 @@ import (
"github.com/usememos/memos/store"
)
-func (d *DB) UpsertWorkspaceSetting(ctx context.Context, upsert *store.WorkspaceSetting) (*store.WorkspaceSetting, error) {
+func (d *DB) UpsertInstanceSetting(ctx context.Context, upsert *store.InstanceSetting) (*store.InstanceSetting, error) {
stmt := "INSERT INTO `system_setting` (`name`, `value`, `description`) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE `value` = ?, `description` = ?"
_, err := d.db.ExecContext(
ctx,
@@ -25,7 +25,7 @@ func (d *DB) UpsertWorkspaceSetting(ctx context.Context, upsert *store.Workspace
return upsert, nil
}
-func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspaceSetting) ([]*store.WorkspaceSetting, error) {
+func (d *DB) ListInstanceSettings(ctx context.Context, find *store.FindInstanceSetting) ([]*store.InstanceSetting, error) {
where, args := []string{"1 = 1"}, []any{}
if find.Name != "" {
where, args = append(where, "`name` = ?"), append(args, find.Name)
@@ -38,9 +38,9 @@ func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspac
}
defer rows.Close()
- list := []*store.WorkspaceSetting{}
+ list := []*store.InstanceSetting{}
for rows.Next() {
- systemSettingMessage := &store.WorkspaceSetting{}
+ systemSettingMessage := &store.InstanceSetting{}
if err := rows.Scan(
&systemSettingMessage.Name,
&systemSettingMessage.Value,
@@ -58,7 +58,7 @@ func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspac
return list, nil
}
-func (d *DB) DeleteWorkspaceSetting(ctx context.Context, delete *store.DeleteWorkspaceSetting) error {
+func (d *DB) DeleteInstanceSetting(ctx context.Context, delete *store.DeleteInstanceSetting) error {
stmt := "DELETE FROM `system_setting` WHERE `name` = ?"
_, err := d.db.ExecContext(ctx, stmt, delete.Name)
return err
diff --git a/store/db/postgres/workspace_setting.go b/store/db/postgres/instance_setting.go
similarity index 72%
rename from store/db/postgres/workspace_setting.go
rename to store/db/postgres/instance_setting.go
index 038a57bdb..a2ec78c3e 100644
--- a/store/db/postgres/workspace_setting.go
+++ b/store/db/postgres/instance_setting.go
@@ -7,13 +7,13 @@ import (
"github.com/usememos/memos/store"
)
-func (d *DB) UpsertWorkspaceSetting(ctx context.Context, upsert *store.WorkspaceSetting) (*store.WorkspaceSetting, error) {
+func (d *DB) UpsertInstanceSetting(ctx context.Context, upsert *store.InstanceSetting) (*store.InstanceSetting, error) {
stmt := `
INSERT INTO system_setting (
name, value, description
)
VALUES ($1, $2, $3)
- ON CONFLICT(name) DO UPDATE
+ ON CONFLICT(name) DO UPDATE
SET
value = EXCLUDED.value,
description = EXCLUDED.description
@@ -25,7 +25,7 @@ func (d *DB) UpsertWorkspaceSetting(ctx context.Context, upsert *store.Workspace
return upsert, nil
}
-func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspaceSetting) ([]*store.WorkspaceSetting, error) {
+func (d *DB) ListInstanceSettings(ctx context.Context, find *store.FindInstanceSetting) ([]*store.InstanceSetting, error) {
where, args := []string{"1 = 1"}, []any{}
if find.Name != "" {
where, args = append(where, "name = "+placeholder(len(args)+1)), append(args, find.Name)
@@ -45,9 +45,9 @@ func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspac
}
defer rows.Close()
- list := []*store.WorkspaceSetting{}
+ list := []*store.InstanceSetting{}
for rows.Next() {
- systemSettingMessage := &store.WorkspaceSetting{}
+ systemSettingMessage := &store.InstanceSetting{}
if err := rows.Scan(
&systemSettingMessage.Name,
&systemSettingMessage.Value,
@@ -65,7 +65,7 @@ func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspac
return list, nil
}
-func (d *DB) DeleteWorkspaceSetting(ctx context.Context, delete *store.DeleteWorkspaceSetting) error {
+func (d *DB) DeleteInstanceSetting(ctx context.Context, delete *store.DeleteInstanceSetting) error {
stmt := `DELETE FROM system_setting WHERE name = $1`
_, err := d.db.ExecContext(ctx, stmt, delete.Name)
return err
diff --git a/store/db/sqlite/workspace_setting.go b/store/db/sqlite/instance_setting.go
similarity index 71%
rename from store/db/sqlite/workspace_setting.go
rename to store/db/sqlite/instance_setting.go
index 5969206ac..658501fc8 100644
--- a/store/db/sqlite/workspace_setting.go
+++ b/store/db/sqlite/instance_setting.go
@@ -7,13 +7,13 @@ import (
"github.com/usememos/memos/store"
)
-func (d *DB) UpsertWorkspaceSetting(ctx context.Context, upsert *store.WorkspaceSetting) (*store.WorkspaceSetting, error) {
+func (d *DB) UpsertInstanceSetting(ctx context.Context, upsert *store.InstanceSetting) (*store.InstanceSetting, error) {
stmt := `
INSERT INTO system_setting (
name, value, description
)
VALUES (?, ?, ?)
- ON CONFLICT(name) DO UPDATE
+ ON CONFLICT(name) DO UPDATE
SET
value = EXCLUDED.value,
description = EXCLUDED.description
@@ -25,7 +25,7 @@ func (d *DB) UpsertWorkspaceSetting(ctx context.Context, upsert *store.Workspace
return upsert, nil
}
-func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspaceSetting) ([]*store.WorkspaceSetting, error) {
+func (d *DB) ListInstanceSettings(ctx context.Context, find *store.FindInstanceSetting) ([]*store.InstanceSetting, error) {
where, args := []string{"1 = 1"}, []any{}
if find.Name != "" {
where, args = append(where, "name = ?"), append(args, find.Name)
@@ -45,9 +45,9 @@ func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspac
}
defer rows.Close()
- list := []*store.WorkspaceSetting{}
+ list := []*store.InstanceSetting{}
for rows.Next() {
- systemSettingMessage := &store.WorkspaceSetting{}
+ systemSettingMessage := &store.InstanceSetting{}
if err := rows.Scan(
&systemSettingMessage.Name,
&systemSettingMessage.Value,
@@ -65,7 +65,7 @@ func (d *DB) ListWorkspaceSettings(ctx context.Context, find *store.FindWorkspac
return list, nil
}
-func (d *DB) DeleteWorkspaceSetting(ctx context.Context, delete *store.DeleteWorkspaceSetting) error {
+func (d *DB) DeleteInstanceSetting(ctx context.Context, delete *store.DeleteInstanceSetting) error {
stmt := "DELETE FROM system_setting WHERE name = ?"
_, err := d.db.ExecContext(ctx, stmt, delete.Name)
return err
diff --git a/store/driver.go b/store/driver.go
index cb5d6eb9c..bee6ed508 100644
--- a/store/driver.go
+++ b/store/driver.go
@@ -15,7 +15,7 @@ type Driver interface {
// MigrationHistory model related methods.
// NOTE: These methods are deprecated. The migration_history table is no longer used
- // for tracking schema versions. Schema version is now stored in workspace_setting.
+ // for tracking schema versions. Schema version is now stored in instance_setting.
// These methods are kept for backward compatibility to migrate existing installations.
FindMigrationHistoryList(ctx context.Context, find *FindMigrationHistory) ([]*MigrationHistory, error)
UpsertMigrationHistory(ctx context.Context, upsert *UpsertMigrationHistory) (*MigrationHistory, error)
@@ -41,10 +41,10 @@ type Driver interface {
ListMemoRelations(ctx context.Context, find *FindMemoRelation) ([]*MemoRelation, error)
DeleteMemoRelation(ctx context.Context, delete *DeleteMemoRelation) error
- // WorkspaceSetting model related methods.
- UpsertWorkspaceSetting(ctx context.Context, upsert *WorkspaceSetting) (*WorkspaceSetting, error)
- ListWorkspaceSettings(ctx context.Context, find *FindWorkspaceSetting) ([]*WorkspaceSetting, error)
- DeleteWorkspaceSetting(ctx context.Context, delete *DeleteWorkspaceSetting) error
+ // InstanceSetting model related methods.
+ UpsertInstanceSetting(ctx context.Context, upsert *InstanceSetting) (*InstanceSetting, error)
+ ListInstanceSettings(ctx context.Context, find *FindInstanceSetting) ([]*InstanceSetting, error)
+ DeleteInstanceSetting(ctx context.Context, delete *DeleteInstanceSetting) error
// User model related methods.
CreateUser(ctx context.Context, create *User) (*User, error)
diff --git a/store/instance_setting.go b/store/instance_setting.go
new file mode 100644
index 000000000..e57901a30
--- /dev/null
+++ b/store/instance_setting.go
@@ -0,0 +1,245 @@
+package store
+
+import (
+ "context"
+
+ "github.com/pkg/errors"
+ "google.golang.org/protobuf/encoding/protojson"
+
+ storepb "github.com/usememos/memos/proto/gen/store"
+)
+
+type InstanceSetting struct {
+ Name string
+ Value string
+ Description string
+}
+
+type FindInstanceSetting struct {
+ Name string
+}
+
+type DeleteInstanceSetting struct {
+ Name string
+}
+
+func (s *Store) UpsertInstanceSetting(ctx context.Context, upsert *storepb.InstanceSetting) (*storepb.InstanceSetting, error) {
+ instanceSettingRaw := &InstanceSetting{
+ Name: upsert.Key.String(),
+ }
+ var valueBytes []byte
+ var err error
+ if upsert.Key == storepb.InstanceSettingKey_BASIC {
+ valueBytes, err = protojson.Marshal(upsert.GetBasicSetting())
+ } else if upsert.Key == storepb.InstanceSettingKey_GENERAL {
+ valueBytes, err = protojson.Marshal(upsert.GetGeneralSetting())
+ } else if upsert.Key == storepb.InstanceSettingKey_STORAGE {
+ valueBytes, err = protojson.Marshal(upsert.GetStorageSetting())
+ } else if upsert.Key == storepb.InstanceSettingKey_MEMO_RELATED {
+ valueBytes, err = protojson.Marshal(upsert.GetMemoRelatedSetting())
+ } else {
+ return nil, errors.Errorf("unsupported instance setting key: %v", upsert.Key)
+ }
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to marshal instance setting value")
+ }
+ valueString := string(valueBytes)
+ instanceSettingRaw.Value = valueString
+ instanceSettingRaw, err = s.driver.UpsertInstanceSetting(ctx, instanceSettingRaw)
+ if err != nil {
+ return nil, errors.Wrap(err, "Failed to upsert instance setting")
+ }
+ instanceSetting, err := convertInstanceSettingFromRaw(instanceSettingRaw)
+ if err != nil {
+ return nil, errors.Wrap(err, "Failed to convert instance setting")
+ }
+ s.instanceSettingCache.Set(ctx, instanceSetting.Key.String(), instanceSetting)
+ return instanceSetting, nil
+}
+
+func (s *Store) ListInstanceSettings(ctx context.Context, find *FindInstanceSetting) ([]*storepb.InstanceSetting, error) {
+ list, err := s.driver.ListInstanceSettings(ctx, find)
+ if err != nil {
+ return nil, err
+ }
+
+ instanceSettings := []*storepb.InstanceSetting{}
+ for _, instanceSettingRaw := range list {
+ instanceSetting, err := convertInstanceSettingFromRaw(instanceSettingRaw)
+ if err != nil {
+ return nil, errors.Wrap(err, "Failed to convert instance setting")
+ }
+ if instanceSetting == nil {
+ continue
+ }
+ s.instanceSettingCache.Set(ctx, instanceSetting.Key.String(), instanceSetting)
+ instanceSettings = append(instanceSettings, instanceSetting)
+ }
+ return instanceSettings, nil
+}
+
+func (s *Store) GetInstanceSetting(ctx context.Context, find *FindInstanceSetting) (*storepb.InstanceSetting, error) {
+ if cache, ok := s.instanceSettingCache.Get(ctx, find.Name); ok {
+ instanceSetting, ok := cache.(*storepb.InstanceSetting)
+ if ok {
+ return instanceSetting, nil
+ }
+ }
+
+ list, err := s.ListInstanceSettings(ctx, find)
+ if err != nil {
+ return nil, err
+ }
+ if len(list) == 0 {
+ return nil, nil
+ }
+ if len(list) > 1 {
+ return nil, errors.Errorf("found multiple instance settings with key %s", find.Name)
+ }
+ return list[0], nil
+}
+
+func (s *Store) GetInstanceBasicSetting(ctx context.Context) (*storepb.InstanceBasicSetting, error) {
+ instanceSetting, err := s.GetInstanceSetting(ctx, &FindInstanceSetting{
+ Name: storepb.InstanceSettingKey_BASIC.String(),
+ })
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to get instance basic setting")
+ }
+
+ instanceBasicSetting := &storepb.InstanceBasicSetting{}
+ if instanceSetting != nil {
+ instanceBasicSetting = instanceSetting.GetBasicSetting()
+ }
+ s.instanceSettingCache.Set(ctx, storepb.InstanceSettingKey_BASIC.String(), &storepb.InstanceSetting{
+ Key: storepb.InstanceSettingKey_BASIC,
+ Value: &storepb.InstanceSetting_BasicSetting{BasicSetting: instanceBasicSetting},
+ })
+ return instanceBasicSetting, nil
+}
+
+func (s *Store) GetInstanceGeneralSetting(ctx context.Context) (*storepb.InstanceGeneralSetting, error) {
+ instanceSetting, err := s.GetInstanceSetting(ctx, &FindInstanceSetting{
+ Name: storepb.InstanceSettingKey_GENERAL.String(),
+ })
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to get instance general setting")
+ }
+
+ instanceGeneralSetting := &storepb.InstanceGeneralSetting{}
+ if instanceSetting != nil {
+ instanceGeneralSetting = instanceSetting.GetGeneralSetting()
+ }
+ s.instanceSettingCache.Set(ctx, storepb.InstanceSettingKey_GENERAL.String(), &storepb.InstanceSetting{
+ Key: storepb.InstanceSettingKey_GENERAL,
+ Value: &storepb.InstanceSetting_GeneralSetting{GeneralSetting: instanceGeneralSetting},
+ })
+ return instanceGeneralSetting, nil
+}
+
+// DefaultContentLengthLimit is the default limit of content length in bytes. 8KB.
+const DefaultContentLengthLimit = 8 * 1024
+
+// DefaultReactions is the default reactions for memo related setting.
+var DefaultReactions = []string{"👍", "👎", "❤️", "🎉", "😄", "😕", "😢", "😡"}
+
+// DefaultNsfwTags is the default tags that mark content as NSFW for blurring.
+var DefaultNsfwTags = []string{"nsfw"}
+
+func (s *Store) GetInstanceMemoRelatedSetting(ctx context.Context) (*storepb.InstanceMemoRelatedSetting, error) {
+ instanceSetting, err := s.GetInstanceSetting(ctx, &FindInstanceSetting{
+ Name: storepb.InstanceSettingKey_MEMO_RELATED.String(),
+ })
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to get instance general setting")
+ }
+
+ instanceMemoRelatedSetting := &storepb.InstanceMemoRelatedSetting{}
+ if instanceSetting != nil {
+ instanceMemoRelatedSetting = instanceSetting.GetMemoRelatedSetting()
+ }
+ if instanceMemoRelatedSetting.ContentLengthLimit < DefaultContentLengthLimit {
+ instanceMemoRelatedSetting.ContentLengthLimit = DefaultContentLengthLimit
+ }
+ if len(instanceMemoRelatedSetting.Reactions) == 0 {
+ instanceMemoRelatedSetting.Reactions = append(instanceMemoRelatedSetting.Reactions, DefaultReactions...)
+ }
+ if len(instanceMemoRelatedSetting.NsfwTags) == 0 {
+ instanceMemoRelatedSetting.NsfwTags = append(instanceMemoRelatedSetting.NsfwTags, DefaultNsfwTags...)
+ }
+ s.instanceSettingCache.Set(ctx, storepb.InstanceSettingKey_MEMO_RELATED.String(), &storepb.InstanceSetting{
+ Key: storepb.InstanceSettingKey_MEMO_RELATED,
+ Value: &storepb.InstanceSetting_MemoRelatedSetting{MemoRelatedSetting: instanceMemoRelatedSetting},
+ })
+ return instanceMemoRelatedSetting, nil
+}
+
+const (
+ defaultInstanceStorageType = storepb.InstanceStorageSetting_DATABASE
+ defaultInstanceUploadSizeLimitMb = 30
+ defaultInstanceFilepathTemplate = "assets/{timestamp}_{filename}"
+)
+
+func (s *Store) GetInstanceStorageSetting(ctx context.Context) (*storepb.InstanceStorageSetting, error) {
+ instanceSetting, err := s.GetInstanceSetting(ctx, &FindInstanceSetting{
+ Name: storepb.InstanceSettingKey_STORAGE.String(),
+ })
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to get instance storage setting")
+ }
+
+ instanceStorageSetting := &storepb.InstanceStorageSetting{}
+ if instanceSetting != nil {
+ instanceStorageSetting = instanceSetting.GetStorageSetting()
+ }
+ if instanceStorageSetting.StorageType == storepb.InstanceStorageSetting_STORAGE_TYPE_UNSPECIFIED {
+ instanceStorageSetting.StorageType = defaultInstanceStorageType
+ }
+ if instanceStorageSetting.UploadSizeLimitMb == 0 {
+ instanceStorageSetting.UploadSizeLimitMb = defaultInstanceUploadSizeLimitMb
+ }
+ if instanceStorageSetting.FilepathTemplate == "" {
+ instanceStorageSetting.FilepathTemplate = defaultInstanceFilepathTemplate
+ }
+ s.instanceSettingCache.Set(ctx, storepb.InstanceSettingKey_STORAGE.String(), &storepb.InstanceSetting{
+ Key: storepb.InstanceSettingKey_STORAGE,
+ Value: &storepb.InstanceSetting_StorageSetting{StorageSetting: instanceStorageSetting},
+ })
+ return instanceStorageSetting, nil
+}
+
+func convertInstanceSettingFromRaw(instanceSettingRaw *InstanceSetting) (*storepb.InstanceSetting, error) {
+ instanceSetting := &storepb.InstanceSetting{
+ Key: storepb.InstanceSettingKey(storepb.InstanceSettingKey_value[instanceSettingRaw.Name]),
+ }
+ switch instanceSettingRaw.Name {
+ case storepb.InstanceSettingKey_BASIC.String():
+ basicSetting := &storepb.InstanceBasicSetting{}
+ if err := protojsonUnmarshaler.Unmarshal([]byte(instanceSettingRaw.Value), basicSetting); err != nil {
+ return nil, err
+ }
+ instanceSetting.Value = &storepb.InstanceSetting_BasicSetting{BasicSetting: basicSetting}
+ case storepb.InstanceSettingKey_GENERAL.String():
+ generalSetting := &storepb.InstanceGeneralSetting{}
+ if err := protojsonUnmarshaler.Unmarshal([]byte(instanceSettingRaw.Value), generalSetting); err != nil {
+ return nil, err
+ }
+ instanceSetting.Value = &storepb.InstanceSetting_GeneralSetting{GeneralSetting: generalSetting}
+ case storepb.InstanceSettingKey_STORAGE.String():
+ storageSetting := &storepb.InstanceStorageSetting{}
+ if err := protojsonUnmarshaler.Unmarshal([]byte(instanceSettingRaw.Value), storageSetting); err != nil {
+ return nil, err
+ }
+ instanceSetting.Value = &storepb.InstanceSetting_StorageSetting{StorageSetting: storageSetting}
+ case storepb.InstanceSettingKey_MEMO_RELATED.String():
+ memoRelatedSetting := &storepb.InstanceMemoRelatedSetting{}
+ if err := protojsonUnmarshaler.Unmarshal([]byte(instanceSettingRaw.Value), memoRelatedSetting); err != nil {
+ return nil, err
+ }
+ instanceSetting.Value = &storepb.InstanceSetting_MemoRelatedSetting{MemoRelatedSetting: memoRelatedSetting}
+ default:
+ // Skip unsupported instance setting key.
+ return nil, nil
+ }
+ return instanceSetting, nil
+}
diff --git a/store/migration_history.go b/store/migration_history.go
index f25b31568..77f41ff0b 100644
--- a/store/migration_history.go
+++ b/store/migration_history.go
@@ -2,8 +2,8 @@ package store
// MigrationHistory represents a record in the migration_history table.
// NOTE: The migration_history table is deprecated in favor of storing schema version
-// in workspace_setting (BASIC setting). This is kept for backward compatibility only.
-// Migration from migration_history to workspace_setting happens automatically during startup.
+// in system_setting (BASIC setting). This is kept for backward compatibility only.
+// Migration from migration_history to system_setting happens automatically during startup.
type MigrationHistory struct {
Version string
CreatedTs int64
diff --git a/store/migrator.go b/store/migrator.go
index d40580400..915105b4c 100644
--- a/store/migrator.go
+++ b/store/migrator.go
@@ -21,19 +21,19 @@ import (
// Migration System Overview:
//
// The migration system handles database schema versioning and upgrades.
-// Schema version is stored in workspace_setting (the new system).
+// Schema version is stored in system_setting (the new system).
// The old migration_history table is deprecated but still supported for backward compatibility.
//
// Migration Flow:
// 1. preMigrate: Check if DB is initialized. If not, apply LATEST.sql
// 2. normalizeMigrationHistoryList: Normalize old migration_history records (for pre-0.22 installations)
-// 3. migrateSchemaVersionToSetting: Migrate version from migration_history to workspace_setting
+// 3. migrateSchemaVersionToSetting: Migrate version from migration_history to system_setting
// 4. Migrate (prod mode): Apply incremental migrations from current to target version
// 5. Migrate (demo mode): Seed database with demo data
//
// Version Tracking:
-// - New installations: Schema version set in workspace_setting immediately
-// - Old installations: Version migrated from migration_history to workspace_setting automatically
+// - New installations: Schema version set in system_setting immediately
+// - Old installations: Version migrated from migration_history to system_setting automatically
// - Empty version: Treated as 0.0.0 and all migrations applied
//
// Migration Files:
@@ -118,25 +118,25 @@ func (s *Store) Migrate(ctx context.Context) error {
switch s.profile.Mode {
case modeProd:
- workspaceBasicSetting, err := s.GetWorkspaceBasicSetting(ctx)
+ instanceBasicSetting, err := s.GetInstanceBasicSetting(ctx)
if err != nil {
- return errors.Wrap(err, "failed to get workspace basic setting")
+ return errors.Wrap(err, "failed to get instance basic setting")
}
currentSchemaVersion, err := s.GetCurrentSchemaVersion()
if err != nil {
return errors.Wrap(err, "failed to get current schema version")
}
// Check for downgrade (but skip if schema version is empty - that means fresh/old installation)
- if !isVersionEmpty(workspaceBasicSetting.SchemaVersion) && version.IsVersionGreaterThan(workspaceBasicSetting.SchemaVersion, currentSchemaVersion) {
+ if !isVersionEmpty(instanceBasicSetting.SchemaVersion) && version.IsVersionGreaterThan(instanceBasicSetting.SchemaVersion, currentSchemaVersion) {
slog.Error("cannot downgrade schema version",
- slog.String("databaseVersion", workspaceBasicSetting.SchemaVersion),
+ slog.String("databaseVersion", instanceBasicSetting.SchemaVersion),
slog.String("currentVersion", currentSchemaVersion),
)
- return errors.Errorf("cannot downgrade schema version from %s to %s", workspaceBasicSetting.SchemaVersion, currentSchemaVersion)
+ return errors.Errorf("cannot downgrade schema version from %s to %s", instanceBasicSetting.SchemaVersion, currentSchemaVersion)
}
// Apply migrations if needed (including when schema version is empty)
- if isVersionEmpty(workspaceBasicSetting.SchemaVersion) || version.IsVersionGreaterThan(currentSchemaVersion, workspaceBasicSetting.SchemaVersion) {
- if err := s.applyMigrations(ctx, workspaceBasicSetting.SchemaVersion, currentSchemaVersion); err != nil {
+ if isVersionEmpty(instanceBasicSetting.SchemaVersion) || version.IsVersionGreaterThan(currentSchemaVersion, instanceBasicSetting.SchemaVersion) {
+ if err := s.applyMigrations(ctx, instanceBasicSetting.SchemaVersion, currentSchemaVersion); err != nil {
return errors.Wrap(err, "failed to apply migrations")
}
}
@@ -363,19 +363,19 @@ func (*Store) execute(ctx context.Context, tx *sql.Tx, stmt string) error {
return nil
}
-// updateCurrentSchemaVersion updates the current schema version in the workspace basic setting.
-// It retrieves the workspace basic setting, updates the schema version, and upserts the setting back to the database.
+// updateCurrentSchemaVersion updates the current schema version in the instance basic setting.
+// It retrieves the instance basic setting, updates the schema version, and upserts the setting back to the database.
func (s *Store) updateCurrentSchemaVersion(ctx context.Context, schemaVersion string) error {
- workspaceBasicSetting, err := s.GetWorkspaceBasicSetting(ctx)
+ instanceBasicSetting, err := s.GetInstanceBasicSetting(ctx)
if err != nil {
- return errors.Wrap(err, "failed to get workspace basic setting")
+ return errors.Wrap(err, "failed to get instance basic setting")
}
- workspaceBasicSetting.SchemaVersion = schemaVersion
- if _, err := s.UpsertWorkspaceSetting(ctx, &storepb.WorkspaceSetting{
- Key: storepb.WorkspaceSettingKey_BASIC,
- Value: &storepb.WorkspaceSetting_BasicSetting{BasicSetting: workspaceBasicSetting},
+ instanceBasicSetting.SchemaVersion = schemaVersion
+ if _, err := s.UpsertInstanceSetting(ctx, &storepb.InstanceSetting{
+ Key: storepb.InstanceSettingKey_BASIC,
+ Value: &storepb.InstanceSetting_BasicSetting{BasicSetting: instanceBasicSetting},
}); err != nil {
- return errors.Wrap(err, "failed to upsert workspace setting")
+ return errors.Wrap(err, "failed to upsert instance setting")
}
return nil
}
@@ -383,7 +383,7 @@ func (s *Store) updateCurrentSchemaVersion(ctx context.Context, schemaVersion st
// normalizeMigrationHistoryList normalizes the migration history list.
// It checks the existing migration history and updates it to the latest schema version if necessary.
// NOTE: This is a transition function for backward compatibility with the deprecated migration_history table.
-// This ensures that old installations (< 0.22) have their migration_history normalized before migrating to workspace_setting.
+// This ensures that old installations (< 0.22) have their migration_history normalized before migrating to system_setting.
func (s *Store) normalizeMigrationHistoryList(ctx context.Context) error {
migrationHistoryList, err := s.driver.FindMigrationHistoryList(ctx, &FindMigrationHistory{})
if err != nil {
@@ -435,11 +435,11 @@ func (s *Store) normalizeMigrationHistoryList(ctx context.Context) error {
return nil
}
-// migrateSchemaVersionToSetting migrates the schema version from the migration history to the workspace basic setting.
-// It retrieves the migration history, sorts the versions, and updates the workspace basic setting if necessary.
+// migrateSchemaVersionToSetting migrates the schema version from the migration history to the instance basic setting.
+// It retrieves the migration history, sorts the versions, and updates the instance basic setting if necessary.
// NOTE: This is a transition function for backward compatibility with the deprecated migration_history table.
-// The migration_history table is deprecated in favor of storing schema version in workspace_setting.
-// This handles upgrades from old installations that only have migration_history but no workspace_setting.
+// The migration_history table is deprecated in favor of storing schema version in system_setting.
+// This handles upgrades from old installations that only have migration_history but no system_setting.
func (s *Store) migrateSchemaVersionToSetting(ctx context.Context) error {
migrationHistoryList, err := s.driver.FindMigrationHistoryList(ctx, &FindMigrationHistory{})
if err != nil {
@@ -455,16 +455,16 @@ func (s *Store) migrateSchemaVersionToSetting(ctx context.Context) error {
sort.Sort(version.SortVersion(versions))
latestVersion := versions[len(versions)-1]
- workspaceBasicSetting, err := s.GetWorkspaceBasicSetting(ctx)
+ instanceBasicSetting, err := s.GetInstanceBasicSetting(ctx)
if err != nil {
- return errors.Wrap(err, "failed to get workspace basic setting")
+ return errors.Wrap(err, "failed to get instance basic setting")
}
- // If workspace_setting has no schema version (empty), or migration_history has a newer version, update workspace_setting.
+ // If instance_setting has no schema version (empty), or migration_history has a newer version, update instance_setting.
// This handles upgrades from old installations where schema version was only tracked in migration_history.
- if isVersionEmpty(workspaceBasicSetting.SchemaVersion) || version.IsVersionGreaterThan(latestVersion, workspaceBasicSetting.SchemaVersion) {
- slog.Info("migrating schema version from migration_history to workspace_setting",
- slog.String("from", workspaceBasicSetting.SchemaVersion),
+ if isVersionEmpty(instanceBasicSetting.SchemaVersion) || version.IsVersionGreaterThan(latestVersion, instanceBasicSetting.SchemaVersion) {
+ slog.Info("migrating schema version from migration_history to instance_setting",
+ slog.String("from", instanceBasicSetting.SchemaVersion),
slog.String("to", latestVersion),
)
if err := s.updateCurrentSchemaVersion(ctx, latestVersion); err != nil {
diff --git a/store/store.go b/store/store.go
index 6b7e8265d..d53c70e92 100644
--- a/store/store.go
+++ b/store/store.go
@@ -16,9 +16,9 @@ type Store struct {
cacheConfig cache.Config
// Caches
- workspaceSettingCache *cache.Cache // cache for workspace settings
- userCache *cache.Cache // cache for users
- userSettingCache *cache.Cache // cache for user settings
+ instanceSettingCache *cache.Cache // cache for instance settings
+ userCache *cache.Cache // cache for users
+ userSettingCache *cache.Cache // cache for user settings
}
// New creates a new instance of Store.
@@ -32,12 +32,12 @@ func New(driver Driver, profile *profile.Profile) *Store {
}
store := &Store{
- driver: driver,
- profile: profile,
- cacheConfig: cacheConfig,
- workspaceSettingCache: cache.New(cacheConfig),
- userCache: cache.New(cacheConfig),
- userSettingCache: cache.New(cacheConfig),
+ driver: driver,
+ profile: profile,
+ cacheConfig: cacheConfig,
+ instanceSettingCache: cache.New(cacheConfig),
+ userCache: cache.New(cacheConfig),
+ userSettingCache: cache.New(cacheConfig),
}
return store
@@ -49,7 +49,7 @@ func (s *Store) GetDriver() Driver {
func (s *Store) Close() error {
// Stop all cache cleanup goroutines
- s.workspaceSettingCache.Close()
+ s.instanceSettingCache.Close()
s.userCache.Close()
s.userSettingCache.Close()
diff --git a/store/test/instance_setting_test.go b/store/test/instance_setting_test.go
new file mode 100644
index 000000000..909ff46d8
--- /dev/null
+++ b/store/test/instance_setting_test.go
@@ -0,0 +1,31 @@
+package test
+
+import (
+ "context"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ storepb "github.com/usememos/memos/proto/gen/store"
+ "github.com/usememos/memos/store"
+)
+
+func TestInstanceSettingV1Store(t *testing.T) {
+ ctx := context.Background()
+ ts := NewTestingStore(ctx, t)
+ instanceSetting, err := ts.UpsertInstanceSetting(ctx, &storepb.InstanceSetting{
+ Key: storepb.InstanceSettingKey_GENERAL,
+ Value: &storepb.InstanceSetting_GeneralSetting{
+ GeneralSetting: &storepb.InstanceGeneralSetting{
+ AdditionalScript: "",
+ },
+ },
+ })
+ require.NoError(t, err)
+ setting, err := ts.GetInstanceSetting(ctx, &store.FindInstanceSetting{
+ Name: storepb.InstanceSettingKey_GENERAL.String(),
+ })
+ require.NoError(t, err)
+ require.Equal(t, instanceSetting, setting)
+ ts.Close()
+}
diff --git a/store/test/workspace_setting_test.go b/store/test/workspace_setting_test.go
deleted file mode 100644
index 2a142d349..000000000
--- a/store/test/workspace_setting_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package test
-
-import (
- "context"
- "testing"
-
- "github.com/stretchr/testify/require"
-
- storepb "github.com/usememos/memos/proto/gen/store"
- "github.com/usememos/memos/store"
-)
-
-func TestWorkspaceSettingV1Store(t *testing.T) {
- ctx := context.Background()
- ts := NewTestingStore(ctx, t)
- workspaceSetting, err := ts.UpsertWorkspaceSetting(ctx, &storepb.WorkspaceSetting{
- Key: storepb.WorkspaceSettingKey_GENERAL,
- Value: &storepb.WorkspaceSetting_GeneralSetting{
- GeneralSetting: &storepb.WorkspaceGeneralSetting{
- AdditionalScript: "",
- },
- },
- })
- require.NoError(t, err)
- setting, err := ts.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{
- Name: storepb.WorkspaceSettingKey_GENERAL.String(),
- })
- require.NoError(t, err)
- require.Equal(t, workspaceSetting, setting)
- ts.Close()
-}
diff --git a/store/workspace_setting.go b/store/workspace_setting.go
deleted file mode 100644
index 9f9054e7c..000000000
--- a/store/workspace_setting.go
+++ /dev/null
@@ -1,245 +0,0 @@
-package store
-
-import (
- "context"
-
- "github.com/pkg/errors"
- "google.golang.org/protobuf/encoding/protojson"
-
- storepb "github.com/usememos/memos/proto/gen/store"
-)
-
-type WorkspaceSetting struct {
- Name string
- Value string
- Description string
-}
-
-type FindWorkspaceSetting struct {
- Name string
-}
-
-type DeleteWorkspaceSetting struct {
- Name string
-}
-
-func (s *Store) UpsertWorkspaceSetting(ctx context.Context, upsert *storepb.WorkspaceSetting) (*storepb.WorkspaceSetting, error) {
- workspaceSettingRaw := &WorkspaceSetting{
- Name: upsert.Key.String(),
- }
- var valueBytes []byte
- var err error
- if upsert.Key == storepb.WorkspaceSettingKey_BASIC {
- valueBytes, err = protojson.Marshal(upsert.GetBasicSetting())
- } else if upsert.Key == storepb.WorkspaceSettingKey_GENERAL {
- valueBytes, err = protojson.Marshal(upsert.GetGeneralSetting())
- } else if upsert.Key == storepb.WorkspaceSettingKey_STORAGE {
- valueBytes, err = protojson.Marshal(upsert.GetStorageSetting())
- } else if upsert.Key == storepb.WorkspaceSettingKey_MEMO_RELATED {
- valueBytes, err = protojson.Marshal(upsert.GetMemoRelatedSetting())
- } else {
- return nil, errors.Errorf("unsupported workspace setting key: %v", upsert.Key)
- }
- if err != nil {
- return nil, errors.Wrap(err, "failed to marshal workspace setting value")
- }
- valueString := string(valueBytes)
- workspaceSettingRaw.Value = valueString
- workspaceSettingRaw, err = s.driver.UpsertWorkspaceSetting(ctx, workspaceSettingRaw)
- if err != nil {
- return nil, errors.Wrap(err, "Failed to upsert workspace setting")
- }
- workspaceSetting, err := convertWorkspaceSettingFromRaw(workspaceSettingRaw)
- if err != nil {
- return nil, errors.Wrap(err, "Failed to convert workspace setting")
- }
- s.workspaceSettingCache.Set(ctx, workspaceSetting.Key.String(), workspaceSetting)
- return workspaceSetting, nil
-}
-
-func (s *Store) ListWorkspaceSettings(ctx context.Context, find *FindWorkspaceSetting) ([]*storepb.WorkspaceSetting, error) {
- list, err := s.driver.ListWorkspaceSettings(ctx, find)
- if err != nil {
- return nil, err
- }
-
- workspaceSettings := []*storepb.WorkspaceSetting{}
- for _, workspaceSettingRaw := range list {
- workspaceSetting, err := convertWorkspaceSettingFromRaw(workspaceSettingRaw)
- if err != nil {
- return nil, errors.Wrap(err, "Failed to convert workspace setting")
- }
- if workspaceSetting == nil {
- continue
- }
- s.workspaceSettingCache.Set(ctx, workspaceSetting.Key.String(), workspaceSetting)
- workspaceSettings = append(workspaceSettings, workspaceSetting)
- }
- return workspaceSettings, nil
-}
-
-func (s *Store) GetWorkspaceSetting(ctx context.Context, find *FindWorkspaceSetting) (*storepb.WorkspaceSetting, error) {
- if cache, ok := s.workspaceSettingCache.Get(ctx, find.Name); ok {
- workspaceSetting, ok := cache.(*storepb.WorkspaceSetting)
- if ok {
- return workspaceSetting, nil
- }
- }
-
- list, err := s.ListWorkspaceSettings(ctx, find)
- if err != nil {
- return nil, err
- }
- if len(list) == 0 {
- return nil, nil
- }
- if len(list) > 1 {
- return nil, errors.Errorf("found multiple workspace settings with key %s", find.Name)
- }
- return list[0], nil
-}
-
-func (s *Store) GetWorkspaceBasicSetting(ctx context.Context) (*storepb.WorkspaceBasicSetting, error) {
- workspaceSetting, err := s.GetWorkspaceSetting(ctx, &FindWorkspaceSetting{
- Name: storepb.WorkspaceSettingKey_BASIC.String(),
- })
- if err != nil {
- return nil, errors.Wrap(err, "failed to get workspace basic setting")
- }
-
- workspaceBasicSetting := &storepb.WorkspaceBasicSetting{}
- if workspaceSetting != nil {
- workspaceBasicSetting = workspaceSetting.GetBasicSetting()
- }
- s.workspaceSettingCache.Set(ctx, storepb.WorkspaceSettingKey_BASIC.String(), &storepb.WorkspaceSetting{
- Key: storepb.WorkspaceSettingKey_BASIC,
- Value: &storepb.WorkspaceSetting_BasicSetting{BasicSetting: workspaceBasicSetting},
- })
- return workspaceBasicSetting, nil
-}
-
-func (s *Store) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.WorkspaceGeneralSetting, error) {
- workspaceSetting, err := s.GetWorkspaceSetting(ctx, &FindWorkspaceSetting{
- Name: storepb.WorkspaceSettingKey_GENERAL.String(),
- })
- if err != nil {
- return nil, errors.Wrap(err, "failed to get workspace general setting")
- }
-
- workspaceGeneralSetting := &storepb.WorkspaceGeneralSetting{}
- if workspaceSetting != nil {
- workspaceGeneralSetting = workspaceSetting.GetGeneralSetting()
- }
- s.workspaceSettingCache.Set(ctx, storepb.WorkspaceSettingKey_GENERAL.String(), &storepb.WorkspaceSetting{
- Key: storepb.WorkspaceSettingKey_GENERAL,
- Value: &storepb.WorkspaceSetting_GeneralSetting{GeneralSetting: workspaceGeneralSetting},
- })
- return workspaceGeneralSetting, nil
-}
-
-// DefaultContentLengthLimit is the default limit of content length in bytes. 8KB.
-const DefaultContentLengthLimit = 8 * 1024
-
-// DefaultReactions is the default reactions for memo related setting.
-var DefaultReactions = []string{"👍", "👎", "❤️", "🎉", "😄", "😕", "😢", "😡"}
-
-// DefaultNsfwTags is the default tags that mark content as NSFW for blurring.
-var DefaultNsfwTags = []string{"nsfw"}
-
-func (s *Store) GetWorkspaceMemoRelatedSetting(ctx context.Context) (*storepb.WorkspaceMemoRelatedSetting, error) {
- workspaceSetting, err := s.GetWorkspaceSetting(ctx, &FindWorkspaceSetting{
- Name: storepb.WorkspaceSettingKey_MEMO_RELATED.String(),
- })
- if err != nil {
- return nil, errors.Wrap(err, "failed to get workspace general setting")
- }
-
- workspaceMemoRelatedSetting := &storepb.WorkspaceMemoRelatedSetting{}
- if workspaceSetting != nil {
- workspaceMemoRelatedSetting = workspaceSetting.GetMemoRelatedSetting()
- }
- if workspaceMemoRelatedSetting.ContentLengthLimit < DefaultContentLengthLimit {
- workspaceMemoRelatedSetting.ContentLengthLimit = DefaultContentLengthLimit
- }
- if len(workspaceMemoRelatedSetting.Reactions) == 0 {
- workspaceMemoRelatedSetting.Reactions = append(workspaceMemoRelatedSetting.Reactions, DefaultReactions...)
- }
- if len(workspaceMemoRelatedSetting.NsfwTags) == 0 {
- workspaceMemoRelatedSetting.NsfwTags = append(workspaceMemoRelatedSetting.NsfwTags, DefaultNsfwTags...)
- }
- s.workspaceSettingCache.Set(ctx, storepb.WorkspaceSettingKey_MEMO_RELATED.String(), &storepb.WorkspaceSetting{
- Key: storepb.WorkspaceSettingKey_MEMO_RELATED,
- Value: &storepb.WorkspaceSetting_MemoRelatedSetting{MemoRelatedSetting: workspaceMemoRelatedSetting},
- })
- return workspaceMemoRelatedSetting, nil
-}
-
-const (
- defaultWorkspaceStorageType = storepb.WorkspaceStorageSetting_DATABASE
- defaultWorkspaceUploadSizeLimitMb = 30
- defaultWorkspaceFilepathTemplate = "assets/{timestamp}_{filename}"
-)
-
-func (s *Store) GetWorkspaceStorageSetting(ctx context.Context) (*storepb.WorkspaceStorageSetting, error) {
- workspaceSetting, err := s.GetWorkspaceSetting(ctx, &FindWorkspaceSetting{
- Name: storepb.WorkspaceSettingKey_STORAGE.String(),
- })
- if err != nil {
- return nil, errors.Wrap(err, "failed to get workspace storage setting")
- }
-
- workspaceStorageSetting := &storepb.WorkspaceStorageSetting{}
- if workspaceSetting != nil {
- workspaceStorageSetting = workspaceSetting.GetStorageSetting()
- }
- if workspaceStorageSetting.StorageType == storepb.WorkspaceStorageSetting_STORAGE_TYPE_UNSPECIFIED {
- workspaceStorageSetting.StorageType = defaultWorkspaceStorageType
- }
- if workspaceStorageSetting.UploadSizeLimitMb == 0 {
- workspaceStorageSetting.UploadSizeLimitMb = defaultWorkspaceUploadSizeLimitMb
- }
- if workspaceStorageSetting.FilepathTemplate == "" {
- workspaceStorageSetting.FilepathTemplate = defaultWorkspaceFilepathTemplate
- }
- s.workspaceSettingCache.Set(ctx, storepb.WorkspaceSettingKey_STORAGE.String(), &storepb.WorkspaceSetting{
- Key: storepb.WorkspaceSettingKey_STORAGE,
- Value: &storepb.WorkspaceSetting_StorageSetting{StorageSetting: workspaceStorageSetting},
- })
- return workspaceStorageSetting, nil
-}
-
-func convertWorkspaceSettingFromRaw(workspaceSettingRaw *WorkspaceSetting) (*storepb.WorkspaceSetting, error) {
- workspaceSetting := &storepb.WorkspaceSetting{
- Key: storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[workspaceSettingRaw.Name]),
- }
- switch workspaceSettingRaw.Name {
- case storepb.WorkspaceSettingKey_BASIC.String():
- basicSetting := &storepb.WorkspaceBasicSetting{}
- if err := protojsonUnmarshaler.Unmarshal([]byte(workspaceSettingRaw.Value), basicSetting); err != nil {
- return nil, err
- }
- workspaceSetting.Value = &storepb.WorkspaceSetting_BasicSetting{BasicSetting: basicSetting}
- case storepb.WorkspaceSettingKey_GENERAL.String():
- generalSetting := &storepb.WorkspaceGeneralSetting{}
- if err := protojsonUnmarshaler.Unmarshal([]byte(workspaceSettingRaw.Value), generalSetting); err != nil {
- return nil, err
- }
- workspaceSetting.Value = &storepb.WorkspaceSetting_GeneralSetting{GeneralSetting: generalSetting}
- case storepb.WorkspaceSettingKey_STORAGE.String():
- storageSetting := &storepb.WorkspaceStorageSetting{}
- if err := protojsonUnmarshaler.Unmarshal([]byte(workspaceSettingRaw.Value), storageSetting); err != nil {
- return nil, err
- }
- workspaceSetting.Value = &storepb.WorkspaceSetting_StorageSetting{StorageSetting: storageSetting}
- case storepb.WorkspaceSettingKey_MEMO_RELATED.String():
- memoRelatedSetting := &storepb.WorkspaceMemoRelatedSetting{}
- if err := protojsonUnmarshaler.Unmarshal([]byte(workspaceSettingRaw.Value), memoRelatedSetting); err != nil {
- return nil, err
- }
- workspaceSetting.Value = &storepb.WorkspaceSetting_MemoRelatedSetting{MemoRelatedSetting: memoRelatedSetting}
- default:
- // Skip unsupported workspace setting key.
- return nil, nil
- }
- return workspaceSetting, nil
-}
diff --git a/web/src/App.tsx b/web/src/App.tsx
index b9569234e..a5afdcc93 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -3,16 +3,16 @@ import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { Outlet } from "react-router-dom";
import useNavigateTo from "./hooks/useNavigateTo";
-import { userStore, workspaceStore } from "./store";
+import { userStore, instanceStore } from "./store";
import { cleanupExpiredOAuthState } from "./utils/oauth";
import { loadTheme } from "./utils/theme";
const App = observer(() => {
const { i18n } = useTranslation();
const navigateTo = useNavigateTo();
- const workspaceProfile = workspaceStore.state.profile;
+ const instanceProfile = instanceStore.state.profile;
const userGeneralSetting = userStore.state.userGeneralSetting;
- const workspaceGeneralSetting = workspaceStore.state.generalSetting;
+ const instanceGeneralSetting = instanceStore.state.generalSetting;
// Clean up expired OAuth states on app initialization
useEffect(() => {
@@ -21,41 +21,41 @@ const App = observer(() => {
// Redirect to sign up page if no instance owner.
useEffect(() => {
- if (!workspaceProfile.owner) {
+ if (!instanceProfile.owner) {
navigateTo("/auth/signup");
}
- }, [workspaceProfile.owner]);
+ }, [instanceProfile.owner]);
useEffect(() => {
- if (workspaceGeneralSetting.additionalStyle) {
+ if (instanceGeneralSetting.additionalStyle) {
const styleEl = document.createElement("style");
- styleEl.innerHTML = workspaceGeneralSetting.additionalStyle;
+ styleEl.innerHTML = instanceGeneralSetting.additionalStyle;
styleEl.setAttribute("type", "text/css");
document.body.insertAdjacentElement("beforeend", styleEl);
}
- }, [workspaceGeneralSetting.additionalStyle]);
+ }, [instanceGeneralSetting.additionalStyle]);
useEffect(() => {
- if (workspaceGeneralSetting.additionalScript) {
+ if (instanceGeneralSetting.additionalScript) {
const scriptEl = document.createElement("script");
- scriptEl.innerHTML = workspaceGeneralSetting.additionalScript;
+ scriptEl.innerHTML = instanceGeneralSetting.additionalScript;
document.head.appendChild(scriptEl);
}
- }, [workspaceGeneralSetting.additionalScript]);
+ }, [instanceGeneralSetting.additionalScript]);
// Dynamic update metadata with customized profile.
useEffect(() => {
- if (!workspaceGeneralSetting.customProfile) {
+ if (!instanceGeneralSetting.customProfile) {
return;
}
- document.title = workspaceGeneralSetting.customProfile.title;
+ document.title = instanceGeneralSetting.customProfile.title;
const link = document.querySelector("link[rel~='icon']") as HTMLLinkElement;
- link.href = workspaceGeneralSetting.customProfile.logoUrl || "/logo.webp";
- }, [workspaceGeneralSetting.customProfile]);
+ link.href = instanceGeneralSetting.customProfile.logoUrl || "/logo.webp";
+ }, [instanceGeneralSetting.customProfile]);
useEffect(() => {
- const currentLocale = workspaceStore.state.locale;
+ const currentLocale = instanceStore.state.locale;
// This will trigger re-rendering of the whole app.
i18n.changeLanguage(currentLocale);
document.documentElement.setAttribute("lang", currentLocale);
@@ -64,26 +64,26 @@ const App = observer(() => {
} else {
document.documentElement.setAttribute("dir", "ltr");
}
- }, [workspaceStore.state.locale]);
+ }, [instanceStore.state.locale]);
useEffect(() => {
if (!userGeneralSetting) {
return;
}
- workspaceStore.state.setPartial({
- locale: userGeneralSetting.locale || workspaceStore.state.locale,
- theme: userGeneralSetting.theme || workspaceStore.state.theme,
+ instanceStore.state.setPartial({
+ locale: userGeneralSetting.locale || instanceStore.state.locale,
+ theme: userGeneralSetting.theme || instanceStore.state.theme,
});
}, [userGeneralSetting?.locale, userGeneralSetting?.theme]);
- // Load theme when workspace theme changes or user setting changes
+ // Load theme when instance theme changes or user setting changes
useEffect(() => {
- const currentTheme = userGeneralSetting?.theme || workspaceStore.state.theme;
+ const currentTheme = userGeneralSetting?.theme || instanceStore.state.theme;
if (currentTheme) {
loadTheme(currentTheme);
}
- }, [userGeneralSetting?.theme, workspaceStore.state.theme]);
+ }, [userGeneralSetting?.theme, instanceStore.state.theme]);
return