chore: remove unused system setting

pull/2998/head
Steven 1 year ago
parent 50a3af3b29
commit ce32206677

@ -477,7 +477,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/github_com_usememos_memos_api_v1.CreateMemoRequest"
"$ref": "#/definitions/api_v1.CreateMemoRequest"
}
}
],
@ -695,7 +695,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/github_com_usememos_memos_api_v1.PatchMemoRequest"
"$ref": "#/definitions/api_v1.PatchMemoRequest"
}
}
],
@ -992,7 +992,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api_v1.CreateResourceRequest"
"$ref": "#/definitions/github_com_usememos_memos_api_v1.CreateResourceRequest"
}
}
],
@ -1116,7 +1116,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api_v1.UpdateResourceRequest"
"$ref": "#/definitions/github_com_usememos_memos_api_v1.UpdateResourceRequest"
}
}
],
@ -1155,7 +1155,7 @@ const docTemplate = `{
"200": {
"description": "System GetSystemStatus",
"schema": {
"$ref": "#/definitions/api_v1.SystemStatus"
"$ref": "#/definitions/github_com_usememos_memos_api_v1.SystemStatus"
}
},
"401": {
@ -1331,7 +1331,7 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api_v1.SystemSetting"
"$ref": "#/definitions/github_com_usememos_memos_api_v1.SystemSetting"
}
}
},
@ -1361,17 +1361,11 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api_v1.UpsertSystemSettingRequest"
"$ref": "#/definitions/github_com_usememos_memos_api_v1.UpsertSystemSettingRequest"
}
}
],
"responses": {
"200": {
"description": "Created system setting",
"schema": {
"$ref": "#/definitions/store.SystemSetting"
}
},
"400": {
"description": "Malformatted post system setting request | invalid system setting"
},
@ -1592,7 +1586,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/github_com_usememos_memos_api_v1.CreateUserRequest"
"$ref": "#/definitions/api_v1.CreateUserRequest"
}
}
],
@ -1773,7 +1767,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/github_com_usememos_memos_api_v1.UpdateUserRequest"
"$ref": "#/definitions/api_v1.UpdateUserRequest"
}
}
],
@ -1940,10 +1934,6 @@ const docTemplate = `{
"description": "Description is the server description.",
"type": "string"
},
"externalUrl": {
"description": "ExternalURL is the external url of server. e.g. https://usermemos.com",
"type": "string"
},
"locale": {
"description": "Locale is the server default locale.",
"type": "string"
@ -2574,10 +2564,6 @@ const docTemplate = `{
"description": "Description is the server description.",
"type": "string"
},
"externalUrl": {
"description": "ExternalURL is the external url of server. e.g. https://usermemos.com",
"type": "string"
},
"locale": {
"description": "Locale is the server default locale.",
"type": "string"
@ -3347,20 +3333,6 @@ const docTemplate = `{
}
}
},
"store.SystemSetting": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"store.User": {
"type": "object",
"properties": {

@ -242,7 +242,7 @@ Visibility can be PUBLIC, PROTECTED or PRIVATE
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| body | body | Request object. | Yes | [github_com_usememos_memos_api_v1.CreateMemoRequest](#github_com_usememos_memos_api_v1creatememorequest) |
| body | body | Request object. | Yes | [api_v1.CreateMemoRequest](#api_v1creatememorequest) |
##### Responses
@ -314,7 +314,7 @@ Visibility can be PUBLIC, PROTECTED or PRIVATE
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| memoId | path | ID of memo to update | Yes | integer |
| body | body | Patched object. | Yes | [github_com_usememos_memos_api_v1.PatchMemoRequest](#github_com_usememos_memos_api_v1patchmemorequest) |
| body | body | Patched object. | Yes | [api_v1.PatchMemoRequest](#api_v1patchmemorequest) |
##### Responses
@ -501,7 +501,7 @@ Get system GetSystemStatus
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | System GetSystemStatus | [api_v1.SystemStatus](#api_v1systemstatus) |
| 200 | System GetSystemStatus | [github_com_usememos_memos_api_v1.SystemStatus](#github_com_usememos_memos_api_v1systemstatus) |
| 401 | Missing user in session \| Unauthorized | |
| 500 | Failed to find host user \| Failed to find system setting list \| Failed to unmarshal system setting customized profile value | |
@ -552,7 +552,7 @@ Create resource
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| body | body | Request object. | Yes | [api_v1.CreateResourceRequest](#api_v1createresourcerequest) |
| body | body | Request object. | Yes | [github_com_usememos_memos_api_v1.CreateResourceRequest](#github_com_usememos_memos_api_v1createresourcerequest) |
##### Responses
@ -596,7 +596,7 @@ Update a resource
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| resourceId | path | Resource ID | Yes | integer |
| patch | body | Patch resource request | Yes | [api_v1.UpdateResourceRequest](#api_v1updateresourcerequest) |
| patch | body | Patch resource request | Yes | [github_com_usememos_memos_api_v1.UpdateResourceRequest](#github_com_usememos_memos_api_v1updateresourcerequest) |
##### Responses
@ -721,7 +721,7 @@ Get a list of system settings
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | System setting list | [ [api_v1.SystemSetting](#api_v1systemsetting) ] |
| 200 | System setting list | [ [github_com_usememos_memos_api_v1.SystemSetting](#github_com_usememos_memos_api_v1systemsetting) ] |
| 401 | Missing user in session \| Unauthorized | |
| 500 | Failed to find user \| Failed to find system setting list | |
@ -734,17 +734,16 @@ Create system setting
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| body | body | Request object. | Yes | [api_v1.UpsertSystemSettingRequest](#api_v1upsertsystemsettingrequest) |
| body | body | Request object. | Yes | [github_com_usememos_memos_api_v1.UpsertSystemSettingRequest](#github_com_usememos_memos_api_v1upsertsystemsettingrequest) |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Created system setting | [store.SystemSetting](#storesystemsetting) |
| 400 | Malformatted post system setting request \| invalid system setting | |
| 401 | Missing user in session \| Unauthorized | |
| 403 | Cannot disable passwords if no SSO identity provider is configured. | |
| 500 | Failed to find user \| Failed to upsert system setting | |
| Code | Description |
| ---- | ----------- |
| 400 | Malformatted post system setting request \| invalid system setting |
| 401 | Missing user in session \| Unauthorized |
| 403 | Cannot disable passwords if no SSO identity provider is configured. |
| 500 | Failed to find user \| Failed to upsert system setting |
---
### /api/v1/tag
@ -843,7 +842,7 @@ Create a user
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| body | body | Request object | Yes | [github_com_usememos_memos_api_v1.CreateUserRequest](#github_com_usememos_memos_api_v1createuserrequest) |
| body | body | Request object | Yes | [api_v1.CreateUserRequest](#api_v1createuserrequest) |
##### Responses
@ -908,7 +907,7 @@ Update a user
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| id | path | User ID | Yes | string |
| patch | body | Patch request | Yes | [github_com_usememos_memos_api_v1.UpdateUserRequest](#github_com_usememos_memos_api_v1updateuserrequest) |
| patch | body | Patch request | Yes | [api_v1.UpdateUserRequest](#api_v1updateuserrequest) |
##### Responses
@ -1032,7 +1031,6 @@ Get GetImage from URL
| ---- | ---- | ----------- | -------- |
| appearance | string | Appearance is the server default appearance. | No |
| description | string | Description is the server description. | No |
| externalUrl | string | ExternalURL is the external url of server. e.g. https://usermemos.com | No |
| locale | string | Locale is the server default locale. | No |
| logoUrl | string | LogoURL is the url of logo image. | No |
| name | string | Name is the server name, default is `memos` | No |
@ -1328,7 +1326,6 @@ Get GetImage from URL
| ---- | ---- | ----------- | -------- |
| appearance | string | Appearance is the server default appearance. | No |
| description | string | Description is the server description. | No |
| externalUrl | string | ExternalURL is the external url of server. e.g. https://usermemos.com | No |
| locale | string | Locale is the server default locale. | No |
| logoUrl | string | LogoURL is the url of logo image. | No |
| name | string | Name is the server name, default is `memos` | No |
@ -1689,14 +1686,6 @@ Get GetImage from URL
| name | string | | No |
| type | string | | No |
#### store.SystemSetting
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| description | string | | No |
| name | string | | No |
| value | string | | No |
#### store.User
| Name | Type | Description | Required |

@ -70,9 +70,6 @@ definitions:
description:
description: Description is the server description.
type: string
externalUrl:
description: ExternalURL is the external url of server. e.g. https://usermemos.com
type: string
locale:
description: Locale is the server default locale.
type: string
@ -502,9 +499,6 @@ definitions:
description:
description: Description is the server description.
type: string
externalUrl:
description: ExternalURL is the external url of server. e.g. https://usermemos.com
type: string
locale:
description: Locale is the server default locale.
type: string
@ -1029,15 +1023,6 @@ definitions:
type:
type: string
type: object
store.SystemSetting:
properties:
description:
type: string
name:
type: string
value:
type: string
type: object
store.User:
properties:
avatarURL:
@ -1397,7 +1382,7 @@ paths:
name: body
required: true
schema:
$ref: '#/definitions/github_com_usememos_memos_api_v1.CreateMemoRequest'
$ref: '#/definitions/api_v1.CreateMemoRequest'
produces:
- application/json
responses:
@ -1494,7 +1479,7 @@ paths:
name: body
required: true
schema:
$ref: '#/definitions/github_com_usememos_memos_api_v1.PatchMemoRequest'
$ref: '#/definitions/api_v1.PatchMemoRequest'
produces:
- application/json
responses:
@ -1753,7 +1738,7 @@ paths:
name: body
required: true
schema:
$ref: '#/definitions/api_v1.CreateResourceRequest'
$ref: '#/definitions/github_com_usememos_memos_api_v1.CreateResourceRequest'
produces:
- application/json
responses:
@ -1811,7 +1796,7 @@ paths:
name: patch
required: true
schema:
$ref: '#/definitions/api_v1.UpdateResourceRequest'
$ref: '#/definitions/github_com_usememos_memos_api_v1.UpdateResourceRequest'
produces:
- application/json
responses:
@ -1866,7 +1851,7 @@ paths:
"200":
description: System GetSystemStatus
schema:
$ref: '#/definitions/api_v1.SystemStatus'
$ref: '#/definitions/github_com_usememos_memos_api_v1.SystemStatus'
"401":
description: Missing user in session | Unauthorized
"500":
@ -1985,7 +1970,7 @@ paths:
description: System setting list
schema:
items:
$ref: '#/definitions/api_v1.SystemSetting'
$ref: '#/definitions/github_com_usememos_memos_api_v1.SystemSetting'
type: array
"401":
description: Missing user in session | Unauthorized
@ -2003,14 +1988,10 @@ paths:
name: body
required: true
schema:
$ref: '#/definitions/api_v1.UpsertSystemSettingRequest'
$ref: '#/definitions/github_com_usememos_memos_api_v1.UpsertSystemSettingRequest'
produces:
- application/json
responses:
"200":
description: Created system setting
schema:
$ref: '#/definitions/store.SystemSetting'
"400":
description: Malformatted post system setting request | invalid system setting
"401":
@ -2152,7 +2133,7 @@ paths:
name: body
required: true
schema:
$ref: '#/definitions/github_com_usememos_memos_api_v1.CreateUserRequest'
$ref: '#/definitions/api_v1.CreateUserRequest'
produces:
- application/json
responses:
@ -2234,7 +2215,7 @@ paths:
name: patch
required: true
schema:
$ref: '#/definitions/github_com_usememos_memos_api_v1.UpdateUserRequest'
$ref: '#/definitions/api_v1.UpdateUserRequest'
produces:
- application/json
responses:

@ -58,8 +58,6 @@ type CustomizedProfile struct {
Locale string `json:"locale"`
// Appearance is the server default appearance.
Appearance string `json:"appearance"`
// ExternalURL is the external url of server. e.g. https://usermemos.com
ExternalURL string `json:"externalUrl"`
}
func (key SystemSettingName) String() string {
@ -129,7 +127,6 @@ func (s *APIV1Service) GetSystemSettingList(c echo.Context) error {
// @Accept json
// @Produce json
// @Param body body UpsertSystemSettingRequest true "Request object."
// @Success 200 {object} store.SystemSetting "Created system setting"
// @Failure 400 {object} nil "Malformatted post system setting request | invalid system setting"
// @Failure 401 {object} nil "Missing user in session | Unauthorized"
// @Failure 403 {object} nil "Cannot disable passwords if no SSO identity provider is configured."
@ -231,12 +228,11 @@ func (upsert UpsertSystemSettingRequest) Validate() error {
}
case SystemSettingCustomizedProfileName:
customizedProfile := CustomizedProfile{
Name: "memos",
Name: "Memos",
LogoURL: "",
Description: "",
Locale: "en",
Appearance: "system",
ExternalURL: "",
}
if err := json.Unmarshal([]byte(upsert.Value), &customizedProfile); err != nil {
return errors.Errorf(systemSettingUnmarshalError, settingName)

@ -1052,22 +1052,48 @@ GetWorkspaceProfile returns the workspace profile.
| 200 | A successful response. | [v2GetWorkspaceProfileResponse](#v2getworkspaceprofileresponse) |
| default | An unexpected error response. | [googlerpcStatus](#googlerpcstatus) |
---
## WorkspaceSettingService
### /api/v2/workspace/{name}
#### GET
##### Summary
GetWorkspaceSetting returns the setting by name.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| name | path | The resource name of the workspace setting. Format: settings/{setting} | Yes | string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. | [v2GetWorkspaceSettingResponse](#v2getworkspacesettingresponse) |
| default | An unexpected error response. | [googlerpcStatus](#googlerpcstatus) |
### /api/v2/workspace/{setting.name}
#### PATCH
##### Summary
UpdateWorkspaceProfile updates the workspace profile.
SetWorkspaceSetting updates the setting.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| workspaceProfile | body | System info is the updated data. | Yes | [v2WorkspaceProfile](#v2workspaceprofile) |
| setting.name | path | name is the name of the setting. Format: settings/{setting} | Yes | string |
| setting | body | setting is the setting to update. | Yes | { **"generalSetting"**: [apiv2WorkspaceGeneralSetting](#apiv2workspacegeneralsetting) } |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. | [v2UpdateWorkspaceProfileResponse](#v2updateworkspaceprofileresponse) |
| 200 | A successful response. | [v2SetWorkspaceSettingResponse](#v2setworkspacesettingresponse) |
| default | An unexpected error response. | [googlerpcStatus](#googlerpcstatus) |
---
@ -1185,6 +1211,23 @@ GetActivity returns the activity with the given id.
| name | string | | No |
| url | string | | No |
#### apiv2WorkspaceGeneralSetting
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| instanceUrl | string | instance_url is the instance URL. | No |
| disallowSignup | boolean | disallow_signup is the flag to disallow signup. | No |
| disallowPasswordLogin | boolean | disallow_password_login is the flag to disallow password login. | No |
| additionalScript | string | additional_script is the additional script. | No |
| additionalStyle | string | additional_style is the additional style. | No |
#### apiv2WorkspaceSetting
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| name | string | | No |
| generalSetting | [apiv2WorkspaceGeneralSetting](#apiv2workspacegeneralsetting) | general_setting is the general setting of workspace. | No |
#### googlerpcStatus
| Name | Type | Description | Required |
@ -1392,6 +1435,12 @@ GetActivity returns the activity with the given id.
| ---- | ---- | ----------- | -------- |
| workspaceProfile | [v2WorkspaceProfile](#v2workspaceprofile) | | No |
#### v2GetWorkspaceSettingResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| setting | [apiv2WorkspaceSetting](#apiv2workspacesetting) | | No |
#### v2Inbox
| Name | Type | Description | Required |
@ -1548,6 +1597,12 @@ GetActivity returns the activity with the given id.
| ---- | ---- | ----------- | -------- |
| v2SetMemoResourcesResponse | object | | |
#### v2SetWorkspaceSettingResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| setting | [apiv2WorkspaceSetting](#apiv2workspacesetting) | | No |
#### v2SignInResponse
| Name | Type | Description | Required |
@ -1615,12 +1670,6 @@ GetActivity returns the activity with the given id.
| ---- | ---- | ----------- | -------- |
| webhook | [apiv2Webhook](#apiv2webhook) | | No |
#### v2UpdateWorkspaceProfileResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| workspaceProfile | [v2WorkspaceProfile](#v2workspaceprofile) | | No |
#### v2UpsertMemoReactionResponse
| Name | Type | Description | Required |
@ -1675,8 +1724,8 @@ GetActivity returns the activity with the given id.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| version | string | | No |
| mode | string | | No |
| allowRegistration | boolean | | No |
| disablePasswordLogin | boolean | | No |
| additionalScript | string | | No |
| additionalStyle | string | | No |
| mode | string | mode is the instance mode (e.g. "prod", "dev" or "demo"). | No |
| allowRegistration | boolean | allow_registration is whether the registration is allowed. | No |
| disablePasswordLogin | boolean | allow_password_login is whether the password login is allowed. | No |
| additionalScript | string | additional_script is the additional script. | No |
| additionalStyle | string | additional_style is the additional style. | No |

@ -117,7 +117,6 @@ const MemoActionMenu = (props: Props) => {
{t("common.share")}
</MenuItem>
)}
<Divider className="!my-1" />
<MenuItem color="warning" onClick={handleArchiveMemoClick}>
<Icon.Archive className="w-4 h-auto" />
{t("common.archive")}

@ -62,12 +62,11 @@ const UpdateCustomizedProfileDialog: React.FC<Props> = ({ destroy }: Props) => {
const handleRestoreButtonClick = () => {
setPartialState({
name: "memos",
name: "Memos",
logoUrl: "/logo.webp",
description: "",
locale: "en",
appearance: "system",
externalUrl: "",
});
};
@ -100,10 +99,7 @@ const UpdateCustomizedProfileDialog: React.FC<Props> = ({ destroy }: Props) => {
</IconButton>
</div>
<div className="dialog-content-container min-w-[16rem]">
<p className="text-sm mb-1">
{t("setting.system-section.server-name")}
<span className="text-sm text-gray-400 ml-1">({t("setting.system-section.customize-server.default")})</span>
</p>
<p className="text-sm mb-1">{t("setting.system-section.server-name")}</p>
<Input className="w-full" type="text" value={state.name} onChange={handleNameChanged} />
<p className="text-sm mb-1 mt-2">{t("setting.system-section.customize-server.icon-url")}</p>
<Input className="w-full" type="text" value={state.logoUrl} onChange={handleLogoUrlChanged} />

@ -39,7 +39,7 @@ const UserBanner = (props: Props) => {
{!collapsed && <span className="ml-2 text-lg font-medium text-slate-800 dark:text-gray-200 shrink truncate">{title}</span>}
</div>
</MenuButton>
<Menu placement="bottom-start" size="sm" style={{ zIndex: "9999" }}>
<Menu placement="bottom-start" style={{ zIndex: "9999" }}>
<MenuItem onClick={handleSignOut}>
<Icon.LogOut className="w-4 h-auto opacity-60 shrink-0" />
<span className="truncate">{t("common.sign-out")}</span>

@ -243,7 +243,6 @@
"server-name": "Server Name",
"customize-server": {
"title": "Customize Server",
"default": "Default is memos",
"icon-url": "Icon URL",
"description": "Description",
"locale": "Server Locale",

@ -111,7 +111,6 @@
"server-name": "Server Name",
"customize-server": {
"title": "Customize Server",
"default": "Default is memos",
"icon-url": "Icon URL"
},
"database-file-size": "Databas filstorlek",

@ -198,7 +198,7 @@ const MemoDetail = () => {
{!readonly && (
<MemoActionMenu
memo={memo}
hiddenActions={["pin", "share"]}
hiddenActions={["pin", "edit", "share"]}
onArchived={handleMemoArchived}
onDeleted={handleMemoDeleted}
/>

@ -23,7 +23,6 @@ export const initialGlobalState = async () => {
description: "",
locale: "en",
appearance: "system",
externalUrl: "",
},
} as SystemStatus,
};
@ -39,7 +38,6 @@ export const initialGlobalState = async () => {
description: customizedProfile.description,
locale: customizedProfile.locale || "en",
appearance: customizedProfile.appearance || "system",
externalUrl: "",
},
};
// Use storageLocale > userLocale > customizedProfile.locale (server's default locale)

@ -29,7 +29,6 @@ const globalSlice = createSlice({
description: "",
locale: "en",
appearance: "system",
externalUrl: "",
},
},
} as State,

@ -9,7 +9,6 @@ interface CustomizedProfile {
description: string;
locale: Locale;
appearance: Appearance;
externalUrl: string;
}
interface SystemStatus {

Loading…
Cancel
Save