diff --git a/api/v1/docs.go b/api/v1/docs.go index 1588278e..f3706a92 100644 --- a/api/v1/docs.go +++ b/api/v1/docs.go @@ -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": { diff --git a/api/v1/swagger.md b/api/v1/swagger.md index caf612cf..678b0d24 100644 --- a/api/v1/swagger.md +++ b/api/v1/swagger.md @@ -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 | diff --git a/api/v1/swagger.yaml b/api/v1/swagger.yaml index a9a58dd7..157cf34e 100644 --- a/api/v1/swagger.yaml +++ b/api/v1/swagger.yaml @@ -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: diff --git a/api/v1/system_setting.go b/api/v1/system_setting.go index c78a92d9..1733b240 100644 --- a/api/v1/system_setting.go +++ b/api/v1/system_setting.go @@ -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) diff --git a/api/v2/apidocs.swagger.md b/api/v2/apidocs.swagger.md index 1d9a97a3..ee03dcf9 100644 --- a/api/v2/apidocs.swagger.md +++ b/api/v2/apidocs.swagger.md @@ -1052,22 +1052,48 @@ GetWorkspaceProfile returns the workspace profile. | 200 | A successful response. | [v2GetWorkspaceProfileResponse](#v2getworkspaceprofileresponse) | | default | An unexpected error response. | [googlerpcStatus](#googlerpcstatus) | -#### PATCH +--- +## WorkspaceSettingService + +### /api/v2/workspace/{name} + +#### GET ##### Summary -UpdateWorkspaceProfile updates the workspace profile. +GetWorkspaceSetting returns the setting by name. ##### Parameters | Name | Located in | Description | Required | Schema | | ---- | ---------- | ----------- | -------- | ------ | -| workspaceProfile | body | System info is the updated data. | Yes | [v2WorkspaceProfile](#v2workspaceprofile) | +| name | path | The resource name of the workspace setting. Format: settings/{setting} | Yes | string | ##### Responses | Code | Description | Schema | | ---- | ----------- | ------ | -| 200 | A successful response. | [v2UpdateWorkspaceProfileResponse](#v2updateworkspaceprofileresponse) | +| 200 | A successful response. | [v2GetWorkspaceSettingResponse](#v2getworkspacesettingresponse) | +| default | An unexpected error response. | [googlerpcStatus](#googlerpcstatus) | + +### /api/v2/workspace/{setting.name} + +#### PATCH +##### Summary + +SetWorkspaceSetting updates the setting. + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ------ | +| 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. | [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 | diff --git a/web/src/components/MemoActionMenu.tsx b/web/src/components/MemoActionMenu.tsx index 2178a403..dc331314 100644 --- a/web/src/components/MemoActionMenu.tsx +++ b/web/src/components/MemoActionMenu.tsx @@ -117,7 +117,6 @@ const MemoActionMenu = (props: Props) => { {t("common.share")} )} - {t("common.archive")} diff --git a/web/src/components/UpdateCustomizedProfileDialog.tsx b/web/src/components/UpdateCustomizedProfileDialog.tsx index 49ddc9f4..7fe2dd51 100644 --- a/web/src/components/UpdateCustomizedProfileDialog.tsx +++ b/web/src/components/UpdateCustomizedProfileDialog.tsx @@ -62,12 +62,11 @@ const UpdateCustomizedProfileDialog: React.FC = ({ 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 = ({ destroy }: Props) => {
-

- {t("setting.system-section.server-name")} - ({t("setting.system-section.customize-server.default")}) -

+

{t("setting.system-section.server-name")}

{t("setting.system-section.customize-server.icon-url")}

diff --git a/web/src/components/UserBanner.tsx b/web/src/components/UserBanner.tsx index 452e89c0..3e4c738e 100644 --- a/web/src/components/UserBanner.tsx +++ b/web/src/components/UserBanner.tsx @@ -39,7 +39,7 @@ const UserBanner = (props: Props) => { {!collapsed && {title}}
- + {t("common.sign-out")} diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 6ffe0446..bd6f1478 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -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", diff --git a/web/src/locales/sv.json b/web/src/locales/sv.json index eefc2765..8b36978f 100644 --- a/web/src/locales/sv.json +++ b/web/src/locales/sv.json @@ -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", diff --git a/web/src/pages/MemoDetail.tsx b/web/src/pages/MemoDetail.tsx index bcfe64bf..77bedf3b 100644 --- a/web/src/pages/MemoDetail.tsx +++ b/web/src/pages/MemoDetail.tsx @@ -198,7 +198,7 @@ const MemoDetail = () => { {!readonly && ( diff --git a/web/src/store/module/global.ts b/web/src/store/module/global.ts index 79b4f346..dccc9c76 100644 --- a/web/src/store/module/global.ts +++ b/web/src/store/module/global.ts @@ -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) diff --git a/web/src/store/reducer/global.ts b/web/src/store/reducer/global.ts index e526e79c..7f3f32a1 100644 --- a/web/src/store/reducer/global.ts +++ b/web/src/store/reducer/global.ts @@ -29,7 +29,6 @@ const globalSlice = createSlice({ description: "", locale: "en", appearance: "system", - externalUrl: "", }, }, } as State, diff --git a/web/src/types/modules/system.d.ts b/web/src/types/modules/system.d.ts index 363cac34..f17272f8 100644 --- a/web/src/types/modules/system.d.ts +++ b/web/src/types/modules/system.d.ts @@ -9,7 +9,6 @@ interface CustomizedProfile { description: string; locale: Locale; appearance: Appearance; - externalUrl: string; } interface SystemStatus {