Skip to content

armgit / memos

Public Imported from GitHub
0

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

refactor: rename workspace to instance throughout codebase

Steven4c1d1c70d1ca
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
-}
-
-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_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
+ return file_store_instance_setting_proto_rawDescData
+}
+
+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_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: &currentTs,
}
- 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 <Outlet />;
});
diff --git a/web/src/components/ActivityCalendar/ActivityCalendar.tsx b/web/src/components/ActivityCalendar/ActivityCalendar.tsx
index b55d4f502..8a230d64e 100644
--- a/web/src/components/ActivityCalendar/ActivityCalendar.tsx
+++ b/web/src/components/ActivityCalendar/ActivityCalendar.tsx
@@ -2,7 +2,7 @@ import dayjs from "dayjs";
import { observer } from "mobx-react-lite";
import { memo, useMemo } from "react";
import { TooltipProvider } from "@/components/ui/tooltip";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
import type { ActivityCalendarProps } from "@/types/statistics";
import { useTranslate } from "@/utils/i18n";
import { CalendarCell } from "./CalendarCell";
@@ -12,7 +12,7 @@ export const ActivityCalendar = memo(
observer((props: ActivityCalendarProps) => {
const t = useTranslate();
const { month, selectedDate, data, onClick } = props;
- const weekStartDayOffset = workspaceStore.state.generalSetting.weekStartDayOffset;
+ const weekStartDayOffset = instanceStore.state.generalSetting.weekStartDayOffset;
const today = useMemo(() => dayjs().format("YYYY-MM-DD"), []);
const selectedDateFormatted = useMemo(() => dayjs(selectedDate).format("YYYY-MM-DD"), [selectedDate]);
diff --git a/web/src/components/AuthFooter.tsx b/web/src/components/AuthFooter.tsx
index 6553af5bc..a4d36cad0 100644
--- a/web/src/components/AuthFooter.tsx
+++ b/web/src/components/AuthFooter.tsx
@@ -1,6 +1,6 @@
import { observer } from "mobx-react-lite";
import { cn } from "@/lib/utils";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
import LocaleSelect from "./LocaleSelect";
import ThemeSelect from "./ThemeSelect";
@@ -11,8 +11,8 @@ interface Props {
const AuthFooter = observer(({ className }: Props) => {
return (
<div className={cn("mt-4 flex flex-row items-center justify-center w-full gap-2", className)}>
- <LocaleSelect value={workspaceStore.state.locale} onChange={(locale) => workspaceStore.state.setPartial({ locale })} />
- <ThemeSelect value={workspaceStore.state.theme} onValueChange={(theme) => workspaceStore.state.setPartial({ theme })} />
+ <LocaleSelect value={instanceStore.state.locale} onChange={(locale) => instanceStore.state.setPartial({ locale })} />
+ <ThemeSelect value={instanceStore.state.theme} onValueChange={(theme) => instanceStore.state.setPartial({ theme })} />
</div>
);
});
diff --git a/web/src/components/MemoActionMenu.tsx b/web/src/components/MemoActionMenu.tsx
index d467a13f4..edf2644de 100644
--- a/web/src/components/MemoActionMenu.tsx
+++ b/web/src/components/MemoActionMenu.tsx
@@ -19,7 +19,7 @@ import { useLocation } from "react-router-dom";
import ConfirmDialog from "@/components/ConfirmDialog";
import useNavigateTo from "@/hooks/useNavigateTo";
import { memoStore, userStore } from "@/store";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
import { State } from "@/types/proto/api/v1/common";
import { Memo } from "@/types/proto/api/v1/memo_service";
import { useTranslate } from "@/utils/i18n";
@@ -119,7 +119,7 @@ const MemoActionMenu = observer((props: Props) => {
};
const handleCopyLink = () => {
- let host = workspaceStore.state.profile.instanceUrl;
+ let host = instanceStore.state.profile.instanceUrl;
if (host === "") {
host = window.location.origin;
}
diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx
index 5e7d4b080..4b48d7401 100644
--- a/web/src/components/MemoEditor/index.tsx
+++ b/web/src/components/MemoEditor/index.tsx
@@ -13,7 +13,7 @@ import { isValidUrl } from "@/helpers/utils";
import useAsyncEffect from "@/hooks/useAsyncEffect";
import useCurrentUser from "@/hooks/useCurrentUser";
import { cn } from "@/lib/utils";
-import { memoStore, attachmentStore, userStore, workspaceStore } from "@/store";
+import { memoStore, attachmentStore, userStore, instanceStore } from "@/store";
import { extractMemoIdFromName } from "@/store/common";
import { Attachment } from "@/types/proto/api/v1/attachment_service";
import { Location, Memo, MemoRelation, MemoRelation_Type, Visibility } from "@/types/proto/api/v1/memo_service";
@@ -81,7 +81,7 @@ const MemoEditor = observer((props: Props) => {
relation.memo?.name === memoName && relation.relatedMemo?.name !== memoName && relation.type === MemoRelation_Type.REFERENCE,
)
: state.relationList.filter((relation) => relation.type === MemoRelation_Type.REFERENCE);
- const workspaceMemoRelatedSetting = workspaceStore.state.memoRelatedSetting;
+ const instanceMemoRelatedSetting = instanceStore.state.memoRelatedSetting;
useEffect(() => {
editorRef.current?.setContent(contentCache || "");
@@ -95,7 +95,7 @@ const MemoEditor = observer((props: Props) => {
useAsyncEffect(async () => {
let visibility = convertVisibilityFromString(userGeneralSetting?.memoVisibility || "PRIVATE");
- if (workspaceMemoRelatedSetting.disallowPublicVisibility && visibility === Visibility.PUBLIC) {
+ if (instanceMemoRelatedSetting.disallowPublicVisibility && visibility === Visibility.PUBLIC) {
visibility = Visibility.PROTECTED;
}
if (parentMemoName) {
@@ -106,7 +106,7 @@ const MemoEditor = observer((props: Props) => {
...prevState,
memoVisibility: convertVisibilityFromString(visibility),
}));
- }, [parentMemoName, userGeneralSetting?.memoVisibility, workspaceMemoRelatedSetting.disallowPublicVisibility]);
+ }, [parentMemoName, userGeneralSetting?.memoVisibility, instanceMemoRelatedSetting.disallowPublicVisibility]);
useAsyncEffect(async () => {
if (!memoName) {
@@ -156,7 +156,7 @@ const MemoEditor = observer((props: Props) => {
handleSaveBtnClick();
return;
}
- if (!workspaceMemoRelatedSetting.disableMarkdownShortcuts) {
+ if (!instanceMemoRelatedSetting.disableMarkdownShortcuts) {
handleEditorKeydownWithMarkdownShortcuts(event, editorRef.current);
}
}
diff --git a/web/src/components/MemoView.tsx b/web/src/components/MemoView.tsx
index f392df895..8d0384059 100644
--- a/web/src/components/MemoView.tsx
+++ b/web/src/components/MemoView.tsx
@@ -7,7 +7,7 @@ import useAsyncEffect from "@/hooks/useAsyncEffect";
import useCurrentUser from "@/hooks/useCurrentUser";
import useNavigateTo from "@/hooks/useNavigateTo";
import { cn } from "@/lib/utils";
-import { memoStore, userStore, workspaceStore } from "@/store";
+import { memoStore, userStore, instanceStore } from "@/store";
import { State } from "@/types/proto/api/v1/common";
import { Memo, MemoRelation_Type, Visibility } from "@/types/proto/api/v1/memo_service";
import { useTranslate } from "@/utils/i18n";
@@ -52,7 +52,7 @@ const MemoView: React.FC<Props> = observer((props: Props) => {
urls: [],
index: 0,
});
- const workspaceMemoRelatedSetting = workspaceStore.state.memoRelatedSetting;
+ const instanceMemoRelatedSetting = instanceStore.state.memoRelatedSetting;
const referencedMemos = memo.relations.filter((relation) => relation.type === MemoRelation_Type.REFERENCE);
const commentAmount = memo.relations.filter(
(relation) => relation.type === MemoRelation_Type.COMMENT && relation.relatedMemo?.name === memo.name,
@@ -63,8 +63,8 @@ const MemoView: React.FC<Props> = observer((props: Props) => {
const isInMemoDetailPage = location.pathname.startsWith(`/${memo.name}`);
const parentPage = props.parentPage || location.pathname;
const nsfw =
- workspaceMemoRelatedSetting.enableBlurNsfwContent &&
- memo.tags?.some((tag) => workspaceMemoRelatedSetting.nsfwTags.some((nsfwTag) => tag === nsfwTag || tag.startsWith(`${nsfwTag}/`)));
+ instanceMemoRelatedSetting.enableBlurNsfwContent &&
+ memo.tags?.some((tag) => instanceMemoRelatedSetting.nsfwTags.some((nsfwTag) => tag === nsfwTag || tag.startsWith(`${nsfwTag}/`)));
// Initial related data: creator.
useAsyncEffect(async () => {
@@ -103,7 +103,7 @@ const MemoView: React.FC<Props> = observer((props: Props) => {
return;
}
- if (workspaceMemoRelatedSetting.enableDoubleClickEdit) {
+ if (instanceMemoRelatedSetting.enableDoubleClickEdit) {
e.preventDefault();
setShowEditor(true);
}
diff --git a/web/src/components/MemosLogo.tsx b/web/src/components/MemosLogo.tsx
index 603de7a79..cf03f10cd 100644
--- a/web/src/components/MemosLogo.tsx
+++ b/web/src/components/MemosLogo.tsx
@@ -1,6 +1,6 @@
import { observer } from "mobx-react-lite";
import { cn } from "@/lib/utils";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
import UserAvatar from "./UserAvatar";
interface Props {
@@ -10,9 +10,9 @@ interface Props {
const MemosLogo = observer((props: Props) => {
const { collapsed } = props;
- const workspaceGeneralSetting = workspaceStore.state.generalSetting;
- const title = workspaceGeneralSetting.customProfile?.title || "Memos";
- const avatarUrl = workspaceGeneralSetting.customProfile?.logoUrl || "/full-logo.webp";
+ const instanceGeneralSetting = instanceStore.state.generalSetting;
+ const title = instanceGeneralSetting.customProfile?.title || "Memos";
+ const avatarUrl = instanceGeneralSetting.customProfile?.logoUrl || "/full-logo.webp";
return (
<div className={cn("relative w-full h-auto shrink-0", props.className)}>
diff --git a/web/src/components/NavigationDrawer.tsx b/web/src/components/NavigationDrawer.tsx
index f18d7b710..62c23f760 100644
--- a/web/src/components/NavigationDrawer.tsx
+++ b/web/src/components/NavigationDrawer.tsx
@@ -3,16 +3,16 @@ import { useEffect, useState } from "react";
import { useLocation } from "react-router-dom";
import { Button } from "@/components/ui/button";
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
import Navigation from "./Navigation";
import UserAvatar from "./UserAvatar";
const NavigationDrawer = observer(() => {
const location = useLocation();
const [open, setOpen] = useState(false);
- const workspaceGeneralSetting = workspaceStore.state.generalSetting;
- const title = workspaceGeneralSetting.customProfile?.title || "Memos";
- const avatarUrl = workspaceGeneralSetting.customProfile?.logoUrl || "/full-logo.webp";
+ const instanceGeneralSetting = instanceStore.state.generalSetting;
+ const title = instanceGeneralSetting.customProfile?.title || "Memos";
+ const avatarUrl = instanceGeneralSetting.customProfile?.logoUrl || "/full-logo.webp";
useEffect(() => {
setOpen(false);
diff --git a/web/src/components/PasswordSignInForm.tsx b/web/src/components/PasswordSignInForm.tsx
index 7a44fac41..749e7ff09 100644
--- a/web/src/components/PasswordSignInForm.tsx
+++ b/web/src/components/PasswordSignInForm.tsx
@@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input";
import { authServiceClient } from "@/grpcweb";
import useLoading from "@/hooks/useLoading";
import useNavigateTo from "@/hooks/useNavigateTo";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
import { initialUserStore } from "@/store/user";
import { useTranslate } from "@/utils/i18n";
@@ -16,8 +16,8 @@ const PasswordSignInForm = observer(() => {
const t = useTranslate();
const navigateTo = useNavigateTo();
const actionBtnLoadingState = useLoading(false);
- const [username, setUsername] = useState(workspaceStore.state.profile.mode === "demo" ? "demo" : "");
- const [password, setPassword] = useState(workspaceStore.state.profile.mode === "demo" ? "secret" : "");
+ const [username, setUsername] = useState(instanceStore.state.profile.mode === "demo" ? "demo" : "");
+ const [password, setPassword] = useState(instanceStore.state.profile.mode === "demo" ? "secret" : "");
const handleUsernameInputChanged = (e: React.ChangeEvent<HTMLInputElement>) => {
const text = e.target.value as string;
diff --git a/web/src/components/ReactionSelector.tsx b/web/src/components/ReactionSelector.tsx
index a4822e482..3a9bfd3a3 100644
--- a/web/src/components/ReactionSelector.tsx
+++ b/web/src/components/ReactionSelector.tsx
@@ -5,7 +5,7 @@ import useClickAway from "react-use/lib/useClickAway";
import { memoServiceClient } from "@/grpcweb";
import useCurrentUser from "@/hooks/useCurrentUser";
import { cn } from "@/lib/utils";
-import { memoStore, workspaceStore } from "@/store";
+import { memoStore, instanceStore } from "@/store";
import { Memo } from "@/types/proto/api/v1/memo_service";
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
@@ -20,7 +20,7 @@ const ReactionSelector = observer((props: Props) => {
const currentUser = useCurrentUser();
const [open, setOpen] = useState(false);
const containerRef = useRef<HTMLDivElement>(null);
- const workspaceMemoRelatedSetting = workspaceStore.state.memoRelatedSetting;
+ const instanceMemoRelatedSetting = instanceStore.state.memoRelatedSetting;
useClickAway(containerRef, () => {
setOpen(false);
@@ -76,7 +76,7 @@ const ReactionSelector = observer((props: Props) => {
<PopoverContent align="center" className="max-w-[90vw] sm:max-w-md">
<div ref={containerRef}>
<div className="grid grid-cols-4 sm:grid-cols-6 md:grid-cols-8 gap-1 max-h-64 overflow-y-auto">
- {workspaceMemoRelatedSetting.reactions.map((reactionType) => {
+ {instanceMemoRelatedSetting.reactions.map((reactionType) => {
return (
<span
key={reactionType}
diff --git a/web/src/components/Settings/WorkspaceSection.tsx b/web/src/components/Settings/InstanceSection.tsx
similarity index 63%
rename from web/src/components/Settings/WorkspaceSection.tsx
rename to web/src/components/Settings/InstanceSection.tsx
index 6d0830812..d3bc60f9b 100644
--- a/web/src/components/Settings/WorkspaceSection.tsx
+++ b/web/src/components/Settings/InstanceSection.tsx
@@ -9,35 +9,35 @@ import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea";
import { identityProviderServiceClient } from "@/grpcweb";
import useDialog from "@/hooks/useDialog";
-import { workspaceStore } from "@/store";
-import { workspaceSettingNamePrefix } from "@/store/common";
+import { instanceStore } from "@/store";
+import { instanceSettingNamePrefix } from "@/store/common";
import { IdentityProvider } from "@/types/proto/api/v1/idp_service";
-import { WorkspaceSetting_GeneralSetting, WorkspaceSetting_Key } from "@/types/proto/api/v1/workspace_service";
+import { InstanceSetting_GeneralSetting, InstanceSetting_Key } from "@/types/proto/api/v1/instance_service";
import { useTranslate } from "@/utils/i18n";
import ThemeSelect from "../ThemeSelect";
import UpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog";
-const WorkspaceSection = observer(() => {
+const InstanceSection = observer(() => {
const t = useTranslate();
const customizeDialog = useDialog();
- const originalSetting = WorkspaceSetting_GeneralSetting.fromPartial(
- workspaceStore.getWorkspaceSettingByKey(WorkspaceSetting_Key.GENERAL)?.generalSetting || {},
+ const originalSetting = InstanceSetting_GeneralSetting.fromPartial(
+ instanceStore.getInstanceSettingByKey(InstanceSetting_Key.GENERAL)?.generalSetting || {},
);
- const [workspaceGeneralSetting, setWorkspaceGeneralSetting] = useState<WorkspaceSetting_GeneralSetting>(originalSetting);
+ const [instanceGeneralSetting, setInstanceGeneralSetting] = useState<InstanceSetting_GeneralSetting>(originalSetting);
const [identityProviderList, setIdentityProviderList] = useState<IdentityProvider[]>([]);
useEffect(() => {
- setWorkspaceGeneralSetting({ ...workspaceGeneralSetting, customProfile: originalSetting.customProfile });
- }, [workspaceStore.getWorkspaceSettingByKey(WorkspaceSetting_Key.GENERAL)]);
+ setInstanceGeneralSetting({ ...instanceGeneralSetting, customProfile: originalSetting.customProfile });
+ }, [instanceStore.getInstanceSettingByKey(InstanceSetting_Key.GENERAL)]);
const handleUpdateCustomizedProfileButtonClick = () => {
customizeDialog.open();
};
- const updatePartialSetting = (partial: Partial<WorkspaceSetting_GeneralSetting>) => {
- setWorkspaceGeneralSetting(
- WorkspaceSetting_GeneralSetting.fromPartial({
- ...workspaceGeneralSetting,
+ const updatePartialSetting = (partial: Partial<InstanceSetting_GeneralSetting>) => {
+ setInstanceGeneralSetting(
+ InstanceSetting_GeneralSetting.fromPartial({
+ ...instanceGeneralSetting,
...partial,
}),
);
@@ -45,9 +45,9 @@ const WorkspaceSection = observer(() => {
const handleSaveGeneralSetting = async () => {
try {
- await workspaceStore.upsertWorkspaceSetting({
- name: `${workspaceSettingNamePrefix}${WorkspaceSetting_Key.GENERAL}`,
- generalSetting: workspaceGeneralSetting,
+ await instanceStore.upsertInstanceSetting({
+ name: `${instanceSettingNamePrefix}${InstanceSetting_Key.GENERAL}`,
+ generalSetting: instanceGeneralSetting,
});
} catch (error: any) {
toast.error(error.details);
@@ -72,7 +72,7 @@ const WorkspaceSection = observer(() => {
<div className="w-full flex flex-row justify-between items-center">
<div>
{t("setting.system-section.server-name")}:{" "}
- <span className="font-mono font-bold">{workspaceGeneralSetting.customProfile?.title || "Memos"}</span>
+ <span className="font-mono font-bold">{instanceGeneralSetting.customProfile?.title || "Memos"}</span>
</div>
<Button variant="outline" onClick={handleUpdateCustomizedProfileButtonClick}>
{t("common.edit")}
@@ -83,7 +83,7 @@ const WorkspaceSection = observer(() => {
<div className="w-full flex flex-row justify-between items-center">
<span>Theme</span>
<ThemeSelect
- value={workspaceGeneralSetting.theme || "default"}
+ value={instanceGeneralSetting.theme || "default"}
onValueChange={(value: string) => updatePartialSetting({ theme: value })}
className="min-w-fit"
/>
@@ -95,7 +95,7 @@ const WorkspaceSection = observer(() => {
className="font-mono w-full"
rows={3}
placeholder={t("setting.system-section.additional-style-placeholder")}
- value={workspaceGeneralSetting.additionalStyle}
+ value={instanceGeneralSetting.additionalStyle}
onChange={(event) => updatePartialSetting({ additionalStyle: event.target.value })}
/>
<div className="w-full flex flex-row justify-between items-center">
@@ -105,46 +105,46 @@ const WorkspaceSection = observer(() => {
className="font-mono w-full"
rows={3}
placeholder={t("setting.system-section.additional-script-placeholder")}
- value={workspaceGeneralSetting.additionalScript}
+ value={instanceGeneralSetting.additionalScript}
onChange={(event) => updatePartialSetting({ additionalScript: event.target.value })}
/>
<div className="w-full flex flex-row justify-between items-center">
- <span>{t("setting.workspace-section.disallow-user-registration")}</span>
+ <span>{t("setting.instance-section.disallow-user-registration")}</span>
<Switch
- disabled={workspaceStore.state.profile.mode === "demo"}
- checked={workspaceGeneralSetting.disallowUserRegistration}
+ disabled={instanceStore.state.profile.mode === "demo"}
+ checked={instanceGeneralSetting.disallowUserRegistration}
onCheckedChange={(checked) => updatePartialSetting({ disallowUserRegistration: checked })}
/>
</div>
<div className="w-full flex flex-row justify-between items-center">
- <span>{t("setting.workspace-section.disallow-password-auth")}</span>
+ <span>{t("setting.instance-section.disallow-password-auth")}</span>
<Switch
disabled={
- workspaceStore.state.profile.mode === "demo" ||
- (identityProviderList.length === 0 && !workspaceGeneralSetting.disallowPasswordAuth)
+ instanceStore.state.profile.mode === "demo" ||
+ (identityProviderList.length === 0 && !instanceGeneralSetting.disallowPasswordAuth)
}
- checked={workspaceGeneralSetting.disallowPasswordAuth}
+ checked={instanceGeneralSetting.disallowPasswordAuth}
onCheckedChange={(checked) => updatePartialSetting({ disallowPasswordAuth: checked })}
/>
</div>
<div className="w-full flex flex-row justify-between items-center">
- <span>{t("setting.workspace-section.disallow-change-username")}</span>
+ <span>{t("setting.instance-section.disallow-change-username")}</span>
<Switch
- checked={workspaceGeneralSetting.disallowChangeUsername}
+ checked={instanceGeneralSetting.disallowChangeUsername}
onCheckedChange={(checked) => updatePartialSetting({ disallowChangeUsername: checked })}
/>
</div>
<div className="w-full flex flex-row justify-between items-center">
- <span>{t("setting.workspace-section.disallow-change-nickname")}</span>
+ <span>{t("setting.instance-section.disallow-change-nickname")}</span>
<Switch
- checked={workspaceGeneralSetting.disallowChangeNickname}
+ checked={instanceGeneralSetting.disallowChangeNickname}
onCheckedChange={(checked) => updatePartialSetting({ disallowChangeNickname: checked })}
/>
</div>
<div className="w-full flex flex-row justify-between items-center">
- <span className="truncate">{t("setting.workspace-section.week-start-day")}</span>
+ <span className="truncate">{t("setting.instance-section.week-start-day")}</span>
<Select
- value={workspaceGeneralSetting.weekStartDayOffset.toString()}
+ value={instanceGeneralSetting.weekStartDayOffset.toString()}
onValueChange={(value) => {
updatePartialSetting({ weekStartDayOffset: parseInt(value) || 0 });
}}
@@ -153,14 +153,14 @@ const WorkspaceSection = observer(() => {
<SelectValue />
</SelectTrigger>
<SelectContent>
- <SelectItem value="-1">{t("setting.workspace-section.saturday")}</SelectItem>
- <SelectItem value="0">{t("setting.workspace-section.sunday")}</SelectItem>
- <SelectItem value="1">{t("setting.workspace-section.monday")}</SelectItem>
+ <SelectItem value="-1">{t("setting.instance-section.saturday")}</SelectItem>
+ <SelectItem value="0">{t("setting.instance-section.sunday")}</SelectItem>
+ <SelectItem value="1">{t("setting.instance-section.monday")}</SelectItem>
</SelectContent>
</Select>
</div>
<div className="mt-2 w-full flex justify-end">
- <Button disabled={isEqual(workspaceGeneralSetting, originalSetting)} onClick={handleSaveGeneralSetting}>
+ <Button disabled={isEqual(instanceGeneralSetting, originalSetting)} onClick={handleSaveGeneralSetting}>
{t("common.save")}
</Button>
</div>
@@ -169,7 +169,7 @@ const WorkspaceSection = observer(() => {
open={customizeDialog.isOpen}
onOpenChange={customizeDialog.setOpen}
onSuccess={() => {
- // Refresh workspace settings if needed
+ // Refresh instance settings if needed
toast.success("Profile updated successfully!");
}}
/>
@@ -177,4 +177,4 @@ const WorkspaceSection = observer(() => {
);
});
-export default WorkspaceSection;
+export default InstanceSection;
diff --git a/web/src/components/Settings/MemoRelatedSettings.tsx b/web/src/components/Settings/MemoRelatedSettings.tsx
index 58f9938fc..dbbf68101 100644
--- a/web/src/components/Settings/MemoRelatedSettings.tsx
+++ b/web/src/components/Settings/MemoRelatedSettings.tsx
@@ -7,24 +7,24 @@ import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Switch } from "@/components/ui/switch";
-import { workspaceStore } from "@/store";
-import { workspaceSettingNamePrefix } from "@/store/common";
-import { WorkspaceSetting_MemoRelatedSetting, WorkspaceSetting_Key } from "@/types/proto/api/v1/workspace_service";
+import { instanceStore } from "@/store";
+import { instanceSettingNamePrefix } from "@/store/common";
+import { InstanceSetting_MemoRelatedSetting, InstanceSetting_Key } from "@/types/proto/api/v1/instance_service";
import { useTranslate } from "@/utils/i18n";
const MemoRelatedSettings = observer(() => {
const t = useTranslate();
- const [originalSetting, setOriginalSetting] = useState<WorkspaceSetting_MemoRelatedSetting>(workspaceStore.state.memoRelatedSetting);
- const [memoRelatedSetting, setMemoRelatedSetting] = useState<WorkspaceSetting_MemoRelatedSetting>(originalSetting);
+ const [originalSetting, setOriginalSetting] = useState<InstanceSetting_MemoRelatedSetting>(instanceStore.state.memoRelatedSetting);
+ const [memoRelatedSetting, setMemoRelatedSetting] = useState<InstanceSetting_MemoRelatedSetting>(originalSetting);
const [editingReaction, setEditingReaction] = useState<string>("");
const [editingNsfwTag, setEditingNsfwTag] = useState<string>("");
- const updatePartialSetting = (partial: Partial<WorkspaceSetting_MemoRelatedSetting>) => {
- const newWorkspaceMemoRelatedSetting = WorkspaceSetting_MemoRelatedSetting.fromPartial({
+ const updatePartialSetting = (partial: Partial<InstanceSetting_MemoRelatedSetting>) => {
+ const newInstanceMemoRelatedSetting = InstanceSetting_MemoRelatedSetting.fromPartial({
...memoRelatedSetting,
...partial,
});
- setMemoRelatedSetting(newWorkspaceMemoRelatedSetting);
+ setMemoRelatedSetting(newInstanceMemoRelatedSetting);
};
const upsertReaction = () => {
@@ -52,8 +52,8 @@ const MemoRelatedSettings = observer(() => {
}
try {
- await workspaceStore.upsertWorkspaceSetting({
- name: `${workspaceSettingNamePrefix}${WorkspaceSetting_Key.MEMO_RELATED}`,
+ await instanceStore.upsertInstanceSetting({
+ name: `${instanceSettingNamePrefix}${InstanceSetting_Key.MEMO_RELATED}`,
memoRelatedSetting,
});
setOriginalSetting(memoRelatedSetting);
diff --git a/web/src/components/Settings/PreferencesSection.tsx b/web/src/components/Settings/PreferencesSection.tsx
index 978343e74..5df3f42ad 100644
--- a/web/src/components/Settings/PreferencesSection.tsx
+++ b/web/src/components/Settings/PreferencesSection.tsx
@@ -1,7 +1,7 @@
import { observer } from "mobx-react-lite";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Separator } from "@/components/ui/separator";
-import { userStore, workspaceStore } from "@/store";
+import { userStore, instanceStore } from "@/store";
import { Visibility } from "@/types/proto/api/v1/memo_service";
import { UserSetting_GeneralSetting } from "@/types/proto/api/v1/user_service";
import { useTranslate } from "@/utils/i18n";
@@ -16,8 +16,8 @@ const PreferencesSection = observer(() => {
const generalSetting = userStore.state.userGeneralSetting;
const handleLocaleSelectChange = async (locale: Locale) => {
- // Update workspace store immediately for instant UI feedback
- workspaceStore.state.setPartial({ locale });
+ // Update instance store immediately for instant UI feedback
+ instanceStore.state.setPartial({ locale });
// Persist to user settings
await userStore.updateUserGeneralSetting({ locale }, ["locale"]);
};
diff --git a/web/src/components/Settings/StorageSection.tsx b/web/src/components/Settings/StorageSection.tsx
index 8216cb8b1..5dfa42def 100644
--- a/web/src/components/Settings/StorageSection.tsx
+++ b/web/src/components/Settings/StorageSection.tsx
@@ -9,87 +9,83 @@ import { Label } from "@/components/ui/label";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { Switch } from "@/components/ui/switch";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
-import { workspaceStore } from "@/store";
-import { workspaceSettingNamePrefix } from "@/store/common";
+import { instanceStore } from "@/store";
+import { instanceSettingNamePrefix } from "@/store/common";
import {
- WorkspaceSetting_Key,
- WorkspaceSetting_StorageSetting,
- WorkspaceSetting_StorageSetting_S3Config,
- WorkspaceSetting_StorageSetting_StorageType,
-} from "@/types/proto/api/v1/workspace_service";
+ InstanceSetting_Key,
+ InstanceSetting_StorageSetting,
+ InstanceSetting_StorageSetting_S3Config,
+ InstanceSetting_StorageSetting_StorageType,
+} from "@/types/proto/api/v1/instance_service";
import { useTranslate } from "@/utils/i18n";
const StorageSection = observer(() => {
const t = useTranslate();
- const [workspaceStorageSetting, setWorkspaceStorageSetting] = useState<WorkspaceSetting_StorageSetting>(
- WorkspaceSetting_StorageSetting.fromPartial(
- workspaceStore.getWorkspaceSettingByKey(WorkspaceSetting_Key.STORAGE)?.storageSetting || {},
- ),
+ const [instanceStorageSetting, setInstanceStorageSetting] = useState<InstanceSetting_StorageSetting>(
+ InstanceSetting_StorageSetting.fromPartial(instanceStore.getInstanceSettingByKey(InstanceSetting_Key.STORAGE)?.storageSetting || {}),
);
useEffect(() => {
- setWorkspaceStorageSetting(
- WorkspaceSetting_StorageSetting.fromPartial(
- workspaceStore.getWorkspaceSettingByKey(WorkspaceSetting_Key.STORAGE)?.storageSetting || {},
- ),
+ setInstanceStorageSetting(
+ InstanceSetting_StorageSetting.fromPartial(instanceStore.getInstanceSettingByKey(InstanceSetting_Key.STORAGE)?.storageSetting || {}),
);
- }, [workspaceStore.getWorkspaceSettingByKey(WorkspaceSetting_Key.STORAGE)]);
+ }, [instanceStore.getInstanceSettingByKey(InstanceSetting_Key.STORAGE)]);
const allowSaveStorageSetting = useMemo(() => {
- if (workspaceStorageSetting.uploadSizeLimitMb <= 0) {
+ if (instanceStorageSetting.uploadSizeLimitMb <= 0) {
return false;
}
- const origin = WorkspaceSetting_StorageSetting.fromPartial(
- workspaceStore.getWorkspaceSettingByKey(WorkspaceSetting_Key.STORAGE)?.storageSetting || {},
+ const origin = InstanceSetting_StorageSetting.fromPartial(
+ instanceStore.getInstanceSettingByKey(InstanceSetting_Key.STORAGE)?.storageSetting || {},
);
- if (workspaceStorageSetting.storageType === WorkspaceSetting_StorageSetting_StorageType.LOCAL) {
- if (workspaceStorageSetting.filepathTemplate.length === 0) {
+ if (instanceStorageSetting.storageType === InstanceSetting_StorageSetting_StorageType.LOCAL) {
+ if (instanceStorageSetting.filepathTemplate.length === 0) {
return false;
}
- } else if (workspaceStorageSetting.storageType === WorkspaceSetting_StorageSetting_StorageType.S3) {
+ } else if (instanceStorageSetting.storageType === InstanceSetting_StorageSetting_StorageType.S3) {
if (
- workspaceStorageSetting.s3Config?.accessKeyId.length === 0 ||
- workspaceStorageSetting.s3Config?.accessKeySecret.length === 0 ||
- workspaceStorageSetting.s3Config?.endpoint.length === 0 ||
- workspaceStorageSetting.s3Config?.region.length === 0 ||
- workspaceStorageSetting.s3Config?.bucket.length === 0
+ instanceStorageSetting.s3Config?.accessKeyId.length === 0 ||
+ instanceStorageSetting.s3Config?.accessKeySecret.length === 0 ||
+ instanceStorageSetting.s3Config?.endpoint.length === 0 ||
+ instanceStorageSetting.s3Config?.region.length === 0 ||
+ instanceStorageSetting.s3Config?.bucket.length === 0
) {
return false;
}
}
- return !isEqual(origin, workspaceStorageSetting);
- }, [workspaceStorageSetting, workspaceStore.state]);
+ return !isEqual(origin, instanceStorageSetting);
+ }, [instanceStorageSetting, instanceStore.state]);
const handleMaxUploadSizeChanged = async (event: React.FocusEvent<HTMLInputElement>) => {
let num = parseInt(event.target.value);
if (Number.isNaN(num)) {
num = 0;
}
- const update: WorkspaceSetting_StorageSetting = {
- ...workspaceStorageSetting,
+ const update: InstanceSetting_StorageSetting = {
+ ...instanceStorageSetting,
uploadSizeLimitMb: num,
};
- setWorkspaceStorageSetting(update);
+ setInstanceStorageSetting(update);
};
const handleFilepathTemplateChanged = async (event: React.FocusEvent<HTMLInputElement>) => {
- const update: WorkspaceSetting_StorageSetting = {
- ...workspaceStorageSetting,
+ const update: InstanceSetting_StorageSetting = {
+ ...instanceStorageSetting,
filepathTemplate: event.target.value,
};
- setWorkspaceStorageSetting(update);
+ setInstanceStorageSetting(update);
};
- const handlePartialS3ConfigChanged = async (s3Config: Partial<WorkspaceSetting_StorageSetting_S3Config>) => {
- const update: WorkspaceSetting_StorageSetting = {
- ...workspaceStorageSetting,
- s3Config: WorkspaceSetting_StorageSetting_S3Config.fromPartial({
- ...workspaceStorageSetting.s3Config,
+ const handlePartialS3ConfigChanged = async (s3Config: Partial<InstanceSetting_StorageSetting_S3Config>) => {
+ const update: InstanceSetting_StorageSetting = {
+ ...instanceStorageSetting,
+ s3Config: InstanceSetting_StorageSetting_S3Config.fromPartial({
+ ...instanceStorageSetting.s3Config,
...s3Config,
}),
};
- setWorkspaceStorageSetting(update);
+ setInstanceStorageSetting(update);
};
const handleS3ConfigAccessKeyIdChanged = async (event: React.FocusEvent<HTMLInputElement>) => {
@@ -118,18 +114,18 @@ const StorageSection = observer(() => {
});
};
- const handleStorageTypeChanged = async (storageType: WorkspaceSetting_StorageSetting_StorageType) => {
- const update: WorkspaceSetting_StorageSetting = {
- ...workspaceStorageSetting,
+ const handleStorageTypeChanged = async (storageType: InstanceSetting_StorageSetting_StorageType) => {
+ const update: InstanceSetting_StorageSetting = {
+ ...instanceStorageSetting,
storageType: storageType,
};
- setWorkspaceStorageSetting(update);
+ setInstanceStorageSetting(update);
};
- const saveWorkspaceStorageSetting = async () => {
- await workspaceStore.upsertWorkspaceSetting({
- name: `${workspaceSettingNamePrefix}${WorkspaceSetting_Key.STORAGE}`,
- storageSetting: workspaceStorageSetting,
+ const saveInstanceStorageSetting = async () => {
+ await instanceStore.upsertInstanceSetting({
+ name: `${instanceSettingNamePrefix}${InstanceSetting_Key.STORAGE}`,
+ storageSetting: instanceStorageSetting,
});
toast.success("Updated");
};
@@ -138,22 +134,22 @@ const StorageSection = observer(() => {
<div className="w-full flex flex-col gap-2 pt-2 pb-4">
<div className="font-medium text-muted-foreground">{t("setting.storage-section.current-storage")}</div>
<RadioGroup
- value={workspaceStorageSetting.storageType}
+ value={instanceStorageSetting.storageType}
onValueChange={(value) => {
- handleStorageTypeChanged(value as WorkspaceSetting_StorageSetting_StorageType);
+ handleStorageTypeChanged(value as InstanceSetting_StorageSetting_StorageType);
}}
className="flex flex-row gap-4"
>
<div className="flex items-center space-x-2">
- <RadioGroupItem value={WorkspaceSetting_StorageSetting_StorageType.DATABASE} id="database" />
+ <RadioGroupItem value={InstanceSetting_StorageSetting_StorageType.DATABASE} id="database" />
<Label htmlFor="database">{t("setting.storage-section.type-database")}</Label>
</div>
<div className="flex items-center space-x-2">
- <RadioGroupItem value={WorkspaceSetting_StorageSetting_StorageType.LOCAL} id="local" />
+ <RadioGroupItem value={InstanceSetting_StorageSetting_StorageType.LOCAL} id="local" />
<Label htmlFor="local">{t("setting.storage-section.type-local")}</Label>
</div>
<div className="flex items-center space-x-2">
- <RadioGroupItem value={WorkspaceSetting_StorageSetting_StorageType.S3} id="s3" />
+ <RadioGroupItem value={InstanceSetting_StorageSetting_StorageType.S3} id="s3" />
<Label htmlFor="s3">S3</Label>
</div>
</RadioGroup>
@@ -171,26 +167,26 @@ const StorageSection = observer(() => {
</Tooltip>
</TooltipProvider>
</div>
- <Input className="w-16 font-mono" value={workspaceStorageSetting.uploadSizeLimitMb} onChange={handleMaxUploadSizeChanged} />
+ <Input className="w-16 font-mono" value={instanceStorageSetting.uploadSizeLimitMb} onChange={handleMaxUploadSizeChanged} />
</div>
- {workspaceStorageSetting.storageType !== WorkspaceSetting_StorageSetting_StorageType.DATABASE && (
+ {instanceStorageSetting.storageType !== InstanceSetting_StorageSetting_StorageType.DATABASE && (
<div className="w-full flex flex-row justify-between items-center">
<span className="text-muted-foreground mr-1">{t("setting.storage-section.filepath-template")}</span>
<Input
className="w-64"
- value={workspaceStorageSetting.filepathTemplate}
+ value={instanceStorageSetting.filepathTemplate}
placeholder="assets/{timestamp}_{filename}"
onChange={handleFilepathTemplateChanged}
/>
</div>
)}
- {workspaceStorageSetting.storageType === WorkspaceSetting_StorageSetting_StorageType.S3 && (
+ {instanceStorageSetting.storageType === InstanceSetting_StorageSetting_StorageType.S3 && (
<>
<div className="w-full flex flex-row justify-between items-center">
<span className="text-muted-foreground mr-1">Access key id</span>
<Input
className="w-64"
- value={workspaceStorageSetting.s3Config?.accessKeyId}
+ value={instanceStorageSetting.s3Config?.accessKeyId}
placeholder=""
onChange={handleS3ConfigAccessKeyIdChanged}
/>
@@ -199,7 +195,7 @@ const StorageSection = observer(() => {
<span className="text-muted-foreground mr-1">Access key secret</span>
<Input
className="w-64"
- value={workspaceStorageSetting.s3Config?.accessKeySecret}
+ value={instanceStorageSetting.s3Config?.accessKeySecret}
placeholder=""
onChange={handleS3ConfigAccessKeySecretChanged}
/>
@@ -208,40 +204,30 @@ const StorageSection = observer(() => {
<span className="text-muted-foreground mr-1">Endpoint</span>
<Input
className="w-64"
- value={workspaceStorageSetting.s3Config?.endpoint}
+ value={instanceStorageSetting.s3Config?.endpoint}
placeholder=""
onChange={handleS3ConfigEndpointChanged}
/>
</div>
<div className="w-full flex flex-row justify-between items-center">
<span className="text-muted-foreground mr-1">Region</span>
- <Input
- className="w-64"
- value={workspaceStorageSetting.s3Config?.region}
- placeholder=""
- onChange={handleS3ConfigRegionChanged}
- />
+ <Input className="w-64" value={instanceStorageSetting.s3Config?.region} placeholder="" onChange={handleS3ConfigRegionChanged} />
</div>
<div className="w-full flex flex-row justify-between items-center">
<span className="text-muted-foreground mr-1">Bucket</span>
- <Input
- className="w-64"
- value={workspaceStorageSetting.s3Config?.bucket}
- placeholder=""
- onChange={handleS3ConfigBucketChanged}
- />
+ <Input className="w-64" value={instanceStorageSetting.s3Config?.bucket} placeholder="" onChange={handleS3ConfigBucketChanged} />
</div>
<div className="w-full flex flex-row justify-between items-center">
<span className="text-muted-foreground mr-1">Use Path Style</span>
<Switch
- checked={workspaceStorageSetting.s3Config?.usePathStyle}
+ checked={instanceStorageSetting.s3Config?.usePathStyle}
onCheckedChange={(checked) => handleS3ConfigUsePathStyleChanged({ target: { checked } } as any)}
/>
</div>
</>
)}
<div>
- <Button disabled={!allowSaveStorageSetting} onClick={saveWorkspaceStorageSetting}>
+ <Button disabled={!allowSaveStorageSetting} onClick={saveInstanceStorageSetting}>
{t("common.save")}
</Button>
</div>
diff --git a/web/src/components/ThemeSelect.tsx b/web/src/components/ThemeSelect.tsx
index 3e0a1a4e2..d9f2fd1bc 100644
--- a/web/src/components/ThemeSelect.tsx
+++ b/web/src/components/ThemeSelect.tsx
@@ -1,6 +1,6 @@
import { Moon, Palette, Sun, Wallpaper } from "lucide-react";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
import { THEME_OPTIONS } from "@/utils/theme";
interface ThemeSelectProps {
@@ -17,13 +17,13 @@ const THEME_ICONS: Record<string, JSX.Element> = {
};
const ThemeSelect = ({ value, onValueChange, className }: ThemeSelectProps = {}) => {
- const currentTheme = value || workspaceStore.state.theme || "default";
+ const currentTheme = value || instanceStore.state.theme || "default";
const handleThemeChange = (newTheme: Theme) => {
if (onValueChange) {
onValueChange(newTheme);
} else {
- workspaceStore.setTheme(newTheme);
+ instanceStore.setTheme(newTheme);
}
};
diff --git a/web/src/components/UpdateAccountDialog.tsx b/web/src/components/UpdateAccountDialog.tsx
index d6be49696..dd327c7ee 100644
--- a/web/src/components/UpdateAccountDialog.tsx
+++ b/web/src/components/UpdateAccountDialog.tsx
@@ -9,7 +9,7 @@ import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { convertFileToBase64 } from "@/helpers/utils";
import useCurrentUser from "@/hooks/useCurrentUser";
-import { userStore, workspaceStore } from "@/store";
+import { userStore, instanceStore } from "@/store";
import { User as UserPb } from "@/types/proto/api/v1/user_service";
import { useTranslate } from "@/utils/i18n";
import UserAvatar from "./UserAvatar";
@@ -38,7 +38,7 @@ function UpdateAccountDialog({ open, onOpenChange, onSuccess }: Props) {
email: currentUser.email,
description: currentUser.description,
});
- const workspaceGeneralSetting = workspaceStore.state.generalSetting;
+ const instanceGeneralSetting = instanceStore.state.generalSetting;
const handleCloseBtnClick = () => {
onOpenChange(false);
@@ -179,7 +179,7 @@ function UpdateAccountDialog({ open, onOpenChange, onSuccess }: Props) {
id="username"
value={state.username}
onChange={handleUsernameChanged}
- disabled={workspaceGeneralSetting.disallowChangeUsername}
+ disabled={instanceGeneralSetting.disallowChangeUsername}
/>
</div>
<div className="grid gap-2">
@@ -191,7 +191,7 @@ function UpdateAccountDialog({ open, onOpenChange, onSuccess }: Props) {
id="displayName"
value={state.displayName}
onChange={handleDisplayNameChanged}
- disabled={workspaceGeneralSetting.disallowChangeNickname}
+ disabled={instanceGeneralSetting.disallowChangeNickname}
/>
</div>
<div className="grid gap-2">
diff --git a/web/src/components/UpdateCustomizedProfileDialog.tsx b/web/src/components/UpdateCustomizedProfileDialog.tsx
index 06eff0e19..1275d1b8f 100644
--- a/web/src/components/UpdateCustomizedProfileDialog.tsx
+++ b/web/src/components/UpdateCustomizedProfileDialog.tsx
@@ -5,9 +5,9 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, D
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
-import { workspaceStore } from "@/store";
-import { workspaceSettingNamePrefix } from "@/store/common";
-import { WorkspaceSetting_GeneralSetting_CustomProfile, WorkspaceSetting_Key } from "@/types/proto/api/v1/workspace_service";
+import { instanceStore } from "@/store";
+import { instanceSettingNamePrefix } from "@/store/common";
+import { InstanceSetting_GeneralSetting_CustomProfile, InstanceSetting_Key } from "@/types/proto/api/v1/instance_service";
import { useTranslate } from "@/utils/i18n";
import LocaleSelect from "./LocaleSelect";
import ThemeSelect from "./ThemeSelect";
@@ -20,14 +20,14 @@ interface Props {
function UpdateCustomizedProfileDialog({ open, onOpenChange, onSuccess }: Props) {
const t = useTranslate();
- const workspaceGeneralSetting = workspaceStore.state.generalSetting;
- const [customProfile, setCustomProfile] = useState<WorkspaceSetting_GeneralSetting_CustomProfile>(
- WorkspaceSetting_GeneralSetting_CustomProfile.fromPartial(workspaceGeneralSetting.customProfile || {}),
+ const instanceGeneralSetting = instanceStore.state.generalSetting;
+ const [customProfile, setCustomProfile] = useState<InstanceSetting_GeneralSetting_CustomProfile>(
+ InstanceSetting_GeneralSetting_CustomProfile.fromPartial(instanceGeneralSetting.customProfile || {}),
);
const [isLoading, setIsLoading] = useState(false);
- const setPartialState = (partialState: Partial<WorkspaceSetting_GeneralSetting_CustomProfile>) => {
+ const setPartialState = (partialState: Partial<InstanceSetting_GeneralSetting_CustomProfile>) => {
setCustomProfile((state) => ({
...state,
...partialState,
@@ -79,10 +79,10 @@ function UpdateCustomizedProfileDialog({ open, onOpenChange, onSuccess }: Props)
setIsLoading(true);
try {
- await workspaceStore.upsertWorkspaceSetting({
- name: `${workspaceSettingNamePrefix}${WorkspaceSetting_Key.GENERAL}`,
+ await instanceStore.upsertInstanceSetting({
+ name: `${instanceSettingNamePrefix}${InstanceSetting_Key.GENERAL}`,
generalSetting: {
- ...workspaceGeneralSetting,
+ ...instanceGeneralSetting,
customProfile: customProfile,
},
});
@@ -102,7 +102,7 @@ function UpdateCustomizedProfileDialog({ open, onOpenChange, onSuccess }: Props)
<DialogContent className="max-w-2xl">
<DialogHeader>
<DialogTitle>{t("setting.system-section.customize-server.title")}</DialogTitle>
- <DialogDescription>Customize your workspace appearance and settings.</DialogDescription>
+ <DialogDescription>Customize your instance appearance and settings.</DialogDescription>
</DialogHeader>
<div className="grid gap-4">
diff --git a/web/src/components/UserMenu.tsx b/web/src/components/UserMenu.tsx
index 36d217569..1fddcbb34 100644
--- a/web/src/components/UserMenu.tsx
+++ b/web/src/components/UserMenu.tsx
@@ -6,7 +6,7 @@ import useNavigateTo from "@/hooks/useNavigateTo";
import { locales } from "@/i18n";
import { cn } from "@/lib/utils";
import { Routes } from "@/router";
-import { userStore, workspaceStore } from "@/store";
+import { userStore, instanceStore } from "@/store";
import { getLocaleDisplayName, useTranslate } from "@/utils/i18n";
import { THEME_OPTIONS } from "@/utils/theme";
import UserAvatar from "./UserAvatar";
@@ -34,8 +34,8 @@ const UserMenu = observer((props: Props) => {
const currentTheme = generalSetting?.theme || "default";
const handleLocaleChange = async (locale: Locale) => {
- // Update workspace store immediately for instant UI feedback
- workspaceStore.state.setPartial({ locale });
+ // Update instance store immediately for instant UI feedback
+ instanceStore.state.setPartial({ locale });
// Persist to user settings
await userStore.updateUserGeneralSetting({ locale }, ["locale"]);
};
diff --git a/web/src/grpcweb.ts b/web/src/grpcweb.ts
index 507b735ad..1457848b3 100644
--- a/web/src/grpcweb.ts
+++ b/web/src/grpcweb.ts
@@ -3,10 +3,10 @@ import { ActivityServiceDefinition } from "./types/proto/api/v1/activity_service
import { AttachmentServiceDefinition } from "./types/proto/api/v1/attachment_service";
import { AuthServiceDefinition } from "./types/proto/api/v1/auth_service";
import { IdentityProviderServiceDefinition } from "./types/proto/api/v1/idp_service";
+import { InstanceServiceDefinition } from "./types/proto/api/v1/instance_service";
import { MemoServiceDefinition } from "./types/proto/api/v1/memo_service";
import { ShortcutServiceDefinition } from "./types/proto/api/v1/shortcut_service";
import { UserServiceDefinition } from "./types/proto/api/v1/user_service";
-import { WorkspaceServiceDefinition } from "./types/proto/api/v1/workspace_service";
const channel = createChannel(
window.location.origin,
@@ -17,7 +17,7 @@ const channel = createChannel(
const clientFactory = createClientFactory();
-export const workspaceServiceClient = clientFactory.create(WorkspaceServiceDefinition, channel);
+export const instanceServiceClient = clientFactory.create(InstanceServiceDefinition, channel);
export const authServiceClient = clientFactory.create(AuthServiceDefinition, channel);
diff --git a/web/src/hooks/useMemoFilters.ts b/web/src/hooks/useMemoFilters.ts
index e3cd4e51e..08ca6920b 100644
--- a/web/src/hooks/useMemoFilters.ts
+++ b/web/src/hooks/useMemoFilters.ts
@@ -1,9 +1,9 @@
import { useMemo } from "react";
-import { userStore, workspaceStore } from "@/store";
+import { userStore, instanceStore } from "@/store";
import { extractUserIdFromName } from "@/store/common";
import memoFilterStore from "@/store/memoFilter";
+import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service";
import { Visibility } from "@/types/proto/api/v1/memo_service";
-import { WorkspaceSetting_Key } from "@/types/proto/api/v1/workspace_service";
// Helper function to extract shortcut ID from resource name
// Format: users/{user}/shortcuts/{shortcut}
@@ -121,8 +121,8 @@ export const useMemoFilters = (options: UseMemoFiltersOptions = {}): string | un
} else if (filter.factor === "property.hasCode") {
conditions.push(`has_code`);
} else if (filter.factor === "displayTime") {
- // Check workspace setting for display time factor
- const displayWithUpdateTime = workspaceStore.getWorkspaceSettingByKey(WorkspaceSetting_Key.MEMO_RELATED).memoRelatedSetting
+ // Check instance setting for display time factor
+ const displayWithUpdateTime = instanceStore.getInstanceSettingByKey(InstanceSetting_Key.MEMO_RELATED).memoRelatedSetting
?.displayWithUpdateTime;
const factor = displayWithUpdateTime ? "updated_ts" : "created_ts";
diff --git a/web/src/layouts/RootLayout.tsx b/web/src/layouts/RootLayout.tsx
index 02a65f0a2..7c3181f90 100644
--- a/web/src/layouts/RootLayout.tsx
+++ b/web/src/layouts/RootLayout.tsx
@@ -8,7 +8,7 @@ import useResponsiveWidth from "@/hooks/useResponsiveWidth";
import { cn } from "@/lib/utils";
import Loading from "@/pages/Loading";
import { Routes } from "@/router";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
import memoFilterStore from "@/store/memoFilter";
const RootLayout = observer(() => {
@@ -23,7 +23,7 @@ const RootLayout = observer(() => {
useEffect(() => {
if (!currentUser) {
// If disallowPublicVisibility is enabled, redirect to the login page if the user is not logged in.
- if (workspaceStore.state.memoRelatedSetting.disallowPublicVisibility) {
+ if (instanceStore.state.memoRelatedSetting.disallowPublicVisibility) {
window.location.href = Routes.AUTH;
return;
} else if (
diff --git a/web/src/locales/ar.json b/web/src/locales/ar.json
index 117dcab69..cc4fabf0f 100644
--- a/web/src/locales/ar.json
+++ b/web/src/locales/ar.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "الرابط"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "عدم السماح بتغيير الاسم المستعار",
"disallow-change-username": "عدم السماح بتغيير اسم المستخدم",
"disallow-password-auth": "عدم السماح بالمصادقة بكلمة المرور",
diff --git a/web/src/locales/ca.json b/web/src/locales/ca.json
index c2f6dc3d7..5486eea39 100644
--- a/web/src/locales/ca.json
+++ b/web/src/locales/ca.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "No permetis canviar el sobrenom",
"disallow-change-username": "No permetis canviar el nom d'usuari",
"disallow-password-auth": "No permetis autenticació per contrasenya",
diff --git a/web/src/locales/cs.json b/web/src/locales/cs.json
index d5d1064a7..9fdf63a99 100644
--- a/web/src/locales/cs.json
+++ b/web/src/locales/cs.json
@@ -393,7 +393,7 @@
"title": "Webhooky",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Zakázat změnu přezdívky",
"disallow-change-username": "Zakázat změnu uživatelského jména",
"disallow-password-auth": "Zakázat ověřování heslem",
diff --git a/web/src/locales/de.json b/web/src/locales/de.json
index d88633611..5438a285e 100644
--- a/web/src/locales/de.json
+++ b/web/src/locales/de.json
@@ -395,7 +395,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Ändern des Spitznamens verbieten",
"disallow-change-username": "Ändern des Benutzernamens verbieten",
"disallow-password-auth": "Passwort-Authentifizierung verbieten",
diff --git a/web/src/locales/en.json b/web/src/locales/en.json
index 17c0ec1ef..6ac8899ba 100644
--- a/web/src/locales/en.json
+++ b/web/src/locales/en.json
@@ -441,7 +441,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Disallow changing nickname",
"disallow-change-username": "Disallow changing username",
"disallow-password-auth": "Disallow password auth",
diff --git a/web/src/locales/es.json b/web/src/locales/es.json
index f06c17b94..2bb2b6c3f 100644
--- a/web/src/locales/es.json
+++ b/web/src/locales/es.json
@@ -406,7 +406,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "No permitir cambiar apodo",
"disallow-change-username": "No permitir cambiar nombre de usuario",
"disallow-password-auth": "No permitir autenticación por contraseña",
diff --git a/web/src/locales/fa.json b/web/src/locales/fa.json
index e0fe9948f..caa4d8e16 100644
--- a/web/src/locales/fa.json
+++ b/web/src/locales/fa.json
@@ -385,7 +385,7 @@
"title": "وب‌هوک‌ها",
"url": "آدرس"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "غیرفعال‌سازی تغییر نام مستعار",
"disallow-change-username": "غیرفعال‌سازی تغییر نام کاربری",
"disallow-password-auth": "غیرفعال‌سازی احراز هویت با گذرواژه",
diff --git a/web/src/locales/fr.json b/web/src/locales/fr.json
index 72993477b..e0f105ab5 100644
--- a/web/src/locales/fr.json
+++ b/web/src/locales/fr.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Interdire le changement de surnom",
"disallow-change-username": "Interdire le changement de nom d'utilisateur",
"disallow-password-auth": "Interdire l'authentification par mot de passe",
diff --git a/web/src/locales/hi.json b/web/src/locales/hi.json
index 081cde76a..b5e0bac00 100644
--- a/web/src/locales/hi.json
+++ b/web/src/locales/hi.json
@@ -411,7 +411,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "उपनाम बदलने की अनुमति न दें",
"disallow-change-username": "उपयोगकर्ता नाम बदलने की अनुमति न दें",
"disallow-password-auth": "पासवर्ड प्रमाणीकरण की अनुमति न दें",
diff --git a/web/src/locales/hr.json b/web/src/locales/hr.json
index d815b943c..39d602e68 100644
--- a/web/src/locales/hr.json
+++ b/web/src/locales/hr.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Onemogući promjenu nadimka",
"disallow-change-username": "Onemogući promjenu korisničkog imena",
"disallow-password-auth": "Onemogući autentikaciju lozinkom",
diff --git a/web/src/locales/hu.json b/web/src/locales/hu.json
index 6c0562cab..cf3d97651 100644
--- a/web/src/locales/hu.json
+++ b/web/src/locales/hu.json
@@ -409,7 +409,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Becenév módosításának tiltása",
"disallow-change-username": "Felhasználónév módosításának tiltása",
"disallow-password-auth": "Jelszavas hitelesítés tiltása",
diff --git a/web/src/locales/id.json b/web/src/locales/id.json
index fecc1f0fd..c7acb0d0e 100644
--- a/web/src/locales/id.json
+++ b/web/src/locales/id.json
@@ -410,7 +410,7 @@
"title": "Webhook",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Larangan mengubah nama panggilan",
"disallow-change-username": "Larangan mengubah nama pengguna",
"disallow-password-auth": "Larangan autentikasi kata sandi",
diff --git a/web/src/locales/it.json b/web/src/locales/it.json
index 18ab19be5..2402a2e7d 100644
--- a/web/src/locales/it.json
+++ b/web/src/locales/it.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Non consentire cambio nickname",
"disallow-change-username": "Non consentire cambio nome utente",
"disallow-password-auth": "Non consentire autenticazione password",
diff --git a/web/src/locales/ja.json b/web/src/locales/ja.json
index 605dbb0d7..efde35211 100644
--- a/web/src/locales/ja.json
+++ b/web/src/locales/ja.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "ニックネーム変更を禁止",
"disallow-change-username": "ユーザー名変更を禁止",
"disallow-password-auth": "パスワード認証を禁止",
diff --git a/web/src/locales/ka-GE.json b/web/src/locales/ka-GE.json
index 8fcc672b6..ce8dfdc14 100644
--- a/web/src/locales/ka-GE.json
+++ b/web/src/locales/ka-GE.json
@@ -410,7 +410,7 @@
"title": "Webhook-ები",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "მეტსახელის შეცვლის აკრძალვა",
"disallow-change-username": "მომხმარებლის სახელის შეცვლის აკრძალვა",
"disallow-password-auth": "პაროლით ავთენტიკაციის აკრძალვა",
diff --git a/web/src/locales/ko.json b/web/src/locales/ko.json
index e7696460d..20552ea06 100644
--- a/web/src/locales/ko.json
+++ b/web/src/locales/ko.json
@@ -410,7 +410,7 @@
"title": "Webhook",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "닉네임 변경 금지",
"disallow-change-username": "유저네임 변경 금지",
"disallow-password-auth": "비밀번호 인증 금지",
diff --git a/web/src/locales/mr.json b/web/src/locales/mr.json
index 30e9d7e7a..eb4cbd048 100644
--- a/web/src/locales/mr.json
+++ b/web/src/locales/mr.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "टोपणनाव बदलण्यास मनाई करा",
"disallow-change-username": "वापरकर्तानाव बदलण्यास मनाई करा",
"disallow-password-auth": "पासवर्ड प्रमाणीकरणास मनाई करा",
diff --git a/web/src/locales/nb.json b/web/src/locales/nb.json
index 74fcf5478..f77c7f09f 100644
--- a/web/src/locales/nb.json
+++ b/web/src/locales/nb.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Ikke tillat endring av kallenavn",
"disallow-change-username": "Ikke tillat endring av brukernavn",
"disallow-password-auth": "Ikke tillat autentisering med passord",
diff --git a/web/src/locales/nl.json b/web/src/locales/nl.json
index 3938501c9..b72ebe702 100644
--- a/web/src/locales/nl.json
+++ b/web/src/locales/nl.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Wijzigen van bijnaam niet toestaan",
"disallow-change-username": "Wijzigen van gebruikersnaam niet toestaan",
"disallow-password-auth": "Wachtwoordauthenticatie niet toestaan",
diff --git a/web/src/locales/pl.json b/web/src/locales/pl.json
index 931d5fd94..1a381d293 100644
--- a/web/src/locales/pl.json
+++ b/web/src/locales/pl.json
@@ -410,7 +410,7 @@
"title": "Webhooki",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Zabroń zmiany pseudonimu",
"disallow-change-username": "Zabroń zmiany nazwy użytkownika",
"disallow-password-auth": "Zabroń uwierzytelniania hasłem",
diff --git a/web/src/locales/pt-BR.json b/web/src/locales/pt-BR.json
index 5194f65e8..dd7126e11 100644
--- a/web/src/locales/pt-BR.json
+++ b/web/src/locales/pt-BR.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Impedir troca de apelido",
"disallow-change-username": "Impedir troca de nome de usuário",
"disallow-password-auth": "Impedir autenticação por senha",
diff --git a/web/src/locales/pt-PT.json b/web/src/locales/pt-PT.json
index ca597b69e..fab7676e4 100644
--- a/web/src/locales/pt-PT.json
+++ b/web/src/locales/pt-PT.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Desativar alteração de apelido",
"disallow-change-username": "Desativar alteração de nome de utilizador",
"disallow-password-auth": "Desativar autenticação por palavra-passe",
diff --git a/web/src/locales/ru.json b/web/src/locales/ru.json
index 7c6ad7d60..1fc11073c 100644
--- a/web/src/locales/ru.json
+++ b/web/src/locales/ru.json
@@ -376,7 +376,7 @@
"title": "Вебхуки",
"url": "Ссылка"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Запретить смену псевдонима",
"disallow-change-username": "Запретить смену имени пользователя",
"disallow-password-auth": "Запретить вход по паролю",
diff --git a/web/src/locales/sl.json b/web/src/locales/sl.json
index 7a39660e7..8dbfcb42f 100644
--- a/web/src/locales/sl.json
+++ b/web/src/locales/sl.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Onemogoči spremembo vzdevka",
"disallow-change-username": "Onemogoči spremembo uporabniškega imena",
"disallow-password-auth": "Onemogoči preverjanje gesla",
diff --git a/web/src/locales/sv.json b/web/src/locales/sv.json
index 18995f948..895ff7c5e 100644
--- a/web/src/locales/sv.json
+++ b/web/src/locales/sv.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Förbjud ändring av smeknamn",
"disallow-change-username": "Förbjud ändring av användarnamn",
"disallow-password-auth": "Förbjud lösenordsautentisering",
diff --git a/web/src/locales/th.json b/web/src/locales/th.json
index f1ea161e0..c9d4cff6b 100644
--- a/web/src/locales/th.json
+++ b/web/src/locales/th.json
@@ -410,7 +410,7 @@
"title": "Webhooks",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "ไม่อนุญาตให้เปลี่ยนชื่อเล่น",
"disallow-change-username": "ไม่อนุญาตให้เปลี่ยนชื่อผู้ใช้",
"disallow-password-auth": "ไม่อนุญาตให้ยืนยันตัวตนด้วยรหัสผ่าน",
diff --git a/web/src/locales/tr.json b/web/src/locales/tr.json
index 38bf21a75..2d8c0f407 100644
--- a/web/src/locales/tr.json
+++ b/web/src/locales/tr.json
@@ -410,7 +410,7 @@
"title": "Webhook'lar",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Takma ad değiştirmeyi yasakla",
"disallow-change-username": "Kullanıcı adı değiştirmeyi yasakla",
"disallow-password-auth": "Şifre ile kimlik doğrulamayı yasakla",
diff --git a/web/src/locales/uk.json b/web/src/locales/uk.json
index 6b357d901..f2fc4ef30 100644
--- a/web/src/locales/uk.json
+++ b/web/src/locales/uk.json
@@ -410,7 +410,7 @@
"title": "Вебхуки",
"url": "URL"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Заборонити зміну нікнейму",
"disallow-change-username": "Заборонити зміну імені користувача",
"disallow-password-auth": "Заборонити авторизацію за паролем",
diff --git a/web/src/locales/vi.json b/web/src/locales/vi.json
index 6dd4d374a..83da23cd9 100644
--- a/web/src/locales/vi.json
+++ b/web/src/locales/vi.json
@@ -324,7 +324,7 @@
"title": "Webhook",
"url": "Url"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "Không cho phép đổi biệt danh",
"disallow-change-username": "Không cho phép đổi tên người dùng",
"disallow-password-auth": "Không cho phép xác thực bằng mật khẩu",
diff --git a/web/src/locales/zh-Hans.json b/web/src/locales/zh-Hans.json
index c8da7eaf9..d6d89f15d 100644
--- a/web/src/locales/zh-Hans.json
+++ b/web/src/locales/zh-Hans.json
@@ -406,7 +406,7 @@
},
"no-webhooks-found": "没有 webhooks。"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "禁止修改用户昵称",
"disallow-change-username": "禁止修改用户名",
"disallow-password-auth": "禁用密码登录",
diff --git a/web/src/locales/zh-Hant.json b/web/src/locales/zh-Hant.json
index 905e14410..6ac5441e7 100644
--- a/web/src/locales/zh-Hant.json
+++ b/web/src/locales/zh-Hant.json
@@ -435,7 +435,7 @@
"title": "Webhook",
"url": "網址"
},
- "workspace-section": {
+ "instance-section": {
"disallow-change-nickname": "禁止變更暱稱",
"disallow-change-username": "禁止變更使用者名稱",
"disallow-password-auth": "禁止使用密碼登入",
diff --git a/web/src/main.tsx b/web/src/main.tsx
index c1f9b3e4b..cd747a044 100644
--- a/web/src/main.tsx
+++ b/web/src/main.tsx
@@ -8,8 +8,8 @@ import "./index.css";
import router from "./router";
// Configure MobX before importing any stores
import "./store/config";
+import { initialInstanceStore } from "./store/instance";
import { initialUserStore } from "./store/user";
-import { initialWorkspaceStore } from "./store/workspace";
import { applyThemeEarly } from "./utils/theme";
import "leaflet/dist/leaflet.css";
@@ -24,7 +24,7 @@ const Main = observer(() => (
));
(async () => {
- await initialWorkspaceStore();
+ await initialInstanceStore();
await initialUserStore();
const container = document.getElementById("root");
diff --git a/web/src/pages/AdminSignIn.tsx b/web/src/pages/AdminSignIn.tsx
index 5a81ef54a..e8cd339f1 100644
--- a/web/src/pages/AdminSignIn.tsx
+++ b/web/src/pages/AdminSignIn.tsx
@@ -1,17 +1,17 @@
import { observer } from "mobx-react-lite";
import AuthFooter from "@/components/AuthFooter";
import PasswordSignInForm from "@/components/PasswordSignInForm";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
const AdminSignIn = observer(() => {
- const workspaceGeneralSetting = workspaceStore.state.generalSetting;
+ const instanceGeneralSetting = instanceStore.state.generalSetting;
return (
<div className="py-4 sm:py-8 w-80 max-w-full min-h-svh mx-auto flex flex-col justify-start items-center">
<div className="w-full py-4 grow flex flex-col justify-center items-center">
<div className="w-full flex flex-row justify-center items-center mb-6">
- <img className="h-14 w-auto rounded-full shadow" src={workspaceGeneralSetting.customProfile?.logoUrl || "/logo.webp"} alt="" />
- <p className="ml-2 text-5xl text-foreground opacity-80">{workspaceGeneralSetting.customProfile?.title || "Memos"}</p>
+ <img className="h-14 w-auto rounded-full shadow" src={instanceGeneralSetting.customProfile?.logoUrl || "/logo.webp"} alt="" />
+ <p className="ml-2 text-5xl text-foreground opacity-80">{instanceGeneralSetting.customProfile?.title || "Memos"}</p>
</div>
<p className="w-full text-xl font-medium text-muted-foreground">Sign in with admin accounts</p>
<PasswordSignInForm />
diff --git a/web/src/pages/Setting.tsx b/web/src/pages/Setting.tsx
index 01bc62e74..f71f1d01a 100644
--- a/web/src/pages/Setting.tsx
+++ b/web/src/pages/Setting.tsx
@@ -3,6 +3,7 @@ import { observer } from "mobx-react-lite";
import { useCallback, useEffect, useMemo, useState } from "react";
import { useLocation } from "react-router-dom";
import MobileHeader from "@/components/MobileHeader";
+import InstanceSection from "@/components/Settings/InstanceSection";
import MemberSection from "@/components/Settings/MemberSection";
import MemoRelatedSettings from "@/components/Settings/MemoRelatedSettings";
import MyAccountSection from "@/components/Settings/MyAccountSection";
@@ -10,13 +11,12 @@ import PreferencesSection from "@/components/Settings/PreferencesSection";
import SSOSection from "@/components/Settings/SSOSection";
import SectionMenuItem from "@/components/Settings/SectionMenuItem";
import StorageSection from "@/components/Settings/StorageSection";
-import WorkspaceSection from "@/components/Settings/WorkspaceSection";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import useCurrentUser from "@/hooks/useCurrentUser";
import useResponsiveWidth from "@/hooks/useResponsiveWidth";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
+import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service";
import { User_Role } from "@/types/proto/api/v1/user_service";
-import { WorkspaceSetting_Key } from "@/types/proto/api/v1/workspace_service";
import { useTranslate } from "@/utils/i18n";
type SettingSection = "my-account" | "preference" | "member" | "system" | "memo-related" | "storage" | "sso";
@@ -71,10 +71,10 @@ const Setting = observer(() => {
return;
}
- // Initial fetch for workspace settings.
+ // Initial fetch for instance settings.
(async () => {
- [WorkspaceSetting_Key.MEMO_RELATED, WorkspaceSetting_Key.STORAGE].forEach(async (key) => {
- await workspaceStore.fetchWorkspaceSetting(key);
+ [InstanceSetting_Key.MEMO_RELATED, InstanceSetting_Key.STORAGE].forEach(async (key) => {
+ await instanceStore.fetchInstanceSetting(key);
});
})();
}, [isHost]);
@@ -115,7 +115,7 @@ const Setting = observer(() => {
/>
))}
<span className="px-3 mt-2 opacity-70 text-sm">
- {t("setting.version")}: v{workspaceStore.state.profile.version}
+ {t("setting.version")}: v{instanceStore.state.profile.version}
</span>
</div>
</>
@@ -143,7 +143,7 @@ const Setting = observer(() => {
) : state.selectedSection === "member" ? (
<MemberSection />
) : state.selectedSection === "system" ? (
- <WorkspaceSection />
+ <InstanceSection />
) : state.selectedSection === "memo-related" ? (
<MemoRelatedSettings />
) : state.selectedSection === "storage" ? (
diff --git a/web/src/pages/SignIn.tsx b/web/src/pages/SignIn.tsx
index aa369f9cf..cd44a95e4 100644
--- a/web/src/pages/SignIn.tsx
+++ b/web/src/pages/SignIn.tsx
@@ -10,7 +10,7 @@ import { identityProviderServiceClient } from "@/grpcweb";
import { absolutifyLink } from "@/helpers/utils";
import useCurrentUser from "@/hooks/useCurrentUser";
import { Routes } from "@/router";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
import { extractIdentityProviderIdFromName } from "@/store/common";
import { IdentityProvider, IdentityProvider_Type } from "@/types/proto/api/v1/idp_service";
import { useTranslate } from "@/utils/i18n";
@@ -20,7 +20,7 @@ const SignIn = observer(() => {
const t = useTranslate();
const currentUser = useCurrentUser();
const [identityProviderList, setIdentityProviderList] = useState<IdentityProvider[]>([]);
- const workspaceGeneralSetting = workspaceStore.state.generalSetting;
+ const instanceGeneralSetting = instanceStore.state.generalSetting;
// Redirect to root page if already signed in.
useEffect(() => {
@@ -71,15 +71,15 @@ const SignIn = observer(() => {
<div className="py-4 sm:py-8 w-80 max-w-full min-h-svh mx-auto flex flex-col justify-start items-center">
<div className="w-full py-4 grow flex flex-col justify-center items-center">
<div className="w-full flex flex-row justify-center items-center mb-6">
- <img className="h-14 w-auto rounded-full shadow" src={workspaceGeneralSetting.customProfile?.logoUrl || "/logo.webp"} alt="" />
- <p className="ml-2 text-5xl text-foreground opacity-80">{workspaceGeneralSetting.customProfile?.title || "Memos"}</p>
+ <img className="h-14 w-auto rounded-full shadow" src={instanceGeneralSetting.customProfile?.logoUrl || "/logo.webp"} alt="" />
+ <p className="ml-2 text-5xl text-foreground opacity-80">{instanceGeneralSetting.customProfile?.title || "Memos"}</p>
</div>
- {!workspaceGeneralSetting.disallowPasswordAuth ? (
+ {!instanceGeneralSetting.disallowPasswordAuth ? (
<PasswordSignInForm />
) : (
identityProviderList.length == 0 && <p className="w-full text-2xl mt-2 text-muted-foreground">Password auth is not allowed.</p>
)}
- {!workspaceGeneralSetting.disallowUserRegistration && !workspaceGeneralSetting.disallowPasswordAuth && (
+ {!instanceGeneralSetting.disallowUserRegistration && !instanceGeneralSetting.disallowPasswordAuth && (
<p className="w-full mt-4 text-sm">
<span className="text-muted-foreground">{t("auth.sign-up-tip")}</span>
<Link to="/auth/signup" className="cursor-pointer ml-2 text-primary hover:underline" viewTransition>
@@ -89,7 +89,7 @@ const SignIn = observer(() => {
)}
{identityProviderList.length > 0 && (
<>
- {!workspaceGeneralSetting.disallowPasswordAuth && (
+ {!instanceGeneralSetting.disallowPasswordAuth && (
<div className="relative my-4 w-full">
<Separator />
<div className="absolute inset-0 flex items-center justify-center">
diff --git a/web/src/pages/SignUp.tsx b/web/src/pages/SignUp.tsx
index 183147150..93647af9b 100644
--- a/web/src/pages/SignUp.tsx
+++ b/web/src/pages/SignUp.tsx
@@ -10,7 +10,7 @@ import { Input } from "@/components/ui/input";
import { authServiceClient, userServiceClient } from "@/grpcweb";
import useLoading from "@/hooks/useLoading";
import useNavigateTo from "@/hooks/useNavigateTo";
-import { workspaceStore } from "@/store";
+import { instanceStore } from "@/store";
import { initialUserStore } from "@/store/user";
import { User, User_Role } from "@/types/proto/api/v1/user_service";
import { useTranslate } from "@/utils/i18n";
@@ -21,7 +21,7 @@ const SignUp = observer(() => {
const actionBtnLoadingState = useLoading(false);
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
- const workspaceGeneralSetting = workspaceStore.state.generalSetting;
+ const instanceGeneralSetting = instanceStore.state.generalSetting;
const handleUsernameInputChanged = (e: React.ChangeEvent<HTMLInputElement>) => {
const text = e.target.value as string;
@@ -71,10 +71,10 @@ const SignUp = observer(() => {
<div className="py-4 sm:py-8 w-80 max-w-full min-h-svh mx-auto flex flex-col justify-start items-center">
<div className="w-full py-4 grow flex flex-col justify-center items-center">
<div className="w-full flex flex-row justify-center items-center mb-6">
- <img className="h-14 w-auto rounded-full shadow" src={workspaceGeneralSetting.customProfile?.logoUrl || "/logo.webp"} alt="" />
- <p className="ml-2 text-5xl text-foreground opacity-80">{workspaceGeneralSetting.customProfile?.title || "Memos"}</p>
+ <img className="h-14 w-auto rounded-full shadow" src={instanceGeneralSetting.customProfile?.logoUrl || "/logo.webp"} alt="" />
+ <p className="ml-2 text-5xl text-foreground opacity-80">{instanceGeneralSetting.customProfile?.title || "Memos"}</p>
</div>
- {!workspaceGeneralSetting.disallowUserRegistration ? (
+ {!instanceGeneralSetting.disallowUserRegistration ? (
<>
<p className="w-full text-2xl mt-2 text-muted-foreground">{t("auth.create-your-account")}</p>
<form className="w-full mt-2" onSubmit={handleFormSubmit}>
@@ -121,7 +121,7 @@ const SignUp = observer(() => {
) : (
<p className="w-full text-2xl mt-2 text-muted-foreground">Sign up is not allowed.</p>
)}
- {!workspaceStore.state.profile.owner ? (
+ {!instanceStore.state.profile.owner ? (
<p className="w-full mt-4 text-sm font-medium text-muted-foreground">{t("auth.host-tip")}</p>
) : (
<p className="w-full mt-4 text-sm">
diff --git a/web/src/store/README.md b/web/src/store/README.md
index 498740b72..c3b3d09e4 100644
--- a/web/src/store/README.md
+++ b/web/src/store/README.md
@@ -17,7 +17,7 @@ The store architecture follows a clear separation of concerns:
|-------|------|---------|
| `memoStore` | `memo.ts` | Memo CRUD operations, optimistic updates |
| `userStore` | `user.ts` | User authentication, settings, stats |
-| `workspaceStore` | `workspace.ts` | Workspace profile and settings |
+| `instanceStore` | `instance.ts` | Instance profile and settings |
| `attachmentStore` | `attachment.ts` | File attachment management |
**Features:**
diff --git a/web/src/store/common.ts b/web/src/store/common.ts
index 9d908908f..d82ba3b39 100644
--- a/web/src/store/common.ts
+++ b/web/src/store/common.ts
@@ -1,4 +1,4 @@
-export const workspaceSettingNamePrefix = "workspace/settings/";
+export const instanceSettingNamePrefix = "instance/settings/";
export const userNamePrefix = "users/";
export const memoNamePrefix = "memos/";
export const identityProviderNamePrefix = "identity-providers/";
diff --git a/web/src/store/index.ts b/web/src/store/index.ts
index 9cbfd0248..433a0ab14 100644
--- a/web/src/store/index.ts
+++ b/web/src/store/index.ts
@@ -11,7 +11,7 @@
* These stores fetch and cache data from the backend API:
* - **memoStore**: Memo CRUD operations
* - **userStore**: User authentication and settings
- * - **workspaceStore**: Workspace configuration
+ * - **instanceStore**: Instance configuration
* - **attachmentStore**: File attachment management
*
* Features:
@@ -46,12 +46,12 @@
*/
// Server State Stores
import attachmentStore from "./attachment";
+import instanceStore from "./instance";
import memoStore from "./memo";
// Client State Stores
import memoFilterStore from "./memoFilter";
import userStore from "./user";
import viewStore from "./view";
-import workspaceStore from "./workspace";
// Utilities and Types
export { StoreError, RequestDeduplicator, createRequestKey } from "./store-utils";
@@ -65,13 +65,13 @@ export { getMemoFilterKey, parseFilterQuery, stringifyFilters } from "./memoFilt
// Re-export view types
export type { LayoutMode } from "./view";
-// Re-export workspace types
-export type { Theme } from "./workspace";
-export { isValidTheme } from "./workspace";
+// Re-export instance types
+export type { Theme } from "./instance";
+export { isValidTheme } from "./instance";
// Re-export common utilities
export {
- workspaceSettingNamePrefix,
+ instanceSettingNamePrefix,
userNamePrefix,
memoNamePrefix,
identityProviderNamePrefix,
@@ -86,7 +86,7 @@ export {
// Server state stores
memoStore,
userStore,
- workspaceStore,
+ instanceStore,
attachmentStore,
// Client state stores
@@ -102,7 +102,7 @@ export const stores = {
server: {
memo: memoStore,
user: userStore,
- workspace: workspaceStore,
+ instance: instanceStore,
attachment: attachmentStore,
},
diff --git a/web/src/store/instance.ts b/web/src/store/instance.ts
new file mode 100644
index 000000000..b02a8ae4a
--- /dev/null
+++ b/web/src/store/instance.ts
@@ -0,0 +1,265 @@
+/**
+ * Instance Store
+ *
+ * Manages instance-level configuration and settings.
+ * This is a server state store that fetches instance profile and settings.
+ */
+import { uniqBy } from "lodash-es";
+import { computed } from "mobx";
+import { instanceServiceClient } from "@/grpcweb";
+import { InstanceProfile, InstanceSetting_Key } from "@/types/proto/api/v1/instance_service";
+import { InstanceSetting_GeneralSetting, InstanceSetting_MemoRelatedSetting, InstanceSetting } from "@/types/proto/api/v1/instance_service";
+import { isValidateLocale } from "@/utils/i18n";
+import { StandardState, createServerStore } from "./base-store";
+import { instanceSettingNamePrefix } from "./common";
+import { createRequestKey } from "./store-utils";
+
+/**
+ * Valid theme options
+ */
+const VALID_THEMES = ["default", "default-dark", "paper", "whitewall"] as const;
+export type Theme = (typeof VALID_THEMES)[number];
+
+/**
+ * Check if a string is a valid theme
+ */
+export function isValidTheme(theme: string): theme is Theme {
+ return VALID_THEMES.includes(theme as Theme);
+}
+
+/**
+ * Instance store state
+ */
+class InstanceState extends StandardState {
+ /**
+ * Current locale (e.g., "en", "zh", "ja")
+ */
+ locale: string = "en";
+
+ /**
+ * Current theme
+ * Note: Accepts string for flexibility, but validates to Theme
+ */
+ theme: Theme | string = "default";
+
+ /**
+ * Instance profile containing owner and metadata
+ */
+ profile: InstanceProfile = InstanceProfile.fromPartial({});
+
+ /**
+ * Array of instance settings
+ */
+ settings: InstanceSetting[] = [];
+
+ /**
+ * Computed property for general settings
+ * Memoized for performance
+ */
+ get generalSetting(): InstanceSetting_GeneralSetting {
+ return computed(() => {
+ const setting = this.settings.find((s) => s.name === `${instanceSettingNamePrefix}${InstanceSetting_Key.GENERAL}`);
+ return setting?.generalSetting || InstanceSetting_GeneralSetting.fromPartial({});
+ }).get();
+ }
+
+ /**
+ * Computed property for memo-related settings
+ * Memoized for performance
+ */
+ get memoRelatedSetting(): InstanceSetting_MemoRelatedSetting {
+ return computed(() => {
+ const setting = this.settings.find((s) => s.name === `${instanceSettingNamePrefix}${InstanceSetting_Key.MEMO_RELATED}`);
+ return setting?.memoRelatedSetting || InstanceSetting_MemoRelatedSetting.fromPartial({});
+ }).get();
+ }
+
+ /**
+ * Override setPartial to validate locale and theme
+ */
+ setPartial(partial: Partial<InstanceState>): void {
+ const finalState = { ...this, ...partial };
+
+ // Validate locale
+ if (partial.locale !== undefined && !isValidateLocale(finalState.locale)) {
+ console.warn(`Invalid locale "${finalState.locale}", falling back to "en"`);
+ finalState.locale = "en";
+ }
+
+ // Validate theme - accept string and validate
+ if (partial.theme !== undefined) {
+ const themeStr = String(finalState.theme);
+ if (!isValidTheme(themeStr)) {
+ console.warn(`Invalid theme "${themeStr}", falling back to "default"`);
+ finalState.theme = "default";
+ } else {
+ finalState.theme = themeStr;
+ }
+ }
+
+ Object.assign(this, finalState);
+ }
+}
+
+/**
+ * Instance store instance
+ */
+const instanceStore = (() => {
+ const base = createServerStore(new InstanceState(), {
+ name: "instance",
+ enableDeduplication: true,
+ });
+
+ const { state, executeRequest } = base;
+
+ /**
+ * Fetch a specific instance setting by key
+ *
+ * @param settingKey - The setting key to fetch
+ */
+ const fetchInstanceSetting = async (settingKey: InstanceSetting_Key): Promise<void> => {
+ const requestKey = createRequestKey("fetchInstanceSetting", { key: settingKey });
+
+ return executeRequest(
+ requestKey,
+ async () => {
+ const setting = await instanceServiceClient.getInstanceSetting({
+ name: `${instanceSettingNamePrefix}${settingKey}`,
+ });
+
+ // Merge into settings array, avoiding duplicates
+ state.setPartial({
+ settings: uniqBy([setting, ...state.settings], "name"),
+ });
+ },
+ "FETCH_INSTANCE_SETTING_FAILED",
+ );
+ };
+
+ /**
+ * Update or create an instance setting
+ *
+ * @param setting - The setting to upsert
+ */
+ const upsertInstanceSetting = async (setting: InstanceSetting): Promise<void> => {
+ return executeRequest(
+ "", // No deduplication for updates
+ async () => {
+ await instanceServiceClient.updateInstanceSetting({ setting });
+
+ // Update local state
+ state.setPartial({
+ settings: uniqBy([setting, ...state.settings], "name"),
+ });
+ },
+ "UPDATE_INSTANCE_SETTING_FAILED",
+ );
+ };
+
+ /**
+ * Get an instance setting from cache by key
+ * Does not trigger a fetch
+ *
+ * @param settingKey - The setting key
+ * @returns The cached setting or an empty setting
+ */
+ const getInstanceSettingByKey = (settingKey: InstanceSetting_Key): InstanceSetting => {
+ const setting = state.settings.find((s) => s.name === `${instanceSettingNamePrefix}${settingKey}`);
+ return setting || InstanceSetting.fromPartial({});
+ };
+
+ /**
+ * Set the instance theme
+ * Updates both local state and persists to server
+ *
+ * @param theme - The theme to set
+ */
+ const setTheme = async (theme: string): Promise<void> => {
+ // Validate theme
+ if (!isValidTheme(theme)) {
+ console.warn(`Invalid theme "${theme}", ignoring`);
+ return;
+ }
+
+ // Update local state immediately
+ state.setPartial({ theme });
+
+ // Persist to server
+ const generalSetting = state.generalSetting;
+ const updatedGeneralSetting = InstanceSetting_GeneralSetting.fromPartial({
+ ...generalSetting,
+ customProfile: {
+ ...generalSetting.customProfile,
+ },
+ });
+
+ await upsertInstanceSetting(
+ InstanceSetting.fromPartial({
+ name: `${instanceSettingNamePrefix}${InstanceSetting_Key.GENERAL}`,
+ generalSetting: updatedGeneralSetting,
+ }),
+ );
+ };
+
+ /**
+ * Fetch instance profile
+ */
+ const fetchInstanceProfile = async (): Promise<InstanceProfile> => {
+ const requestKey = createRequestKey("fetchInstanceProfile");
+
+ return executeRequest(
+ requestKey,
+ async () => {
+ const profile = await instanceServiceClient.getInstanceProfile({});
+ state.setPartial({ profile });
+ return profile;
+ },
+ "FETCH_INSTANCE_PROFILE_FAILED",
+ );
+ };
+
+ return {
+ state,
+ fetchInstanceSetting,
+ fetchInstanceProfile,
+ upsertInstanceSetting,
+ getInstanceSettingByKey,
+ setTheme,
+ };
+})();
+
+/**
+ * Initialize the instance store
+ * Called once at app startup to load instance profile and settings
+ *
+ * @throws Never - errors are logged but not thrown
+ */
+export const initialInstanceStore = async (): Promise<void> => {
+ try {
+ // Fetch instance profile
+ const instanceProfile = await instanceStore.fetchInstanceProfile();
+
+ // Fetch required settings
+ await Promise.all([
+ instanceStore.fetchInstanceSetting(InstanceSetting_Key.GENERAL),
+ instanceStore.fetchInstanceSetting(InstanceSetting_Key.MEMO_RELATED),
+ ]);
+
+ // Apply settings to state
+ const instanceGeneralSetting = instanceStore.state.generalSetting;
+ instanceStore.state.setPartial({
+ locale: instanceGeneralSetting.customProfile?.locale || "en",
+ theme: "default",
+ profile: instanceProfile,
+ });
+ } catch (error) {
+ console.error("Failed to initialize instance store:", error);
+ // Set default fallback values
+ instanceStore.state.setPartial({
+ locale: "en",
+ theme: "default",
+ });
+ }
+};
+
+export default instanceStore;
diff --git a/web/src/store/user.ts b/web/src/store/user.ts
index 0526df42e..f7cf248fd 100644
--- a/web/src/store/user.ts
+++ b/web/src/store/user.ts
@@ -14,8 +14,8 @@ import {
UserStats,
} from "@/types/proto/api/v1/user_service";
import { findNearestMatchedLanguage } from "@/utils/i18n";
+import instanceStore from "./instance";
import { RequestDeduplicator, createRequestKey, StoreError } from "./store-utils";
-import workspaceStore from "./workspace";
class LocalState {
currentUser?: string;
@@ -311,7 +311,7 @@ const userStore = (() => {
* 1. Fetch current authenticated user session
* 2. Set current user in store (required for subsequent calls)
* 3. Fetch user settings (depends on currentUser being set)
- * 4. Apply user preferences to workspace store
+ * 4. Apply user preferences to instance store
*
* @throws Never - errors are handled internally with fallback behavior
*/
@@ -329,7 +329,7 @@ export const initialUserStore = async () => {
});
const locale = findNearestMatchedLanguage(navigator.language);
- workspaceStore.state.setPartial({ locale });
+ instanceStore.state.setPartial({ locale });
return;
}
@@ -348,26 +348,26 @@ export const initialUserStore = async () => {
// The fetchUserSettings() method checks state.currentUser internally
await userStore.fetchUserSettings();
- // Step 4: Apply user preferences to workspace
+ // Step 4: Apply user preferences to instance
// CRITICAL: This must happen after fetchUserSettings() completes
// We need userGeneralSetting to be populated before accessing it
const generalSetting = userStore.state.userGeneralSetting;
if (generalSetting) {
// Note: setPartial will validate theme automatically
- workspaceStore.state.setPartial({
+ instanceStore.state.setPartial({
locale: generalSetting.locale,
theme: generalSetting.theme || "default", // Validation handled by setPartial
});
} else {
// Fallback if settings weren't loaded
const locale = findNearestMatchedLanguage(navigator.language);
- workspaceStore.state.setPartial({ locale });
+ instanceStore.state.setPartial({ locale });
}
} catch (error) {
// On any error, fall back to browser language detection
console.error("Failed to initialize user store:", error);
const locale = findNearestMatchedLanguage(navigator.language);
- workspaceStore.state.setPartial({ locale });
+ instanceStore.state.setPartial({ locale });
}
};
diff --git a/web/src/store/workspace.ts b/web/src/store/workspace.ts
deleted file mode 100644
index e53c3241b..000000000
--- a/web/src/store/workspace.ts
+++ /dev/null
@@ -1,269 +0,0 @@
-/**
- * Workspace Store
- *
- * Manages workspace-level configuration and settings.
- * This is a server state store that fetches workspace profile and settings.
- */
-import { uniqBy } from "lodash-es";
-import { computed } from "mobx";
-import { workspaceServiceClient } from "@/grpcweb";
-import { WorkspaceProfile, WorkspaceSetting_Key } from "@/types/proto/api/v1/workspace_service";
-import {
- WorkspaceSetting_GeneralSetting,
- WorkspaceSetting_MemoRelatedSetting,
- WorkspaceSetting,
-} from "@/types/proto/api/v1/workspace_service";
-import { isValidateLocale } from "@/utils/i18n";
-import { StandardState, createServerStore } from "./base-store";
-import { workspaceSettingNamePrefix } from "./common";
-import { createRequestKey } from "./store-utils";
-
-/**
- * Valid theme options
- */
-const VALID_THEMES = ["default", "default-dark", "paper", "whitewall"] as const;
-export type Theme = (typeof VALID_THEMES)[number];
-
-/**
- * Check if a string is a valid theme
- */
-export function isValidTheme(theme: string): theme is Theme {
- return VALID_THEMES.includes(theme as Theme);
-}
-
-/**
- * Workspace store state
- */
-class WorkspaceState extends StandardState {
- /**
- * Current locale (e.g., "en", "zh", "ja")
- */
- locale: string = "en";
-
- /**
- * Current theme
- * Note: Accepts string for flexibility, but validates to Theme
- */
- theme: Theme | string = "default";
-
- /**
- * Workspace profile containing owner and metadata
- */
- profile: WorkspaceProfile = WorkspaceProfile.fromPartial({});
-
- /**
- * Array of workspace settings
- */
- settings: WorkspaceSetting[] = [];
-
- /**
- * Computed property for general settings
- * Memoized for performance
- */
- get generalSetting(): WorkspaceSetting_GeneralSetting {
- return computed(() => {
- const setting = this.settings.find((s) => s.name === `${workspaceSettingNamePrefix}${WorkspaceSetting_Key.GENERAL}`);
- return setting?.generalSetting || WorkspaceSetting_GeneralSetting.fromPartial({});
- }).get();
- }
-
- /**
- * Computed property for memo-related settings
- * Memoized for performance
- */
- get memoRelatedSetting(): WorkspaceSetting_MemoRelatedSetting {
- return computed(() => {
- const setting = this.settings.find((s) => s.name === `${workspaceSettingNamePrefix}${WorkspaceSetting_Key.MEMO_RELATED}`);
- return setting?.memoRelatedSetting || WorkspaceSetting_MemoRelatedSetting.fromPartial({});
- }).get();
- }
-
- /**
- * Override setPartial to validate locale and theme
- */
- setPartial(partial: Partial<WorkspaceState>): void {
- const finalState = { ...this, ...partial };
-
- // Validate locale
- if (partial.locale !== undefined && !isValidateLocale(finalState.locale)) {
- console.warn(`Invalid locale "${finalState.locale}", falling back to "en"`);
- finalState.locale = "en";
- }
-
- // Validate theme - accept string and validate
- if (partial.theme !== undefined) {
- const themeStr = String(finalState.theme);
- if (!isValidTheme(themeStr)) {
- console.warn(`Invalid theme "${themeStr}", falling back to "default"`);
- finalState.theme = "default";
- } else {
- finalState.theme = themeStr;
- }
- }
-
- Object.assign(this, finalState);
- }
-}
-
-/**
- * Workspace store instance
- */
-const workspaceStore = (() => {
- const base = createServerStore(new WorkspaceState(), {
- name: "workspace",
- enableDeduplication: true,
- });
-
- const { state, executeRequest } = base;
-
- /**
- * Fetch a specific workspace setting by key
- *
- * @param settingKey - The setting key to fetch
- */
- const fetchWorkspaceSetting = async (settingKey: WorkspaceSetting_Key): Promise<void> => {
- const requestKey = createRequestKey("fetchWorkspaceSetting", { key: settingKey });
-
- return executeRequest(
- requestKey,
- async () => {
- const setting = await workspaceServiceClient.getWorkspaceSetting({
- name: `${workspaceSettingNamePrefix}${settingKey}`,
- });
-
- // Merge into settings array, avoiding duplicates
- state.setPartial({
- settings: uniqBy([setting, ...state.settings], "name"),
- });
- },
- "FETCH_WORKSPACE_SETTING_FAILED",
- );
- };
-
- /**
- * Update or create a workspace setting
- *
- * @param setting - The setting to upsert
- */
- const upsertWorkspaceSetting = async (setting: WorkspaceSetting): Promise<void> => {
- return executeRequest(
- "", // No deduplication for updates
- async () => {
- await workspaceServiceClient.updateWorkspaceSetting({ setting });
-
- // Update local state
- state.setPartial({
- settings: uniqBy([setting, ...state.settings], "name"),
- });
- },
- "UPDATE_WORKSPACE_SETTING_FAILED",
- );
- };
-
- /**
- * Get a workspace setting from cache by key
- * Does not trigger a fetch
- *
- * @param settingKey - The setting key
- * @returns The cached setting or an empty setting
- */
- const getWorkspaceSettingByKey = (settingKey: WorkspaceSetting_Key): WorkspaceSetting => {
- const setting = state.settings.find((s) => s.name === `${workspaceSettingNamePrefix}${settingKey}`);
- return setting || WorkspaceSetting.fromPartial({});
- };
-
- /**
- * Set the workspace theme
- * Updates both local state and persists to server
- *
- * @param theme - The theme to set
- */
- const setTheme = async (theme: string): Promise<void> => {
- // Validate theme
- if (!isValidTheme(theme)) {
- console.warn(`Invalid theme "${theme}", ignoring`);
- return;
- }
-
- // Update local state immediately
- state.setPartial({ theme });
-
- // Persist to server
- const generalSetting = state.generalSetting;
- const updatedGeneralSetting = WorkspaceSetting_GeneralSetting.fromPartial({
- ...generalSetting,
- customProfile: {
- ...generalSetting.customProfile,
- },
- });
-
- await upsertWorkspaceSetting(
- WorkspaceSetting.fromPartial({
- name: `${workspaceSettingNamePrefix}${WorkspaceSetting_Key.GENERAL}`,
- generalSetting: updatedGeneralSetting,
- }),
- );
- };
-
- /**
- * Fetch workspace profile
- */
- const fetchWorkspaceProfile = async (): Promise<WorkspaceProfile> => {
- const requestKey = createRequestKey("fetchWorkspaceProfile");
-
- return executeRequest(
- requestKey,
- async () => {
- const profile = await workspaceServiceClient.getWorkspaceProfile({});
- state.setPartial({ profile });
- return profile;
- },
- "FETCH_WORKSPACE_PROFILE_FAILED",
- );
- };
-
- return {
- state,
- fetchWorkspaceSetting,
- fetchWorkspaceProfile,
- upsertWorkspaceSetting,
- getWorkspaceSettingByKey,
- setTheme,
- };
-})();
-
-/**
- * Initialize the workspace store
- * Called once at app startup to load workspace profile and settings
- *
- * @throws Never - errors are logged but not thrown
- */
-export const initialWorkspaceStore = async (): Promise<void> => {
- try {
- // Fetch workspace profile
- const workspaceProfile = await workspaceStore.fetchWorkspaceProfile();
-
- // Fetch required settings
- await Promise.all([
- workspaceStore.fetchWorkspaceSetting(WorkspaceSetting_Key.GENERAL),
- workspaceStore.fetchWorkspaceSetting(WorkspaceSetting_Key.MEMO_RELATED),
- ]);
-
- // Apply settings to state
- const workspaceGeneralSetting = workspaceStore.state.generalSetting;
- workspaceStore.state.setPartial({
- locale: workspaceGeneralSetting.customProfile?.locale || "en",
- theme: "default",
- profile: workspaceProfile,
- });
- } catch (error) {
- console.error("Failed to initialize workspace store:", error);
- // Set default fallback values
- workspaceStore.state.setPartial({
- locale: "en",
- theme: "default",
- });
- }
-};
-
-export default workspaceStore;
diff --git a/web/src/types/proto/api/v1/idp_service.ts b/web/src/types/proto/api/v1/idp_service.ts
index 225184811..e04872aa6 100644
--- a/web/src/types/proto/api/v1/idp_service.ts
+++ b/web/src/types/proto/api/v1/idp_service.ts
@@ -14,7 +14,7 @@ export const protobufPackage = "memos.api.v1";
export interface IdentityProvider {
/**
* The resource name of the identity provider.
- * Format: identityProviders/{idp}
+ * Format: identity-providers/{idp}
*/
name: string;
/** Required. The type of the identity provider. */
@@ -93,7 +93,7 @@ export interface ListIdentityProvidersResponse {
export interface GetIdentityProviderRequest {
/**
* Required. The resource name of the identity provider to get.
- * Format: identityProviders/{idp}
+ * Format: identity-providers/{idp}
*/
name: string;
}
@@ -125,7 +125,7 @@ export interface UpdateIdentityProviderRequest {
export interface DeleteIdentityProviderRequest {
/**
* Required. The resource name of the identity provider to delete.
- * Format: identityProviders/{idp}
+ * Format: identity-providers/{idp}
*/
name: string;
}
@@ -792,9 +792,9 @@ export const IdentityProviderServiceDefinition = {
_unknownFields: {
578365826: [
new Uint8Array([
- 27,
+ 28,
18,
- 25,
+ 26,
47,
97,
112,
@@ -811,7 +811,8 @@ export const IdentityProviderServiceDefinition = {
105,
116,
121,
- 80,
+ 45,
+ 112,
114,
111,
118,
@@ -837,9 +838,9 @@ export const IdentityProviderServiceDefinition = {
8410: [new Uint8Array([4, 110, 97, 109, 101])],
578365826: [
new Uint8Array([
- 36,
+ 37,
18,
- 34,
+ 35,
47,
97,
112,
@@ -862,7 +863,8 @@ export const IdentityProviderServiceDefinition = {
105,
116,
121,
- 80,
+ 45,
+ 112,
114,
111,
118,
@@ -893,7 +895,7 @@ export const IdentityProviderServiceDefinition = {
],
578365826: [
new Uint8Array([
- 46,
+ 47,
58,
17,
105,
@@ -914,7 +916,7 @@ export const IdentityProviderServiceDefinition = {
101,
114,
34,
- 25,
+ 26,
47,
97,
112,
@@ -931,7 +933,8 @@ export const IdentityProviderServiceDefinition = {
105,
116,
121,
- 80,
+ 45,
+ 112,
114,
111,
118,
@@ -990,7 +993,7 @@ export const IdentityProviderServiceDefinition = {
],
578365826: [
new Uint8Array([
- 73,
+ 74,
58,
17,
105,
@@ -1011,7 +1014,7 @@ export const IdentityProviderServiceDefinition = {
101,
114,
50,
- 52,
+ 53,
47,
97,
112,
@@ -1052,7 +1055,8 @@ export const IdentityProviderServiceDefinition = {
105,
116,
121,
- 80,
+ 45,
+ 112,
114,
111,
118,
@@ -1081,9 +1085,9 @@ export const IdentityProviderServiceDefinition = {
8410: [new Uint8Array([4, 110, 97, 109, 101])],
578365826: [
new Uint8Array([
- 36,
+ 37,
42,
- 34,
+ 35,
47,
97,
112,
@@ -1106,7 +1110,8 @@ export const IdentityProviderServiceDefinition = {
105,
116,
121,
- 80,
+ 45,
+ 112,
114,
111,
118,
diff --git a/web/src/types/proto/api/v1/inbox_service.ts b/web/src/types/proto/api/v1/inbox_service.ts
deleted file mode 100644
index 68f3b80b8..000000000
--- a/web/src/types/proto/api/v1/inbox_service.ts
+++ /dev/null
@@ -1,779 +0,0 @@
-// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
-// versions:
-// protoc-gen-ts_proto v2.6.1
-// protoc unknown
-// source: api/v1/inbox_service.proto
-
-/* eslint-disable */
-import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
-import { Empty } from "../../google/protobuf/empty";
-import { FieldMask } from "../../google/protobuf/field_mask";
-import { Timestamp } from "../../google/protobuf/timestamp";
-
-export const protobufPackage = "memos.api.v1";
-
-export interface Inbox {
- /**
- * The resource name of the inbox.
- * Format: inboxes/{inbox}
- */
- name: string;
- /**
- * The sender of the inbox notification.
- * Format: users/{user}
- */
- sender: string;
- /**
- * The receiver of the inbox notification.
- * Format: users/{user}
- */
- receiver: string;
- /** The status of the inbox notification. */
- status: Inbox_Status;
- /** Output only. The creation timestamp. */
- createTime?:
- | Date
- | undefined;
- /** The type of the inbox notification. */
- type: Inbox_Type;
- /** Optional. The activity ID associated with this inbox notification. */
- activityId?: number | undefined;
-}
-
-/** Status enumeration for inbox notifications. */
-export enum Inbox_Status {
- /** STATUS_UNSPECIFIED - Unspecified status. */
- STATUS_UNSPECIFIED = "STATUS_UNSPECIFIED",
- /** UNREAD - The notification is unread. */
- UNREAD = "UNREAD",
- /** ARCHIVED - The notification is archived. */
- ARCHIVED = "ARCHIVED",
- UNRECOGNIZED = "UNRECOGNIZED",
-}
-
-export function inbox_StatusFromJSON(object: any): Inbox_Status {
- switch (object) {
- case 0:
- case "STATUS_UNSPECIFIED":
- return Inbox_Status.STATUS_UNSPECIFIED;
- case 1:
- case "UNREAD":
- return Inbox_Status.UNREAD;
- case 2:
- case "ARCHIVED":
- return Inbox_Status.ARCHIVED;
- case -1:
- case "UNRECOGNIZED":
- default:
- return Inbox_Status.UNRECOGNIZED;
- }
-}
-
-export function inbox_StatusToNumber(object: Inbox_Status): number {
- switch (object) {
- case Inbox_Status.STATUS_UNSPECIFIED:
- return 0;
- case Inbox_Status.UNREAD:
- return 1;
- case Inbox_Status.ARCHIVED:
- return 2;
- case Inbox_Status.UNRECOGNIZED:
- default:
- return -1;
- }
-}
-
-/** Type enumeration for inbox notifications. */
-export enum Inbox_Type {
- /** TYPE_UNSPECIFIED - Unspecified type. */
- TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED",
- /** MEMO_COMMENT - Memo comment notification. */
- MEMO_COMMENT = "MEMO_COMMENT",
- UNRECOGNIZED = "UNRECOGNIZED",
-}
-
-export function inbox_TypeFromJSON(object: any): Inbox_Type {
- switch (object) {
- case 0:
- case "TYPE_UNSPECIFIED":
- return Inbox_Type.TYPE_UNSPECIFIED;
- case 1:
- case "MEMO_COMMENT":
- return Inbox_Type.MEMO_COMMENT;
- case -1:
- case "UNRECOGNIZED":
- default:
- return Inbox_Type.UNRECOGNIZED;
- }
-}
-
-export function inbox_TypeToNumber(object: Inbox_Type): number {
- switch (object) {
- case Inbox_Type.TYPE_UNSPECIFIED:
- return 0;
- case Inbox_Type.MEMO_COMMENT:
- return 1;
- case Inbox_Type.UNRECOGNIZED:
- default:
- return -1;
- }
-}
-
-export interface ListInboxesRequest {
- /**
- * Required. The parent resource whose inboxes will be listed.
- * Format: users/{user}
- */
- parent: string;
- /**
- * 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: number;
- /**
- * Optional. A page token, received from a previous `ListInboxes` call.
- * Provide this to retrieve the subsequent page.
- */
- pageToken: string;
- /**
- * 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;
- /**
- * Optional. The order to sort results by.
- * Example: "create_time desc" or "status asc"
- */
- orderBy: string;
-}
-
-export interface ListInboxesResponse {
- /** The list of inboxes. */
- inboxes: Inbox[];
- /**
- * 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;
- /** The total count of inboxes (may be approximate). */
- totalSize: number;
-}
-
-export interface UpdateInboxRequest {
- /** Required. The inbox to update. */
- inbox?:
- | Inbox
- | undefined;
- /** Required. The list of fields to update. */
- updateMask?:
- | string[]
- | undefined;
- /** Optional. If set to true, allows updating missing fields. */
- allowMissing: boolean;
-}
-
-export interface DeleteInboxRequest {
- /**
- * Required. The resource name of the inbox to delete.
- * Format: inboxes/{inbox}
- */
- name: string;
-}
-
-function createBaseInbox(): Inbox {
- return {
- name: "",
- sender: "",
- receiver: "",
- status: Inbox_Status.STATUS_UNSPECIFIED,
- createTime: undefined,
- type: Inbox_Type.TYPE_UNSPECIFIED,
- activityId: undefined,
- };
-}
-
-export const Inbox: MessageFns<Inbox> = {
- encode(message: Inbox, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
- }
- if (message.sender !== "") {
- writer.uint32(18).string(message.sender);
- }
- if (message.receiver !== "") {
- writer.uint32(26).string(message.receiver);
- }
- if (message.status !== Inbox_Status.STATUS_UNSPECIFIED) {
- writer.uint32(32).int32(inbox_StatusToNumber(message.status));
- }
- if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join();
- }
- if (message.type !== Inbox_Type.TYPE_UNSPECIFIED) {
- writer.uint32(48).int32(inbox_TypeToNumber(message.type));
- }
- if (message.activityId !== undefined) {
- writer.uint32(56).int32(message.activityId);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): Inbox {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseInbox();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.name = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.sender = reader.string();
- continue;
- }
- case 3: {
- if (tag !== 26) {
- break;
- }
-
- message.receiver = reader.string();
- continue;
- }
- case 4: {
- if (tag !== 32) {
- break;
- }
-
- message.status = inbox_StatusFromJSON(reader.int32());
- continue;
- }
- case 5: {
- if (tag !== 42) {
- break;
- }
-
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
- continue;
- }
- case 6: {
- if (tag !== 48) {
- break;
- }
-
- message.type = inbox_TypeFromJSON(reader.int32());
- continue;
- }
- case 7: {
- if (tag !== 56) {
- break;
- }
-
- message.activityId = reader.int32();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<Inbox>): Inbox {
- return Inbox.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<Inbox>): Inbox {
- const message = createBaseInbox();
- message.name = object.name ?? "";
- message.sender = object.sender ?? "";
- message.receiver = object.receiver ?? "";
- message.status = object.status ?? Inbox_Status.STATUS_UNSPECIFIED;
- message.createTime = object.createTime ?? undefined;
- message.type = object.type ?? Inbox_Type.TYPE_UNSPECIFIED;
- message.activityId = object.activityId ?? undefined;
- return message;
- },
-};
-
-function createBaseListInboxesRequest(): ListInboxesRequest {
- return { parent: "", pageSize: 0, pageToken: "", filter: "", orderBy: "" };
-}
-
-export const ListInboxesRequest: MessageFns<ListInboxesRequest> = {
- encode(message: ListInboxesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.parent !== "") {
- writer.uint32(10).string(message.parent);
- }
- if (message.pageSize !== 0) {
- writer.uint32(16).int32(message.pageSize);
- }
- if (message.pageToken !== "") {
- writer.uint32(26).string(message.pageToken);
- }
- if (message.filter !== "") {
- writer.uint32(34).string(message.filter);
- }
- if (message.orderBy !== "") {
- writer.uint32(42).string(message.orderBy);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): ListInboxesRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListInboxesRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.parent = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 16) {
- break;
- }
-
- message.pageSize = reader.int32();
- continue;
- }
- case 3: {
- if (tag !== 26) {
- break;
- }
-
- message.pageToken = reader.string();
- continue;
- }
- case 4: {
- if (tag !== 34) {
- break;
- }
-
- message.filter = reader.string();
- continue;
- }
- case 5: {
- if (tag !== 42) {
- break;
- }
-
- message.orderBy = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<ListInboxesRequest>): ListInboxesRequest {
- return ListInboxesRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<ListInboxesRequest>): ListInboxesRequest {
- const message = createBaseListInboxesRequest();
- message.parent = object.parent ?? "";
- message.pageSize = object.pageSize ?? 0;
- message.pageToken = object.pageToken ?? "";
- message.filter = object.filter ?? "";
- message.orderBy = object.orderBy ?? "";
- return message;
- },
-};
-
-function createBaseListInboxesResponse(): ListInboxesResponse {
- return { inboxes: [], nextPageToken: "", totalSize: 0 };
-}
-
-export const ListInboxesResponse: MessageFns<ListInboxesResponse> = {
- encode(message: ListInboxesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- for (const v of message.inboxes) {
- Inbox.encode(v!, writer.uint32(10).fork()).join();
- }
- if (message.nextPageToken !== "") {
- writer.uint32(18).string(message.nextPageToken);
- }
- if (message.totalSize !== 0) {
- writer.uint32(24).int32(message.totalSize);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): ListInboxesResponse {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListInboxesResponse();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.inboxes.push(Inbox.decode(reader, reader.uint32()));
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.nextPageToken = reader.string();
- continue;
- }
- case 3: {
- if (tag !== 24) {
- break;
- }
-
- message.totalSize = reader.int32();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<ListInboxesResponse>): ListInboxesResponse {
- return ListInboxesResponse.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<ListInboxesResponse>): ListInboxesResponse {
- const message = createBaseListInboxesResponse();
- message.inboxes = object.inboxes?.map((e) => Inbox.fromPartial(e)) || [];
- message.nextPageToken = object.nextPageToken ?? "";
- message.totalSize = object.totalSize ?? 0;
- return message;
- },
-};
-
-function createBaseUpdateInboxRequest(): UpdateInboxRequest {
- return { inbox: undefined, updateMask: undefined, allowMissing: false };
-}
-
-export const UpdateInboxRequest: MessageFns<UpdateInboxRequest> = {
- encode(message: UpdateInboxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.inbox !== undefined) {
- Inbox.encode(message.inbox, writer.uint32(10).fork()).join();
- }
- if (message.updateMask !== undefined) {
- FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
- }
- if (message.allowMissing !== false) {
- writer.uint32(24).bool(message.allowMissing);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): UpdateInboxRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseUpdateInboxRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.inbox = Inbox.decode(reader, reader.uint32());
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
- continue;
- }
- case 3: {
- if (tag !== 24) {
- break;
- }
-
- message.allowMissing = reader.bool();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<UpdateInboxRequest>): UpdateInboxRequest {
- return UpdateInboxRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<UpdateInboxRequest>): UpdateInboxRequest {
- const message = createBaseUpdateInboxRequest();
- message.inbox = (object.inbox !== undefined && object.inbox !== null) ? Inbox.fromPartial(object.inbox) : undefined;
- message.updateMask = object.updateMask ?? undefined;
- message.allowMissing = object.allowMissing ?? false;
- return message;
- },
-};
-
-function createBaseDeleteInboxRequest(): DeleteInboxRequest {
- return { name: "" };
-}
-
-export const DeleteInboxRequest: MessageFns<DeleteInboxRequest> = {
- encode(message: DeleteInboxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): DeleteInboxRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseDeleteInboxRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.name = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<DeleteInboxRequest>): DeleteInboxRequest {
- return DeleteInboxRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<DeleteInboxRequest>): DeleteInboxRequest {
- const message = createBaseDeleteInboxRequest();
- message.name = object.name ?? "";
- return message;
- },
-};
-
-export type InboxServiceDefinition = typeof InboxServiceDefinition;
-export const InboxServiceDefinition = {
- name: "InboxService",
- fullName: "memos.api.v1.InboxService",
- methods: {
- /** ListInboxes lists inboxes for a user. */
- listInboxes: {
- name: "ListInboxes",
- requestType: ListInboxesRequest,
- requestStream: false,
- responseType: ListInboxesResponse,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],
- 578365826: [
- new Uint8Array([
- 34,
- 18,
- 32,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 117,
- 115,
- 101,
- 114,
- 115,
- 47,
- 42,
- 125,
- 47,
- 105,
- 110,
- 98,
- 111,
- 120,
- 101,
- 115,
- ]),
- ],
- },
- },
- },
- /** UpdateInbox updates an inbox. */
- updateInbox: {
- name: "UpdateInbox",
- requestType: UpdateInboxRequest,
- requestStream: false,
- responseType: Inbox,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([17, 105, 110, 98, 111, 120, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107])],
- 578365826: [
- new Uint8Array([
- 39,
- 58,
- 5,
- 105,
- 110,
- 98,
- 111,
- 120,
- 50,
- 30,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 105,
- 110,
- 98,
- 111,
- 120,
- 46,
- 110,
- 97,
- 109,
- 101,
- 61,
- 105,
- 110,
- 98,
- 111,
- 120,
- 101,
- 115,
- 47,
- 42,
- 125,
- ]),
- ],
- },
- },
- },
- /** DeleteInbox deletes an inbox. */
- deleteInbox: {
- name: "DeleteInbox",
- requestType: DeleteInboxRequest,
- requestStream: false,
- responseType: Empty,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([4, 110, 97, 109, 101])],
- 578365826: [
- new Uint8Array([
- 26,
- 42,
- 24,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 110,
- 97,
- 109,
- 101,
- 61,
- 105,
- 110,
- 98,
- 111,
- 120,
- 101,
- 115,
- 47,
- 42,
- 125,
- ]),
- ],
- },
- },
- },
- },
-} as const;
-
-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
-
-export type DeepPartial<T> = T extends Builtin ? T
- : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
- : Partial<T>;
-
-function toTimestamp(date: Date): Timestamp {
- const seconds = Math.trunc(date.getTime() / 1_000);
- const nanos = (date.getTime() % 1_000) * 1_000_000;
- return { seconds, nanos };
-}
-
-function fromTimestamp(t: Timestamp): Date {
- let millis = (t.seconds || 0) * 1_000;
- millis += (t.nanos || 0) / 1_000_000;
- return new globalThis.Date(millis);
-}
-
-export interface MessageFns<T> {
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
- decode(input: BinaryReader | Uint8Array, length?: number): T;
- create(base?: DeepPartial<T>): T;
- fromPartial(object: DeepPartial<T>): T;
-}
diff --git a/web/src/types/proto/api/v1/workspace_service.ts b/web/src/types/proto/api/v1/instance_service.ts
similarity index 62%
rename from web/src/types/proto/api/v1/workspace_service.ts
rename to web/src/types/proto/api/v1/instance_service.ts
index b17c252dc..771f6bb58 100644
--- a/web/src/types/proto/api/v1/workspace_service.ts
+++ b/web/src/types/proto/api/v1/instance_service.ts
@@ -2,7 +2,7 @@
// versions:
// protoc-gen-ts_proto v2.6.1
// protoc unknown
-// source: api/v1/workspace_service.proto
+// source: api/v1/instance_service.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -10,8 +10,8 @@ import { FieldMask } from "../../google/protobuf/field_mask";
export const protobufPackage = "memos.api.v1";
-/** Workspace profile message containing basic workspace information. */
-export interface WorkspaceProfile {
+/** Instance profile message containing basic instance information. */
+export interface InstanceProfile {
/**
* The name of instance owner.
* Format: users/{user}
@@ -25,24 +25,24 @@ export interface WorkspaceProfile {
instanceUrl: string;
}
-/** Request for workspace profile. */
-export interface GetWorkspaceProfileRequest {
+/** Request for instance profile. */
+export interface GetInstanceProfileRequest {
}
-/** A workspace setting resource. */
-export interface WorkspaceSetting {
+/** An instance setting resource. */
+export interface InstanceSetting {
/**
- * The name of the workspace setting.
- * Format: workspace/settings/{setting}
+ * The name of the instance setting.
+ * Format: instance/settings/{setting}
*/
name: string;
- generalSetting?: WorkspaceSetting_GeneralSetting | undefined;
- storageSetting?: WorkspaceSetting_StorageSetting | undefined;
- memoRelatedSetting?: WorkspaceSetting_MemoRelatedSetting | undefined;
+ generalSetting?: InstanceSetting_GeneralSetting | undefined;
+ storageSetting?: InstanceSetting_StorageSetting | undefined;
+ memoRelatedSetting?: InstanceSetting_MemoRelatedSetting | undefined;
}
-/** Enumeration of workspace setting keys. */
-export enum WorkspaceSetting_Key {
+/** Enumeration of instance setting keys. */
+export enum InstanceSetting_Key {
KEY_UNSPECIFIED = "KEY_UNSPECIFIED",
/** GENERAL - GENERAL is the key for general settings. */
GENERAL = "GENERAL",
@@ -53,45 +53,45 @@ export enum WorkspaceSetting_Key {
UNRECOGNIZED = "UNRECOGNIZED",
}
-export function workspaceSetting_KeyFromJSON(object: any): WorkspaceSetting_Key {
+export function instanceSetting_KeyFromJSON(object: any): InstanceSetting_Key {
switch (object) {
case 0:
case "KEY_UNSPECIFIED":
- return WorkspaceSetting_Key.KEY_UNSPECIFIED;
+ return InstanceSetting_Key.KEY_UNSPECIFIED;
case 1:
case "GENERAL":
- return WorkspaceSetting_Key.GENERAL;
+ return InstanceSetting_Key.GENERAL;
case 2:
case "STORAGE":
- return WorkspaceSetting_Key.STORAGE;
+ return InstanceSetting_Key.STORAGE;
case 3:
case "MEMO_RELATED":
- return WorkspaceSetting_Key.MEMO_RELATED;
+ return InstanceSetting_Key.MEMO_RELATED;
case -1:
case "UNRECOGNIZED":
default:
- return WorkspaceSetting_Key.UNRECOGNIZED;
+ return InstanceSetting_Key.UNRECOGNIZED;
}
}
-export function workspaceSetting_KeyToNumber(object: WorkspaceSetting_Key): number {
+export function instanceSetting_KeyToNumber(object: InstanceSetting_Key): number {
switch (object) {
- case WorkspaceSetting_Key.KEY_UNSPECIFIED:
+ case InstanceSetting_Key.KEY_UNSPECIFIED:
return 0;
- case WorkspaceSetting_Key.GENERAL:
+ case InstanceSetting_Key.GENERAL:
return 1;
- case WorkspaceSetting_Key.STORAGE:
+ case InstanceSetting_Key.STORAGE:
return 2;
- case WorkspaceSetting_Key.MEMO_RELATED:
+ case InstanceSetting_Key.MEMO_RELATED:
return 3;
- case WorkspaceSetting_Key.UNRECOGNIZED:
+ case InstanceSetting_Key.UNRECOGNIZED:
default:
return -1;
}
}
-/** General workspace settings configuration. */
-export interface WorkspaceSetting_GeneralSetting {
+/** General instance settings configuration. */
+export interface InstanceSetting_GeneralSetting {
/**
* theme is the name of the selected theme.
* This references a CSS file in the web/public/themes/ directory.
@@ -107,7 +107,7 @@ export interface WorkspaceSetting_GeneralSetting {
additionalStyle: string;
/** custom_profile is the custom profile. */
customProfile?:
- | WorkspaceSetting_GeneralSetting_CustomProfile
+ | InstanceSetting_GeneralSetting_CustomProfile
| undefined;
/**
* week_start_day_offset is the week start day offset from Sunday.
@@ -121,18 +121,18 @@ export interface WorkspaceSetting_GeneralSetting {
disallowChangeNickname: boolean;
}
-/** Custom profile configuration for workspace branding. */
-export interface WorkspaceSetting_GeneralSetting_CustomProfile {
+/** Custom profile configuration for instance branding. */
+export interface InstanceSetting_GeneralSetting_CustomProfile {
title: string;
description: string;
logoUrl: string;
locale: string;
}
-/** Storage configuration settings for workspace attachments. */
-export interface WorkspaceSetting_StorageSetting {
+/** Storage configuration settings for instance attachments. */
+export interface InstanceSetting_StorageSetting {
/** storage_type is the storage type. */
- storageType: WorkspaceSetting_StorageSetting_StorageType;
+ storageType: InstanceSetting_StorageSetting_StorageType;
/**
* The template of file path.
* e.g. assets/{timestamp}_{filename}
@@ -141,11 +141,11 @@ export interface WorkspaceSetting_StorageSetting {
/** The max upload size in megabytes. */
uploadSizeLimitMb: number;
/** The S3 config. */
- s3Config?: WorkspaceSetting_StorageSetting_S3Config | undefined;
+ s3Config?: InstanceSetting_StorageSetting_S3Config | undefined;
}
/** Storage type enumeration for different storage backends. */
-export enum WorkspaceSetting_StorageSetting_StorageType {
+export enum InstanceSetting_StorageSetting_StorageType {
STORAGE_TYPE_UNSPECIFIED = "STORAGE_TYPE_UNSPECIFIED",
/** DATABASE - DATABASE is the database storage type. */
DATABASE = "DATABASE",
@@ -156,42 +156,42 @@ export enum WorkspaceSetting_StorageSetting_StorageType {
UNRECOGNIZED = "UNRECOGNIZED",
}
-export function workspaceSetting_StorageSetting_StorageTypeFromJSON(
+export function instanceSetting_StorageSetting_StorageTypeFromJSON(
object: any,
-): WorkspaceSetting_StorageSetting_StorageType {
+): InstanceSetting_StorageSetting_StorageType {
switch (object) {
case 0:
case "STORAGE_TYPE_UNSPECIFIED":
- return WorkspaceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED;
+ return InstanceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED;
case 1:
case "DATABASE":
- return WorkspaceSetting_StorageSetting_StorageType.DATABASE;
+ return InstanceSetting_StorageSetting_StorageType.DATABASE;
case 2:
case "LOCAL":
- return WorkspaceSetting_StorageSetting_StorageType.LOCAL;
+ return InstanceSetting_StorageSetting_StorageType.LOCAL;
case 3:
case "S3":
- return WorkspaceSetting_StorageSetting_StorageType.S3;
+ return InstanceSetting_StorageSetting_StorageType.S3;
case -1:
case "UNRECOGNIZED":
default:
- return WorkspaceSetting_StorageSetting_StorageType.UNRECOGNIZED;
+ return InstanceSetting_StorageSetting_StorageType.UNRECOGNIZED;
}
}
-export function workspaceSetting_StorageSetting_StorageTypeToNumber(
- object: WorkspaceSetting_StorageSetting_StorageType,
+export function instanceSetting_StorageSetting_StorageTypeToNumber(
+ object: InstanceSetting_StorageSetting_StorageType,
): number {
switch (object) {
- case WorkspaceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED:
+ case InstanceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED:
return 0;
- case WorkspaceSetting_StorageSetting_StorageType.DATABASE:
+ case InstanceSetting_StorageSetting_StorageType.DATABASE:
return 1;
- case WorkspaceSetting_StorageSetting_StorageType.LOCAL:
+ case InstanceSetting_StorageSetting_StorageType.LOCAL:
return 2;
- case WorkspaceSetting_StorageSetting_StorageType.S3:
+ case InstanceSetting_StorageSetting_StorageType.S3:
return 3;
- case WorkspaceSetting_StorageSetting_StorageType.UNRECOGNIZED:
+ case InstanceSetting_StorageSetting_StorageType.UNRECOGNIZED:
default:
return -1;
}
@@ -201,7 +201,7 @@ export function workspaceSetting_StorageSetting_StorageTypeToNumber(
* S3 configuration for cloud storage backend.
* Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
*/
-export interface WorkspaceSetting_StorageSetting_S3Config {
+export interface InstanceSetting_StorageSetting_S3Config {
accessKeyId: string;
accessKeySecret: string;
endpoint: string;
@@ -210,8 +210,8 @@ export interface WorkspaceSetting_StorageSetting_S3Config {
usePathStyle: boolean;
}
-/** Memo-related workspace settings and policies. */
-export interface WorkspaceSetting_MemoRelatedSetting {
+/** Memo-related instance settings and policies. */
+export interface InstanceSetting_MemoRelatedSetting {
/** disallow_public_visibility disallows set memo as public visibility. */
disallowPublicVisibility: boolean;
/** display_with_update_time orders and displays memo with update time. */
@@ -232,31 +232,31 @@ export interface WorkspaceSetting_MemoRelatedSetting {
nsfwTags: string[];
}
-/** Request message for GetWorkspaceSetting method. */
-export interface GetWorkspaceSettingRequest {
+/** Request message for GetInstanceSetting method. */
+export interface GetInstanceSettingRequest {
/**
- * The resource name of the workspace setting.
- * Format: workspace/settings/{setting}
+ * The resource name of the instance setting.
+ * Format: instance/settings/{setting}
*/
name: string;
}
-/** Request message for UpdateWorkspaceSetting method. */
-export interface UpdateWorkspaceSettingRequest {
- /** The workspace setting resource which replaces the resource on the server. */
+/** Request message for UpdateInstanceSetting method. */
+export interface UpdateInstanceSettingRequest {
+ /** The instance setting resource which replaces the resource on the server. */
setting?:
- | WorkspaceSetting
+ | InstanceSetting
| undefined;
/** The list of fields to update. */
updateMask?: string[] | undefined;
}
-function createBaseWorkspaceProfile(): WorkspaceProfile {
+function createBaseInstanceProfile(): InstanceProfile {
return { owner: "", version: "", mode: "", instanceUrl: "" };
}
-export const WorkspaceProfile: MessageFns<WorkspaceProfile> = {
- encode(message: WorkspaceProfile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+export const InstanceProfile: MessageFns<InstanceProfile> = {
+ encode(message: InstanceProfile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.owner !== "") {
writer.uint32(10).string(message.owner);
}
@@ -272,10 +272,10 @@ export const WorkspaceProfile: MessageFns<WorkspaceProfile> = {
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceProfile {
+ decode(input: BinaryReader | Uint8Array, length?: number): InstanceProfile {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseWorkspaceProfile();
+ const message = createBaseInstanceProfile();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -320,11 +320,11 @@ export const WorkspaceProfile: MessageFns<WorkspaceProfile> = {
return message;
},
- create(base?: DeepPartial<WorkspaceProfile>): WorkspaceProfile {
- return WorkspaceProfile.fromPartial(base ?? {});
+ create(base?: DeepPartial<InstanceProfile>): InstanceProfile {
+ return InstanceProfile.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<WorkspaceProfile>): WorkspaceProfile {
- const message = createBaseWorkspaceProfile();
+ fromPartial(object: DeepPartial<InstanceProfile>): InstanceProfile {
+ const message = createBaseInstanceProfile();
message.owner = object.owner ?? "";
message.version = object.version ?? "";
message.mode = object.mode ?? "";
@@ -333,19 +333,19 @@ export const WorkspaceProfile: MessageFns<WorkspaceProfile> = {
},
};
-function createBaseGetWorkspaceProfileRequest(): GetWorkspaceProfileRequest {
+function createBaseGetInstanceProfileRequest(): GetInstanceProfileRequest {
return {};
}
-export const GetWorkspaceProfileRequest: MessageFns<GetWorkspaceProfileRequest> = {
- encode(_: GetWorkspaceProfileRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+export const GetInstanceProfileRequest: MessageFns<GetInstanceProfileRequest> = {
+ encode(_: GetInstanceProfileRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): GetWorkspaceProfileRequest {
+ decode(input: BinaryReader | Uint8Array, length?: number): GetInstanceProfileRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseGetWorkspaceProfileRequest();
+ const message = createBaseGetInstanceProfileRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -358,40 +358,40 @@ export const GetWorkspaceProfileRequest: MessageFns<GetWorkspaceProfileRequest>
return message;
},
- create(base?: DeepPartial<GetWorkspaceProfileRequest>): GetWorkspaceProfileRequest {
- return GetWorkspaceProfileRequest.fromPartial(base ?? {});
+ create(base?: DeepPartial<GetInstanceProfileRequest>): GetInstanceProfileRequest {
+ return GetInstanceProfileRequest.fromPartial(base ?? {});
},
- fromPartial(_: DeepPartial<GetWorkspaceProfileRequest>): GetWorkspaceProfileRequest {
- const message = createBaseGetWorkspaceProfileRequest();
+ fromPartial(_: DeepPartial<GetInstanceProfileRequest>): GetInstanceProfileRequest {
+ const message = createBaseGetInstanceProfileRequest();
return message;
},
};
-function createBaseWorkspaceSetting(): WorkspaceSetting {
+function createBaseInstanceSetting(): InstanceSetting {
return { name: "", generalSetting: undefined, storageSetting: undefined, memoRelatedSetting: undefined };
}
-export const WorkspaceSetting: MessageFns<WorkspaceSetting> = {
- encode(message: WorkspaceSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+export const InstanceSetting: MessageFns<InstanceSetting> = {
+ encode(message: InstanceSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.generalSetting !== undefined) {
- WorkspaceSetting_GeneralSetting.encode(message.generalSetting, writer.uint32(18).fork()).join();
+ InstanceSetting_GeneralSetting.encode(message.generalSetting, writer.uint32(18).fork()).join();
}
if (message.storageSetting !== undefined) {
- WorkspaceSetting_StorageSetting.encode(message.storageSetting, writer.uint32(26).fork()).join();
+ InstanceSetting_StorageSetting.encode(message.storageSetting, writer.uint32(26).fork()).join();
}
if (message.memoRelatedSetting !== undefined) {
- WorkspaceSetting_MemoRelatedSetting.encode(message.memoRelatedSetting, writer.uint32(34).fork()).join();
+ InstanceSetting_MemoRelatedSetting.encode(message.memoRelatedSetting, writer.uint32(34).fork()).join();
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceSetting {
+ decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseWorkspaceSetting();
+ const message = createBaseInstanceSetting();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -408,7 +408,7 @@ export const WorkspaceSetting: MessageFns<WorkspaceSetting> = {
break;
}
- message.generalSetting = WorkspaceSetting_GeneralSetting.decode(reader, reader.uint32());
+ message.generalSetting = InstanceSetting_GeneralSetting.decode(reader, reader.uint32());
continue;
}
case 3: {
@@ -416,7 +416,7 @@ export const WorkspaceSetting: MessageFns<WorkspaceSetting> = {
break;
}
- message.storageSetting = WorkspaceSetting_StorageSetting.decode(reader, reader.uint32());
+ message.storageSetting = InstanceSetting_StorageSetting.decode(reader, reader.uint32());
continue;
}
case 4: {
@@ -424,7 +424,7 @@ export const WorkspaceSetting: MessageFns<WorkspaceSetting> = {
break;
}
- message.memoRelatedSetting = WorkspaceSetting_MemoRelatedSetting.decode(reader, reader.uint32());
+ message.memoRelatedSetting = InstanceSetting_MemoRelatedSetting.decode(reader, reader.uint32());
continue;
}
}
@@ -436,26 +436,26 @@ export const WorkspaceSetting: MessageFns<WorkspaceSetting> = {
return message;
},
- create(base?: DeepPartial<WorkspaceSetting>): WorkspaceSetting {
- return WorkspaceSetting.fromPartial(base ?? {});
+ create(base?: DeepPartial<InstanceSetting>): InstanceSetting {
+ return InstanceSetting.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<WorkspaceSetting>): WorkspaceSetting {
- const message = createBaseWorkspaceSetting();
+ fromPartial(object: DeepPartial<InstanceSetting>): InstanceSetting {
+ const message = createBaseInstanceSetting();
message.name = object.name ?? "";
message.generalSetting = (object.generalSetting !== undefined && object.generalSetting !== null)
- ? WorkspaceSetting_GeneralSetting.fromPartial(object.generalSetting)
+ ? InstanceSetting_GeneralSetting.fromPartial(object.generalSetting)
: undefined;
message.storageSetting = (object.storageSetting !== undefined && object.storageSetting !== null)
- ? WorkspaceSetting_StorageSetting.fromPartial(object.storageSetting)
+ ? InstanceSetting_StorageSetting.fromPartial(object.storageSetting)
: undefined;
message.memoRelatedSetting = (object.memoRelatedSetting !== undefined && object.memoRelatedSetting !== null)
- ? WorkspaceSetting_MemoRelatedSetting.fromPartial(object.memoRelatedSetting)
+ ? InstanceSetting_MemoRelatedSetting.fromPartial(object.memoRelatedSetting)
: undefined;
return message;
},
};
-function createBaseWorkspaceSetting_GeneralSetting(): WorkspaceSetting_GeneralSetting {
+function createBaseInstanceSetting_GeneralSetting(): InstanceSetting_GeneralSetting {
return {
theme: "",
disallowUserRegistration: false,
@@ -469,8 +469,8 @@ function createBaseWorkspaceSetting_GeneralSetting(): WorkspaceSetting_GeneralSe
};
}
-export const WorkspaceSetting_GeneralSetting: MessageFns<WorkspaceSetting_GeneralSetting> = {
- encode(message: WorkspaceSetting_GeneralSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+export const InstanceSetting_GeneralSetting: MessageFns<InstanceSetting_GeneralSetting> = {
+ encode(message: InstanceSetting_GeneralSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.theme !== "") {
writer.uint32(10).string(message.theme);
}
@@ -487,7 +487,7 @@ export const WorkspaceSetting_GeneralSetting: MessageFns<WorkspaceSetting_Genera
writer.uint32(42).string(message.additionalStyle);
}
if (message.customProfile !== undefined) {
- WorkspaceSetting_GeneralSetting_CustomProfile.encode(message.customProfile, writer.uint32(50).fork()).join();
+ InstanceSetting_GeneralSetting_CustomProfile.encode(message.customProfile, writer.uint32(50).fork()).join();
}
if (message.weekStartDayOffset !== 0) {
writer.uint32(56).int32(message.weekStartDayOffset);
@@ -501,10 +501,10 @@ export const WorkspaceSetting_GeneralSetting: MessageFns<WorkspaceSetting_Genera
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceSetting_GeneralSetting {
+ decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting_GeneralSetting {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseWorkspaceSetting_GeneralSetting();
+ const message = createBaseInstanceSetting_GeneralSetting();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -553,7 +553,7 @@ export const WorkspaceSetting_GeneralSetting: MessageFns<WorkspaceSetting_Genera
break;
}
- message.customProfile = WorkspaceSetting_GeneralSetting_CustomProfile.decode(reader, reader.uint32());
+ message.customProfile = InstanceSetting_GeneralSetting_CustomProfile.decode(reader, reader.uint32());
continue;
}
case 7: {
@@ -589,18 +589,18 @@ export const WorkspaceSetting_GeneralSetting: MessageFns<WorkspaceSetting_Genera
return message;
},
- create(base?: DeepPartial<WorkspaceSetting_GeneralSetting>): WorkspaceSetting_GeneralSetting {
- return WorkspaceSetting_GeneralSetting.fromPartial(base ?? {});
+ create(base?: DeepPartial<InstanceSetting_GeneralSetting>): InstanceSetting_GeneralSetting {
+ return InstanceSetting_GeneralSetting.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<WorkspaceSetting_GeneralSetting>): WorkspaceSetting_GeneralSetting {
- const message = createBaseWorkspaceSetting_GeneralSetting();
+ fromPartial(object: DeepPartial<InstanceSetting_GeneralSetting>): InstanceSetting_GeneralSetting {
+ const message = createBaseInstanceSetting_GeneralSetting();
message.theme = object.theme ?? "";
message.disallowUserRegistration = object.disallowUserRegistration ?? false;
message.disallowPasswordAuth = object.disallowPasswordAuth ?? false;
message.additionalScript = object.additionalScript ?? "";
message.additionalStyle = object.additionalStyle ?? "";
message.customProfile = (object.customProfile !== undefined && object.customProfile !== null)
- ? WorkspaceSetting_GeneralSetting_CustomProfile.fromPartial(object.customProfile)
+ ? InstanceSetting_GeneralSetting_CustomProfile.fromPartial(object.customProfile)
: undefined;
message.weekStartDayOffset = object.weekStartDayOffset ?? 0;
message.disallowChangeUsername = object.disallowChangeUsername ?? false;
@@ -609,109 +609,108 @@ export const WorkspaceSetting_GeneralSetting: MessageFns<WorkspaceSetting_Genera
},
};
-function createBaseWorkspaceSetting_GeneralSetting_CustomProfile(): WorkspaceSetting_GeneralSetting_CustomProfile {
+function createBaseInstanceSetting_GeneralSetting_CustomProfile(): InstanceSetting_GeneralSetting_CustomProfile {
return { title: "", description: "", logoUrl: "", locale: "" };
}
-export const WorkspaceSetting_GeneralSetting_CustomProfile: MessageFns<WorkspaceSetting_GeneralSetting_CustomProfile> =
- {
- encode(
- message: WorkspaceSetting_GeneralSetting_CustomProfile,
- writer: BinaryWriter = new BinaryWriter(),
- ): BinaryWriter {
- if (message.title !== "") {
- writer.uint32(10).string(message.title);
- }
- if (message.description !== "") {
- writer.uint32(18).string(message.description);
- }
- if (message.logoUrl !== "") {
- writer.uint32(26).string(message.logoUrl);
- }
- if (message.locale !== "") {
- writer.uint32(34).string(message.locale);
- }
- return writer;
- },
+export const InstanceSetting_GeneralSetting_CustomProfile: MessageFns<InstanceSetting_GeneralSetting_CustomProfile> = {
+ encode(
+ message: InstanceSetting_GeneralSetting_CustomProfile,
+ writer: BinaryWriter = new BinaryWriter(),
+ ): BinaryWriter {
+ if (message.title !== "") {
+ writer.uint32(10).string(message.title);
+ }
+ if (message.description !== "") {
+ writer.uint32(18).string(message.description);
+ }
+ if (message.logoUrl !== "") {
+ writer.uint32(26).string(message.logoUrl);
+ }
+ if (message.locale !== "") {
+ writer.uint32(34).string(message.locale);
+ }
+ return writer;
+ },
- decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceSetting_GeneralSetting_CustomProfile {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseWorkspaceSetting_GeneralSetting_CustomProfile();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.title = reader.string();
- continue;
+ decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting_GeneralSetting_CustomProfile {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseInstanceSetting_GeneralSetting_CustomProfile();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
}
- case 2: {
- if (tag !== 18) {
- break;
- }
- message.description = reader.string();
- continue;
+ message.title = reader.string();
+ continue;
+ }
+ case 2: {
+ if (tag !== 18) {
+ break;
}
- case 3: {
- if (tag !== 26) {
- break;
- }
- message.logoUrl = reader.string();
- continue;
+ message.description = reader.string();
+ continue;
+ }
+ case 3: {
+ if (tag !== 26) {
+ break;
}
- case 4: {
- if (tag !== 34) {
- break;
- }
- message.locale = reader.string();
- continue;
- }
+ message.logoUrl = reader.string();
+ continue;
}
- if ((tag & 7) === 4 || tag === 0) {
- break;
+ case 4: {
+ if (tag !== 34) {
+ break;
+ }
+
+ message.locale = reader.string();
+ continue;
}
- reader.skip(tag & 7);
}
- return message;
- },
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
- create(
- base?: DeepPartial<WorkspaceSetting_GeneralSetting_CustomProfile>,
- ): WorkspaceSetting_GeneralSetting_CustomProfile {
- return WorkspaceSetting_GeneralSetting_CustomProfile.fromPartial(base ?? {});
- },
- fromPartial(
- object: DeepPartial<WorkspaceSetting_GeneralSetting_CustomProfile>,
- ): WorkspaceSetting_GeneralSetting_CustomProfile {
- const message = createBaseWorkspaceSetting_GeneralSetting_CustomProfile();
- message.title = object.title ?? "";
- message.description = object.description ?? "";
- message.logoUrl = object.logoUrl ?? "";
- message.locale = object.locale ?? "";
- return message;
- },
- };
+ create(
+ base?: DeepPartial<InstanceSetting_GeneralSetting_CustomProfile>,
+ ): InstanceSetting_GeneralSetting_CustomProfile {
+ return InstanceSetting_GeneralSetting_CustomProfile.fromPartial(base ?? {});
+ },
+ fromPartial(
+ object: DeepPartial<InstanceSetting_GeneralSetting_CustomProfile>,
+ ): InstanceSetting_GeneralSetting_CustomProfile {
+ const message = createBaseInstanceSetting_GeneralSetting_CustomProfile();
+ message.title = object.title ?? "";
+ message.description = object.description ?? "";
+ message.logoUrl = object.logoUrl ?? "";
+ message.locale = object.locale ?? "";
+ return message;
+ },
+};
-function createBaseWorkspaceSetting_StorageSetting(): WorkspaceSetting_StorageSetting {
+function createBaseInstanceSetting_StorageSetting(): InstanceSetting_StorageSetting {
return {
- storageType: WorkspaceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED,
+ storageType: InstanceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED,
filepathTemplate: "",
uploadSizeLimitMb: 0,
s3Config: undefined,
};
}
-export const WorkspaceSetting_StorageSetting: MessageFns<WorkspaceSetting_StorageSetting> = {
- encode(message: WorkspaceSetting_StorageSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.storageType !== WorkspaceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED) {
- writer.uint32(8).int32(workspaceSetting_StorageSetting_StorageTypeToNumber(message.storageType));
+export const InstanceSetting_StorageSetting: MessageFns<InstanceSetting_StorageSetting> = {
+ encode(message: InstanceSetting_StorageSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.storageType !== InstanceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED) {
+ writer.uint32(8).int32(instanceSetting_StorageSetting_StorageTypeToNumber(message.storageType));
}
if (message.filepathTemplate !== "") {
writer.uint32(18).string(message.filepathTemplate);
@@ -720,15 +719,15 @@ export const WorkspaceSetting_StorageSetting: MessageFns<WorkspaceSetting_Storag
writer.uint32(24).int64(message.uploadSizeLimitMb);
}
if (message.s3Config !== undefined) {
- WorkspaceSetting_StorageSetting_S3Config.encode(message.s3Config, writer.uint32(34).fork()).join();
+ InstanceSetting_StorageSetting_S3Config.encode(message.s3Config, writer.uint32(34).fork()).join();
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceSetting_StorageSetting {
+ decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting_StorageSetting {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseWorkspaceSetting_StorageSetting();
+ const message = createBaseInstanceSetting_StorageSetting();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -737,7 +736,7 @@ export const WorkspaceSetting_StorageSetting: MessageFns<WorkspaceSetting_Storag
break;
}
- message.storageType = workspaceSetting_StorageSetting_StorageTypeFromJSON(reader.int32());
+ message.storageType = instanceSetting_StorageSetting_StorageTypeFromJSON(reader.int32());
continue;
}
case 2: {
@@ -761,7 +760,7 @@ export const WorkspaceSetting_StorageSetting: MessageFns<WorkspaceSetting_Storag
break;
}
- message.s3Config = WorkspaceSetting_StorageSetting_S3Config.decode(reader, reader.uint32());
+ message.s3Config = InstanceSetting_StorageSetting_S3Config.decode(reader, reader.uint32());
continue;
}
}
@@ -773,27 +772,27 @@ export const WorkspaceSetting_StorageSetting: MessageFns<WorkspaceSetting_Storag
return message;
},
- create(base?: DeepPartial<WorkspaceSetting_StorageSetting>): WorkspaceSetting_StorageSetting {
- return WorkspaceSetting_StorageSetting.fromPartial(base ?? {});
+ create(base?: DeepPartial<InstanceSetting_StorageSetting>): InstanceSetting_StorageSetting {
+ return InstanceSetting_StorageSetting.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<WorkspaceSetting_StorageSetting>): WorkspaceSetting_StorageSetting {
- const message = createBaseWorkspaceSetting_StorageSetting();
- message.storageType = object.storageType ?? WorkspaceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED;
+ fromPartial(object: DeepPartial<InstanceSetting_StorageSetting>): InstanceSetting_StorageSetting {
+ const message = createBaseInstanceSetting_StorageSetting();
+ message.storageType = object.storageType ?? InstanceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED;
message.filepathTemplate = object.filepathTemplate ?? "";
message.uploadSizeLimitMb = object.uploadSizeLimitMb ?? 0;
message.s3Config = (object.s3Config !== undefined && object.s3Config !== null)
- ? WorkspaceSetting_StorageSetting_S3Config.fromPartial(object.s3Config)
+ ? InstanceSetting_StorageSetting_S3Config.fromPartial(object.s3Config)
: undefined;
return message;
},
};
-function createBaseWorkspaceSetting_StorageSetting_S3Config(): WorkspaceSetting_StorageSetting_S3Config {
+function createBaseInstanceSetting_StorageSetting_S3Config(): InstanceSetting_StorageSetting_S3Config {
return { accessKeyId: "", accessKeySecret: "", endpoint: "", region: "", bucket: "", usePathStyle: false };
}
-export const WorkspaceSetting_StorageSetting_S3Config: MessageFns<WorkspaceSetting_StorageSetting_S3Config> = {
- encode(message: WorkspaceSetting_StorageSetting_S3Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+export const InstanceSetting_StorageSetting_S3Config: MessageFns<InstanceSetting_StorageSetting_S3Config> = {
+ encode(message: InstanceSetting_StorageSetting_S3Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.accessKeyId !== "") {
writer.uint32(10).string(message.accessKeyId);
}
@@ -815,10 +814,10 @@ export const WorkspaceSetting_StorageSetting_S3Config: MessageFns<WorkspaceSetti
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceSetting_StorageSetting_S3Config {
+ decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting_StorageSetting_S3Config {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseWorkspaceSetting_StorageSetting_S3Config();
+ const message = createBaseInstanceSetting_StorageSetting_S3Config();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -879,11 +878,11 @@ export const WorkspaceSetting_StorageSetting_S3Config: MessageFns<WorkspaceSetti
return message;
},
- create(base?: DeepPartial<WorkspaceSetting_StorageSetting_S3Config>): WorkspaceSetting_StorageSetting_S3Config {
- return WorkspaceSetting_StorageSetting_S3Config.fromPartial(base ?? {});
+ create(base?: DeepPartial<InstanceSetting_StorageSetting_S3Config>): InstanceSetting_StorageSetting_S3Config {
+ return InstanceSetting_StorageSetting_S3Config.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<WorkspaceSetting_StorageSetting_S3Config>): WorkspaceSetting_StorageSetting_S3Config {
- const message = createBaseWorkspaceSetting_StorageSetting_S3Config();
+ fromPartial(object: DeepPartial<InstanceSetting_StorageSetting_S3Config>): InstanceSetting_StorageSetting_S3Config {
+ const message = createBaseInstanceSetting_StorageSetting_S3Config();
message.accessKeyId = object.accessKeyId ?? "";
message.accessKeySecret = object.accessKeySecret ?? "";
message.endpoint = object.endpoint ?? "";
@@ -894,7 +893,7 @@ export const WorkspaceSetting_StorageSetting_S3Config: MessageFns<WorkspaceSetti
},
};
-function createBaseWorkspaceSetting_MemoRelatedSetting(): WorkspaceSetting_MemoRelatedSetting {
+function createBaseInstanceSetting_MemoRelatedSetting(): InstanceSetting_MemoRelatedSetting {
return {
disallowPublicVisibility: false,
displayWithUpdateTime: false,
@@ -908,8 +907,8 @@ function createBaseWorkspaceSetting_MemoRelatedSetting(): WorkspaceSetting_MemoR
};
}
-export const WorkspaceSetting_MemoRelatedSetting: MessageFns<WorkspaceSetting_MemoRelatedSetting> = {
- encode(message: WorkspaceSetting_MemoRelatedSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+export const InstanceSetting_MemoRelatedSetting: MessageFns<InstanceSetting_MemoRelatedSetting> = {
+ encode(message: InstanceSetting_MemoRelatedSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.disallowPublicVisibility !== false) {
writer.uint32(8).bool(message.disallowPublicVisibility);
}
@@ -940,10 +939,10 @@ export const WorkspaceSetting_MemoRelatedSetting: MessageFns<WorkspaceSetting_Me
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceSetting_MemoRelatedSetting {
+ decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting_MemoRelatedSetting {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseWorkspaceSetting_MemoRelatedSetting();
+ const message = createBaseInstanceSetting_MemoRelatedSetting();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1028,11 +1027,11 @@ export const WorkspaceSetting_MemoRelatedSetting: MessageFns<WorkspaceSetting_Me
return message;
},
- create(base?: DeepPartial<WorkspaceSetting_MemoRelatedSetting>): WorkspaceSetting_MemoRelatedSetting {
- return WorkspaceSetting_MemoRelatedSetting.fromPartial(base ?? {});
+ create(base?: DeepPartial<InstanceSetting_MemoRelatedSetting>): InstanceSetting_MemoRelatedSetting {
+ return InstanceSetting_MemoRelatedSetting.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<WorkspaceSetting_MemoRelatedSetting>): WorkspaceSetting_MemoRelatedSetting {
- const message = createBaseWorkspaceSetting_MemoRelatedSetting();
+ fromPartial(object: DeepPartial<InstanceSetting_MemoRelatedSetting>): InstanceSetting_MemoRelatedSetting {
+ const message = createBaseInstanceSetting_MemoRelatedSetting();
message.disallowPublicVisibility = object.disallowPublicVisibility ?? false;
message.displayWithUpdateTime = object.displayWithUpdateTime ?? false;
message.contentLengthLimit = object.contentLengthLimit ?? 0;
@@ -1046,22 +1045,22 @@ export const WorkspaceSetting_MemoRelatedSetting: MessageFns<WorkspaceSetting_Me
},
};
-function createBaseGetWorkspaceSettingRequest(): GetWorkspaceSettingRequest {
+function createBaseGetInstanceSettingRequest(): GetInstanceSettingRequest {
return { name: "" };
}
-export const GetWorkspaceSettingRequest: MessageFns<GetWorkspaceSettingRequest> = {
- encode(message: GetWorkspaceSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+export const GetInstanceSettingRequest: MessageFns<GetInstanceSettingRequest> = {
+ encode(message: GetInstanceSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): GetWorkspaceSettingRequest {
+ decode(input: BinaryReader | Uint8Array, length?: number): GetInstanceSettingRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseGetWorkspaceSettingRequest();
+ const message = createBaseGetInstanceSettingRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1082,24 +1081,24 @@ export const GetWorkspaceSettingRequest: MessageFns<GetWorkspaceSettingRequest>
return message;
},
- create(base?: DeepPartial<GetWorkspaceSettingRequest>): GetWorkspaceSettingRequest {
- return GetWorkspaceSettingRequest.fromPartial(base ?? {});
+ create(base?: DeepPartial<GetInstanceSettingRequest>): GetInstanceSettingRequest {
+ return GetInstanceSettingRequest.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<GetWorkspaceSettingRequest>): GetWorkspaceSettingRequest {
- const message = createBaseGetWorkspaceSettingRequest();
+ fromPartial(object: DeepPartial<GetInstanceSettingRequest>): GetInstanceSettingRequest {
+ const message = createBaseGetInstanceSettingRequest();
message.name = object.name ?? "";
return message;
},
};
-function createBaseUpdateWorkspaceSettingRequest(): UpdateWorkspaceSettingRequest {
+function createBaseUpdateInstanceSettingRequest(): UpdateInstanceSettingRequest {
return { setting: undefined, updateMask: undefined };
}
-export const UpdateWorkspaceSettingRequest: MessageFns<UpdateWorkspaceSettingRequest> = {
- encode(message: UpdateWorkspaceSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+export const UpdateInstanceSettingRequest: MessageFns<UpdateInstanceSettingRequest> = {
+ encode(message: UpdateInstanceSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.setting !== undefined) {
- WorkspaceSetting.encode(message.setting, writer.uint32(10).fork()).join();
+ InstanceSetting.encode(message.setting, writer.uint32(10).fork()).join();
}
if (message.updateMask !== undefined) {
FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
@@ -1107,10 +1106,10 @@ export const UpdateWorkspaceSettingRequest: MessageFns<UpdateWorkspaceSettingReq
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): UpdateWorkspaceSettingRequest {
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateInstanceSettingRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseUpdateWorkspaceSettingRequest();
+ const message = createBaseUpdateInstanceSettingRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1119,7 +1118,7 @@ export const UpdateWorkspaceSettingRequest: MessageFns<UpdateWorkspaceSettingReq
break;
}
- message.setting = WorkspaceSetting.decode(reader, reader.uint32());
+ message.setting = InstanceSetting.decode(reader, reader.uint32());
continue;
}
case 2: {
@@ -1139,38 +1138,38 @@ export const UpdateWorkspaceSettingRequest: MessageFns<UpdateWorkspaceSettingReq
return message;
},
- create(base?: DeepPartial<UpdateWorkspaceSettingRequest>): UpdateWorkspaceSettingRequest {
- return UpdateWorkspaceSettingRequest.fromPartial(base ?? {});
+ create(base?: DeepPartial<UpdateInstanceSettingRequest>): UpdateInstanceSettingRequest {
+ return UpdateInstanceSettingRequest.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<UpdateWorkspaceSettingRequest>): UpdateWorkspaceSettingRequest {
- const message = createBaseUpdateWorkspaceSettingRequest();
+ fromPartial(object: DeepPartial<UpdateInstanceSettingRequest>): UpdateInstanceSettingRequest {
+ const message = createBaseUpdateInstanceSettingRequest();
message.setting = (object.setting !== undefined && object.setting !== null)
- ? WorkspaceSetting.fromPartial(object.setting)
+ ? InstanceSetting.fromPartial(object.setting)
: undefined;
message.updateMask = object.updateMask ?? undefined;
return message;
},
};
-export type WorkspaceServiceDefinition = typeof WorkspaceServiceDefinition;
-export const WorkspaceServiceDefinition = {
- name: "WorkspaceService",
- fullName: "memos.api.v1.WorkspaceService",
+export type InstanceServiceDefinition = typeof InstanceServiceDefinition;
+export const InstanceServiceDefinition = {
+ name: "InstanceService",
+ fullName: "memos.api.v1.InstanceService",
methods: {
- /** Gets the workspace profile. */
- getWorkspaceProfile: {
- name: "GetWorkspaceProfile",
- requestType: GetWorkspaceProfileRequest,
+ /** Gets the instance profile. */
+ getInstanceProfile: {
+ name: "GetInstanceProfile",
+ requestType: GetInstanceProfileRequest,
requestStream: false,
- responseType: WorkspaceProfile,
+ responseType: InstanceProfile,
responseStream: false,
options: {
_unknownFields: {
578365826: [
new Uint8Array([
- 27,
+ 26,
18,
- 25,
+ 24,
47,
97,
112,
@@ -1179,13 +1178,12 @@ export const WorkspaceServiceDefinition = {
118,
49,
47,
- 119,
- 111,
- 114,
- 107,
+ 105,
+ 110,
115,
- 112,
+ 116,
97,
+ 110,
99,
101,
47,
@@ -1201,21 +1199,21 @@ export const WorkspaceServiceDefinition = {
},
},
},
- /** Gets a workspace setting. */
- getWorkspaceSetting: {
- name: "GetWorkspaceSetting",
- requestType: GetWorkspaceSettingRequest,
+ /** Gets an instance setting. */
+ getInstanceSetting: {
+ name: "GetInstanceSetting",
+ requestType: GetInstanceSettingRequest,
requestStream: false,
- responseType: WorkspaceSetting,
+ responseType: InstanceSetting,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([4, 110, 97, 109, 101])],
578365826: [
new Uint8Array([
- 37,
+ 36,
18,
- 35,
+ 34,
47,
97,
112,
@@ -1230,13 +1228,12 @@ export const WorkspaceServiceDefinition = {
109,
101,
61,
- 119,
- 111,
- 114,
- 107,
+ 105,
+ 110,
115,
- 112,
+ 116,
97,
+ 110,
99,
101,
47,
@@ -1256,12 +1253,12 @@ export const WorkspaceServiceDefinition = {
},
},
},
- /** Updates a workspace setting. */
- updateWorkspaceSetting: {
- name: "UpdateWorkspaceSetting",
- requestType: UpdateWorkspaceSettingRequest,
+ /** Updates an instance setting. */
+ updateInstanceSetting: {
+ name: "UpdateInstanceSetting",
+ requestType: UpdateInstanceSettingRequest,
requestStream: false,
- responseType: WorkspaceSetting,
+ responseType: InstanceSetting,
responseStream: false,
options: {
_unknownFields: {
@@ -1291,7 +1288,7 @@ export const WorkspaceServiceDefinition = {
],
578365826: [
new Uint8Array([
- 54,
+ 53,
58,
7,
115,
@@ -1302,7 +1299,7 @@ export const WorkspaceServiceDefinition = {
110,
103,
50,
- 43,
+ 42,
47,
97,
112,
@@ -1325,13 +1322,12 @@ export const WorkspaceServiceDefinition = {
109,
101,
61,
- 119,
- 111,
- 114,
- 107,
+ 105,
+ 110,
115,
- 112,
+ 116,
97,
+ 110,
99,
101,
47,
diff --git a/web/src/utils/theme.ts b/web/src/utils/theme.ts
index 7957cb558..e4e80a2e0 100644
--- a/web/src/utils/theme.ts
+++ b/web/src/utils/theme.ts
@@ -69,14 +69,14 @@ export const loadTheme = (themeName: string): void => {
const validTheme = validateTheme(themeName);
// Remove existing theme
- document.getElementById("workspace-theme")?.remove();
+ document.getElementById("instance-theme")?.remove();
// Apply theme (skip for default)
if (validTheme !== "default") {
const css = THEME_CONTENT[validTheme];
if (css) {
const style = document.createElement("style");
- style.id = "workspace-theme";
+ style.id = "instance-theme";
style.textContent = css;
document.head.appendChild(style);
}