Skip to content

armgit / memos

Public Imported from GitHub
0

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

chore: update demo site

Johnny5562282822be
diff --git a/proto/api/v1/README.md b/proto/api/v1/README.md
new file mode 100644
index 000000000..09b7b3d6c
--- /dev/null
+++ b/proto/api/v1/README.md
@@ -0,0 +1,3 @@
+# Memos API Design
+
+This API design should follow the guidelines and best practices outlined in the [Google API Improvement Proposals (AIPs)](https://google.aip.dev/).
diff --git a/server/router/api/v1/workspace_setting_service.go b/server/router/api/v1/workspace_setting_service.go
index 1ea2f0f04..f72b49471 100644
--- a/server/router/api/v1/workspace_setting_service.go
+++ b/server/router/api/v1/workspace_setting_service.go
@@ -70,12 +70,6 @@ func (s *APIV1Service) SetWorkspaceSetting(ctx context.Context, request *v1pb.Se
}
updateSetting := convertWorkspaceSettingToStore(request.Setting)
- // Don't allow to update workspace general setting in demo mode.
- // Such as disallow user registration, disallow password auth, etc.
- if s.Profile.Mode == "demo" && updateSetting.Key == storepb.WorkspaceSettingKey_GENERAL {
- return nil, status.Errorf(codes.InvalidArgument, "setting workspace setting is not allowed in demo mode")
- }
-
workspaceSetting, err := s.Store.UpsertWorkspaceSetting(ctx, updateSetting)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to upsert workspace setting: %v", err)
diff --git a/web/src/components/Settings/WorkspaceSection.tsx b/web/src/components/Settings/WorkspaceSection.tsx
index 7660f37b4..81a2b24a8 100644
--- a/web/src/components/Settings/WorkspaceSection.tsx
+++ b/web/src/components/Settings/WorkspaceSection.tsx
@@ -120,6 +120,7 @@ const WorkspaceSection = () => {
<div className="w-full flex flex-row justify-between items-center">
<span>{t("setting.workspace-section.disallow-user-registration")}</span>
<Switch
+ disabled={workspaceStore.state.profile.mode === "demo"}
checked={workspaceGeneralSetting.disallowUserRegistration}
onChange={(event) => updatePartialSetting({ disallowUserRegistration: event.target.checked })}
/>
@@ -127,7 +128,7 @@ const WorkspaceSection = () => {
<div className="w-full flex flex-row justify-between items-center">
<span>{t("setting.workspace-section.disallow-password-auth")}</span>
<Switch
- disabled={identityProviderList.length === 0 ? true : false}
+ disabled={workspaceStore.state.profile.mode === "demo" || identityProviderList.length === 0}
checked={workspaceGeneralSetting.disallowPasswordAuth}
onChange={(event) => updatePartialSetting({ disallowPasswordAuth: event.target.checked })}
/>