hash,date,author,commit_message,is_merge,git_diff,type,masked_commit_message f1d6a6766e4122140fccbf1e57847f8cb0bafcd6,2024-12-07 09:49:55,johnnyjoy,chore: revert bump react version,False,"diff --git a/web/package.json b/web/package.json index a8e3c86333113..ebad315923fbe 100644 --- a/web/package.json +++ b/web/package.json @@ -32,9 +32,9 @@ ""lodash-es"": ""^4.17.21"", ""lucide-react"": ""^0.453.0"", ""mermaid"": ""^11.3.0"", - ""react"": ""^19.0.0"", + ""react"": ""^18.3.1"", ""react-datepicker"": ""^7.5.0"", - ""react-dom"": ""^19.0.0"", + ""react-dom"": ""^18.3.1"", ""react-force-graph-2d"": ""^1.25.7"", ""react-hot-toast"": ""^2.4.1"", ""react-i18next"": ""^15.1.0"", @@ -60,8 +60,8 @@ ""@types/lodash-es"": ""^4.17.12"", ""@types/node"": ""^22.8.6"", ""@types/qs"": ""^6.9.16"", - ""@types/react"": ""^19.0.0"", - ""@types/react-dom"": ""^19.0.1"", + ""@types/react"": ""^18.3.12"", + ""@types/react-dom"": ""^18.3.1"", ""@types/textarea-caret"": ""^3.0.3"", ""@types/uuid"": ""^10.0.0"", ""@typescript-eslint/eslint-plugin"": ""^7.18.0"", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 32d7e0c9e8b81..ed68cea28f2b9 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -10,37 +10,37 @@ importers: dependencies: '@dnd-kit/core': specifier: ^6.1.0 - version: 6.1.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 6.1.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@dnd-kit/sortable': specifier: ^8.0.0 - version: 8.0.0(@dnd-kit/core@6.1.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0) + version: 8.0.0(@dnd-kit/core@6.1.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) '@dnd-kit/utilities': specifier: ^3.2.2 - version: 3.2.2(react@19.0.0) + version: 3.2.2(react@18.3.1) '@emotion/react': specifier: ^11.13.3 - version: 11.13.3(@types/react@19.0.0)(react@19.0.0) + version: 11.13.3(@types/react@18.3.12)(react@18.3.1) '@emotion/styled': specifier: ^11.13.0 - version: 11.13.0(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0) + version: 11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1) '@github/relative-time-element': specifier: ^4.4.3 version: 4.4.3 '@matejmazur/react-katex': specifier: ^3.1.3 - version: 3.1.3(katex@0.16.11)(react@19.0.0) + version: 3.1.3(katex@0.16.11)(react@18.3.1) '@mui/joy': specifier: 5.0.0-beta.48 - version: 5.0.0-beta.48(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 5.0.0-beta.48(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@radix-ui/react-popover': specifier: ^1.1.2 - version: 1.1.2(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 1.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@reduxjs/toolkit': specifier: ^2.4.0 - version: 2.4.0(react-redux@9.1.2(@types/react@19.0.0)(react@19.0.0)(redux@5.0.1))(react@19.0.0) + version: 2.4.0(react-redux@9.1.2(@types/react@18.3.12)(react@18.3.1)(redux@5.0.1))(react@18.3.1) '@usememos/mui': specifier: 0.0.1-alpha.26 - version: 0.0.1-alpha.26(lucide-react@0.453.0(react@19.0.0))(postcss@8.4.47)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(tailwind-merge@2.5.5)(tailwindcss@3.4.14) + version: 0.0.1-alpha.26(lucide-react@0.453.0(react@18.3.1))(postcss@8.4.47)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(tailwind-merge@2.5.5)(tailwindcss@3.4.14) class-variance-authority: specifier: ^0.7.1 version: 0.7.1 @@ -73,43 +73,43 @@ importers: version: 4.17.21 lucide-react: specifier: ^0.453.0 - version: 0.453.0(react@19.0.0) + version: 0.453.0(react@18.3.1) mermaid: specifier: ^11.3.0 version: 11.3.0 react: - specifier: ^19.0.0 - version: 19.0.0 + specifier: ^18.3.1 + version: 18.3.1 react-datepicker: specifier: ^7.5.0 - version: 7.5.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 7.5.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-dom: - specifier: ^19.0.0 - version: 19.0.0(react@19.0.0) + specifier: ^18.3.1 + version: 18.3.1(react@18.3.1) react-force-graph-2d: specifier: ^1.25.7 - version: 1.25.7(react@19.0.0) + version: 1.25.7(react@18.3.1) react-hot-toast: specifier: ^2.4.1 - version: 2.4.1(csstype@3.1.3)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 2.4.1(csstype@3.1.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-i18next: specifier: ^15.1.0 - version: 15.1.0(i18next@23.16.3)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 15.1.0(i18next@23.16.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-leaflet: specifier: ^4.2.1 - version: 4.2.1(leaflet@1.9.4)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 4.2.1(leaflet@1.9.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-redux: specifier: ^9.1.2 - version: 9.1.2(@types/react@19.0.0)(react@19.0.0)(redux@5.0.1) + version: 9.1.2(@types/react@18.3.12)(react@18.3.1)(redux@5.0.1) react-router-dom: specifier: ^6.27.0 - version: 6.27.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 6.27.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-simple-pull-to-refresh: specifier: ^1.3.3 - version: 1.3.3(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 1.3.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-use: specifier: ^17.5.1 - version: 17.5.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 17.5.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) tailwind-merge: specifier: ^2.5.5 version: 2.5.5 @@ -127,7 +127,7 @@ importers: version: 11.0.2 zustand: specifier: ^5.0.1 - version: 5.0.1(@types/react@19.0.0)(immer@10.1.1)(react@19.0.0)(use-sync-external-store@1.2.2(react@19.0.0)) + version: 5.0.1(@types/react@18.3.12)(immer@10.1.1)(react@18.3.1)(use-sync-external-store@1.2.2(react@18.3.1)) devDependencies: '@bufbuild/buf': specifier: ^1.47.2 @@ -157,11 +157,11 @@ importers: specifier: ^6.9.16 version: 6.9.16 '@types/react': - specifier: ^19.0.0 - version: 19.0.0 + specifier: ^18.3.12 + version: 18.3.12 '@types/react-dom': - specifier: ^19.0.1 - version: 19.0.1 + specifier: ^18.3.1 + version: 18.3.1 '@types/textarea-caret': specifier: ^3.0.3 version: 3.0.3 @@ -1333,15 +1333,12 @@ packages: '@types/qs@6.9.16': resolution: {integrity: sha512-7i+zxXdPD0T4cKDuxCUXJ4wHcsJLwENa6Z3dCu8cfCK743OGy5Nu1RmAGqDPsoTDINVEcdXKRvR/zre+P2Ku1A==} - '@types/react-dom@19.0.1': - resolution: {integrity: sha512-hljHij7MpWPKF6u5vojuyfV0YA4YURsQG7KT6SzV0Zs2BXAtgdTxG6A229Ub/xiWV4w/7JL8fi6aAyjshH4meA==} + '@types/react-dom@18.3.1': + resolution: {integrity: sha512-qW1Mfv8taImTthu4KoXgDfLuk4bydU6Q/TkADnDWWHwi4NX4BR+LWfTp2sVmTqRrsHvyDDTelgelxJ+SsejKKQ==} '@types/react@18.3.12': resolution: {integrity: sha512-D2wOSq/d6Agt28q7rSI3jhU7G6aiuzljDGZ2hTZHIkrTLUI+AF3WMeKkEZ9nN2fkBAlcktT6vcZjDFiIhMYEQw==} - '@types/react@19.0.0': - resolution: {integrity: sha512-MY3oPudxvMYyesqs/kW1Bh8y9VqSmf+tzqw3ae8a9DZW68pUe3zAdHeI1jc6iAysuRdACnVknHP8AhwD4/dxtg==} - '@types/textarea-caret@3.0.3': resolution: {integrity: sha512-bsA9GdXV1wQsXyDjS5+A+czz8IAR3haH5DU+KctIoXbzobRL2NOiwF/+EbB7pofAyudMytLj4ihPtbmbJT8FWw==} @@ -2877,10 +2874,10 @@ packages: react: ^16.9.0 || ^17 || ^18 react-dom: ^16.9.0 || ^17 || ^18 - react-dom@19.0.0: - resolution: {integrity: sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==} + react-dom@18.3.1: + resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==} peerDependencies: - react: ^19.0.0 + react: ^18.3.1 react-force-graph-2d@1.25.7: resolution: {integrity: sha512-WVNLK/z8RDq8kDhfEH/cZBGl64R3M761M3Xa3nXjXFW4mO3xUbQ7GG7dKV0brd4LSfjamGs2f1+UmXF4Tp8sGQ==} @@ -3004,8 +3001,8 @@ packages: react: '*' react-dom: '*' - react@19.0.0: - resolution: {integrity: sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==} + react@18.3.1: + resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==} engines: {node: '>=0.10.0'} read-cache@1.0.0: @@ -3095,8 +3092,8 @@ packages: sax@1.4.1: resolution: {integrity: sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==} - scheduler@0.25.0: - resolution: {integrity: sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==} + scheduler@0.23.2: + resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==} screenfull@5.2.0: resolution: {integrity: sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA==} @@ -3758,29 +3755,29 @@ snapshots: '@chevrotain/utils@11.0.3': {} - '@dnd-kit/accessibility@3.1.0(react@19.0.0)': + '@dnd-kit/accessibility@3.1.0(react@18.3.1)': dependencies: - react: 19.0.0 + react: 18.3.1 tslib: 2.8.0 - '@dnd-kit/core@6.1.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@dnd-kit/core@6.1.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: - '@dnd-kit/accessibility': 3.1.0(react@19.0.0) - '@dnd-kit/utilities': 3.2.2(react@19.0.0) - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + '@dnd-kit/accessibility': 3.1.0(react@18.3.1) + '@dnd-kit/utilities': 3.2.2(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) tslib: 2.8.0 - '@dnd-kit/sortable@8.0.0(@dnd-kit/core@6.1.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0)': + '@dnd-kit/sortable@8.0.0(@dnd-kit/core@6.1.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)': dependencies: - '@dnd-kit/core': 6.1.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@dnd-kit/utilities': 3.2.2(react@19.0.0) - react: 19.0.0 + '@dnd-kit/core': 6.1.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@dnd-kit/utilities': 3.2.2(react@18.3.1) + react: 18.3.1 tslib: 2.8.0 - '@dnd-kit/utilities@3.2.2(react@19.0.0)': + '@dnd-kit/utilities@3.2.2(react@18.3.1)': dependencies: - react: 19.0.0 + react: 18.3.1 tslib: 2.8.0 '@emotion/babel-plugin@11.12.0': @@ -3815,19 +3812,19 @@ snapshots: '@emotion/memoize@0.9.0': {} - '@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0)': + '@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1)': dependencies: '@babel/runtime': 7.26.0 '@emotion/babel-plugin': 11.12.0 '@emotion/cache': 11.13.1 '@emotion/serialize': 1.3.2 - '@emotion/use-insertion-effect-with-fallbacks': 1.1.0(react@19.0.0) + '@emotion/use-insertion-effect-with-fallbacks': 1.1.0(react@18.3.1) '@emotion/utils': 1.4.1 '@emotion/weak-memoize': 0.4.0 hoist-non-react-statics: 3.3.2 - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 transitivePeerDependencies: - supports-color @@ -3841,26 +3838,26 @@ snapshots: '@emotion/sheet@1.4.0': {} - '@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0)': + '@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1)': dependencies: '@babel/runtime': 7.26.0 '@emotion/babel-plugin': 11.12.0 '@emotion/is-prop-valid': 1.3.1 - '@emotion/react': 11.13.3(@types/react@19.0.0)(react@19.0.0) + '@emotion/react': 11.13.3(@types/react@18.3.12)(react@18.3.1) '@emotion/serialize': 1.3.2 - '@emotion/use-insertion-effect-with-fallbacks': 1.1.0(react@19.0.0) + '@emotion/use-insertion-effect-with-fallbacks': 1.1.0(react@18.3.1) '@emotion/utils': 1.4.1 - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 transitivePeerDependencies: - supports-color '@emotion/unitless@0.10.0': {} - '@emotion/use-insertion-effect-with-fallbacks@1.1.0(react@19.0.0)': + '@emotion/use-insertion-effect-with-fallbacks@1.1.0(react@18.3.1)': dependencies: - react: 19.0.0 + react: 18.3.1 '@emotion/utils@1.4.1': {} @@ -3967,18 +3964,18 @@ snapshots: '@floating-ui/core': 1.6.8 '@floating-ui/utils': 0.2.8 - '@floating-ui/react-dom@2.1.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@floating-ui/react-dom@2.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@floating-ui/dom': 1.6.11 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) - '@floating-ui/react@0.26.25(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@floating-ui/react@0.26.25(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: - '@floating-ui/react-dom': 2.1.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@floating-ui/react-dom': 2.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@floating-ui/utils': 0.2.8 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) tabbable: 6.2.0 '@floating-ui/utils@0.2.8': {} @@ -4037,99 +4034,99 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@matejmazur/react-katex@3.1.3(katex@0.16.11)(react@19.0.0)': + '@matejmazur/react-katex@3.1.3(katex@0.16.11)(react@18.3.1)': dependencies: katex: 0.16.11 - react: 19.0.0 + react: 18.3.1 '@mermaid-js/parser@0.3.0': dependencies: langium: 3.0.0 - '@mui/base@5.0.0-beta.40(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@mui/base@5.0.0-beta.40(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@babel/runtime': 7.26.0 - '@floating-ui/react-dom': 2.1.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@mui/types': 7.2.18(@types/react@19.0.0) - '@mui/utils': 5.16.6(@types/react@19.0.0)(react@19.0.0) + '@floating-ui/react-dom': 2.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@mui/types': 7.2.18(@types/react@18.3.12) + '@mui/utils': 5.16.6(@types/react@18.3.12)(react@18.3.1) '@popperjs/core': 2.11.8 clsx: 2.1.1 prop-types: 15.8.1 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 '@mui/core-downloads-tracker@5.16.7': {} - '@mui/joy@5.0.0-beta.48(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@mui/joy@5.0.0-beta.48(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@babel/runtime': 7.26.0 - '@mui/base': 5.0.0-beta.40(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@mui/base': 5.0.0-beta.40(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mui/core-downloads-tracker': 5.16.7 - '@mui/system': 5.16.7(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0) - '@mui/types': 7.2.18(@types/react@19.0.0) - '@mui/utils': 5.16.6(@types/react@19.0.0)(react@19.0.0) + '@mui/system': 5.16.7(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1) + '@mui/types': 7.2.18(@types/react@18.3.12) + '@mui/utils': 5.16.6(@types/react@18.3.12)(react@18.3.1) clsx: 2.1.1 prop-types: 15.8.1 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) optionalDependencies: - '@emotion/react': 11.13.3(@types/react@19.0.0)(react@19.0.0) - '@emotion/styled': 11.13.0(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0) - '@types/react': 19.0.0 + '@emotion/react': 11.13.3(@types/react@18.3.12)(react@18.3.1) + '@emotion/styled': 11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1) + '@types/react': 18.3.12 - '@mui/private-theming@5.16.6(@types/react@19.0.0)(react@19.0.0)': + '@mui/private-theming@5.16.6(@types/react@18.3.12)(react@18.3.1)': dependencies: '@babel/runtime': 7.26.0 - '@mui/utils': 5.16.6(@types/react@19.0.0)(react@19.0.0) + '@mui/utils': 5.16.6(@types/react@18.3.12)(react@18.3.1) prop-types: 15.8.1 - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@mui/styled-engine@5.16.6(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0))(react@19.0.0)': + '@mui/styled-engine@5.16.6(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1))(react@18.3.1)': dependencies: '@babel/runtime': 7.26.0 '@emotion/cache': 11.13.1 csstype: 3.1.3 prop-types: 15.8.1 - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@emotion/react': 11.13.3(@types/react@19.0.0)(react@19.0.0) - '@emotion/styled': 11.13.0(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0) + '@emotion/react': 11.13.3(@types/react@18.3.12)(react@18.3.1) + '@emotion/styled': 11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1) - '@mui/system@5.16.7(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0)': + '@mui/system@5.16.7(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1)': dependencies: '@babel/runtime': 7.26.0 - '@mui/private-theming': 5.16.6(@types/react@19.0.0)(react@19.0.0) - '@mui/styled-engine': 5.16.6(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0))(react@19.0.0) - '@mui/types': 7.2.18(@types/react@19.0.0) - '@mui/utils': 5.16.6(@types/react@19.0.0)(react@19.0.0) + '@mui/private-theming': 5.16.6(@types/react@18.3.12)(react@18.3.1) + '@mui/styled-engine': 5.16.6(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1))(react@18.3.1) + '@mui/types': 7.2.18(@types/react@18.3.12) + '@mui/utils': 5.16.6(@types/react@18.3.12)(react@18.3.1) clsx: 2.1.1 csstype: 3.1.3 prop-types: 15.8.1 - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@emotion/react': 11.13.3(@types/react@19.0.0)(react@19.0.0) - '@emotion/styled': 11.13.0(@emotion/react@11.13.3(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0) - '@types/react': 19.0.0 + '@emotion/react': 11.13.3(@types/react@18.3.12)(react@18.3.1) + '@emotion/styled': 11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1) + '@types/react': 18.3.12 - '@mui/types@7.2.18(@types/react@19.0.0)': + '@mui/types@7.2.18(@types/react@18.3.12)': optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@mui/utils@5.16.6(@types/react@19.0.0)(react@19.0.0)': + '@mui/utils@5.16.6(@types/react@18.3.12)(react@18.3.1)': dependencies: '@babel/runtime': 7.26.0 - '@mui/types': 7.2.18(@types/react@19.0.0) + '@mui/types': 7.2.18(@types/react@18.3.12) '@types/prop-types': 15.7.13 clsx: 2.1.1 prop-types: 15.8.1 - react: 19.0.0 + react: 18.3.1 react-is: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 '@nodelib/fs.scandir@2.1.5': dependencies: @@ -4175,204 +4172,204 @@ snapshots: '@radix-ui/primitive@1.1.0': {} - '@radix-ui/react-arrow@1.1.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@radix-ui/react-arrow@1.1.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: - '@radix-ui/react-primitive': 2.0.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + '@radix-ui/react-primitive': 2.0.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) optionalDependencies: - '@types/react': 19.0.0 - '@types/react-dom': 19.0.1 + '@types/react': 18.3.12 + '@types/react-dom': 18.3.1 - '@radix-ui/react-compose-refs@1.1.0(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-compose-refs@1.1.0(@types/react@18.3.12)(react@18.3.1)': dependencies: - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@radix-ui/react-context@1.1.0(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-context@1.1.0(@types/react@18.3.12)(react@18.3.1)': dependencies: - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@radix-ui/react-context@1.1.1(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-context@1.1.1(@types/react@18.3.12)(react@18.3.1)': dependencies: - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@radix-ui/react-dismissable-layer@1.1.1(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@radix-ui/react-dismissable-layer@1.1.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@radix-ui/primitive': 1.1.0 - '@radix-ui/react-compose-refs': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-primitive': 2.0.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-use-escape-keydown': 1.1.0(@types/react@19.0.0)(react@19.0.0) - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + '@radix-ui/react-compose-refs': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-primitive': 2.0.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-use-escape-keydown': 1.1.0(@types/react@18.3.12)(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) optionalDependencies: - '@types/react': 19.0.0 - '@types/react-dom': 19.0.1 + '@types/react': 18.3.12 + '@types/react-dom': 18.3.1 - '@radix-ui/react-focus-guards@1.1.1(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-focus-guards@1.1.1(@types/react@18.3.12)(react@18.3.1)': dependencies: - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@radix-ui/react-focus-scope@1.1.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@radix-ui/react-focus-scope@1.1.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: - '@radix-ui/react-compose-refs': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-primitive': 2.0.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@19.0.0)(react@19.0.0) - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + '@radix-ui/react-compose-refs': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-primitive': 2.0.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@18.3.12)(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) optionalDependencies: - '@types/react': 19.0.0 - '@types/react-dom': 19.0.1 + '@types/react': 18.3.12 + '@types/react-dom': 18.3.1 - '@radix-ui/react-id@1.1.0(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-id@1.1.0(@types/react@18.3.12)(react@18.3.1)': dependencies: - '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.0)(react@19.0.0) - react: 19.0.0 + '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@18.3.12)(react@18.3.1) + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@radix-ui/react-popover@1.1.2(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@radix-ui/react-popover@1.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@radix-ui/primitive': 1.1.0 - '@radix-ui/react-compose-refs': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-context': 1.1.1(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-dismissable-layer': 1.1.1(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-focus-guards': 1.1.1(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-focus-scope': 1.1.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-id': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-popper': 1.2.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-portal': 1.1.2(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-presence': 1.1.1(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-primitive': 2.0.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-slot': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-use-controllable-state': 1.1.0(@types/react@19.0.0)(react@19.0.0) + '@radix-ui/react-compose-refs': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-context': 1.1.1(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-dismissable-layer': 1.1.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-focus-guards': 1.1.1(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-focus-scope': 1.1.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-id': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-popper': 1.2.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-portal': 1.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-presence': 1.1.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-primitive': 2.0.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-slot': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-use-controllable-state': 1.1.0(@types/react@18.3.12)(react@18.3.1) aria-hidden: 1.2.4 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) - react-remove-scroll: 2.6.0(@types/react@19.0.0)(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + react-remove-scroll: 2.6.0(@types/react@18.3.12)(react@18.3.1) optionalDependencies: - '@types/react': 19.0.0 - '@types/react-dom': 19.0.1 - - '@radix-ui/react-popper@1.2.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': - dependencies: - '@floating-ui/react-dom': 2.1.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-arrow': 1.1.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-compose-refs': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-context': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-primitive': 2.0.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-use-rect': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-use-size': 1.1.0(@types/react@19.0.0)(react@19.0.0) + '@types/react': 18.3.12 + '@types/react-dom': 18.3.1 + + '@radix-ui/react-popper@1.2.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + dependencies: + '@floating-ui/react-dom': 2.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-arrow': 1.1.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-compose-refs': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-context': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-primitive': 2.0.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-use-rect': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-use-size': 1.1.0(@types/react@18.3.12)(react@18.3.1) '@radix-ui/rect': 1.1.0 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) optionalDependencies: - '@types/react': 19.0.0 - '@types/react-dom': 19.0.1 + '@types/react': 18.3.12 + '@types/react-dom': 18.3.1 - '@radix-ui/react-portal@1.1.2(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@radix-ui/react-portal@1.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: - '@radix-ui/react-primitive': 2.0.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.0)(react@19.0.0) - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + '@radix-ui/react-primitive': 2.0.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@18.3.12)(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) optionalDependencies: - '@types/react': 19.0.0 - '@types/react-dom': 19.0.1 + '@types/react': 18.3.12 + '@types/react-dom': 18.3.1 - '@radix-ui/react-presence@1.1.1(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@radix-ui/react-presence@1.1.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: - '@radix-ui/react-compose-refs': 1.1.0(@types/react@19.0.0)(react@19.0.0) - '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.0)(react@19.0.0) - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + '@radix-ui/react-compose-refs': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@18.3.12)(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) optionalDependencies: - '@types/react': 19.0.0 - '@types/react-dom': 19.0.1 + '@types/react': 18.3.12 + '@types/react-dom': 18.3.1 - '@radix-ui/react-primitive@2.0.0(@types/react-dom@19.0.1)(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@radix-ui/react-primitive@2.0.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: - '@radix-ui/react-slot': 1.1.0(@types/react@19.0.0)(react@19.0.0) - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + '@radix-ui/react-slot': 1.1.0(@types/react@18.3.12)(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) optionalDependencies: - '@types/react': 19.0.0 - '@types/react-dom': 19.0.1 + '@types/react': 18.3.12 + '@types/react-dom': 18.3.1 - '@radix-ui/react-slot@1.1.0(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-slot@1.1.0(@types/react@18.3.12)(react@18.3.1)': dependencies: - '@radix-ui/react-compose-refs': 1.1.0(@types/react@19.0.0)(react@19.0.0) - react: 19.0.0 + '@radix-ui/react-compose-refs': 1.1.0(@types/react@18.3.12)(react@18.3.1) + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@radix-ui/react-use-callback-ref@1.1.0(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-use-callback-ref@1.1.0(@types/react@18.3.12)(react@18.3.1)': dependencies: - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@radix-ui/react-use-controllable-state@1.1.0(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-use-controllable-state@1.1.0(@types/react@18.3.12)(react@18.3.1)': dependencies: - '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@19.0.0)(react@19.0.0) - react: 19.0.0 + '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@18.3.12)(react@18.3.1) + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@radix-ui/react-use-escape-keydown@1.1.0(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-use-escape-keydown@1.1.0(@types/react@18.3.12)(react@18.3.1)': dependencies: - '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@19.0.0)(react@19.0.0) - react: 19.0.0 + '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@18.3.12)(react@18.3.1) + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@radix-ui/react-use-layout-effect@1.1.0(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-use-layout-effect@1.1.0(@types/react@18.3.12)(react@18.3.1)': dependencies: - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@radix-ui/react-use-rect@1.1.0(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-use-rect@1.1.0(@types/react@18.3.12)(react@18.3.1)': dependencies: '@radix-ui/rect': 1.1.0 - react: 19.0.0 + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - '@radix-ui/react-use-size@1.1.0(@types/react@19.0.0)(react@19.0.0)': + '@radix-ui/react-use-size@1.1.0(@types/react@18.3.12)(react@18.3.1)': dependencies: - '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.0)(react@19.0.0) - react: 19.0.0 + '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@18.3.12)(react@18.3.1) + react: 18.3.1 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 '@radix-ui/rect@1.1.0': {} - '@react-leaflet/core@2.1.0(leaflet@1.9.4)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@react-leaflet/core@2.1.0(leaflet@1.9.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: leaflet: 1.9.4 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) - '@reduxjs/toolkit@2.4.0(react-redux@9.1.2(@types/react@19.0.0)(react@19.0.0)(redux@5.0.1))(react@19.0.0)': + '@reduxjs/toolkit@2.4.0(react-redux@9.1.2(@types/react@18.3.12)(react@18.3.1)(redux@5.0.1))(react@18.3.1)': dependencies: immer: 10.1.1 redux: 5.0.1 redux-thunk: 3.1.0(redux@5.0.1) reselect: 5.1.1 optionalDependencies: - react: 19.0.0 - react-redux: 9.1.2(@types/react@19.0.0)(react@19.0.0)(redux@5.0.1) + react: 18.3.1 + react-redux: 9.1.2(@types/react@18.3.12)(react@18.3.1)(redux@5.0.1) '@remix-run/router@1.20.0': {} @@ -4604,7 +4601,7 @@ snapshots: '@types/qs@6.9.16': {} - '@types/react-dom@19.0.1': + '@types/react-dom@18.3.1': dependencies: '@types/react': 18.3.12 @@ -4613,10 +4610,6 @@ snapshots: '@types/prop-types': 15.7.13 csstype: 3.1.3 - '@types/react@19.0.0': - dependencies: - csstype: 3.1.3 - '@types/textarea-caret@3.0.3': {} '@types/use-sync-external-store@0.0.3': {} @@ -4706,12 +4699,12 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@usememos/mui@0.0.1-alpha.26(lucide-react@0.453.0(react@19.0.0))(postcss@8.4.47)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(tailwind-merge@2.5.5)(tailwindcss@3.4.14)': + '@usememos/mui@0.0.1-alpha.26(lucide-react@0.453.0(react@18.3.1))(postcss@8.4.47)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(tailwind-merge@2.5.5)(tailwindcss@3.4.14)': dependencies: - lucide-react: 0.453.0(react@19.0.0) + lucide-react: 0.453.0(react@18.3.1) postcss: 8.4.47 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) tailwind-merge: 2.5.5 tailwindcss: 3.4.14 @@ -6052,9 +6045,9 @@ snapshots: dependencies: yallist: 3.1.1 - lucide-react@0.453.0(react@19.0.0): + lucide-react@0.453.0(react@18.3.1): dependencies: - react: 19.0.0 + react: 18.3.1 make-dir@2.1.0: dependencies: @@ -6131,15 +6124,15 @@ snapshots: object-assign: 4.1.1 thenify-all: 1.6.0 - nano-css@5.6.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + nano-css@5.6.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@jridgewell/sourcemap-codec': 1.5.0 css-tree: 1.1.3 csstype: 3.1.3 fastest-stable-stringify: 2.0.2 inline-style-prefixer: 7.0.1 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) rtl-css-js: 1.16.1 stacktrace-js: 2.0.2 stylis: 4.3.4 @@ -6371,123 +6364,124 @@ snapshots: queue-microtask@1.2.3: {} - react-datepicker@7.5.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + react-datepicker@7.5.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: - '@floating-ui/react': 0.26.25(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@floating-ui/react': 0.26.25(react-dom@18.3.1(react@18.3.1))(react@18.3.1) clsx: 2.1.1 date-fns: 3.6.0 prop-types: 15.8.1 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) - react-dom@19.0.0(react@19.0.0): + react-dom@18.3.1(react@18.3.1): dependencies: - react: 19.0.0 - scheduler: 0.25.0 + loose-envify: 1.4.0 + react: 18.3.1 + scheduler: 0.23.2 - react-force-graph-2d@1.25.7(react@19.0.0): + react-force-graph-2d@1.25.7(react@18.3.1): dependencies: force-graph: 1.45.0 prop-types: 15.8.1 - react: 19.0.0 - react-kapsule: 2.4.1(react@19.0.0) + react: 18.3.1 + react-kapsule: 2.4.1(react@18.3.1) - react-hot-toast@2.4.1(csstype@3.1.3)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + react-hot-toast@2.4.1(csstype@3.1.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: goober: 2.1.16(csstype@3.1.3) - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) transitivePeerDependencies: - csstype - react-i18next@15.1.0(i18next@23.16.3)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + react-i18next@15.1.0(i18next@23.16.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@babel/runtime': 7.26.0 html-parse-stringify: 3.0.1 i18next: 23.16.3 - react: 19.0.0 + react: 18.3.1 optionalDependencies: - react-dom: 19.0.0(react@19.0.0) + react-dom: 18.3.1(react@18.3.1) react-is@16.13.1: {} react-is@18.3.1: {} - react-kapsule@2.4.1(react@19.0.0): + react-kapsule@2.4.1(react@18.3.1): dependencies: fromentries: 1.3.2 jerrypick: 1.1.1 - react: 19.0.0 + react: 18.3.1 - react-leaflet@4.2.1(leaflet@1.9.4)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + react-leaflet@4.2.1(leaflet@1.9.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: - '@react-leaflet/core': 2.1.0(leaflet@1.9.4)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@react-leaflet/core': 2.1.0(leaflet@1.9.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) leaflet: 1.9.4 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) - react-redux@9.1.2(@types/react@19.0.0)(react@19.0.0)(redux@5.0.1): + react-redux@9.1.2(@types/react@18.3.12)(react@18.3.1)(redux@5.0.1): dependencies: '@types/use-sync-external-store': 0.0.3 - react: 19.0.0 - use-sync-external-store: 1.2.2(react@19.0.0) + react: 18.3.1 + use-sync-external-store: 1.2.2(react@18.3.1) optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 redux: 5.0.1 react-refresh@0.14.2: {} - react-remove-scroll-bar@2.3.6(@types/react@19.0.0)(react@19.0.0): + react-remove-scroll-bar@2.3.6(@types/react@18.3.12)(react@18.3.1): dependencies: - react: 19.0.0 - react-style-singleton: 2.2.1(@types/react@19.0.0)(react@19.0.0) + react: 18.3.1 + react-style-singleton: 2.2.1(@types/react@18.3.12)(react@18.3.1) tslib: 2.8.0 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - react-remove-scroll@2.6.0(@types/react@19.0.0)(react@19.0.0): + react-remove-scroll@2.6.0(@types/react@18.3.12)(react@18.3.1): dependencies: - react: 19.0.0 - react-remove-scroll-bar: 2.3.6(@types/react@19.0.0)(react@19.0.0) - react-style-singleton: 2.2.1(@types/react@19.0.0)(react@19.0.0) + react: 18.3.1 + react-remove-scroll-bar: 2.3.6(@types/react@18.3.12)(react@18.3.1) + react-style-singleton: 2.2.1(@types/react@18.3.12)(react@18.3.1) tslib: 2.8.0 - use-callback-ref: 1.3.2(@types/react@19.0.0)(react@19.0.0) - use-sidecar: 1.1.2(@types/react@19.0.0)(react@19.0.0) + use-callback-ref: 1.3.2(@types/react@18.3.12)(react@18.3.1) + use-sidecar: 1.1.2(@types/react@18.3.12)(react@18.3.1) optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - react-router-dom@6.27.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + react-router-dom@6.27.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@remix-run/router': 1.20.0 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) - react-router: 6.27.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + react-router: 6.27.0(react@18.3.1) - react-router@6.27.0(react@19.0.0): + react-router@6.27.0(react@18.3.1): dependencies: '@remix-run/router': 1.20.0 - react: 19.0.0 + react: 18.3.1 - react-simple-pull-to-refresh@1.3.3(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + react-simple-pull-to-refresh@1.3.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) - react-style-singleton@2.2.1(@types/react@19.0.0)(react@19.0.0): + react-style-singleton@2.2.1(@types/react@18.3.12)(react@18.3.1): dependencies: get-nonce: 1.0.1 invariant: 2.2.4 - react: 19.0.0 + react: 18.3.1 tslib: 2.8.0 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - react-universal-interface@0.6.2(react@19.0.0)(tslib@2.8.0): + react-universal-interface@0.6.2(react@18.3.1)(tslib@2.8.0): dependencies: - react: 19.0.0 + react: 18.3.1 tslib: 2.8.0 - react-use@17.5.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + react-use@17.5.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@types/js-cookie': 2.2.7 '@xobotyi/scrollbar-width': 1.9.5 @@ -6495,10 +6489,10 @@ snapshots: fast-deep-equal: 3.1.3 fast-shallow-equal: 1.0.0 js-cookie: 2.2.1 - nano-css: 5.6.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) - react-universal-interface: 0.6.2(react@19.0.0)(tslib@2.8.0) + nano-css: 5.6.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + react-universal-interface: 0.6.2(react@18.3.1)(tslib@2.8.0) resize-observer-polyfill: 1.5.1 screenfull: 5.2.0 set-harmonic-interval: 1.0.1 @@ -6506,7 +6500,9 @@ snapshots: ts-easing: 0.2.0 tslib: 2.8.0 - react@19.0.0: {} + react@18.3.1: + dependencies: + loose-envify: 1.4.0 read-cache@1.0.0: dependencies: @@ -6624,7 +6620,9 @@ snapshots: sax@1.4.1: optional: true - scheduler@0.25.0: {} + scheduler@0.23.2: + dependencies: + loose-envify: 1.4.0 screenfull@5.2.0: {} @@ -6917,24 +6915,24 @@ snapshots: dependencies: punycode: 2.3.1 - use-callback-ref@1.3.2(@types/react@19.0.0)(react@19.0.0): + use-callback-ref@1.3.2(@types/react@18.3.12)(react@18.3.1): dependencies: - react: 19.0.0 + react: 18.3.1 tslib: 2.8.0 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - use-sidecar@1.1.2(@types/react@19.0.0)(react@19.0.0): + use-sidecar@1.1.2(@types/react@18.3.12)(react@18.3.1): dependencies: detect-node-es: 1.1.0 - react: 19.0.0 + react: 18.3.1 tslib: 2.8.0 optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 - use-sync-external-store@1.2.2(react@19.0.0): + use-sync-external-store@1.2.2(react@18.3.1): dependencies: - react: 19.0.0 + react: 18.3.1 util-deprecate@1.0.2: {} @@ -7051,9 +7049,9 @@ snapshots: yocto-queue@0.1.0: {} - zustand@5.0.1(@types/react@19.0.0)(immer@10.1.1)(react@19.0.0)(use-sync-external-store@1.2.2(react@19.0.0)): + zustand@5.0.1(@types/react@18.3.12)(immer@10.1.1)(react@18.3.1)(use-sync-external-store@1.2.2(react@18.3.1)): optionalDependencies: - '@types/react': 19.0.0 + '@types/react': 18.3.12 immer: 10.1.1 - react: 19.0.0 - use-sync-external-store: 1.2.2(react@19.0.0) + react: 18.3.1 + use-sync-external-store: 1.2.2(react@18.3.1)",chore,revert bump react version 6d10251cbdea88843183cdf08316d7e739a6f33e,2024-04-08 18:12:53,Steven,feat: impl list syntax auto complete to editor,False,"diff --git a/web/src/components/MemoEditor/Editor/index.tsx b/web/src/components/MemoEditor/Editor/index.tsx index 0b82591ffe095..1ebfcc527685d 100644 --- a/web/src/components/MemoEditor/Editor/index.tsx +++ b/web/src/components/MemoEditor/Editor/index.tsx @@ -1,8 +1,10 @@ import classNames from ""classnames""; import { forwardRef, ReactNode, useCallback, useEffect, useImperativeHandle, useRef } from ""react""; +import { useAutoComplete } from ""../hooks""; import TagSuggestions from ""./TagSuggestions""; export interface EditorRefActions { + getEditor: () => HTMLTextAreaElement | null; focus: FunctionType; scrollToCursor: FunctionType; insertText: (text: string, prefix?: string, suffix?: string) => void; @@ -43,101 +45,104 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef< } }, [editorRef.current?.value]); - const updateEditorHeight = () => { - if (editorRef.current) { - editorRef.current.style.height = ""auto""; - editorRef.current.style.height = (editorRef.current.scrollHeight ?? 0) + ""px""; - } - }; + const editorActions = { + getEditor: () => { + return editorRef.current; + }, + focus: () => { + editorRef.current?.focus(); + }, + scrollToCursor: () => { + if (editorRef.current) { + editorRef.current.scrollTop = editorRef.current.scrollHeight; + } + }, + insertText: (content = """", prefix = """", suffix = """") => { + if (!editorRef.current) { + return; + } - useImperativeHandle( - ref, - () => ({ - focus: () => { - editorRef.current?.focus(); - }, - scrollToCursor: () => { - if (editorRef.current) { - editorRef.current.scrollTop = editorRef.current.scrollHeight; - } - }, - insertText: (content = """", prefix = """", suffix = """") => { - if (!editorRef.current) { - return; - } + const cursorPosition = editorRef.current.selectionStart; + const endPosition = editorRef.current.selectionEnd; + const prevValue = editorRef.current.value; + const value = + prevValue.slice(0, cursorPosition) + + prefix + + (content || prevValue.slice(cursorPosition, endPosition)) + + suffix + + prevValue.slice(endPosition); - const cursorPosition = editorRef.current.selectionStart; - const endPosition = editorRef.current.selectionEnd; - const prevValue = editorRef.current.value; - const value = - prevValue.slice(0, cursorPosition) + - prefix + - (content || prevValue.slice(cursorPosition, endPosition)) + - suffix + - prevValue.slice(endPosition); + editorRef.current.value = value; + editorRef.current.focus(); + editorRef.current.selectionEnd = endPosition + prefix.length + content.length; + handleContentChangeCallback(editorRef.current.value); + updateEditorHeight(); + }, + removeText: (start: number, length: number) => { + if (!editorRef.current) { + return; + } - editorRef.current.value = value; - editorRef.current.focus(); - editorRef.current.selectionEnd = endPosition + prefix.length + content.length; + const prevValue = editorRef.current.value; + const value = prevValue.slice(0, start) + prevValue.slice(start + length); + editorRef.current.value = value; + editorRef.current.focus(); + editorRef.current.selectionEnd = start; + handleContentChangeCallback(editorRef.current.value); + updateEditorHeight(); + }, + setContent: (text: string) => { + if (editorRef.current) { + editorRef.current.value = text; handleContentChangeCallback(editorRef.current.value); updateEditorHeight(); - }, - removeText: (start: number, length: number) => { - if (!editorRef.current) { - return; - } - - const prevValue = editorRef.current.value; - const value = prevValue.slice(0, start) + prevValue.slice(start + length); - editorRef.current.value = value; + } + }, + getContent: (): string => { + return editorRef.current?.value ?? """"; + }, + getCursorPosition: (): number => { + return editorRef.current?.selectionStart ?? 0; + }, + getSelectedContent: () => { + const start = editorRef.current?.selectionStart; + const end = editorRef.current?.selectionEnd; + return editorRef.current?.value.slice(start, end) ?? """"; + }, + setCursorPosition: (startPos: number, endPos?: number) => { + const _endPos = isNaN(endPos as number) ? startPos : (endPos as number); + editorRef.current?.setSelectionRange(startPos, _endPos); + }, + getCursorLineNumber: () => { + const cursorPosition = editorRef.current?.selectionStart ?? 0; + const lines = editorRef.current?.value.slice(0, cursorPosition).split(""\n"") ?? []; + return lines.length - 1; + }, + getLine: (lineNumber: number) => { + return editorRef.current?.value.split(""\n"")[lineNumber] ?? """"; + }, + setLine: (lineNumber: number, text: string) => { + const lines = editorRef.current?.value.split(""\n"") ?? []; + lines[lineNumber] = text; + if (editorRef.current) { + editorRef.current.value = lines.join(""\n""); editorRef.current.focus(); - editorRef.current.selectionEnd = start; handleContentChangeCallback(editorRef.current.value); updateEditorHeight(); - }, - setContent: (text: string) => { - if (editorRef.current) { - editorRef.current.value = text; - handleContentChangeCallback(editorRef.current.value); - updateEditorHeight(); - } - }, - getContent: (): string => { - return editorRef.current?.value ?? """"; - }, - getCursorPosition: (): number => { - return editorRef.current?.selectionStart ?? 0; - }, - getSelectedContent: () => { - const start = editorRef.current?.selectionStart; - const end = editorRef.current?.selectionEnd; - return editorRef.current?.value.slice(start, end) ?? """"; - }, - setCursorPosition: (startPos: number, endPos?: number) => { - const _endPos = isNaN(endPos as number) ? startPos : (endPos as number); - editorRef.current?.setSelectionRange(startPos, _endPos); - }, - getCursorLineNumber: () => { - const cursorPosition = editorRef.current?.selectionStart ?? 0; - const lines = editorRef.current?.value.slice(0, cursorPosition).split(""\n"") ?? []; - return lines.length - 1; - }, - getLine: (lineNumber: number) => { - return editorRef.current?.value.split(""\n"")[lineNumber] ?? """"; - }, - setLine: (lineNumber: number, text: string) => { - const lines = editorRef.current?.value.split(""\n"") ?? []; - lines[lineNumber] = text; - if (editorRef.current) { - editorRef.current.value = lines.join(""\n""); - editorRef.current.focus(); - handleContentChangeCallback(editorRef.current.value); - updateEditorHeight(); - } - }, - }), - [], - ); + } + }, + }; + + useAutoComplete(editorActions); + + useImperativeHandle(ref, () => editorActions, []); + + const updateEditorHeight = () => { + if (editorRef.current) { + editorRef.current.style.height = ""auto""; + editorRef.current.style.height = (editorRef.current.scrollHeight ?? 0) + ""px""; + } + }; const handleEditorInput = useCallback(() => { handleContentChangeCallback(editorRef.current?.value ?? """"); diff --git a/web/src/components/MemoEditor/handlers.tsx b/web/src/components/MemoEditor/handlers.ts similarity index 100% rename from web/src/components/MemoEditor/handlers.tsx rename to web/src/components/MemoEditor/handlers.ts diff --git a/web/src/components/MemoEditor/hooks/index.ts b/web/src/components/MemoEditor/hooks/index.ts new file mode 100644 index 0000000000000..d1293f1ad0e26 --- /dev/null +++ b/web/src/components/MemoEditor/hooks/index.ts @@ -0,0 +1,3 @@ +import useAutoComplete from ""./useAutoComplete""; + +export { useAutoComplete }; diff --git a/web/src/components/MemoEditor/hooks/useAutoComplete.ts b/web/src/components/MemoEditor/hooks/useAutoComplete.ts new file mode 100644 index 0000000000000..eb104e461167d --- /dev/null +++ b/web/src/components/MemoEditor/hooks/useAutoComplete.ts @@ -0,0 +1,40 @@ +import { last } from ""lodash-es""; +import { useEffect } from ""react""; +import { NodeType, OrderedListNode, TaskListNode, UnorderedListNode } from ""@/types/node""; +import { EditorRefActions } from ""../Editor""; + +const useAutoComplete = (actions: EditorRefActions) => { + useEffect(() => { + const editor = actions.getEditor(); + if (!editor) return; + + editor.addEventListener(""keydown"", (event) => { + if (event.key === ""Enter"") { + const cursorPosition = actions.getCursorPosition(); + const prevContent = actions.getContent().substring(0, cursorPosition); + const lastNode = last(window.parse(prevContent)); + if (!lastNode) { + return; + } + + let insertText = """"; + if (lastNode.type === NodeType.TASK_LIST) { + const { complete } = lastNode.value as TaskListNode; + insertText = complete ? ""- [x] "" : ""- [ ] ""; + } else if (lastNode.type === NodeType.UNORDERED_LIST) { + const { symbol } = lastNode.value as UnorderedListNode; + insertText = `${symbol} `; + } else if (lastNode.type === NodeType.ORDERED_LIST) { + const { number } = lastNode.value as OrderedListNode; + insertText = `${Number(number) + 1}. `; + } + if (insertText) { + actions.insertText(`\n${insertText}`); + event.preventDefault(); + } + } + }); + }, []); +}; + +export default useAutoComplete;",feat,impl list syntax auto complete to editor 13aa61bbc08ab72e0f53f7870636d011d8fd9cfc,2022-09-17 11:03:40,Steven,chore: update i18n for change password dialog,False,"diff --git a/web/src/components/ChangePasswordDialog.tsx b/web/src/components/ChangePasswordDialog.tsx index a565d045eb6b7..83c24032286b8 100644 --- a/web/src/components/ChangePasswordDialog.tsx +++ b/web/src/components/ChangePasswordDialog.tsx @@ -17,7 +17,7 @@ const validateConfig: ValidatorConfig = { type Props = DialogProps; const ChangePasswordDialog: React.FC = ({ destroy }: Props) => { - const { t, locale } = useI18n(); + const { t } = useI18n(); const [newPassword, setNewPassword] = useState(""""); const [newPasswordAgain, setNewPasswordAgain] = useState(""""); @@ -53,7 +53,7 @@ const ChangePasswordDialog: React.FC = ({ destroy }: Props) => { const passwordValidResult = validate(newPassword, validateConfig); if (!passwordValidResult.result) { - toastHelper.error(t(""common.password"") + locale === ""zh"" ? """" : "" "" + passwordValidResult.reason); + toastHelper.error(`${t(""common.password"")} ${passwordValidResult.reason}`); return; } @@ -63,7 +63,7 @@ const ChangePasswordDialog: React.FC = ({ destroy }: Props) => { id: user.id, password: newPassword, }); - toastHelper.info(t(""common.password"") + t(""common.changed"")); + toastHelper.info(t(""message.password-changed"")); handleCloseBtnClick(); } catch (error: any) { console.error(error); @@ -74,7 +74,7 @@ const ChangePasswordDialog: React.FC = ({ destroy }: Props) => { return ( <>
-

{t(""common.password"" + "" "" + t(""common.change""))}

+

{t(""setting.account-section.change-password"")}

diff --git a/web/src/components/Settings/MyAccountSection.tsx b/web/src/components/Settings/MyAccountSection.tsx index fca19ba4bdadd..b67c4aaf16c0e 100644 --- a/web/src/components/Settings/MyAccountSection.tsx +++ b/web/src/components/Settings/MyAccountSection.tsx @@ -58,6 +58,12 @@ const MyAccountSection = () => { title: ""Reset Open API"", content: ""❗️The existing API will be invalidated and a new one will be generated, are you sure you want to reset?"", style: ""warning"", + onConfirm: async () => { + await userService.patchUser({ + id: user.id, + resetOpenId: true, + }); + }, }); }; diff --git a/web/src/locales/en.json b/web/src/locales/en.json index a16a1a66bb31d..71eb5a6ae7884 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -99,7 +99,8 @@ ""member"": ""Member"", ""member-list"": ""Member list"", ""account-section"": { - ""title"": ""Account Information"" + ""title"": ""Account Information"", + ""change-password"": ""Change password"" }, ""preference-section"": { ""default-memo-visibility"": ""Default memo visibility"", @@ -128,6 +129,7 @@ ""fill-form"": ""Please fill out this form"", ""login-failed"": ""Login failed"", ""signup-failed"": ""Signup failed"", - ""user-not-found"": ""User not found"" + ""user-not-found"": ""User not found"", + ""password-changed"": ""Password Changed"" } } diff --git a/web/src/locales/vi.json b/web/src/locales/vi.json index 45ce32decc686..d7dde537859e0 100644 --- a/web/src/locales/vi.json +++ b/web/src/locales/vi.json @@ -99,7 +99,8 @@ ""member"": ""Thành viên"", ""member-list"": ""Danh sách thành viên"", ""account-section"": { - ""title"": ""Thông tin tài khoản"" + ""title"": ""Thông tin tài khoản"", + ""change-password"": ""đổi mật khẩu"" }, ""preference-section"": { ""default-memo-visibility"": ""Chế độ memo mặc định"", @@ -128,6 +129,7 @@ ""fill-form"": ""Please fill out this form"", ""login-failed"": ""Đăng nhập thất bại"", ""signup-failed"": ""Đăng ký thất bại"", - ""user-not-found"": ""Không tìm thấy người dùng này"" + ""user-not-found"": ""Không tìm thấy người dùng này"", + ""password-changed"": ""mật khẩu đã được thay đổi"" } } diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index 921c27972a7d3..35fe871fdc5da 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -99,7 +99,8 @@ ""member"": ""成员"", ""member-list"": ""成员列表"", ""account-section"": { - ""title"": ""账号信息"" + ""title"": ""账号信息"", + ""change-password"": ""修改密码"" }, ""preference-section"": { ""default-memo-visibility"": ""默认 Memo 可见性"", @@ -128,6 +129,7 @@ ""fill-form"": ""请填写此表单"", ""login-failed"": ""登录失败"", ""signup-failed"": ""注册失败"", - ""user-not-found"": ""未找到用户"" + ""user-not-found"": ""未找到用户"", + ""password-changed"": ""密码已修改"" } }",chore,update i18n for change password dialog 50f7f131ea12378d01df19e4cb77d34627157060,2024-01-30 05:26:03,Wen Sun,fix: month grouping error in timeline page (#2861),False,"diff --git a/web/src/components/ActivityCalendar.tsx b/web/src/components/ActivityCalendar.tsx index e22f0a1a03718..feb030408b05c 100644 --- a/web/src/components/ActivityCalendar.tsx +++ b/web/src/components/ActivityCalendar.tsx @@ -1,6 +1,6 @@ import { Tooltip } from ""@mui/joy""; import classNames from ""classnames""; -import { getNormalizedDateString } from ""@/helpers/datetime""; +import { getNormalizedDateString, getDateWithOffset } from ""@/helpers/datetime""; interface Props { // Format: 2021-1 @@ -26,8 +26,8 @@ const getCellAdditionalStyles = (count: number, maxCount: number) => { const ActivityCalendar = (props: Props) => { const { month: monthStr, data, onClick } = props; - const year = new Date(monthStr).getFullYear(); - const month = new Date(monthStr).getMonth() + 1; + const year = new Date(monthStr).getUTCFullYear(); + const month = new Date(monthStr).getUTCMonth() + 1; const dayInMonth = new Date(year, month, 0).getDate(); const firstDay = new Date(year, month - 1, 1).getDay(); const lastDay = new Date(year, month - 1, dayInMonth).getDay(); @@ -47,7 +47,9 @@ const ActivityCalendar = (props: Props) => { return (
{days.map((day, index) => { - const date = getNormalizedDateString(`${year}-${String(month).padStart(2, ""0"")}-${String(day).padStart(2, ""0"")}`); + const date = getNormalizedDateString( + getDateWithOffset(`${year}-${String(month).padStart(2, ""0"")}-${String(day).padStart(2, ""0"")}`), + ); const count = data[date] || 0; const isToday = new Date().toDateString() === new Date(date).toDateString(); const tooltipText = count ? `${count} memos in ${date}` : date; diff --git a/web/src/helpers/datetime.ts b/web/src/helpers/datetime.ts index 576d08c96d0d1..54d57158b60d2 100644 --- a/web/src/helpers/datetime.ts +++ b/web/src/helpers/datetime.ts @@ -169,3 +169,15 @@ export function isFutureDate(t?: Date | number | string): boolean { const timestamp = getTimeStampByDate(t ? t : Date.now()); return timestamp > Date.now(); } + +/** + * Calculates a new Date object by adjusting the provided date, timestamp, or date string + * based on the current timezone offset. + * + * @param t - The input date, timestamp, or date string (optional). If not provided, + * the current date and time will be used. + * @returns A new Date object adjusted by the current timezone offset. + */ +export function getDateWithOffset(t?: Date | number | string): Date { + return new Date(getTimeStampByDate(t) + new Date().getTimezoneOffset() * 60 * 1000); +} diff --git a/web/src/pages/Timeline.tsx b/web/src/pages/Timeline.tsx index 2f34490501cb3..d5868456ff31d 100644 --- a/web/src/pages/Timeline.tsx +++ b/web/src/pages/Timeline.tsx @@ -148,9 +148,9 @@ const Timeline = () => {
- {new Date(group.month).toLocaleString(i18n.language, { month: ""short"" })} + {new Date(group.month).toLocaleString(i18n.language, { month: ""short"", timeZone: ""UTC"" })} - {new Date(group.month).getFullYear()} + {new Date(group.month).getUTCFullYear()} Total: {sum(Object.values(group.data))}
setSelectedDay(date)} />",fix,month grouping error in timeline page (#2861) a9eb605b0f3be2f6ae53c47f57baeda35d59f4d5,2023-07-23 16:41:29,Mason Sun,fix: auth api json format (#2021),False,"diff --git a/api/v1/auth.go b/api/v1/auth.go index c42e5ab849029..7d2b279c2b3cd 100644 --- a/api/v1/auth.go +++ b/api/v1/auth.go @@ -65,7 +65,8 @@ func (s *APIV1Service) registerAuthRoutes(g *echo.Group) { if err := s.createAuthSignInActivity(c, user); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, ""Failed to create activity"").SetInternal(err) } - return c.JSON(http.StatusOK, user) + userMessage := convertUserFromStore(user) + return c.JSON(http.StatusOK, userMessage) }) // POST /auth/signin/sso - Sign in with SSO @@ -152,7 +153,8 @@ func (s *APIV1Service) registerAuthRoutes(g *echo.Group) { if err := s.createAuthSignInActivity(c, user); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, ""Failed to create activity"").SetInternal(err) } - return c.JSON(http.StatusOK, user) + userMessage := convertUserFromStore(user) + return c.JSON(http.StatusOK, userMessage) }) // POST /auth/signup - Sign up a new user. @@ -218,7 +220,8 @@ func (s *APIV1Service) registerAuthRoutes(g *echo.Group) { return echo.NewHTTPError(http.StatusInternalServerError, ""Failed to create activity"").SetInternal(err) } - return c.JSON(http.StatusOK, user) + userMessage := convertUserFromStore(user) + return c.JSON(http.StatusOK, userMessage) }) // POST /auth/signout - Sign out.",fix,auth api json format (#2021) 553e8d09ddad1c1049a7ca979ea0a79722888598,2024-07-24 21:04:19,Steven,chore: update public default value to false,False,"diff --git a/bin/memos/main.go b/bin/memos/main.go index 1e5855bc193c0..56cd4dd86f445 100644 --- a/bin/memos/main.go +++ b/bin/memos/main.go @@ -110,7 +110,7 @@ func init() { rootCmd.PersistentFlags().StringVarP(&data, ""data"", ""d"", """", ""data directory"") rootCmd.PersistentFlags().StringVarP(&driver, ""driver"", """", """", ""database driver"") rootCmd.PersistentFlags().StringVarP(&dsn, ""dsn"", """", """", ""database source name(aka. DSN)"") - rootCmd.PersistentFlags().BoolVarP(&public, ""public"", """", true, """") + rootCmd.PersistentFlags().BoolVarP(&public, ""public"", """", false, """") err := viper.BindPFlag(""mode"", rootCmd.PersistentFlags().Lookup(""mode"")) if err != nil { @@ -145,7 +145,7 @@ func init() { viper.SetDefault(""driver"", ""sqlite"") viper.SetDefault(""addr"", """") viper.SetDefault(""port"", 8081) - viper.SetDefault(""public"", true) + viper.SetDefault(""public"", false) viper.SetEnvPrefix(""memos"") } @@ -166,9 +166,10 @@ dsn: %s addr: %s port: %d mode: %s +public: %t driver: %s --- -`, instanceProfile.Version, instanceProfile.Data, instanceProfile.DSN, instanceProfile.Addr, instanceProfile.Port, instanceProfile.Mode, instanceProfile.Driver) +`, instanceProfile.Version, instanceProfile.Data, instanceProfile.DSN, instanceProfile.Addr, instanceProfile.Port, instanceProfile.Mode, instanceProfile.Public, instanceProfile.Driver) } func printGreetings() { diff --git a/server/router/api/v1/workspace_service.go b/server/router/api/v1/workspace_service.go index 3796d3f46e9f8..2cbc67fb22ecd 100644 --- a/server/router/api/v1/workspace_service.go +++ b/server/router/api/v1/workspace_service.go @@ -23,6 +23,9 @@ func (s *APIV1Service) GetWorkspaceProfile(ctx context.Context, _ *v1pb.GetWorks } if owner != nil { workspaceProfile.Owner = owner.Name + } else { + // If owner is not found, set public to true. + workspaceProfile.Public = true } return workspaceProfile, nil }",chore,update public default value to false 673809e07d5cf44f78569e8f21eb0ed6288ecbf0,2024-01-02 16:03:19,Noah Alderton,fix: docker-compose.dev.yaml (#2695),False,"diff --git a/.gitignore b/.gitignore index ba1958d418d87..17f64ee21ad8a 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,9 @@ build # Jetbrains .idea +# Docker Compose Environment File +.env + bin/air -dev-dist \ No newline at end of file +dev-dist diff --git a/scripts/docker-compose.dev.yaml b/scripts/docker-compose.dev.yaml index 6e4039dbb6a1e..b72a47684cf72 100644 --- a/scripts/docker-compose.dev.yaml +++ b/scripts/docker-compose.dev.yaml @@ -1,8 +1,13 @@ +version: ""3.0"" +name: memos-dev services: db: image: mysql volumes: - - ./.air/mysql:/var/lib/mysql + - ./../.air/mysql:/var/lib/mysql + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: memos api: image: cosmtrek/air working_dir: /work @@ -11,8 +16,8 @@ services: - ""MEMOS_DSN=root@tcp(db)/memos"" - ""MEMOS_DRIVER=mysql"" volumes: - - .:/work/ - - .air/go-build:/root/.cache/go-build + - ./..:/work/ + - ./../.air/go-build:/root/.cache/go-build - $HOME/go/pkg/:/go/pkg/ # Cache for go mod shared with the host web: image: node:20-alpine @@ -23,8 +28,7 @@ services: entrypoint: [""/bin/sh"", ""-c""] command: [""corepack enable && pnpm install && pnpm dev""] volumes: - - ./web:/work - - ./.air/node_modules/:/work/node_modules/ # Cache for Node Modules + - ./../web:/work # Services below are used for developers to run once # @@ -43,8 +47,8 @@ services: working_dir: /work/proto command: generate volumes: - - ./proto:/work/proto - - ./web/src/types/:/work/web/src/types/ + - ./../proto:/work/proto + - ./../web/src/types/:/work/web/src/types/ # Do golang static code check before create PR golangci-lint: @@ -55,8 +59,8 @@ services: command: run -v volumes: - $HOME/go/pkg/:/go/pkg/ # Cache for go mod shared with the host - - .air/go-build:/root/.cache/go-build - - .:/work/ + - ./../.air/go-build:/root/.cache/go-build + - ./..:/work/ # run npm npm: @@ -66,5 +70,4 @@ services: environment: [""NPM_CONFIG_UPDATE_NOTIFIER=false""] entrypoint: ""npm"" volumes: - - ./web:/work - - ./.air/node_modules/:/work/node_modules/ + - ./../web:/work diff --git a/web/.gitignore b/web/.gitignore index f4e178b9b5bd0..77f1076b8dbec 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -1,4 +1,5 @@ node_modules +.pnpm-store .DS_Store dist dist-ssr",fix,docker-compose.dev.yaml (#2695) ff81ea602d6ba98b5cfcb78f536a1eded9d87f9d,2024-04-07 20:05:02,Steven,chore: tweak error message,False,"diff --git a/bin/memos/main.go b/bin/memos/main.go index e8181bced33bd..c28d1aeedca02 100644 --- a/bin/memos/main.go +++ b/bin/memos/main.go @@ -14,7 +14,7 @@ import ( ""github.com/usememos/memos/internal/jobs"" ""github.com/usememos/memos/server"" - _profile ""github.com/usememos/memos/server/profile"" + ""github.com/usememos/memos/server/profile"" ""github.com/usememos/memos/store"" ""github.com/usememos/memos/store/db"" ) @@ -31,22 +31,22 @@ const ( ) var ( - profile *_profile.Profile - mode string - addr string - port int - data string - driver string - dsn string - serveFrontend bool - allowedOrigins []string + mode string + addr string + port int + data string + driver string + dsn string + serveFrontend bool + allowedOrigins []string + instanceProfile *profile.Profile rootCmd = &cobra.Command{ Use: ""memos"", Short: `An open source, lightweight note-taking service. Easily capture and share your great thoughts.`, Run: func(_cmd *cobra.Command, _args []string) { ctx, cancel := context.WithCancel(context.Background()) - dbDriver, err := db.NewDBDriver(profile) + dbDriver, err := db.NewDBDriver(instanceProfile) if err != nil { cancel() slog.Error(""failed to create db driver"", err) @@ -58,14 +58,14 @@ var ( return } - storeInstance := store.New(dbDriver, profile) + storeInstance := store.New(dbDriver, instanceProfile) if err := storeInstance.MigrateManually(ctx); err != nil { cancel() slog.Error(""failed to migrate manually"", err) return } - s, err := server.NewServer(ctx, profile, storeInstance) + s, err := server.NewServer(ctx, instanceProfile, storeInstance) if err != nil { cancel() slog.Error(""failed to create server"", err) @@ -162,7 +162,7 @@ func init() { func initConfig() { viper.AutomaticEnv() var err error - profile, err = _profile.GetProfile() + instanceProfile, err = profile.GetProfile() if err != nil { fmt.Printf(""failed to get profile, error: %+v\n"", err) return @@ -179,15 +179,15 @@ mode: %s driver: %s frontend: %t --- -`, profile.Version, profile.Data, profile.DSN, profile.Addr, profile.Port, profile.Mode, profile.Driver, profile.Frontend) +`, instanceProfile.Version, instanceProfile.Data, instanceProfile.DSN, instanceProfile.Addr, instanceProfile.Port, instanceProfile.Mode, instanceProfile.Driver, instanceProfile.Frontend) } func printGreetings() { print(greetingBanner) - if len(profile.Addr) == 0 { - fmt.Printf(""Version %s has been started on port %d\n"", profile.Version, profile.Port) + if len(instanceProfile.Addr) == 0 { + fmt.Printf(""Version %s has been started on port %d\n"", instanceProfile.Version, instanceProfile.Port) } else { - fmt.Printf(""Version %s has been started on address '%s' and port %d\n"", profile.Version, profile.Addr, profile.Port) + fmt.Printf(""Version %s has been started on address '%s' and port %d\n"", instanceProfile.Version, instanceProfile.Addr, instanceProfile.Port) } fmt.Printf(`--- See more in: diff --git a/server/route/api/v2/auth_service.go b/server/route/api/v2/auth_service.go index c97cc626c2d61..1cf681a9d1549 100644 --- a/server/route/api/v2/auth_service.go +++ b/server/route/api/v2/auth_service.go @@ -30,7 +30,7 @@ func (s *APIV2Service) GetAuthStatus(ctx context.Context, _ *apiv2pb.GetAuthStat if user == nil { // Set the cookie header to expire access token. if err := s.clearAccessTokenCookie(ctx); err != nil { - return nil, status.Errorf(codes.Internal, ""failed to set grpc header"") + return nil, status.Errorf(codes.Internal, ""failed to set grpc header: %v"", err) } return nil, status.Errorf(codes.Unauthenticated, ""user not found"") } diff --git a/server/route/api/v2/memo_service.go b/server/route/api/v2/memo_service.go index bba8a887ccbd2..339020f882e7b 100644 --- a/server/route/api/v2/memo_service.go +++ b/server/route/api/v2/memo_service.go @@ -106,7 +106,7 @@ func (s *APIV2Service) ListMemos(ctx context.Context, request *apiv2pb.ListMemos memoFind.Offset = &offset memos, err := s.Store.ListMemos(ctx, memoFind) if err != nil { - return nil, status.Errorf(codes.Internal, ""failed to list memos"") + return nil, status.Errorf(codes.Internal, ""failed to list memos: %v"", err) } memoMessages := []*apiv2pb.Memo{} @@ -459,7 +459,7 @@ func (s *APIV2Service) GetUserMemosStats(ctx context.Context, request *apiv2pb.G memos, err := s.Store.ListMemos(ctx, memoFind) if err != nil { - return nil, status.Errorf(codes.Internal, ""failed to list memos"") + return nil, status.Errorf(codes.Internal, ""failed to list memos: %v"", err) } location, err := time.LoadLocation(request.Timezone) @@ -494,12 +494,12 @@ func (s *APIV2Service) ExportMemos(ctx context.Context, request *apiv2pb.ExportM ExcludeComments: true, } if err := s.buildMemoFindWithFilter(ctx, memoFind, request.Filter); err != nil { - return nil, status.Errorf(codes.Internal, ""failed to build find memos with filter"") + return nil, status.Errorf(codes.Internal, ""failed to build find memos with filter: %v"", err) } memos, err := s.Store.ListMemos(ctx, memoFind) if err != nil { - return nil, status.Errorf(codes.Internal, ""failed to list memos"") + return nil, status.Errorf(codes.Internal, ""failed to list memos: %v"", err) } buf := new(bytes.Buffer)",chore,tweak error message ed96d65645a43e31c1df277112582802f4ba674b,2023-10-06 15:59:50,boojack,chore: update i18n with weblate (#2338),False,"diff --git a/web/src/locales/pt-BR.json b/web/src/locales/pt-BR.json index ea74681b146e0..260604740a863 100644 --- a/web/src/locales/pt-BR.json +++ b/web/src/locales/pt-BR.json @@ -1,375 +1,375 @@ { + ""about"": { + ""about-memos"": ""Sobre o Memos"", + ""memos-description"": ""Memos é um aplicativo de bloco de notas baseado na web que você pode usar para escrever, organizar e compartilhar anotações."", + ""no-server-description"": ""Nenhuma descrição configurada para este servidor."", + ""other-projects"": ""Outros projetos"", + ""powered-by"": ""Provido por"" + }, + ""amount-text"": { + ""memo_many"": ""MEMOS"", + ""memo_one"": ""MEMO"", + ""memo_other"": """" + }, + ""auth"": { + ""create-your-account"": ""Crie sua conta"", + ""host-tip"": ""Você está se registrando como Host do Site."", + ""new-password"": ""Nova senha"", + ""repeat-new-password"": ""Repita a nova senha"", + ""sign-in-tip"": ""Já tem uma conta?"", + ""sign-up-tip"": ""Ainda não tem uma conta?"" + }, ""common"": { ""about"": ""Sobre"", - ""home"": ""Início"", - ""resources"": ""Recursos"", - ""settings"": ""Configurações"", + ""admin"": ""Admin"", + ""archive"": ""Arquivar"", ""archived"": ""Arquivado"", - ""email"": ""Email"", - ""password"": ""Senha"", ""avatar"": ""Avatar"", - ""username"": ""Nome de usuário"", - ""nickname"": ""Apelido"", - ""save"": ""Salvar"", - ""close"": ""Fechar"", + ""basic"": ""Básico"", + ""beta"": ""Beta"", ""cancel"": ""Cancelar"", - ""create"": ""Criar"", - ""update"": ""Atualizar"", ""change"": ""Alterar"", + ""changed"": ""alterado"", + ""clear"": ""Limpar"", + ""close"": ""Fechar"", ""confirm"": ""Confirmar"", - ""reset"": ""Redefinir"", - ""language"": ""Idioma"", - ""version"": ""Versão"", - ""pin"": ""Fixar"", - ""unpin"": ""Desafixar"", - ""edit"": ""Editar"", - ""restore"": ""Restaurar"", + ""create"": ""Criar"", + ""database"": ""Banco de dados"", ""delete"": ""Deletar"", - ""null"": ""Nulo"", - ""share"": ""Compartilhar"", - ""archive"": ""Arquivar"", - ""basic"": ""Básico"", - ""admin"": ""Admin"", + ""edit"": ""Editar"", + ""email"": ""Email"", + ""expand"": ""Expandir"", ""explore"": ""Explorar"", - ""sign-in"": ""Entrar"", - ""sign-in-with"": ""Entrar usando {{provider}}"", - ""or"": ""ou"", - ""sign-up"": ""Registrar"", - ""sign-out"": ""Sair"", - ""type"": ""Tipo"", - ""title"": ""Título"", ""filter"": ""Filtro"", ""filter-period"": ""{{from}} até {{to}}"", - ""tags"": ""Tags"", - ""yourself"": ""Você mesmo"", - ""changed"": ""alterado"", ""fold"": ""Recolher"", - ""expand"": ""Expandir"", + ""home"": ""Início"", ""image"": ""Imagem"", + ""language"": ""Idioma"", + ""learn-more"": ""Saiba mais"", ""link"": ""Link"", - ""vacuum"": ""Compactar (vacuum)"", - ""select"": ""Selecionar"", - ""database"": ""Banco de dados"", - ""upload"": ""Carregar"", + ""mark"": ""Vincular"", + ""name"": ""Nome"", + ""new"": ""Novo"", + ""nickname"": ""Apelido"", + ""null"": ""Nulo"", + ""or"": ""ou"", + ""password"": ""Senha"", + ""pin"": ""Fixar"", ""preview"": ""Pré-visualizar"", + ""profile"": ""Perfil"", ""rename"": ""Renomear"", - ""clear"": ""Limpar"", - ""name"": ""Nome"", + ""reset"": ""Redefinir"", + ""resources"": ""Recursos"", + ""restore"": ""Restaurar"", + ""save"": ""Salvar"", + ""select"": ""Selecionar"", + ""settings"": ""Configurações"", + ""share"": ""Compartilhar"", + ""sign-in"": ""Entrar"", + ""sign-in-with"": ""Entrar usando {{provider}}"", + ""sign-out"": ""Sair"", + ""sign-up"": ""Registrar"", + ""tags"": ""Tags"", + ""title"": ""Título"", + ""type"": ""Tipo"", + ""unpin"": ""Desafixar"", + ""update"": ""Atualizar"", + ""upload"": ""Carregar"", + ""username"": ""Nome de usuário"", + ""vacuum"": ""Compactar (vacuum)"", + ""version"": ""Versão"", ""visibility"": ""Visibilidade"", - ""learn-more"": ""Saiba mais"", - ""beta"": ""Beta"", - ""profile"": ""Perfil"", - ""mark"": ""Mark"", - ""new"": ""Novo"" + ""yourself"": ""Você mesmo"" }, - ""auth"": { - ""host-tip"": ""Você está se registrando como Host do Site."", - ""new-password"": ""Nova senha"", - ""repeat-new-password"": ""Repita a nova senha"", - ""sign-up-tip"": ""Ainda não tem uma conta?"", - ""sign-in-tip"": ""Já tem uma conta?"", - ""create-your-account"": ""Crie sua conta"" + ""daily-review"": { + ""no-memos"": ""Não há memos."", + ""title"": ""Resumo Diário"" + }, + ""days"": { + ""fri"": ""Sex"", + ""mon"": ""Seg"", + ""sat"": ""Sáb"", + ""sun"": ""Dom"", + ""thu"": ""Qui"", + ""tue"": ""Ter"", + ""wed"": ""Qua"" }, ""editor"": { - ""editing"": ""Editando…"", ""cancel-edit"": ""Cancelar edição"", - ""save"": ""Salvar"", - ""placeholder"": ""Alguma ideia…"", - ""only-image-supported"": ""Apenas imagens são suportadas."", ""cant-empty"": ""O conteúdo não pode estar vazio"", + ""editing"": ""Editando…"", ""local"": ""Local"", - ""resources"": ""Recursos"" + ""only-image-supported"": ""Apenas imagens são suportadas."", + ""placeholder"": ""Alguma ideia…"", + ""resources"": ""Recursos"", + ""save"": ""Salvar"" + }, + ""embed-memo"": { + ""copy"": ""Copiar"", + ""only-public-supported"": ""* Somente memos públicos podem ser incorporados."", + ""text"": ""Copie o código abaixo para incorporar este memo em seu site."", + ""title"": ""Incorporar memo"" + }, + ""heatmap"": { + ""day"": ""dia"", + ""days"": ""dias"", + ""memo-in"": ""memo em {{period}}"", + ""memo-on"": ""{{amount}} memo em {{date}}"", + ""memos-in"": ""memos em {{period}}"", + ""memos-on"": ""{{amount}} memos em {{date}}"" }, ""memo"": { - ""view-detail"": ""Ver detalhes"", + ""archived-at"": ""Arquivado em"", + ""archived-memos"": ""Memos arquivados"", + ""comment"": { + ""no-comment"": ""Nenhum comentário"", + ""self"": ""Comentários"" + }, ""copy-link"": ""Copiar link"", + ""delete-confirm"": ""Tem certeza de que deseja deletar este memo?\n\nESTA AÇÃO É IRREVERSÍVEL❗"", + ""delete-memo"": ""Deletar memo"", ""embed"": ""Incorporar"", - ""archived-memos"": ""Memos arquivados"", - ""no-archived-memos"": ""Nenhum memo arquivado."", - ""fetching-data"": ""Obtendo dados…"", ""fetch-more"": ""Clique para carregar mais dados"", - ""archived-at"": ""Arquivado em"", + ""fetching-data"": ""Obtendo dados…"", + ""no-archived-memos"": ""Nenhum memo arquivado."", ""search-placeholder"": ""Pesquisar memos"", + ""view-detail"": ""Ver detalhes"", ""visibility"": { + ""disabled"": ""Memos públicos estão desabilitados"", ""private"": ""Privado (eu)"", ""protected"": ""Protegido (membros)"", - ""public"": ""Público (todos)"", - ""disabled"": ""Memos públicos estão desabilitados"" - }, - ""delete-memo"": ""Deletar memo"", - ""delete-confirm"": ""Tem certeza de que deseja deletar este memo?\n\nESTA AÇÃO É IRREVERSÍVEL❗"", - ""comment"": { - ""no-comment"": ""Nenhum comentário"", - ""self"": ""Comentários"" + ""public"": ""Público (todos)"" } }, + ""message"": { + ""change-memo-created-time"": ""Alterar data de criação do memo"", + ""change-memo-created-time-warning-1"": ""ESTE NÃO É UM PROCEDIMENTO RECOMENDADO."", + ""change-memo-created-time-warning-2"": ""Esteja certo de que realmente precisa disso."", + ""change-resource-filename"": ""Alterar nome do arquivo do recurso"", + ""click-to-save-the-image"": ""Clique para salvar a imagem"", + ""copied"": ""Copiado"", + ""count-selected-resources"": ""Total selecionado"", + ""file-exceeds-upload-limit-of"": ""O arquivo {{file}} excede o limite de upload de {{size}} MiB"", + ""fill-all"": ""Por favor, preencha todos os campos."", + ""fill-form"": ""Por favor, preencha o formulário"", + ""fill-server-name"": ""Por favor, preencha o nome do servidor"", + ""generating-the-screenshot"": ""Gerando a captura de tela…"", + ""image-load-failed"": ""Falha ao carregar a imagem"", + ""invalid-created-datetime"": ""Data de criação inválida."", + ""invalid-resource-filename"": ""Nome de arquivo de recurso inválido."", + ""login-failed"": ""Falha no login"", + ""maximum-upload-size-is"": ""O tamanho máximo permitido para upload é {{size}} MiB"", + ""memo-not-found"": ""Memo não encontrado."", + ""memo-updated-datetime"": ""Data de criação do memo atualizada."", + ""memos-ready"": ""todos os memos estão prontos 🎉"", + ""new-password-not-match"": ""As novas senhas não coincidem."", + ""no-data"": ""Nenhum dado encontrado."", + ""page-not-found"": ""404 - Página não encontrada 😥"", + ""password-changed"": ""Senha alterada"", + ""password-login-disabled"": ""Não é possível remover o último provedor de identidade disponível quando o login com senha está desabilitado"", + ""password-not-match"": ""As senhas não coincidem."", + ""private-only"": ""Este memo é privado."", + ""resource-filename-updated"": ""Nome do arquivo do recurso atualizado."", + ""resource-ready"": ""todos os recursos estão prontos 🎉"", + ""restored-successfully"": ""Restaurado com êxito"", + ""signup-failed"": ""Falha no registro"", + ""succeed-copy-code"": ""Código copiado com êxito."", + ""succeed-copy-content"": ""Conteúdo copiado com êxito."", + ""succeed-copy-link"": ""Link copiado com êxito."", + ""succeed-copy-resource-link"": ""Link do recurso copiado com êxito."", + ""succeed-update-additional-script"": ""Script adicional atualizado com êxito."", + ""succeed-update-additional-style"": ""Folha de estilos adicional atualizada com êxito."", + ""succeed-update-customized-profile"": ""Perfil personalizado com êxito."", + ""succeed-vacuum-database"": ""Banco de dados compactado com êxito."", + ""update-succeed"": ""Atualizado com êxito"", + ""updating-setting-failed"": ""Falha ao atualizar configuração"", + ""user-not-found"": ""Usuário não encontrado"" + }, ""resource"": { - ""no-resources"": ""Nenhum recurso."", - ""fetching-data"": ""Obtendo dados…"", - ""copy-link"": ""Copiar link"", - ""reset-link"": ""Redefinir link"", - ""reset-resource-link"": ""Redefinir link do recurso"", - ""reset-link-prompt"": ""Tem certeza de que deseja redefinir o link?\nIsso quebrará todos os vínculos atuais.\n\nESTA AÇÃO É IRREVERSÍVEL❗"", - ""delete-resource"": ""Deletar recurso"", - ""linked-amount"": ""Quantidade de vínculos"", - ""warning-text"": ""Tem certeza de que deseja deletar este recurso?\n\nESTA AÇÃO É IRREVERSÍVEL❗"", - ""warning-text-unused"": ""Tem certeza de que deseja deletar este recurso não utilizado?\n\nESTA AÇÃO É IRREVERSÍVEL❗"", - ""no-unused-resources"": ""Nenhum recurso não utilizado"", - ""delete-selected-resources"": ""Deletar recursos selecionados"", - ""no-files-selected"": ""Nenhum arquivo selecionado❗"", - ""upload-successfully"": ""Carregado com êxito"", - ""file-drag-drop-prompt"": ""Arraste e solte o arquivo aqui para carregá-lo"", - ""search-bar-placeholder"": ""Pesquisar recurso"", ""clear"": ""Limpar"", + ""copy-link"": ""Copiar link"", ""create-dialog"": { - ""title"": ""Criar recurso"", - ""upload-method"": ""Método de carregamento"", - ""local-file"": { - ""option"": ""Arquivo local"", - ""choose"": ""Escolher arquivo…"" - }, ""external-link"": { - ""option"": ""Link externo"", - ""link"": ""Link"", - ""link-placeholder"": ""https://o.link.para/seu/recurso"", ""file-name"": ""Nome do arquivo"", ""file-name-placeholder"": ""Nome do arquivo"", + ""link"": ""Link"", + ""link-placeholder"": ""https://o.link.para/seu/recurso"", + ""option"": ""Link externo"", ""type"": ""Tipo"", ""type-placeholder"": ""Tipo do arquivo"" - } - } - }, - ""tag-list"": { - ""tip-text"": ""Insira `#tag` para criar uma nova"", - ""create-tag"": ""Criar Tag"", - ""all-tags"": ""Todas as Tags"", - ""tag-name"": ""NOME_DA_TAG"", - ""save-all"": ""Salvar tudo"", - ""invalid-tag-name"": ""Nome de tag inválido"", - ""hide"": ""Ocultar"", - ""show"": ""Mostrar"", - ""tag-suggestions"": ""Sugestões de Tag"" + }, + ""local-file"": { + ""choose"": ""Escolher arquivo…"", + ""option"": ""Arquivo local"" + }, + ""title"": ""Criar recurso"", + ""upload-method"": ""Método de carregamento"" + }, + ""delete-resource"": ""Deletar recurso"", + ""delete-selected-resources"": ""Deletar recursos selecionados"", + ""fetching-data"": ""Obtendo dados…"", + ""file-drag-drop-prompt"": ""Arraste e solte o arquivo aqui para carregá-lo"", + ""linked-amount"": ""Quantidade de vínculos"", + ""no-files-selected"": ""Nenhum arquivo selecionado❗"", + ""no-resources"": ""Nenhum recurso."", + ""no-unused-resources"": ""Nenhum recurso não utilizado"", + ""reset-link"": ""Redefinir link"", + ""reset-link-prompt"": ""Tem certeza de que deseja redefinir o link?\nIsso quebrará todos os vínculos atuais.\n\nESTA AÇÃO É IRREVERSÍVEL❗"", + ""reset-resource-link"": ""Redefinir link do recurso"", + ""search-bar-placeholder"": ""Pesquisar recurso"", + ""upload-successfully"": ""Carregado com êxito"", + ""warning-text"": ""Tem certeza de que deseja deletar este recurso?\n\nESTA AÇÃO É IRREVERSÍVEL❗"", + ""warning-text-unused"": ""Tem certeza de que deseja deletar este recurso não utilizado?\n\nESTA AÇÃO É IRREVERSÍVEL❗"" }, - ""daily-review"": { - ""title"": ""Resumo Diário"", - ""no-memos"": ""Não há memos."" + ""router"": { + ""back-to-top"": ""Voltar ao Topo"", + ""go-to-home"": ""Ir ao início"" }, ""setting"": { - ""my-account"": ""Minha conta"", - ""preference"": ""Preferências"", - ""member"": ""Membro"", - ""member-list"": ""Lista de membros"", - ""system"": ""Sistema"", - ""storage"": ""Armazenamento"", - ""sso"": ""SSO"", ""account-section"": { - ""title"": ""Informação da conta"", - ""username-note"": ""Usado para entrar"", - ""nickname-note"": ""Exibido no banner"", - ""email-note"": ""Opcional"", - ""update-information"": ""Atualizar informações"", ""change-password"": ""Alterar senha"", - ""reset-api"": ""Redefinir API"", - ""openapi-title"": ""OpenAPI"", + ""email-note"": ""Opcional"", + ""nickname-note"": ""Exibido no banner"", ""openapi-reset"": ""Redefinir chave OpenAPI"", - ""openapi-sample-post"": ""Olá #memos em {{url}}"" + ""openapi-sample-post"": ""Olá #memos em {{url}}"", + ""openapi-title"": ""OpenAPI"", + ""reset-api"": ""Redefinir API"", + ""title"": ""Informação da conta"", + ""update-information"": ""Atualizar informações"", + ""username-note"": ""Usado para entrar"" + }, + ""appearance-option"": { + ""dark"": ""Escuro"", + ""light"": ""Claro"", + ""system"": ""Sistema"" + }, + ""member"": ""Membro"", + ""member-list"": ""Lista de membros"", + ""member-section"": { + ""archive-member"": ""Arquivar membro"", + ""archive-warning"": ""❗ Tem certeza de que deseja arquivar {{username}}?"", + ""create-a-member"": ""Criar um membro"", + ""delete-member"": ""Deletar membro"", + ""delete-warning"": ""❗ Tem certeza de que deseja deletar {{username}}?\n\nESTA AÇÃO É IRREVERSÍVEL❗"" }, + ""my-account"": ""Minha conta"", + ""preference"": ""Preferências"", ""preference-section"": { - ""theme"": ""Tema"", + ""auto-collapse"": ""Recolher automaticamente"", + ""created_ts"": ""Hora de criação"", + ""daily-review-time-offset"": ""Compensação de tempo do Resumo Diário"", + ""default-memo-sort-option"": ""Exibição de tempo do memo"", ""default-memo-visibility"": ""Visibilidade padrão do memo"", ""default-resource-visibility"": ""Visibilidade padrão do recurso"", - ""enable-folding-memo"": ""Habilitar recolher memo"", - ""enable-double-click"": ""Habilitar duplo clique para editar"", ""editor-font-style"": ""Estilo de fonte do editor"", + ""enable-double-click"": ""Habilitar duplo clique para editar"", + ""enable-folding-memo"": ""Habilitar recolher memo"", ""mobile-editor-style"": ""Estilo do editor para dispositivos móveis"", - ""default-memo-sort-option"": ""Exibição de tempo do memo"", - ""created_ts"": ""Hora de criação"", - ""updated_ts"": ""Hora de atualização"", - ""daily-review-time-offset"": ""Compensação de tempo do Resumo Diário"", - ""auto-collapse"": ""Recolher automaticamente"", ""telegram-user-id"": ""ID de usuário do Telegram"", - ""telegram-user-id-placeholder"": ""Envie quaisquer palavras para seu Bot do Telegram como um memo"" + ""telegram-user-id-placeholder"": ""Envie quaisquer palavras para seu Bot do Telegram como um memo"", + ""theme"": ""Tema"", + ""updated_ts"": ""Hora de atualização"" }, + ""sso"": ""SSO"", + ""sso-section"": { + ""authorization-endpoint"": ""Endpoint de autenticação"", + ""client-id"": ""ID do cliente"", + ""client-secret"": ""Segredo do cliente"", + ""confirm-delete"": ""Tem certeza de que deseja excluir a configuração SSO \""{{name}}\""?\n\nESTA AÇÃO É IRREVERSÍVEL❗"", + ""create-sso"": ""Criar SSO"", + ""custom"": ""Personalizado"", + ""delete-sso"": ""Confirmar exclusão"", + ""disabled-password-login-warning"": ""O login com senha está desabilitado. Tome cuidado ao remover provedores de identidade❗"", + ""display-name"": ""Nome de exibição"", + ""identifier"": ""Identificador"", + ""identifier-filter"": ""Filtro identificador"", + ""redirect-url"": ""URL de redirecionamento"", + ""scopes"": ""Escopos"", + ""sso-created"": ""SSO {{name}} criado"", + ""sso-list"": ""Lista de SSOs (Login Único)"", + ""sso-updated"": ""SSO {{name}} atualizado"", + ""template"": ""Modelo"", + ""token-endpoint"": ""Endpoint de token"", + ""update-sso"": ""Atualizar SSO"", + ""user-endpoint"": ""Endpoint do usuário"" + }, + ""storage"": ""Armazenamento"", ""storage-section"": { - ""current-storage"": ""Armazenamento de objetos atual"", - ""type-database"": ""Banco de dados"", - ""type-local"": ""Sistema de arquivos local"", - ""storage-services-list"": ""Lista de serviços de armazenamento"", - ""create-a-service"": ""Criar um serviço"", - ""update-a-service"": ""Atualizar um serviço"", - ""warning-text"": ""Tem certeza de que deseja deletar o serviço de armazenamento \""{{name}}\""?\n\nESTA AÇÃO É IRREVERSÍVEL❗"", - ""delete-storage"": ""Deletar armazenamento"", - ""local-storage-path"": ""Caminho do armazenamento local"", - ""update-local-path"": ""Atualizar caminho do armazenamento local"", - ""update-local-path-description"": ""O caminho de armazenamento local é relativo ao seu banco de dados"", - ""create-storage"": ""Criar armazenamento"", - ""update-storage"": ""Atualizar armazenamento"", - ""endpoint"": ""Ponto de extremidade (endpoint)"", - ""s3-compatible-url"": ""URL compatível com S3"", - ""region"": ""Região"", - ""region-placeholder"": ""Nome da região"", ""accesskey"": ""Chave de acesso"", ""accesskey-placeholder"": ""Chave de acesso / ID de acesso"", - ""secretkey"": ""Chave secreta"", - ""secretkey-placeholder"": ""Chave secreta / Chave de acesso"", ""bucket"": ""Bucket"", ""bucket-placeholder"": ""Nome do bucket"", + ""create-a-service"": ""Criar um serviço"", + ""create-storage"": ""Criar armazenamento"", + ""current-storage"": ""Armazenamento de objetos atual"", + ""delete-storage"": ""Deletar armazenamento"", + ""endpoint"": ""Ponto de extremidade (endpoint)"", + ""local-storage-path"": ""Caminho do armazenamento local"", ""path"": ""Caminho do armazenamento"", ""path-description"": ""Você pode usar as mesmas variáveis dinâmicas do armazenamento local, como {filename}"", ""path-placeholder"": ""caminho"", + ""region"": ""Região"", + ""region-placeholder"": ""Nome da região"", + ""s3-compatible-url"": ""URL compatível com S3"", + ""secretkey"": ""Chave secreta"", + ""secretkey-placeholder"": ""Chave secreta / Chave de acesso"", + ""storage-services-list"": ""Lista de serviços de armazenamento"", + ""type-database"": ""Banco de dados"", + ""type-local"": ""Sistema de arquivos local"", + ""update-a-service"": ""Atualizar um serviço"", + ""update-local-path"": ""Atualizar caminho do armazenamento local"", + ""update-local-path-description"": ""O caminho de armazenamento local é relativo ao seu banco de dados"", + ""update-storage"": ""Atualizar armazenamento"", ""url-prefix"": ""Prefixo da URL"", ""url-prefix-placeholder"": ""Prefixo personalizado da URL, opcional"", ""url-suffix"": ""Sufixo da URL"", - ""url-suffix-placeholder"": ""Sufixo personalizado da URL, opcional"" - }, - ""member-section"": { - ""create-a-member"": ""Criar um membro"", - ""archive-member"": ""Arquivar membro"", - ""archive-warning"": ""❗ Tem certeza de que deseja arquivar {{username}}?"", - ""delete-member"": ""Deletar membro"", - ""delete-warning"": ""❗ Tem certeza de que deseja deletar {{username}}?\n\nESTA AÇÃO É IRREVERSÍVEL❗"" + ""url-suffix-placeholder"": ""Sufixo personalizado da URL, opcional"", + ""warning-text"": ""Tem certeza de que deseja deletar o serviço de armazenamento \""{{name}}\""?\n\nESTA AÇÃO É IRREVERSÍVEL❗"" }, + ""system"": ""Sistema"", ""system-section"": { - ""server-name"": ""Nome do servidor"", + ""additional-script"": ""Script adicional"", + ""additional-script-placeholder"": ""Código JavaScript adicional"", + ""additional-style"": ""Estilo adicional"", + ""additional-style-placeholder"": ""Código CSS adicional"", + ""allow-user-signup"": ""Permitir registro de usuário"", + ""auto-backup-interval"": ""Intervalo para backup automático (segundos)"", + ""auto-backup-interval-hint"": ""Defina como 0 para desabilitar o backup automático. É necessário reiniciar após alterar esse valor."", ""customize-server"": { - ""title"": ""Personalizar Servidor"", + ""appearance"": ""Aparência do servidor"", ""default"": ""O padrão é memos"", - ""icon-url"": ""URL do ícone"", ""description"": ""Descrição"", + ""icon-url"": ""URL do ícone"", ""locale"": ""Localização do servidor"", - ""appearance"": ""Aparência do servidor"" + ""title"": ""Personalizar Servidor"" }, ""database-file-size"": ""Tamanho do banco de dados"", - ""allow-user-signup"": ""Permitir registro de usuário"", - ""ignore-version-upgrade"": ""Ignorar atualização de versão"", + ""disable-password-login"": ""Desabilitar login com senha"", + ""disable-password-login-final-warning"": ""Por favor, digite \""CONFIRM\"" para prosseguir."", + ""disable-password-login-warning"": ""Isso desabilitará o login com senha para todos os usuários. Caso seus provedores de identidade (SSO) configurados falhem, não será possível fazer login sem reverter esse ajuste manualmente no banco de dados. Você também deverá tomar precauções adicionais ao remover qualquer provedor de identidade ❗"", ""disable-public-memos"": ""Desabilitar memos públicos"", + ""display-with-updated-time"": ""Exibir hora de atualização nos memos"", + ""enable-password-login"": ""Habilitar login com senha"", + ""enable-password-login-warning"": ""Isso permitirá o login com senha para todos os usuários. Continue apenas se desejar que os usuários possam fazer login usando SSO e senha local❗"", + ""ignore-version-upgrade"": ""Ignorar atualização de versão"", ""max-upload-size"": ""Tamanho máximo de upload (MiB)"", ""max-upload-size-hint"": ""O valor recomendado é 32 MiB."", - ""additional-style"": ""Estilo adicional"", - ""additional-script"": ""Script adicional"", - ""additional-style-placeholder"": ""Código CSS adicional"", - ""additional-script-placeholder"": ""Código JavaScript adicional"", - ""display-with-updated-time"": ""Exibir hora de atualização nos memos"", - ""disable-password-login-warning"": ""Isso desabilitará o login com senha para todos os usuários. Caso seus provedores de identidade (SSO) configurados falhem, não será possível fazer login sem reverter esse ajuste manualmente no banco de dados. Você também deverá tomar precauções adicionais ao remover qualquer provedor de identidade ❗"", - ""telegram-bot-token-placeholder"": ""Seu token de Bot do Telegram"", + ""server-name"": ""Nome do servidor"", ""telegram-bot-token"": ""Token de Bot do Telegram"", ""telegram-bot-token-description"": ""Token de Bot do Telegram ou Proxy de API, tipo `http…/bot`"", - ""disable-password-login"": ""Desabilitar login com senha"", - ""auto-backup-interval-hint"": ""Defina como 0 para desabilitar o backup automático. É necessário reiniciar após alterar esse valor."", - ""disable-password-login-final-warning"": ""Por favor, digite \""CONFIRM\"" para prosseguir."", - ""enable-password-login"": ""Habilitar login com senha"", - ""auto-backup-interval"": ""Intervalo para backup automático (segundos)"", - ""enable-password-login-warning"": ""Isso permitirá o login com senha para todos os usuários. Continue apenas se desejar que os usuários possam fazer login usando SSO e senha local❗"" - }, - ""appearance-option"": { - ""system"": ""Sistema"", - ""light"": ""Claro"", - ""dark"": ""Escuro"" - }, - ""sso-section"": { - ""sso-list"": ""Lista de SSOs (Login Único)"", - ""delete-sso"": ""Confirmar exclusão"", - ""confirm-delete"": ""Tem certeza de que deseja excluir a configuração SSO \""{{name}}\""?\n\nESTA AÇÃO É IRREVERSÍVEL❗"", - ""create-sso"": ""Criar SSO"", - ""update-sso"": ""Atualizar SSO"", - ""sso-created"": ""SSO {{name}} criado"", - ""sso-updated"": ""SSO {{name}} atualizado"", - ""identifier"": ""Identificador"", - ""display-name"": ""Nome de exibição"", - ""template"": ""Modelo"", - ""custom"": ""Personalizado"", - ""identifier-filter"": ""Filtro identificador"", - ""redirect-url"": ""URL de redirecionamento"", - ""client-id"": ""ID do cliente"", - ""client-secret"": ""Segredo do cliente"", - ""authorization-endpoint"": ""Endpoint de autenticação"", - ""token-endpoint"": ""Endpoint de token"", - ""user-endpoint"": ""Endpoint do usuário"", - ""scopes"": ""Escopos"", - ""disabled-password-login-warning"": ""O login com senha está desabilitado. Tome cuidado ao remover provedores de identidade❗"" + ""telegram-bot-token-placeholder"": ""Seu token de Bot do Telegram"" } }, - ""message"": { - ""no-data"": ""Talvez nenhum dado tenha sido encontrado ou talvez devesse ser outra opção."", - ""memos-ready"": ""todos os memos estão prontos 🎉"", - ""resource-ready"": ""todos os recursos estão prontos 🎉"", - ""restored-successfully"": ""Restaurado com êxito"", - ""memo-updated-datetime"": ""Data de criação do memo atualizada."", - ""invalid-created-datetime"": ""Data de criação inválida."", - ""change-memo-created-time"": ""Alterar data de criação do memo"", - ""change-memo-created-time-warning-1"": ""ESTE NÃO É UM PROCEDIMENTO RECOMENDADO."", - ""change-memo-created-time-warning-2"": ""Esteja certo de que realmente precisa disso."", - ""memo-not-found"": ""Memo não encontrado."", - ""fill-all"": ""Por favor, preencha todos os campos."", - ""password-not-match"": ""As senhas não coincidem."", - ""new-password-not-match"": ""As novas senhas não coincidem."", - ""image-load-failed"": ""Falha ao carregar a imagem"", - ""fill-form"": ""Por favor, preencha o formulário"", - ""fill-server-name"": ""Por favor, preencha o nome do servidor"", - ""login-failed"": ""Falha no login"", - ""signup-failed"": ""Falha no registro"", - ""user-not-found"": ""Usuário não encontrado"", - ""password-changed"": ""Senha alterada"", - ""private-only"": ""Este memo é privado."", - ""copied"": ""Copiado"", - ""succeed-copy-content"": ""Conteúdo copiado com êxito."", - ""succeed-copy-code"": ""Código copiado com êxito."", - ""succeed-copy-link"": ""Link copiado com êxito."", - ""change-resource-filename"": ""Alterar nome do arquivo do recurso"", - ""resource-filename-updated"": ""Nome do arquivo do recurso atualizado."", - ""invalid-resource-filename"": ""Nome de arquivo de recurso inválido."", - ""click-to-save-the-image"": ""Clique para salvar a imagem"", - ""generating-the-screenshot"": ""Gerando a captura de tela…"", - ""count-selected-resources"": ""Total selecionado"", - ""succeed-vacuum-database"": ""Banco de dados compactado com êxito."", - ""succeed-update-additional-style"": ""Folha de estilos adicional atualizada com êxito."", - ""succeed-copy-resource-link"": ""Link do recurso copiado com êxito."", - ""succeed-update-customized-profile"": ""Perfil personalizado com êxito."", - ""succeed-update-additional-script"": ""Script adicional atualizado com êxito."", - ""update-succeed"": ""Atualizado com êxito"", - ""page-not-found"": ""404 - Página não encontrada 😥"", - ""maximum-upload-size-is"": ""O tamanho máximo permitido para upload é {{size}} MiB"", - ""file-exceeds-upload-limit-of"": ""O arquivo {{file}} excede o limite de upload de {{size}} MiB"", - ""password-login-disabled"": ""Não é possível remover o último provedor de identidade disponível quando o login com senha está desabilitado"", - ""updating-setting-failed"": ""Falha ao atualizar configuração"" - }, - ""days"": { - ""mon"": ""Seg"", - ""tue"": ""Ter"", - ""wed"": ""Qua"", - ""thu"": ""Qui"", - ""fri"": ""Sex"", - ""sat"": ""Sáb"", - ""sun"": ""Dom"" - }, - ""embed-memo"": { - ""title"": ""Incorporar memo"", - ""text"": ""Copie o código abaixo para incorporar este memo em seu site."", - ""only-public-supported"": ""* Somente memos públicos podem ser incorporados."", - ""copy"": ""Copiar"" - }, - ""heatmap"": { - ""memo-in"": ""memo em {{period}}"", - ""memos-in"": ""memos em {{period}}"", - ""memo-on"": ""{{amount}} memo em {{date}}"", - ""memos-on"": ""{{amount}} memos em {{date}}"", - ""day"": ""dia"", - ""days"": ""dias"" - }, - ""about"": { - ""about-memos"": ""Sobre o Memos"", - ""memos-description"": ""Memos é um aplicativo de bloco de notas baseado na web que você pode usar para escrever, organizar e compartilhar anotações."", - ""no-server-description"": ""Nenhuma descrição configurada para este servidor."", - ""powered-by"": ""Provido por"", - ""other-projects"": ""Outros projetos"" - }, - ""amount-text"": { - ""memo_one"": ""MEMO"", - ""memo_many"": ""MEMOS"", - ""memo_other"": """" - }, - ""router"": { - ""go-to-home"": ""Ir ao início"", - ""back-to-top"": ""Voltar ao Topo"" + ""tag-list"": { + ""all-tags"": ""Todas as Tags"", + ""create-tag"": ""Criar Tag"", + ""hide"": ""Ocultar"", + ""invalid-tag-name"": ""Nome de tag inválido"", + ""save-all"": ""Salvar tudo"", + ""show"": ""Mostrar"", + ""tag-name"": ""NOME_DA_TAG"", + ""tag-suggestions"": ""Sugestões de Tag"", + ""tip-text"": ""Insira `#tag` para criar uma nova"" } } diff --git a/web/src/locales/zh-Hans.json b/web/src/locales/zh-Hans.json index e45da5aaaa8a0..7bb05974f4951 100644 --- a/web/src/locales/zh-Hans.json +++ b/web/src/locales/zh-Hans.json @@ -1,4 +1,22 @@ { + ""about"": { + ""about-memos"": ""关于Memos"", + ""memos-description"": ""Memos 是一个基于网页的笔记应用程序,您可以使用它来编写、组织和共享笔记。"", + ""no-server-description"": ""没有为此服务器配置描述。"", + ""other-projects"": ""其他的项目"", + ""powered-by"": ""Powered by"" + }, + ""amount-text"": { + ""memo"": ""MEMO"" + }, + ""auth"": { + ""create-your-account"": ""创建你的账户"", + ""host-tip"": ""你正在注册为管理员用户账号。"", + ""new-password"": ""新密码"", + ""repeat-new-password"": ""重复新密码"", + ""sign-in-tip"": ""已有账户?"", + ""sign-up-tip"": ""还没有账户?"" + }, ""common"": { ""about"": ""关于"", ""admin"": ""管理"", @@ -28,13 +46,16 @@ ""language"": ""语言"", ""learn-more"": ""了解更多"", ""link"": ""链接"", + ""mark"": ""引用"", ""name"": ""名称"", + ""new"": ""新建"", ""nickname"": ""昵称"", ""null"": ""空"", ""or"": ""或者"", ""password"": ""密码"", ""pin"": ""置顶"", ""preview"": ""预览"", + ""profile"": ""个人资料"", ""rename"": ""改名"", ""reset"": ""重置"", ""resources"": ""资源库"", @@ -57,24 +78,7 @@ ""vacuum"": ""清理未使用资源"", ""version"": ""版本"", ""visibility"": ""可见性"", - ""yourself"": ""你自己"", - ""new"": ""新建"", - ""mark"": ""引用"" - }, - ""about"": { - ""about-memos"": ""关于Memos"", - ""memos-description"": ""Memos是一个基于网页的笔记应用程序,您可以使用它来编写、组织和共享笔记"", - ""no-server-description"": ""没有为此服务器配置描述。"", - ""other-projects"": ""其他的项目"", - ""powered-by"": ""Powered by"" - }, - ""amount-text"": { - ""memo_other"": ""MEMOS"" - }, - ""auth"": { - ""host-tip"": ""你正在注册为管理员用户账号。"", - ""new-password"": ""新密码"", - ""repeat-new-password"": ""重复新密码"" + ""yourself"": ""你自己"" }, ""daily-review"": { ""no-memos"": ""哎呀,空无一物。"", @@ -109,27 +113,31 @@ ""day"": ""天中"", ""days"": ""天中"", ""memo-in"": "" 条备忘录,在过去的"", - ""memos-in"": "" 条备忘录,在过去的"", ""memo-on"": ""{{date}} 记了 {{amount}} 条备忘录"", + ""memos-in"": "" 条备忘录,在过去的"", ""memos-on"": ""{{date}} 记了 {{amount}} 条备忘录"" }, ""memo"": { ""archived-at"": ""存档于"", ""archived-memos"": ""归档备忘录"", + ""comment"": { + ""no-comment"": ""没有评论"", + ""self"": ""评论"" + }, ""copy-link"": ""复制链接"", - ""delete-confirm"": ""您确定要删除此备忘录吗?\n\n此操作不可逆❗"", + ""delete-confirm"": ""您确定要删除此备忘录吗?\n\n此操作不可逆"", ""delete-memo"": ""删除备忘录"", ""embed"": ""嵌入"", ""fetch-more"": ""点击此处获取更多"", - ""fetching-data"": ""正在获取数据..."", + ""fetching-data"": ""正在获取数据…"", ""no-archived-memos"": ""无存档的备忘录。"", ""search-placeholder"": ""搜索备忘录"", ""view-detail"": ""查看详情"", ""visibility"": { ""disabled"": ""公共备忘录已禁用"", ""private"": ""仅自己可见"", - ""protected"": ""登录用户可见"", - ""public"": ""所有人可见"" + ""protected"": ""工作区"", + ""public"": ""公开"" } }, ""message"": { @@ -140,39 +148,41 @@ ""click-to-save-the-image"": ""点击保存图片"", ""copied"": ""已复制"", ""count-selected-resources"": ""所选资源总数"", + ""file-exceeds-upload-limit-of"": ""文件 {{file}} 超出了 {{size}} MiB 的上传限制"", ""fill-all"": ""请填写所有栏目。"", ""fill-form"": ""请填写此表单"", ""fill-server-name"": ""请填写服务器名称"", - ""generating-the-screenshot"": ""正在生成截图..."", + ""generating-the-screenshot"": ""正在生成截图…"", ""image-load-failed"": ""图片加载失败"", ""invalid-created-datetime"": ""创建的日期时间无效。"", - ""invalid-resource-filename"": ""无效的资源文件名"", + ""invalid-resource-filename"": ""无效的资源文件名。"", ""login-failed"": ""登录失败"", + ""maximum-upload-size-is"": ""允许的最大上传大小为 {{size}} MiB"", ""memo-not-found"": ""找不到备忘录。"", ""memo-updated-datetime"": ""备忘录创建日期时间已更改。"", - ""memos-ready"": ""所有备忘录已就绪 🎉"", + ""memos-ready"": ""所有备忘录已就绪"", ""new-password-not-match"": ""新密码不匹配。"", - ""no-data"": ""也许寻觅无果,也许可重新设定标准。"", - ""page-not-found"": ""404 - 未找到网页 😥"", + ""no-data"": ""未找到任何数据。"", + ""page-not-found"": ""404 - 未找到网页"", ""password-changed"": ""密码已修改"", + ""password-login-disabled"": ""在禁用密码登录时无法移除最后一个身份提供程序"", ""password-not-match"": ""密码不一致。"", - ""private-only"": ""此备忘录仅自己可见"", + ""private-only"": ""此备忘录仅自己可见。"", ""resource-filename-updated"": ""资源文件名更改成功。"", - ""resource-ready"": ""所有资源已就绪 🎉"", + ""resource-ready"": ""所有资源已就绪"", ""restored-successfully"": ""恢复成功"", ""signup-failed"": ""注册失败"", ""succeed-copy-code"": ""复制代码到剪贴板成功。"", ""succeed-copy-content"": ""复制内容到剪贴板成功。"", ""succeed-copy-link"": ""复制链接到剪贴板成功。"", - ""succeed-copy-resource-link"": ""复制资源链接到剪贴板成功"", - ""succeed-update-additional-script"": ""更新附加脚本成功"", - ""succeed-update-additional-style"": ""更新附加样式成功"", - ""succeed-update-customized-profile"": ""更新自定义配置文件成功"", - ""succeed-vacuum-database"": ""清理数据库成功"", + ""succeed-copy-resource-link"": ""复制资源链接到剪贴板成功。"", + ""succeed-update-additional-script"": ""更新附加脚本成功。"", + ""succeed-update-additional-style"": ""更新附加样式成功。"", + ""succeed-update-customized-profile"": ""更新自定义配置文件成功。"", + ""succeed-vacuum-database"": ""清理数据库成功。"", ""update-succeed"": ""更新成功"", - ""user-not-found"": ""未找到该用户"", - ""maximum-upload-size-is"": ""允许的最大上传大小为 {{size}} MiB"", - ""file-exceeds-upload-limit-of"": ""文件 {{file}} 超出了 {{size}} MiB 的上传限制"" + ""updating-setting-failed"": ""更新设置失败"", + ""user-not-found"": ""未找到该用户"" }, ""resource"": { ""clear"": ""清除"", @@ -188,7 +198,7 @@ ""type-placeholder"": ""文件类型"" }, ""local-file"": { - ""choose"": ""选择文件..."", + ""choose"": ""选择文件…"", ""option"": ""本地文件"" }, ""title"": ""创建资源"", @@ -196,21 +206,22 @@ }, ""delete-resource"": ""删除资源"", ""delete-selected-resources"": ""删除选中资源"", - ""fetching-data"": ""请求数据中..."", + ""fetching-data"": ""请求数据中…"", ""file-drag-drop-prompt"": ""将您的文件拖放到此处以上传文件"", ""linked-amount"": ""链接的备忘录数量"", - ""no-files-selected"": ""没有文件被选中❗"", - ""no-resources"": ""没有资源"", + ""no-files-selected"": ""没有文件被选中"", + ""no-resources"": ""没有资源。"", ""no-unused-resources"": ""无可删除的资源"", ""reset-link"": ""重置链接"", - ""reset-link-prompt"": ""您确定要重置链接吗?\n这将打破所有当前的链接用法。\n\n此操作不可逆❗"", + ""reset-link-prompt"": ""您确定要重置链接吗?\n这将打破所有当前的链接用法。\n\n此操作不可逆"", ""reset-resource-link"": ""重置资源链接"", ""search-bar-placeholder"": ""搜索资源"", ""upload-successfully"": ""上传成功"", - ""warning-text"": ""确定删除这个资源么?\n\n此操作不可逆❗"", - ""warning-text-unused"": ""确定删除这些无用资源么?\n\n此操作不可逆❗"" + ""warning-text"": ""确定删除这个资源么?\n\n此操作不可逆"", + ""warning-text-unused"": ""您确定要删除这些无用资源么?\n\n此操作不可逆"" }, ""router"": { + ""back-to-top"": ""回到顶部"", ""go-to-home"": ""回到首页"" }, ""setting"": { @@ -235,10 +246,10 @@ ""member-list"": ""成员列表"", ""member-section"": { ""archive-member"": ""归档成员"", - ""archive-warning"": ""❗您确定要归档 {{username}} 吗?"", + ""archive-warning"": ""您确定要归档 {{username}} 吗?"", ""create-a-member"": ""创建成员"", ""delete-member"": ""删除成员"", - ""delete-warning"": ""❗您确定要删除 {{username}} 吗?\n\n此操作不可逆❗"" + ""delete-warning"": ""您确定要删除 {{username}} 吗?\n\n此操作不可逆"" }, ""my-account"": ""我的账号"", ""preference"": ""偏好设置"", @@ -248,6 +259,7 @@ ""daily-review-time-offset"": ""每日回顾时间偏移"", ""default-memo-sort-option"": ""备忘录显示时间"", ""default-memo-visibility"": ""默认备忘录可见性"", + ""default-resource-visibility"": ""默认资源可见性"", ""editor-font-style"": ""编辑器字体样式"", ""enable-double-click"": ""开启双击编辑"", ""enable-folding-memo"": ""开启折叠备忘录"", @@ -255,18 +267,18 @@ ""telegram-user-id"": ""Telegram UserID"", ""telegram-user-id-placeholder"": ""向Telegram机器人发送任意消息以获取"", ""theme"": ""主题"", - ""updated_ts"": ""更新时间"", - ""default-resource-visibility"": ""默认资源可见性"" + ""updated_ts"": ""更新时间"" }, ""sso"": ""SSO"", ""sso-section"": { ""authorization-endpoint"": ""授权端点(Authorization Endpoint)"", ""client-id"": ""客户端ID(Client ID)"", ""client-secret"": ""客户端密钥(Client Secret)"", - ""confirm-delete"": ""您确定要删除“{{name}}”单点登录配置吗?\n\n此操作不可逆❗"", + ""confirm-delete"": ""您确定要删除“{{name}}”单点登录配置吗?\n\n此操作不可逆"", ""create-sso"": ""创建单点登录"", ""custom"": ""自定义"", ""delete-sso"": ""确认删除"", + ""disabled-password-login-warning"": ""密码登录已被禁用,删除身份提供程序时要格外小心"", ""display-name"": ""显示名称"", ""identifier"": ""标识符(Identifier)"", ""identifier-filter"": ""标识符过滤器(Identifier Filter)"", @@ -302,7 +314,7 @@ ""secretkey-placeholder"": ""Secret key / Access Key"", ""storage-services-list"": ""存储服务列表"", ""type-database"": ""数据库"", - ""type-local"": ""本地存储"", + ""type-local"": ""本地文件系统"", ""update-a-service"": ""更新服务"", ""update-local-path"": ""更新本地存储路径"", ""update-local-path-description"": ""本地存储路径是数据库文件的相对路径"", @@ -311,7 +323,7 @@ ""url-prefix-placeholder"": ""自定义 URL 前缀,可选"", ""url-suffix"": ""URL 后缀"", ""url-suffix-placeholder"": ""自定义 URL 后缀,可选"", - ""warning-text"": ""确定删除这个存储服务“{{name}}”么?\n\n此操作不可逆❗"" + ""warning-text"": ""确定删除这个存储服务“{{name}}”么?\n\n此操作不可逆"" }, ""system"": ""系统"", ""system-section"": { @@ -320,6 +332,8 @@ ""additional-style"": ""自定义样式"", ""additional-style-placeholder"": ""自定义 CSS 代码"", ""allow-user-signup"": ""允许用户注册"", + ""auto-backup-interval"": ""自动备份间隔(单位:秒)"", + ""auto-backup-interval-hint"": ""设置为 0 禁止自动备份,重启后生效。"", ""customize-server"": { ""appearance"": ""服务器外观"", ""default"": ""默认为 memos"", @@ -330,31 +344,30 @@ }, ""database-file-size"": ""数据库文件大小"", ""disable-password-login"": ""禁用密码登录"", - ""disable-password-login-warning"": ""所有用户将无法使用密码登录。如果配置的身份提供程序失效,不在数据库中恢复此设置将无法登录。删除身份提供程序时也要格外小心❗"", - ""disable-password-login-final-warning"": ""如果你知道自己在做什么,请输入 \""CONFIRM\"""", + ""disable-password-login-final-warning"": ""如果你知道自己在做什么,请输入 \""CONFIRM\""。"", + ""disable-password-login-warning"": ""所有用户将无法使用密码登录。如果配置的身份提供程序失效,不在数据库中恢复此设置将无法登录。删除身份提供程序时也要格外小心"", + ""disable-public-memos"": ""禁用公共备忘录"", + ""display-with-updated-time"": ""显示最后修改时间"", ""enable-password-login"": ""启用密码登录"", ""enable-password-login-warning"": ""启用所有用户的密码登录。如果希望用户同时使用 SSO 和密码登录,请开启密码登录"", - ""disable-public-memos"": ""禁用公共备忘录"", ""ignore-version-upgrade"": ""忽略版本升级"", - ""telegram-bot-token"": ""Telegram 机器人 Token"", - ""telegram-bot-token-description"": ""Telegram 机器人Token或`http.../bot`格式的代理地址"", - ""telegram-bot-token-placeholder"": ""Telegram 的机器人 Token"", - ""server-name"": ""服务名称"", - ""max-upload-size-hint"": ""建议值为 32 MiB。"", ""max-upload-size"": ""最大上传大小 (MiB)"", - ""auto-backup-interval"": ""自动备份间隔(单位:秒)"", - ""auto-backup-interval-hint"": ""设置为0禁止自动备份,重启后生效"", - ""display-with-updated-time"": ""显示最后修改时间"" + ""max-upload-size-hint"": ""建议值为 32 MiB。"", + ""server-name"": ""服务名称"", + ""telegram-bot-token"": ""Telegram 机器人 Token"", + ""telegram-bot-token-description"": ""Telegram 机器人 Token 或 `http…/bot` 格式的代理地址"", + ""telegram-bot-token-placeholder"": ""Telegram 的机器人 Token"" } }, ""tag-list"": { ""all-tags"": ""全部标签"", ""create-tag"": ""创建标签"", + ""hide"": ""收起"", + ""invalid-tag-name"": ""无效的标签名称"", + ""save-all"": ""全部保存"", + ""show"": ""展开"", ""tag-name"": ""标签名称"", - ""tip-text"": ""输入`#tag`来创建标签"", ""tag-suggestions"": ""标签建议"", - ""show"": ""展开"", - ""hide"": ""收起"", - ""save-all"": ""全部保存"" + ""tip-text"": ""输入`#tag`来创建标签"" } }",chore,update i18n with weblate (#2338) 087e631dd8f7f5f3186f3f4d2ac6f247c40817d7,2023-10-07 18:54:53,Athurg Gooth,chore: optmize docker-compose.dev.yml (#2347),False,"diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index 5bcad49329d5c..7830ec97ef1ba 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -1,36 +1,26 @@ -# 1.Prepare your workspace by: -# docker compose -f docker-compose.dev.yaml run api go install github.com/cosmtrek/air@latest -# docker compose -f docker-compose.dev.yaml run web npm install -# -# 2. Start you work by: -# docker compose up -d -# -# 3. Check logs by: -# docker compose logs -f -# services: db: image: mysql volumes: - ./.air/mysql:/var/lib/mysql api: - image: golang:1.21-alpine + image: cosmtrek/air working_dir: /work - command: air -c ./scripts/.air.toml + command: [""-c"", ""./scripts/.air.toml""] environment: - ""MEMOS_DSN=root@tcp(db)/memos"" - ""MEMOS_DRIVER=mysql"" volumes: - - $HOME/go/pkg/:/go/pkg/ # Cache for go mod shared with the host - - ./.air/bin/:/go/bin/ # Cache for binary used only in container, such as *air* - .:/work/ + - $HOME/go/pkg/:/go/pkg/ # Cache for go mod shared with the host web: image: node:18-alpine working_dir: /work depends_on: [""api""] ports: [""3001:3001""] environment: [""DEV_PROXY_SERVER=http://api:8081/""] - command: npm run dev + entrypoint: [""/bin/sh"", ""-c""] + command: [""corepack enable && pnpm install && pnpm dev""] volumes: - ./web:/work - ./.air/node_modules/:/work/node_modules/ # Cache for Node Modules",chore,optmize docker-compose.dev.yml (#2347) 10c9bb081b77b275665c04873846bb98c21a8dc2,2024-07-19 21:58:49,Steven,chore: retire timeline page,False,"diff --git a/web/src/components/ActivityCalendar.tsx b/web/src/components/ActivityCalendar.tsx index e7050834bcfe5..996894d8f9ee9 100644 --- a/web/src/components/ActivityCalendar.tsx +++ b/web/src/components/ActivityCalendar.tsx @@ -18,11 +18,11 @@ const getCellAdditionalStyles = (count: number, maxCount: number) => { const ratio = count / maxCount; if (ratio > 0.7) { - return ""bg-blue-600 text-gray-100 dark:opacity-80""; + return ""bg-teal-600 text-gray-100 dark:opacity-80""; } else if (ratio > 0.4) { - return ""bg-blue-400 text-gray-200 dark:opacity-80""; + return ""bg-teal-400 text-gray-100 dark:opacity-80""; } else { - return ""bg-blue-300 text-gray-600 dark:opacity-80""; + return ""bg-teal-300 text-gray-100 dark:opacity-80""; } }; @@ -48,7 +48,7 @@ const ActivityCalendar = (props: Props) => { } return ( -
+
{days.map((day, index) => { const date = getNormalizedDateString( getDateWithOffset(`${year}-${String(month).padStart(2, ""0"")}-${String(day).padStart(2, ""0"")}`), @@ -61,7 +61,7 @@ const ActivityCalendar = (props: Props) => {
{
diff --git a/web/src/components/Navigation.tsx b/web/src/components/Navigation.tsx index 724815b333846..de6809b8dd589 100644 --- a/web/src/components/Navigation.tsx +++ b/web/src/components/Navigation.tsx @@ -50,16 +50,10 @@ const Navigation = (props: Props) => { const homeNavLink: NavLinkItem = { id: ""header-home"", - path: Routes.HOME, + path: Routes.ROOT, title: t(""common.home""), icon: , }; - const timelineNavLink: NavLinkItem = { - id: ""header-timeline"", - path: Routes.TIMELINE, - title: t(""timeline.title""), - icon: , - }; const resourcesNavLink: NavLinkItem = { id: ""header-resources"", path: Routes.RESOURCES, @@ -117,7 +111,7 @@ const Navigation = (props: Props) => { }; const navLinks: NavLinkItem[] = user - ? [homeNavLink, timelineNavLink, resourcesNavLink, exploreNavLink, profileNavLink, inboxNavLink, archivedNavLink, settingNavLink] + ? [homeNavLink, resourcesNavLink, exploreNavLink, profileNavLink, inboxNavLink, archivedNavLink, settingNavLink] : [exploreNavLink, signInNavLink, aboutNavLink]; return ( diff --git a/web/src/components/TimelineSidebar/TimelineSidebar.tsx b/web/src/components/TimelineSidebar/TimelineSidebar.tsx deleted file mode 100644 index 134df6e4c871c..0000000000000 --- a/web/src/components/TimelineSidebar/TimelineSidebar.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import clsx from ""clsx""; -import TagsSection from ""../HomeSidebar/TagsSection""; -import SearchBar from ""../SearchBar""; -import UserStatisticsView from ""../UserStatisticsView""; - -interface Props { - className?: string; -} - -const TimelineSidebar = (props: Props) => { - return ( - - ); -}; - -export default TimelineSidebar; diff --git a/web/src/components/TimelineSidebar/TimelineSidebarDrawer.tsx b/web/src/components/TimelineSidebar/TimelineSidebarDrawer.tsx deleted file mode 100644 index 3231850076ed1..0000000000000 --- a/web/src/components/TimelineSidebar/TimelineSidebarDrawer.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { Drawer, IconButton } from ""@mui/joy""; -import { useEffect, useState } from ""react""; -import { useLocation } from ""react-router-dom""; -import Icon from ""../Icon""; -import TimelineSidebar from ""./TimelineSidebar""; - -const TimelineSidebarDrawer = () => { - const location = useLocation(); - const [open, setOpen] = useState(false); - - useEffect(() => { - setOpen(false); - }, [location.pathname]); - - const toggleDrawer = (inOpen: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { - if (event.type === ""keydown"" && ((event as React.KeyboardEvent).key === ""Tab"" || (event as React.KeyboardEvent).key === ""Shift"")) { - return; - } - - setOpen(inOpen); - }; - - return ( - <> - - - - -
- -
-
- - ); -}; - -export default TimelineSidebarDrawer; diff --git a/web/src/components/TimelineSidebar/index.ts b/web/src/components/TimelineSidebar/index.ts deleted file mode 100644 index b5dbfcf585101..0000000000000 --- a/web/src/components/TimelineSidebar/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import TimelineSidebar from ""./TimelineSidebar""; -import TimelineSidebarDrawer from ""./TimelineSidebarDrawer""; - -export { TimelineSidebar, TimelineSidebarDrawer }; diff --git a/web/src/components/UserStatisticsView.tsx b/web/src/components/UserStatisticsView.tsx index 6435f9a4a2545..a28ffff2d4015 100644 --- a/web/src/components/UserStatisticsView.tsx +++ b/web/src/components/UserStatisticsView.tsx @@ -1,13 +1,16 @@ import { Divider, Tooltip } from ""@mui/joy""; import clsx from ""clsx""; +import dayjs from ""dayjs""; import { useState } from ""react""; import toast from ""react-hot-toast""; import { memoServiceClient } from ""@/grpcweb""; import useAsyncEffect from ""@/hooks/useAsyncEffect""; import useCurrentUser from ""@/hooks/useCurrentUser""; +import i18n from ""@/i18n""; import { useFilterStore } from ""@/store/module""; import { useMemoStore } from ""@/store/v1""; import { useTranslate } from ""@/utils/i18n""; +import ActivityCalendar from ""./ActivityCalendar""; import Icon from ""./Icon""; interface UserMemoStats { @@ -25,6 +28,8 @@ const UserStatisticsView = () => { const [memoAmount, setMemoAmount] = useState(0); const [isRequesting, setIsRequesting] = useState(false); const [memoStats, setMemoStats] = useState({ link: 0, taskList: 0, code: 0, incompleteTasks: 0 }); + const [activityStats, setActivityStats] = useState>({}); + const monthString = dayjs(new Date().toDateString()).format(""YYYY-MM""); const days = Math.ceil((Date.now() - currentUser.createTime!.getTime()) / 86400000); const filter = filterStore.state; @@ -50,6 +55,21 @@ const UserStatisticsView = () => { }); setMemoStats(memoStats); setMemoAmount(properties.length); + + const filters = [`row_status == ""NORMAL""`]; + const { stats } = await memoServiceClient.getUserMemosStats({ + name: currentUser.name, + timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, + filter: filters.join("" && ""), + }); + + setActivityStats( + Object.fromEntries( + Object.entries(stats).filter(([date]) => { + return dayjs(date).format(""YYYY-MM"") === monthString; + }), + ), + ); setIsRequesting(false); }, [memoStore.stateId]); @@ -64,7 +84,9 @@ const UserStatisticsView = () => { return (
-

{t(""common.statistics"")}

+

+ {new Date().toLocaleDateString(i18n.language, { month: ""long"", day: ""numeric"" })} +

{
+
+ +
diff --git a/web/src/layouts/RootLayout.tsx b/web/src/layouts/RootLayout.tsx index e0cf853e0572d..18dcad0410d3b 100644 --- a/web/src/layouts/RootLayout.tsx +++ b/web/src/layouts/RootLayout.tsx @@ -14,31 +14,16 @@ const RootLayout = () => { const location = useLocation(); const { sm } = useResponsiveWidth(); const currentUser = useCurrentUser(); - const [lastVisited] = useLocalStorage(""lastVisited"", ""/home""); const [collapsed, setCollapsed] = useLocalStorage(""navigation-collapsed"", false); const [initialized, setInitialized] = useState(false); useEffect(() => { if (!currentUser) { - if ( - ([Routes.ROOT, Routes.HOME, Routes.TIMELINE, Routes.RESOURCES, Routes.INBOX, Routes.ARCHIVED, Routes.SETTING] as string[]).includes( - location.pathname, - ) - ) { + if (([Routes.ROOT, Routes.RESOURCES, Routes.INBOX, Routes.ARCHIVED, Routes.SETTING] as string[]).includes(location.pathname)) { window.location.href = Routes.EXPLORE; return; } - } else { - if (location.pathname === Routes.ROOT) { - if (lastVisited && ([Routes.HOME, Routes.TIMELINE] as string[]).includes(lastVisited)) { - window.location.href = lastVisited; - } else { - window.location.href = Routes.HOME; - } - return; - } } - setInitialized(true); }, []); diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 8b15ebaa2f259..fac5b42fc672f 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -307,8 +307,5 @@ ""delete-confirm"": ""Are you sure to delete this tag? All related memos will be archived."", ""delete-tag"": ""Delete Tag"", ""no-tag-found"": ""No tag found"" - }, - ""timeline"": { - ""title"": ""Timeline"" } } diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index 497f1d304d881..a97ff4f7b8eb9 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -1,7 +1,6 @@ import { Button } from ""@mui/joy""; import clsx from ""clsx""; import { useEffect, useState } from ""react""; -import useLocalStorage from ""react-use/lib/useLocalStorage""; import Empty from ""@/components/Empty""; import { HomeSidebar, HomeSidebarDrawer } from ""@/components/HomeSidebar""; import Icon from ""@/components/Icon""; @@ -13,7 +12,6 @@ import { getTimeStampByDate } from ""@/helpers/datetime""; import useCurrentUser from ""@/hooks/useCurrentUser""; import useFilterWithUrlParams from ""@/hooks/useFilterWithUrlParams""; import useResponsiveWidth from ""@/hooks/useResponsiveWidth""; -import { Routes } from ""@/router""; import { useMemoList, useMemoStore } from ""@/store/v1""; import { RowStatus } from ""@/types/proto/api/v1/common""; import { useTranslate } from ""@/utils/i18n""; @@ -24,7 +22,6 @@ const Home = () => { const user = useCurrentUser(); const memoStore = useMemoStore(); const memoList = useMemoList(); - const [, setLastVisited] = useLocalStorage(""lastVisited"", Routes.HOME); const [isRequesting, setIsRequesting] = useState(true); const [nextPageToken, setNextPageToken] = useState(""""); const filter = useFilterWithUrlParams(); @@ -33,10 +30,6 @@ const Home = () => { .sort((a, b) => getTimeStampByDate(b.displayTime) - getTimeStampByDate(a.displayTime)) .sort((a, b) => Number(b.pinned) - Number(a.pinned)); - useEffect(() => { - setLastVisited(Routes.HOME); - }, []); - useEffect(() => { memoList.reset(); fetchMemos(""""); diff --git a/web/src/pages/Timeline.tsx b/web/src/pages/Timeline.tsx deleted file mode 100644 index 45fc949cf2965..0000000000000 --- a/web/src/pages/Timeline.tsx +++ /dev/null @@ -1,216 +0,0 @@ -import { Button, IconButton } from ""@mui/joy""; -import clsx from ""clsx""; -import dayjs from ""dayjs""; -import { useEffect, useState } from ""react""; -import useLocalStorage from ""react-use/lib/useLocalStorage""; -import ActivityCalendar from ""@/components/ActivityCalendar""; -import Empty from ""@/components/Empty""; -import Icon from ""@/components/Icon""; -import showMemoEditorDialog from ""@/components/MemoEditor/MemoEditorDialog""; -import MemoView from ""@/components/MemoView""; -import MobileHeader from ""@/components/MobileHeader""; -import { TimelineSidebar, TimelineSidebarDrawer } from ""@/components/TimelineSidebar""; -import { memoServiceClient } from ""@/grpcweb""; -import { DAILY_TIMESTAMP, DEFAULT_LIST_MEMOS_PAGE_SIZE } from ""@/helpers/consts""; -import { getTimeStampByDate } from ""@/helpers/datetime""; -import useCurrentUser from ""@/hooks/useCurrentUser""; -import useFilterWithUrlParams from ""@/hooks/useFilterWithUrlParams""; -import useResponsiveWidth from ""@/hooks/useResponsiveWidth""; -import i18n from ""@/i18n""; -import { Routes } from ""@/router""; -import { useMemoList, useMemoStore } from ""@/store/v1""; -import { useTranslate } from ""@/utils/i18n""; - -const Timeline = () => { - const t = useTranslate(); - const { md } = useResponsiveWidth(); - const user = useCurrentUser(); - const memoStore = useMemoStore(); - const memoList = useMemoList(); - const [, setLastVisited] = useLocalStorage(""lastVisited"", Routes.TIMELINE); - const filter = useFilterWithUrlParams(); - const [activityStats, setActivityStats] = useState>({}); - const [selectedDateString, setSelectedDateString] = useState(new Date().toDateString()); - const [isRequesting, setIsRequesting] = useState(true); - const [nextPageToken, setNextPageToken] = useState(""""); - const sortedMemos = memoList.value.sort((a, b) => getTimeStampByDate(a.displayTime) - getTimeStampByDate(b.displayTime)); - const monthString = dayjs(selectedDateString).format(""YYYY-MM""); - - useEffect(() => { - setLastVisited(Routes.TIMELINE); - }, []); - - useEffect(() => { - memoList.reset(); - fetchMemos(""""); - }, [selectedDateString, filter.text, filter.tag, filter.memoPropertyFilter]); - - useEffect(() => { - (async () => { - const filters = [`row_status == ""NORMAL""`]; - const { stats } = await memoServiceClient.getUserMemosStats({ - name: user.name, - timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, - filter: filters.join("" && ""), - }); - - setActivityStats( - Object.fromEntries( - Object.entries(stats).filter(([date]) => { - return dayjs(date).format(""YYYY-MM"") === monthString; - }), - ), - ); - })(); - }, [sortedMemos.length]); - - const fetchMemos = async (nextPageToken: string) => { - setIsRequesting(true); - const filters = [`creator == ""${user.name}""`, `row_status == ""NORMAL""`]; - const contentSearch: string[] = []; - if (filter.text) { - contentSearch.push(JSON.stringify(filter.text)); - } - if (contentSearch.length > 0) { - filters.push(`content_search == [${contentSearch.join("", "")}]`); - } - if (filter.tag) { - filters.push(`tag == ""${filter.tag}""`); - } - if (filter.memoPropertyFilter) { - if (filter.memoPropertyFilter.hasLink) { - filters.push(`has_link == true`); - } - if (filter.memoPropertyFilter.hasTaskList) { - filters.push(`has_task_list == true`); - } - if (filter.memoPropertyFilter.hasCode) { - filters.push(`has_code == true`); - } - } - if (selectedDateString) { - const selectedDateStamp = getTimeStampByDate(selectedDateString); - filters.push( - ...[`display_time_after == ${selectedDateStamp / 1000}`, `display_time_before == ${(selectedDateStamp + DAILY_TIMESTAMP) / 1000}`], - ); - } - const response = await memoStore.fetchMemos({ - pageSize: DEFAULT_LIST_MEMOS_PAGE_SIZE, - filter: filters.join("" && ""), - pageToken: nextPageToken, - }); - setIsRequesting(false); - setNextPageToken(response.nextPageToken); - }; - - const handleSelectedDataChange = (date: string) => { - if (dayjs(date).isValid()) { - setSelectedDateString(new Date(date).toDateString()); - } - }; - - const handleNewMemo = () => { - showMemoEditorDialog({}); - }; - - return ( -
- {!md && ( - - - - )} -
-
-
-
-
-
setSelectedDateString(new Date().toDateString())} - > - - {t(""timeline.title"")} -
-
-
- handleNewMemo()}> - - -
-
-
-
-
-
-
- {new Date(selectedDateString).toLocaleDateString(i18n.language, { month: ""short"", day: ""numeric"" })} - e.target.showPicker()} - onChange={(e) => handleSelectedDataChange(e.target.value)} - /> -
- {dayjs(monthString).year()} -
- setSelectedDateString(date)} - /> -
- -
- {sortedMemos.map((memo) => ( - - ))} -
-
- - {isRequesting ? ( -
- -

{t(""memo.fetching-data"")}

-
- ) : !nextPageToken ? ( - sortedMemos.length === 0 && ( -
- -

{t(""message.no-data"")}

-
- ) - ) : ( -
- -
- )} -
-
-
- {md && ( -
- -
- )} -
-
- ); -}; - -export default Timeline; diff --git a/web/src/router/index.tsx b/web/src/router/index.tsx index 418b21834a284..6cacedf3a415a 100644 --- a/web/src/router/index.tsx +++ b/web/src/router/index.tsx @@ -15,13 +15,10 @@ import Resources from ""@/pages/Resources""; import Setting from ""@/pages/Setting""; import SignIn from ""@/pages/SignIn""; import SignUp from ""@/pages/SignUp""; -import Timeline from ""@/pages/Timeline""; import UserProfile from ""@/pages/UserProfile""; export enum Routes { ROOT = ""/"", - HOME = ""/home"", - TIMELINE = ""/timeline"", RESOURCES = ""/resources"", INBOX = ""/inbox"", ARCHIVED = ""/archived"", @@ -59,13 +56,9 @@ const router = createBrowserRouter([ element: , children: [ { - path: Routes.HOME, + path: """", element: , }, - { - path: Routes.TIMELINE, - element: , - }, { path: Routes.RESOURCES, element: ,",chore,retire timeline page b6e78a1c2d6f29b7f075e81a781da4f89d1595dd,2022-03-24 17:40:46,email,chore: update docker run commands,False,"diff --git a/Dockerfile b/Dockerfile index 5575365995739..f177bfb3b4aaa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,4 @@ COPY --from=frontend /frontend-build/dist /usr/local/memos/web/dist # Directory to store the data, which can be referenced as the mounting point. RUN mkdir -p /var/opt/memos -CMD [""-mode"", ""release"", ""-port"", ""8080"", ""-data"", ""/var/opt/memos""] - ENTRYPOINT [""./memos""] diff --git a/docs/deploy/docker-deploy-guide.md b/docs/deploy/docker-deploy-guide.md index 96e87a3da1b1c..9991696bbff97 100644 --- a/docs/deploy/docker-deploy-guide.md +++ b/docs/deploy/docker-deploy-guide.md @@ -11,7 +11,7 @@ 2. pull and run docker image: ```docker - docker run --name memos --restart always --publish 8080:8080 --volume ~/path/to/your/data/:/var/opt/memos/ neosmemo/memos:next -mode release + docker run --name memos --publish 8080:8080 --volume ~/path/to/your/data/:/var/opt/memos -e mode=release -e data=/var/opt/memos neosmemo/memos:next ``` The default user account is `guest` with password `secret`.",chore,update docker run commands cf4e660f4161f348c49cba5491ee14e180ace93e,2024-09-26 19:41:37,Steven,chore: add memo location setting,False,"diff --git a/proto/api/v1/workspace_setting_service.proto b/proto/api/v1/workspace_setting_service.proto index c092813052c03..e8e271ccc76c1 100644 --- a/proto/api/v1/workspace_setting_service.proto +++ b/proto/api/v1/workspace_setting_service.proto @@ -109,6 +109,8 @@ message WorkspaceMemoRelatedSetting { bool enable_link_preview = 6; // enable_comment enables comment. bool enable_comment = 7; + // enable_location enables setting location for memo. + bool enable_location = 8; } message GetWorkspaceSettingRequest { diff --git a/proto/gen/api/v1/workspace_setting_service.pb.go b/proto/gen/api/v1/workspace_setting_service.pb.go index c7c7e825cc492..752f141829b8b 100644 --- a/proto/gen/api/v1/workspace_setting_service.pb.go +++ b/proto/gen/api/v1/workspace_setting_service.pb.go @@ -468,6 +468,8 @@ type WorkspaceMemoRelatedSetting struct { EnableLinkPreview bool `protobuf:""varint,6,opt,name=enable_link_preview,json=enableLinkPreview,proto3"" json:""enable_link_preview,omitempty""` // enable_comment enables comment. EnableComment bool `protobuf:""varint,7,opt,name=enable_comment,json=enableComment,proto3"" json:""enable_comment,omitempty""` + // enable_location enables setting location for memo. + EnableLocation bool `protobuf:""varint,8,opt,name=enable_location,json=enableLocation,proto3"" json:""enable_location,omitempty""` } func (x *WorkspaceMemoRelatedSetting) Reset() { @@ -551,6 +553,13 @@ func (x *WorkspaceMemoRelatedSetting) GetEnableComment() bool { return false } +func (x *WorkspaceMemoRelatedSetting) GetEnableLocation() bool { + if x != nil { + return x.EnableLocation + } + return false +} + type GetWorkspaceSettingRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -832,7 +841,7 @@ var file_api_v1_workspace_setting_service_proto_rawDesc = []byte{ 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x10, - 0x02, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x33, 0x10, 0x03, 0x22, 0x86, 0x03, 0x0a, 0x1b, 0x57, 0x6f, + 0x02, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x33, 0x10, 0x03, 0x22, 0xaf, 0x03, 0x0a, 0x1b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3c, 0x0a, 0x1a, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x76, 0x69, 0x73, @@ -857,49 +866,52 @@ var file_api_v1_workspace_setting_service_proto_rawDesc = []byte{ 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, - 0x6e, 0x74, 0x22, 0x36, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, - 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x56, 0x0a, 0x1a, 0x53, 0x65, - 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x32, 0xd9, 0x02, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x93, - 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x6e, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x65, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x36, 0x0a, 0x1a, 0x47, + 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x22, 0x56, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x52, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xd9, 0x02, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x22, 0x32, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, - 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xa7, 0x01, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x57, - 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x46, 0xda, 0x41, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x36, 0x3a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x32, 0x2b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x2f, 0x7b, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x6e, 0x61, - 0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xb4, - 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x42, 0x1c, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, - 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, - 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, - 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, - 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x93, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x57, + 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, + 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x32, 0xda, 0x41, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, + 0x65, 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xa7, 0x01, + 0x0a, 0x13, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, + 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, + 0x46, 0xda, 0x41, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x36, 0x3a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x2b, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x7b, 0x73, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xb4, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x1c, 0x57, 0x6f, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, + 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, + 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, + 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, + 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, + 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index 59915af24980a..61ea6f5e45645 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -2119,6 +2119,9 @@ definitions: enableComment: type: boolean description: enable_comment enables comment. + enableLocation: + type: boolean + description: enable_location enables setting location for memo. apiv1WorkspaceSetting: type: object properties: diff --git a/proto/gen/store/workspace_setting.pb.go b/proto/gen/store/workspace_setting.pb.go index 827c08c3cad4e..b2cb93fcd1534 100644 --- a/proto/gen/store/workspace_setting.pb.go +++ b/proto/gen/store/workspace_setting.pb.go @@ -675,6 +675,8 @@ type WorkspaceMemoRelatedSetting struct { EnableLinkPreview bool `protobuf:""varint,6,opt,name=enable_link_preview,json=enableLinkPreview,proto3"" json:""enable_link_preview,omitempty""` // enable_comment enables comment. EnableComment bool `protobuf:""varint,7,opt,name=enable_comment,json=enableComment,proto3"" json:""enable_comment,omitempty""` + // enable_location enables setting location for memo. + EnableLocation bool `protobuf:""varint,8,opt,name=enable_location,json=enableLocation,proto3"" json:""enable_location,omitempty""` } func (x *WorkspaceMemoRelatedSetting) Reset() { @@ -758,6 +760,13 @@ func (x *WorkspaceMemoRelatedSetting) GetEnableComment() bool { return false } +func (x *WorkspaceMemoRelatedSetting) GetEnableLocation() bool { + if x != nil { + return x.EnableLocation + } + return false +} + var File_store_workspace_setting_proto protoreflect.FileDescriptor var file_store_workspace_setting_proto_rawDesc = []byte{ @@ -868,7 +877,7 @@ var file_store_workspace_setting_proto_rawDesc = []byte{ 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, - 0x74, 0x22, 0x86, 0x03, 0x0a, 0x1b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, + 0x74, 0x22, 0xaf, 0x03, 0x0a, 0x1b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3c, 0x0a, 0x1a, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, @@ -892,25 +901,28 @@ var file_store_workspace_setting_proto_rawDesc = []byte{ 0x52, 0x11, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6e, 0x61, - 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2a, 0x73, 0x0a, 0x13, 0x57, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, - 0x79, 0x12, 0x25, 0x0a, 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, - 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x41, 0x53, 0x49, - 0x43, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x02, - 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, 0x10, 0x0a, - 0x0c, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x04, 0x42, - 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x42, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, - 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, - 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, - 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, - 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, - 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2a, 0x73, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x21, 0x57, 0x4f, + 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, + 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x41, 0x53, 0x49, 0x43, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, + 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, + 0x52, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x52, + 0x45, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x04, 0x42, 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x15, 0x57, 0x6f, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, + 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, + 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, + 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/proto/store/workspace_setting.proto b/proto/store/workspace_setting.proto index 6d74a5d817c3e..5ba87b6659736 100644 --- a/proto/store/workspace_setting.proto +++ b/proto/store/workspace_setting.proto @@ -108,4 +108,6 @@ message WorkspaceMemoRelatedSetting { bool enable_link_preview = 6; // enable_comment enables comment. bool enable_comment = 7; + // enable_location enables setting location for memo. + bool enable_location = 8; } diff --git a/server/router/api/v1/workspace_setting_service.go b/server/router/api/v1/workspace_setting_service.go index 24a0ff691d047..b625e9f1a4ccb 100644 --- a/server/router/api/v1/workspace_setting_service.go +++ b/server/router/api/v1/workspace_setting_service.go @@ -231,6 +231,7 @@ func convertWorkspaceMemoRelatedSettingFromStore(setting *storepb.WorkspaceMemoR EnableDoubleClickEdit: setting.EnableDoubleClickEdit, EnableLinkPreview: setting.EnableLinkPreview, EnableComment: setting.EnableComment, + EnableLocation: setting.EnableLocation, } } @@ -246,5 +247,6 @@ func convertWorkspaceMemoRelatedSettingToStore(setting *v1pb.WorkspaceMemoRelate EnableDoubleClickEdit: setting.EnableDoubleClickEdit, EnableLinkPreview: setting.EnableLinkPreview, EnableComment: setting.EnableComment, + EnableLocation: setting.EnableLocation, } } diff --git a/store/seed/sqlite/01__dump.sql b/store/seed/sqlite/01__dump.sql index 90ecf1294c238..48c135943ae6b 100644 --- a/store/seed/sqlite/01__dump.sql +++ b/store/seed/sqlite/01__dump.sql @@ -10,3 +10,4 @@ INSERT INTO resource VALUES(1,'oQ9JTLpGKisxDwnAosJcaA',1,1722096752,1722096788,' INSERT INTO reaction VALUES(1,1722097094,1,'memos/4','THUMBS_UP'); INSERT INTO reaction VALUES(2,1722097100,1,'memos/4','HEART'); INSERT INTO reaction VALUES(3,1722097101,1,'memos/4','FIRE'); +INSERT INTO system_setting VALUES ('MEMO_RELATED', '{""contentLengthLimit"":8192,""enableAutoCompact"":true,""enableComment"":true,""enableLocation"":true}', ''); diff --git a/web/src/components/LeafletMap.tsx b/web/src/components/LeafletMap.tsx index 08d325a6e7e3f..e1facc54cb057 100644 --- a/web/src/components/LeafletMap.tsx +++ b/web/src/components/LeafletMap.tsx @@ -12,6 +12,7 @@ const markerIcon = new DivIcon({ interface MarkerProps { position: LatLng | undefined; onChange: (position: LatLng) => void; + readonly?: boolean; } const LocationMarker = (props: MarkerProps) => { @@ -19,9 +20,12 @@ const LocationMarker = (props: MarkerProps) => { const map = useMapEvents({ click(e) { + if (props.readonly) { + return; + } + setPosition(e.latlng); map.locate(); - // Call the parent onChange function. props.onChange(e.latlng); }, @@ -37,6 +41,7 @@ const LocationMarker = (props: MarkerProps) => { }; interface MapProps { + readonly?: boolean; latlng?: LatLng; onChange?: (position: LatLng) => void; } @@ -48,7 +53,7 @@ const LeafletMap = (props: MapProps) => { return ( - {}} /> + {}} /> ); }; diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx index 3f3561ada71cb..435232c4e1279 100644 --- a/web/src/components/MemoEditor/index.tsx +++ b/web/src/components/MemoEditor/index.tsx @@ -445,15 +445,17 @@ const MemoEditor = (props: Props) => { - - setState((prevState) => ({ - ...prevState, - location, - })) - } - /> + {workspaceMemoRelatedSetting.enableLocation && ( + + setState((prevState) => ({ + ...prevState, + location, + })) + } + /> + )}
diff --git a/web/src/components/MemoLocationView.tsx b/web/src/components/MemoLocationView.tsx index 71d0c9f744aa2..ac6cc05aeff7e 100644 --- a/web/src/components/MemoLocationView.tsx +++ b/web/src/components/MemoLocationView.tsx @@ -25,7 +25,7 @@ const MemoLocationView: React.FC = (props: Props) => {
- +
diff --git a/web/src/components/Settings/MemoRelatedSettings.tsx b/web/src/components/Settings/MemoRelatedSettings.tsx index 8c43620a7f45a..7cc2e62511f41 100644 --- a/web/src/components/Settings/MemoRelatedSettings.tsx +++ b/web/src/components/Settings/MemoRelatedSettings.tsx @@ -67,6 +67,13 @@ const MemoRelatedSettings = () => { onChange={(event) => updatePartialSetting({ enableComment: event.target.checked })} />
+
+ Enable memo location + updatePartialSetting({ enableLocation: event.target.checked })} + /> +
{t(""setting.system-section.enable-double-click-to-edit"")} { const date = `${year}-${month}-${day}`; const count = data[date] || 0; return day ? ( - +
) : ( diff --git a/web/src/components/ChangeMemoCreatedTsDialog.tsx b/web/src/components/ChangeMemoCreatedTsDialog.tsx index c5639c586b564..98c3f1eeb7d89 100644 --- a/web/src/components/ChangeMemoCreatedTsDialog.tsx +++ b/web/src/components/ChangeMemoCreatedTsDialog.tsx @@ -1,7 +1,7 @@ import { Button, IconButton, Input } from ""@mui/joy""; import { useEffect, useState } from ""react""; import { toast } from ""react-hot-toast""; -import { getNormalizedTimeString, getUnixTime } from ""@/helpers/datetime""; +import { getNormalizedTimeString } from ""@/helpers/datetime""; import { useMemoStore } from ""@/store/v1""; import { useTranslate } from ""@/utils/i18n""; import { generateDialog } from ""./Dialog""; @@ -40,12 +40,6 @@ const ChangeMemoCreatedTsDialog: React.FC = (props: Props) => { }; const handleSaveBtnClick = async () => { - const nowTs = getUnixTime(); - if (getUnixTime(createdAt) > nowTs) { - toast.error(t(""message.invalid-created-datetime"")); - return; - } - try { await memoStore.updateMemo( { diff --git a/web/src/pages/Timeline.tsx b/web/src/pages/Timeline.tsx index 82727a9387efd..ea19606e93996 100644 --- a/web/src/pages/Timeline.tsx +++ b/web/src/pages/Timeline.tsx @@ -108,7 +108,7 @@ const Timeline = () => { key={group.month} className={classNames(""flex justify-start items-start w-full mt-2 mb-4"", md ? ""flex-row"" : ""flex-col"")} > -
+
{new Date(group.month).toLocaleString(i18n.language, { month: ""short"" })} @@ -122,11 +122,11 @@ const Timeline = () => { {group.memos.map((memo, index) => (
{group.memos.length > 1 && ( -
+
{index !== group.memos.length - 1 && (
)}",chore,tweak timeline styles cbebbca7d68745761468c60f992ee71d228cb4ff,2024-03-30 12:28:47,Steven,chore: add idp definition,False,"diff --git a/proto/api/v2/idp_service.proto b/proto/api/v2/idp_service.proto new file mode 100644 index 0000000000000..db2ded42ce616 --- /dev/null +++ b/proto/api/v2/idp_service.proto @@ -0,0 +1,124 @@ +syntax = ""proto3""; + +package memos.api.v2; + +import ""google/api/annotations.proto""; +import ""google/api/client.proto""; +import ""google/protobuf/field_mask.proto""; + +option go_package = ""gen/api/v2""; + +service IdentityProviderService { + rpc ListIdentityProviders(ListIdentityProvidersRequest) returns (ListIdentityProvidersResponse) { + option (google.api.http) = {get: ""/api/v2/identityProviders""}; + } + rpc GetIdentityProvider(GetIdentityProviderRequest) returns (GetIdentityProviderResponse) { + option (google.api.http) = {get: ""/api/v2/{name=identityProviders/*}""}; + option (google.api.method_signature) = ""name""; + } + rpc CreateIdentityProvider(CreateIdentityProviderRequest) returns (CreateIdentityProviderResponse) { + option (google.api.http) = {post: ""/api/v2/identityProviders""}; + } + // UpdateIdentityProvider updates an identity provider. + rpc UpdateIdentityProvider(UpdateIdentityProviderRequest) returns (UpdateIdentityProviderResponse) { + option (google.api.http) = { + patch: ""/api/v2/{identity_provider.name=identityProviders/*}"" + body: ""identity_provider"" + }; + option (google.api.method_signature) = ""identity_provider,update_mask""; + } + // DeleteIdentityProvider deletes an identity provider. + rpc DeleteIdentityProvider(DeleteIdentityProviderRequest) returns (DeleteIdentityProviderResponse) { + option (google.api.http) = {delete: ""/api/v2/{name=identityProviders/*}""}; + option (google.api.method_signature) = ""name""; + } +} + +message IdentityProvider { + // The name of the identityProvider. + // Format: identityProviders/{id} + string name = 1; + + enum Type { + TYPE_UNSPECIFIED = 0; + OAUTH2 = 1; + } + Type type = 2; + + string title = 3; + + string identifier_filter = 4; + + message Config { + message FieldMapping { + string identifier = 1; + string display_name = 2; + string email = 3; + } + + message OAuth2 { + string client_id = 1; + string client_secret = 2; + string auth_url = 3; + string token_url = 4; + string user_info_url = 5; + repeated string scopes = 6; + FieldMapping field_mapping = 7; + } + + oneof config { + OAuth2 oauth2 = 1; + } + } + + Config config = 5; +} + +message ListIdentityProvidersRequest {} + +message ListIdentityProvidersResponse { + repeated IdentityProvider identity_providers = 1; +} + +message GetIdentityProviderRequest { + // The name of the identityProvider to get. + // Format: identityProviders/{id} + string name = 1; +} + +message GetIdentityProviderResponse { + // The identityProvider. + IdentityProvider identity_provider = 1; +} + +message CreateIdentityProviderRequest { + // The identityProvider to create. + IdentityProvider identity_provider = 1; +} + +message CreateIdentityProviderResponse { + // The created identityProvider. + IdentityProvider identity_provider = 1; +} + +message UpdateIdentityProviderRequest { + // The identityProvider to update. + IdentityProvider identity_provider = 1; + + // The update mask applies to the resource. Only the top level fields of + // IdentityProvider are supported. + google.protobuf.FieldMask update_mask = 2; +} + +message UpdateIdentityProviderResponse { + // The updated identityProvider. + IdentityProvider identity_provider = 1; +} + +message DeleteIdentityProviderRequest { + // The name of the identityProvider to delete. + // Format: identityProviders/{id} + string name = 1; +} + +message DeleteIdentityProviderResponse {} diff --git a/proto/api/v2/inbox_service.proto b/proto/api/v2/inbox_service.proto index bb937ca10d195..50d13b42ebc1c 100644 --- a/proto/api/v2/inbox_service.proto +++ b/proto/api/v2/inbox_service.proto @@ -31,11 +31,11 @@ service InboxService { message Inbox { // The name of the inbox. - // Format: inboxes/{uid} + // Format: inboxes/{id} string name = 1; - // Format: users/{username} + // Format: users/{id} string sender = 2; - // Format: users/{username} + // Format: users/{id} string receiver = 3; enum Status { @@ -58,7 +58,7 @@ message Inbox { } message ListInboxesRequest { - // Format: users/{username} + // Format: users/{id} string user = 1; } @@ -78,7 +78,7 @@ message UpdateInboxResponse { message DeleteInboxRequest { // The name of the inbox to delete. - // Format: inboxes/{uid} + // Format: inboxes/{id} string name = 1; } diff --git a/proto/gen/api/v2/README.md b/proto/gen/api/v2/README.md index ef705e4e4be77..c3fd167b6e688 100644 --- a/proto/gen/api/v2/README.md +++ b/proto/gen/api/v2/README.md @@ -63,6 +63,26 @@ - [AuthService](#memos-api-v2-AuthService) +- [api/v2/idp_service.proto](#api_v2_idp_service-proto) + - [CreateIdentityProviderRequest](#memos-api-v2-CreateIdentityProviderRequest) + - [CreateIdentityProviderResponse](#memos-api-v2-CreateIdentityProviderResponse) + - [DeleteIdentityProviderRequest](#memos-api-v2-DeleteIdentityProviderRequest) + - [DeleteIdentityProviderResponse](#memos-api-v2-DeleteIdentityProviderResponse) + - [GetIdentityProviderRequest](#memos-api-v2-GetIdentityProviderRequest) + - [GetIdentityProviderResponse](#memos-api-v2-GetIdentityProviderResponse) + - [IdentityProvider](#memos-api-v2-IdentityProvider) + - [IdentityProvider.Config](#memos-api-v2-IdentityProvider-Config) + - [IdentityProvider.Config.FieldMapping](#memos-api-v2-IdentityProvider-Config-FieldMapping) + - [IdentityProvider.Config.OAuth2](#memos-api-v2-IdentityProvider-Config-OAuth2) + - [ListIdentityProvidersRequest](#memos-api-v2-ListIdentityProvidersRequest) + - [ListIdentityProvidersResponse](#memos-api-v2-ListIdentityProvidersResponse) + - [UpdateIdentityProviderRequest](#memos-api-v2-UpdateIdentityProviderRequest) + - [UpdateIdentityProviderResponse](#memos-api-v2-UpdateIdentityProviderResponse) + + - [IdentityProvider.Type](#memos-api-v2-IdentityProvider-Type) + + - [IdentityProviderService](#memos-api-v2-IdentityProviderService) + - [api/v2/inbox_service.proto](#api_v2_inbox_service-proto) - [DeleteInboxRequest](#memos-api-v2-DeleteInboxRequest) - [DeleteInboxResponse](#memos-api-v2-DeleteInboxResponse) @@ -977,6 +997,261 @@ Used internally for obfuscating the page token. + +

Top

+ +## api/v2/idp_service.proto + + + + + +### CreateIdentityProviderRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| identity_provider | [IdentityProvider](#memos-api-v2-IdentityProvider) | | The identityProvider to create. | + + + + + + + + +### CreateIdentityProviderResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| identity_provider | [IdentityProvider](#memos-api-v2-IdentityProvider) | | The created identityProvider. | + + + + + + + + +### DeleteIdentityProviderRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | The name of the identityProvider to delete. Format: identityProviders/{id} | + + + + + + + + +### DeleteIdentityProviderResponse + + + + + + + + + +### GetIdentityProviderRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | The name of the identityProvider to get. Format: identityProviders/{id} | + + + + + + + + +### GetIdentityProviderResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| identity_provider | [IdentityProvider](#memos-api-v2-IdentityProvider) | | The identityProvider. | + + + + + + + + +### IdentityProvider + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | The name of the identityProvider. Format: identityProviders/{id} | +| type | [IdentityProvider.Type](#memos-api-v2-IdentityProvider-Type) | | | +| title | [string](#string) | | | +| identifier_filter | [string](#string) | | | +| config | [IdentityProvider.Config](#memos-api-v2-IdentityProvider-Config) | | | + + + + + + + + +### IdentityProvider.Config + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| oauth2 | [IdentityProvider.Config.OAuth2](#memos-api-v2-IdentityProvider-Config-OAuth2) | | | + + + + + + + + +### IdentityProvider.Config.FieldMapping + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| identifier | [string](#string) | | | +| display_name | [string](#string) | | | +| email | [string](#string) | | | + + + + + + + + +### IdentityProvider.Config.OAuth2 + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| client_id | [string](#string) | | | +| client_secret | [string](#string) | | | +| auth_url | [string](#string) | | | +| token_url | [string](#string) | | | +| user_info_url | [string](#string) | | | +| scopes | [string](#string) | repeated | | +| field_mapping | [IdentityProvider.Config.FieldMapping](#memos-api-v2-IdentityProvider-Config-FieldMapping) | | | + + + + + + + + +### ListIdentityProvidersRequest + + + + + + + + + +### ListIdentityProvidersResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| identity_providers | [IdentityProvider](#memos-api-v2-IdentityProvider) | repeated | | + + + + + + + + +### UpdateIdentityProviderRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| identity_provider | [IdentityProvider](#memos-api-v2-IdentityProvider) | | The identityProvider to update. | +| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The update mask applies to the resource. Only the top level fields of IdentityProvider are supported. | + + + + + + + + +### UpdateIdentityProviderResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| identity_provider | [IdentityProvider](#memos-api-v2-IdentityProvider) | | The updated identityProvider. | + + + + + + + + + + +### IdentityProvider.Type + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| TYPE_UNSPECIFIED | 0 | | +| OAUTH2 | 1 | | + + + + + + + + + +### IdentityProviderService + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| ListIdentityProviders | [ListIdentityProvidersRequest](#memos-api-v2-ListIdentityProvidersRequest) | [ListIdentityProvidersResponse](#memos-api-v2-ListIdentityProvidersResponse) | | +| GetIdentityProvider | [GetIdentityProviderRequest](#memos-api-v2-GetIdentityProviderRequest) | [GetIdentityProviderResponse](#memos-api-v2-GetIdentityProviderResponse) | | +| CreateIdentityProvider | [CreateIdentityProviderRequest](#memos-api-v2-CreateIdentityProviderRequest) | [CreateIdentityProviderResponse](#memos-api-v2-CreateIdentityProviderResponse) | | +| UpdateIdentityProvider | [UpdateIdentityProviderRequest](#memos-api-v2-UpdateIdentityProviderRequest) | [UpdateIdentityProviderResponse](#memos-api-v2-UpdateIdentityProviderResponse) | UpdateIdentityProvider updates an identity provider. | +| DeleteIdentityProvider | [DeleteIdentityProviderRequest](#memos-api-v2-DeleteIdentityProviderRequest) | [DeleteIdentityProviderResponse](#memos-api-v2-DeleteIdentityProviderResponse) | DeleteIdentityProvider deletes an identity provider. | + + + + +

Top

@@ -992,7 +1267,7 @@ Used internally for obfuscating the page token. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| name | [string](#string) | | The name of the inbox to delete. Format: inboxes/{uid} | +| name | [string](#string) | | The name of the inbox to delete. Format: inboxes/{id} | @@ -1017,9 +1292,9 @@ Used internally for obfuscating the page token. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| name | [string](#string) | | The name of the inbox. Format: inboxes/{uid} | -| sender | [string](#string) | | Format: users/{username} | -| receiver | [string](#string) | | Format: users/{username} | +| name | [string](#string) | | The name of the inbox. Format: inboxes/{id} | +| sender | [string](#string) | | Format: users/{id} | +| receiver | [string](#string) | | Format: users/{id} | | status | [Inbox.Status](#memos-api-v2-Inbox-Status) | | | | create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | | type | [Inbox.Type](#memos-api-v2-Inbox-Type) | | | @@ -1038,7 +1313,7 @@ Used internally for obfuscating the page token. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| user | [string](#string) | | Format: users/{username} | +| user | [string](#string) | | Format: users/{id} | diff --git a/proto/gen/api/v2/idp_service.pb.go b/proto/gen/api/v2/idp_service.pb.go new file mode 100644 index 0000000000000..f17a4c3f5f056 --- /dev/null +++ b/proto/gen/api/v2/idp_service.pb.go @@ -0,0 +1,1289 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: api/v2/idp_service.proto + +package apiv2 + +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"" +) + +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) +) + +type IdentityProvider_Type int32 + +const ( + IdentityProvider_TYPE_UNSPECIFIED IdentityProvider_Type = 0 + IdentityProvider_OAUTH2 IdentityProvider_Type = 1 +) + +// Enum value maps for IdentityProvider_Type. +var ( + IdentityProvider_Type_name = map[int32]string{ + 0: ""TYPE_UNSPECIFIED"", + 1: ""OAUTH2"", + } + IdentityProvider_Type_value = map[string]int32{ + ""TYPE_UNSPECIFIED"": 0, + ""OAUTH2"": 1, + } +) + +func (x IdentityProvider_Type) Enum() *IdentityProvider_Type { + p := new(IdentityProvider_Type) + *p = x + return p +} + +func (x IdentityProvider_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (IdentityProvider_Type) Descriptor() protoreflect.EnumDescriptor { + return file_api_v2_idp_service_proto_enumTypes[0].Descriptor() +} + +func (IdentityProvider_Type) Type() protoreflect.EnumType { + return &file_api_v2_idp_service_proto_enumTypes[0] +} + +func (x IdentityProvider_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use IdentityProvider_Type.Descriptor instead. +func (IdentityProvider_Type) EnumDescriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{0, 0} +} + +type IdentityProvider struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the identityProvider. + // Format: identityProviders/{id} + Name string `protobuf:""bytes,1,opt,name=name,proto3"" json:""name,omitempty""` + Type IdentityProvider_Type `protobuf:""varint,2,opt,name=type,proto3,enum=memos.api.v2.IdentityProvider_Type"" json:""type,omitempty""` + Title string `protobuf:""bytes,3,opt,name=title,proto3"" json:""title,omitempty""` + IdentifierFilter string `protobuf:""bytes,4,opt,name=identifier_filter,json=identifierFilter,proto3"" json:""identifier_filter,omitempty""` + Config *IdentityProvider_Config `protobuf:""bytes,5,opt,name=config,proto3"" json:""config,omitempty""` +} + +func (x *IdentityProvider) Reset() { + *x = IdentityProvider{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityProvider) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityProvider) ProtoMessage() {} + +func (x *IdentityProvider) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityProvider.ProtoReflect.Descriptor instead. +func (*IdentityProvider) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{0} +} + +func (x *IdentityProvider) GetName() string { + if x != nil { + return x.Name + } + return """" +} + +func (x *IdentityProvider) GetType() IdentityProvider_Type { + if x != nil { + return x.Type + } + return IdentityProvider_TYPE_UNSPECIFIED +} + +func (x *IdentityProvider) GetTitle() string { + if x != nil { + return x.Title + } + return """" +} + +func (x *IdentityProvider) GetIdentifierFilter() string { + if x != nil { + return x.IdentifierFilter + } + return """" +} + +func (x *IdentityProvider) GetConfig() *IdentityProvider_Config { + if x != nil { + return x.Config + } + return nil +} + +type ListIdentityProvidersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListIdentityProvidersRequest) Reset() { + *x = ListIdentityProvidersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIdentityProvidersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIdentityProvidersRequest) ProtoMessage() {} + +func (x *ListIdentityProvidersRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIdentityProvidersRequest.ProtoReflect.Descriptor instead. +func (*ListIdentityProvidersRequest) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{1} +} + +type ListIdentityProvidersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IdentityProviders []*IdentityProvider `protobuf:""bytes,1,rep,name=identity_providers,json=identityProviders,proto3"" json:""identity_providers,omitempty""` +} + +func (x *ListIdentityProvidersResponse) Reset() { + *x = ListIdentityProvidersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIdentityProvidersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIdentityProvidersResponse) ProtoMessage() {} + +func (x *ListIdentityProvidersResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIdentityProvidersResponse.ProtoReflect.Descriptor instead. +func (*ListIdentityProvidersResponse) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ListIdentityProvidersResponse) GetIdentityProviders() []*IdentityProvider { + if x != nil { + return x.IdentityProviders + } + return nil +} + +type GetIdentityProviderRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the identityProvider to get. + // Format: identityProviders/{id} + Name string `protobuf:""bytes,1,opt,name=name,proto3"" json:""name,omitempty""` +} + +func (x *GetIdentityProviderRequest) Reset() { + *x = GetIdentityProviderRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIdentityProviderRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIdentityProviderRequest) ProtoMessage() {} + +func (x *GetIdentityProviderRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIdentityProviderRequest.ProtoReflect.Descriptor instead. +func (*GetIdentityProviderRequest) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{3} +} + +func (x *GetIdentityProviderRequest) GetName() string { + if x != nil { + return x.Name + } + return """" +} + +type GetIdentityProviderResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The identityProvider. + IdentityProvider *IdentityProvider `protobuf:""bytes,1,opt,name=identity_provider,json=identityProvider,proto3"" json:""identity_provider,omitempty""` +} + +func (x *GetIdentityProviderResponse) Reset() { + *x = GetIdentityProviderResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIdentityProviderResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIdentityProviderResponse) ProtoMessage() {} + +func (x *GetIdentityProviderResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIdentityProviderResponse.ProtoReflect.Descriptor instead. +func (*GetIdentityProviderResponse) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{4} +} + +func (x *GetIdentityProviderResponse) GetIdentityProvider() *IdentityProvider { + if x != nil { + return x.IdentityProvider + } + return nil +} + +type CreateIdentityProviderRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The identityProvider to create. + IdentityProvider *IdentityProvider `protobuf:""bytes,1,opt,name=identity_provider,json=identityProvider,proto3"" json:""identity_provider,omitempty""` +} + +func (x *CreateIdentityProviderRequest) Reset() { + *x = CreateIdentityProviderRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateIdentityProviderRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateIdentityProviderRequest) ProtoMessage() {} + +func (x *CreateIdentityProviderRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateIdentityProviderRequest.ProtoReflect.Descriptor instead. +func (*CreateIdentityProviderRequest) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateIdentityProviderRequest) GetIdentityProvider() *IdentityProvider { + if x != nil { + return x.IdentityProvider + } + return nil +} + +type CreateIdentityProviderResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The created identityProvider. + IdentityProvider *IdentityProvider `protobuf:""bytes,1,opt,name=identity_provider,json=identityProvider,proto3"" json:""identity_provider,omitempty""` +} + +func (x *CreateIdentityProviderResponse) Reset() { + *x = CreateIdentityProviderResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateIdentityProviderResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateIdentityProviderResponse) ProtoMessage() {} + +func (x *CreateIdentityProviderResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateIdentityProviderResponse.ProtoReflect.Descriptor instead. +func (*CreateIdentityProviderResponse) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{6} +} + +func (x *CreateIdentityProviderResponse) GetIdentityProvider() *IdentityProvider { + if x != nil { + return x.IdentityProvider + } + return nil +} + +type UpdateIdentityProviderRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The identityProvider to update. + IdentityProvider *IdentityProvider `protobuf:""bytes,1,opt,name=identity_provider,json=identityProvider,proto3"" json:""identity_provider,omitempty""` + // The update mask applies to the resource. Only the top level fields of + // IdentityProvider are supported. + UpdateMask *fieldmaskpb.FieldMask `protobuf:""bytes,2,opt,name=update_mask,json=updateMask,proto3"" json:""update_mask,omitempty""` +} + +func (x *UpdateIdentityProviderRequest) Reset() { + *x = UpdateIdentityProviderRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateIdentityProviderRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateIdentityProviderRequest) ProtoMessage() {} + +func (x *UpdateIdentityProviderRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateIdentityProviderRequest.ProtoReflect.Descriptor instead. +func (*UpdateIdentityProviderRequest) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{7} +} + +func (x *UpdateIdentityProviderRequest) GetIdentityProvider() *IdentityProvider { + if x != nil { + return x.IdentityProvider + } + return nil +} + +func (x *UpdateIdentityProviderRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +type UpdateIdentityProviderResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The updated identityProvider. + IdentityProvider *IdentityProvider `protobuf:""bytes,1,opt,name=identity_provider,json=identityProvider,proto3"" json:""identity_provider,omitempty""` +} + +func (x *UpdateIdentityProviderResponse) Reset() { + *x = UpdateIdentityProviderResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateIdentityProviderResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateIdentityProviderResponse) ProtoMessage() {} + +func (x *UpdateIdentityProviderResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateIdentityProviderResponse.ProtoReflect.Descriptor instead. +func (*UpdateIdentityProviderResponse) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdateIdentityProviderResponse) GetIdentityProvider() *IdentityProvider { + if x != nil { + return x.IdentityProvider + } + return nil +} + +type DeleteIdentityProviderRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the identityProvider to delete. + // Format: identityProviders/{id} + Name string `protobuf:""bytes,1,opt,name=name,proto3"" json:""name,omitempty""` +} + +func (x *DeleteIdentityProviderRequest) Reset() { + *x = DeleteIdentityProviderRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteIdentityProviderRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteIdentityProviderRequest) ProtoMessage() {} + +func (x *DeleteIdentityProviderRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteIdentityProviderRequest.ProtoReflect.Descriptor instead. +func (*DeleteIdentityProviderRequest) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{9} +} + +func (x *DeleteIdentityProviderRequest) GetName() string { + if x != nil { + return x.Name + } + return """" +} + +type DeleteIdentityProviderResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteIdentityProviderResponse) Reset() { + *x = DeleteIdentityProviderResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteIdentityProviderResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteIdentityProviderResponse) ProtoMessage() {} + +func (x *DeleteIdentityProviderResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteIdentityProviderResponse.ProtoReflect.Descriptor instead. +func (*DeleteIdentityProviderResponse) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{10} +} + +type IdentityProvider_Config struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Config: + // + // *IdentityProvider_Config_Oauth2 + Config isIdentityProvider_Config_Config `protobuf_oneof:""config""` +} + +func (x *IdentityProvider_Config) Reset() { + *x = IdentityProvider_Config{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityProvider_Config) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityProvider_Config) ProtoMessage() {} + +func (x *IdentityProvider_Config) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityProvider_Config.ProtoReflect.Descriptor instead. +func (*IdentityProvider_Config) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{0, 0} +} + +func (m *IdentityProvider_Config) GetConfig() isIdentityProvider_Config_Config { + if m != nil { + return m.Config + } + return nil +} + +func (x *IdentityProvider_Config) GetOauth2() *IdentityProvider_Config_OAuth2 { + if x, ok := x.GetConfig().(*IdentityProvider_Config_Oauth2); ok { + return x.Oauth2 + } + return nil +} + +type isIdentityProvider_Config_Config interface { + isIdentityProvider_Config_Config() +} + +type IdentityProvider_Config_Oauth2 struct { + Oauth2 *IdentityProvider_Config_OAuth2 `protobuf:""bytes,1,opt,name=oauth2,proto3,oneof""` +} + +func (*IdentityProvider_Config_Oauth2) isIdentityProvider_Config_Config() {} + +type IdentityProvider_Config_FieldMapping struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Identifier string `protobuf:""bytes,1,opt,name=identifier,proto3"" json:""identifier,omitempty""` + DisplayName string `protobuf:""bytes,2,opt,name=display_name,json=displayName,proto3"" json:""display_name,omitempty""` + Email string `protobuf:""bytes,3,opt,name=email,proto3"" json:""email,omitempty""` +} + +func (x *IdentityProvider_Config_FieldMapping) Reset() { + *x = IdentityProvider_Config_FieldMapping{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityProvider_Config_FieldMapping) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityProvider_Config_FieldMapping) ProtoMessage() {} + +func (x *IdentityProvider_Config_FieldMapping) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityProvider_Config_FieldMapping.ProtoReflect.Descriptor instead. +func (*IdentityProvider_Config_FieldMapping) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{0, 0, 0} +} + +func (x *IdentityProvider_Config_FieldMapping) GetIdentifier() string { + if x != nil { + return x.Identifier + } + return """" +} + +func (x *IdentityProvider_Config_FieldMapping) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return """" +} + +func (x *IdentityProvider_Config_FieldMapping) GetEmail() string { + if x != nil { + return x.Email + } + return """" +} + +type IdentityProvider_Config_OAuth2 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ClientId string `protobuf:""bytes,1,opt,name=client_id,json=clientId,proto3"" json:""client_id,omitempty""` + ClientSecret string `protobuf:""bytes,2,opt,name=client_secret,json=clientSecret,proto3"" json:""client_secret,omitempty""` + AuthUrl string `protobuf:""bytes,3,opt,name=auth_url,json=authUrl,proto3"" json:""auth_url,omitempty""` + TokenUrl string `protobuf:""bytes,4,opt,name=token_url,json=tokenUrl,proto3"" json:""token_url,omitempty""` + UserInfoUrl string `protobuf:""bytes,5,opt,name=user_info_url,json=userInfoUrl,proto3"" json:""user_info_url,omitempty""` + Scopes []string `protobuf:""bytes,6,rep,name=scopes,proto3"" json:""scopes,omitempty""` + FieldMapping *IdentityProvider_Config_FieldMapping `protobuf:""bytes,7,opt,name=field_mapping,json=fieldMapping,proto3"" json:""field_mapping,omitempty""` +} + +func (x *IdentityProvider_Config_OAuth2) Reset() { + *x = IdentityProvider_Config_OAuth2{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_idp_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityProvider_Config_OAuth2) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityProvider_Config_OAuth2) ProtoMessage() {} + +func (x *IdentityProvider_Config_OAuth2) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_idp_service_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityProvider_Config_OAuth2.ProtoReflect.Descriptor instead. +func (*IdentityProvider_Config_OAuth2) Descriptor() ([]byte, []int) { + return file_api_v2_idp_service_proto_rawDescGZIP(), []int{0, 0, 1} +} + +func (x *IdentityProvider_Config_OAuth2) GetClientId() string { + if x != nil { + return x.ClientId + } + return """" +} + +func (x *IdentityProvider_Config_OAuth2) GetClientSecret() string { + if x != nil { + return x.ClientSecret + } + return """" +} + +func (x *IdentityProvider_Config_OAuth2) GetAuthUrl() string { + if x != nil { + return x.AuthUrl + } + return """" +} + +func (x *IdentityProvider_Config_OAuth2) GetTokenUrl() string { + if x != nil { + return x.TokenUrl + } + return """" +} + +func (x *IdentityProvider_Config_OAuth2) GetUserInfoUrl() string { + if x != nil { + return x.UserInfoUrl + } + return """" +} + +func (x *IdentityProvider_Config_OAuth2) GetScopes() []string { + if x != nil { + return x.Scopes + } + return nil +} + +func (x *IdentityProvider_Config_OAuth2) GetFieldMapping() *IdentityProvider_Config_FieldMapping { + if x != nil { + return x.FieldMapping + } + return nil +} + +var File_api_v2_idp_service_proto protoreflect.FileDescriptor + +var file_api_v2_idp_service_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x69, 0x64, 0x70, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xeb, 0x05, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, 0xdd, 0x03, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x12, 0x46, 0x0a, 0x06, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x48, 0x00, + 0x52, 0x06, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x1a, 0x67, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, + 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, + 0x6c, 0x1a, 0x97, 0x02, 0x0a, 0x06, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x12, 0x1b, 0x0a, 0x09, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x19, + 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x61, 0x75, 0x74, 0x68, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x22, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, + 0x6e, 0x66, 0x6f, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x75, + 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x55, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x73, 0x12, 0x57, 0x0a, 0x0d, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x70, 0x70, + 0x69, 0x6e, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0c, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x42, 0x08, 0x0a, 0x06, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x28, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, + 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x41, 0x55, 0x54, 0x48, 0x32, 0x10, 0x01, 0x22, + 0x1e, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x6e, 0x0a, 0x1d, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x4d, 0x0a, 0x12, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x11, 0x69, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x22, + 0x30, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x22, 0x6a, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x4b, 0x0a, 0x11, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x10, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x22, 0x6c, 0x0a, + 0x1d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4b, + 0x0a, 0x11, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x22, 0x6d, 0x0a, 0x1e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, + 0x11, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x22, 0xa9, 0x01, 0x0a, 0x1d, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4b, 0x0a, 0x11, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x6d, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x11, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x22, 0x33, 0x0a, 0x1d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x0a, 0x1e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf8, 0x06, 0x0a, + 0x17, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x93, 0x01, 0x0a, 0x15, 0x4c, 0x69, 0x73, + 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x73, 0x12, 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x12, 0x9d, + 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x29, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0xda, 0x41, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, 0x22, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x96, + 0x01, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x2b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x22, 0x19, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x12, 0xe4, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x12, 0x2b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6f, 0xda, + 0x41, 0x1d, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x49, 0x3a, 0x11, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x32, 0x34, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x32, 0x2f, 0x7b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xa6, + 0x01, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x2b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x24, 0x2a, 0x22, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, + 0x6d, 0x65, 0x3d, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xa7, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x0f, 0x49, 0x64, + 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, + 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, + 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, + 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, + 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_v2_idp_service_proto_rawDescOnce sync.Once + file_api_v2_idp_service_proto_rawDescData = file_api_v2_idp_service_proto_rawDesc +) + +func file_api_v2_idp_service_proto_rawDescGZIP() []byte { + file_api_v2_idp_service_proto_rawDescOnce.Do(func() { + file_api_v2_idp_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v2_idp_service_proto_rawDescData) + }) + return file_api_v2_idp_service_proto_rawDescData +} + +var file_api_v2_idp_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_v2_idp_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_api_v2_idp_service_proto_goTypes = []interface{}{ + (IdentityProvider_Type)(0), // 0: memos.api.v2.IdentityProvider.Type + (*IdentityProvider)(nil), // 1: memos.api.v2.IdentityProvider + (*ListIdentityProvidersRequest)(nil), // 2: memos.api.v2.ListIdentityProvidersRequest + (*ListIdentityProvidersResponse)(nil), // 3: memos.api.v2.ListIdentityProvidersResponse + (*GetIdentityProviderRequest)(nil), // 4: memos.api.v2.GetIdentityProviderRequest + (*GetIdentityProviderResponse)(nil), // 5: memos.api.v2.GetIdentityProviderResponse + (*CreateIdentityProviderRequest)(nil), // 6: memos.api.v2.CreateIdentityProviderRequest + (*CreateIdentityProviderResponse)(nil), // 7: memos.api.v2.CreateIdentityProviderResponse + (*UpdateIdentityProviderRequest)(nil), // 8: memos.api.v2.UpdateIdentityProviderRequest + (*UpdateIdentityProviderResponse)(nil), // 9: memos.api.v2.UpdateIdentityProviderResponse + (*DeleteIdentityProviderRequest)(nil), // 10: memos.api.v2.DeleteIdentityProviderRequest + (*DeleteIdentityProviderResponse)(nil), // 11: memos.api.v2.DeleteIdentityProviderResponse + (*IdentityProvider_Config)(nil), // 12: memos.api.v2.IdentityProvider.Config + (*IdentityProvider_Config_FieldMapping)(nil), // 13: memos.api.v2.IdentityProvider.Config.FieldMapping + (*IdentityProvider_Config_OAuth2)(nil), // 14: memos.api.v2.IdentityProvider.Config.OAuth2 + (*fieldmaskpb.FieldMask)(nil), // 15: google.protobuf.FieldMask +} +var file_api_v2_idp_service_proto_depIdxs = []int32{ + 0, // 0: memos.api.v2.IdentityProvider.type:type_name -> memos.api.v2.IdentityProvider.Type + 12, // 1: memos.api.v2.IdentityProvider.config:type_name -> memos.api.v2.IdentityProvider.Config + 1, // 2: memos.api.v2.ListIdentityProvidersResponse.identity_providers:type_name -> memos.api.v2.IdentityProvider + 1, // 3: memos.api.v2.GetIdentityProviderResponse.identity_provider:type_name -> memos.api.v2.IdentityProvider + 1, // 4: memos.api.v2.CreateIdentityProviderRequest.identity_provider:type_name -> memos.api.v2.IdentityProvider + 1, // 5: memos.api.v2.CreateIdentityProviderResponse.identity_provider:type_name -> memos.api.v2.IdentityProvider + 1, // 6: memos.api.v2.UpdateIdentityProviderRequest.identity_provider:type_name -> memos.api.v2.IdentityProvider + 15, // 7: memos.api.v2.UpdateIdentityProviderRequest.update_mask:type_name -> google.protobuf.FieldMask + 1, // 8: memos.api.v2.UpdateIdentityProviderResponse.identity_provider:type_name -> memos.api.v2.IdentityProvider + 14, // 9: memos.api.v2.IdentityProvider.Config.oauth2:type_name -> memos.api.v2.IdentityProvider.Config.OAuth2 + 13, // 10: memos.api.v2.IdentityProvider.Config.OAuth2.field_mapping:type_name -> memos.api.v2.IdentityProvider.Config.FieldMapping + 2, // 11: memos.api.v2.IdentityProviderService.ListIdentityProviders:input_type -> memos.api.v2.ListIdentityProvidersRequest + 4, // 12: memos.api.v2.IdentityProviderService.GetIdentityProvider:input_type -> memos.api.v2.GetIdentityProviderRequest + 6, // 13: memos.api.v2.IdentityProviderService.CreateIdentityProvider:input_type -> memos.api.v2.CreateIdentityProviderRequest + 8, // 14: memos.api.v2.IdentityProviderService.UpdateIdentityProvider:input_type -> memos.api.v2.UpdateIdentityProviderRequest + 10, // 15: memos.api.v2.IdentityProviderService.DeleteIdentityProvider:input_type -> memos.api.v2.DeleteIdentityProviderRequest + 3, // 16: memos.api.v2.IdentityProviderService.ListIdentityProviders:output_type -> memos.api.v2.ListIdentityProvidersResponse + 5, // 17: memos.api.v2.IdentityProviderService.GetIdentityProvider:output_type -> memos.api.v2.GetIdentityProviderResponse + 7, // 18: memos.api.v2.IdentityProviderService.CreateIdentityProvider:output_type -> memos.api.v2.CreateIdentityProviderResponse + 9, // 19: memos.api.v2.IdentityProviderService.UpdateIdentityProvider:output_type -> memos.api.v2.UpdateIdentityProviderResponse + 11, // 20: memos.api.v2.IdentityProviderService.DeleteIdentityProvider:output_type -> memos.api.v2.DeleteIdentityProviderResponse + 16, // [16:21] is the sub-list for method output_type + 11, // [11:16] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_api_v2_idp_service_proto_init() } +func file_api_v2_idp_service_proto_init() { + if File_api_v2_idp_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_v2_idp_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityProvider); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListIdentityProvidersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListIdentityProvidersResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetIdentityProviderRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetIdentityProviderResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateIdentityProviderRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateIdentityProviderResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateIdentityProviderRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateIdentityProviderResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteIdentityProviderRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteIdentityProviderResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityProvider_Config); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityProvider_Config_FieldMapping); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_idp_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityProvider_Config_OAuth2); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_api_v2_idp_service_proto_msgTypes[11].OneofWrappers = []interface{}{ + (*IdentityProvider_Config_Oauth2)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_v2_idp_service_proto_rawDesc, + NumEnums: 1, + NumMessages: 14, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_v2_idp_service_proto_goTypes, + DependencyIndexes: file_api_v2_idp_service_proto_depIdxs, + EnumInfos: file_api_v2_idp_service_proto_enumTypes, + MessageInfos: file_api_v2_idp_service_proto_msgTypes, + }.Build() + File_api_v2_idp_service_proto = out.File + file_api_v2_idp_service_proto_rawDesc = nil + file_api_v2_idp_service_proto_goTypes = nil + file_api_v2_idp_service_proto_depIdxs = nil +} diff --git a/proto/gen/api/v2/idp_service.pb.gw.go b/proto/gen/api/v2/idp_service.pb.gw.go new file mode 100644 index 0000000000000..74bdcb5a369cc --- /dev/null +++ b/proto/gen/api/v2/idp_service.pb.gw.go @@ -0,0 +1,599 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: api/v2/idp_service.proto + +/* +Package apiv2 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package apiv2 + +import ( + ""context"" + ""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 +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_IdentityProviderService_ListIdentityProviders_0(ctx context.Context, marshaler runtime.Marshaler, client IdentityProviderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListIdentityProvidersRequest + var metadata runtime.ServerMetadata + + msg, err := client.ListIdentityProviders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_IdentityProviderService_ListIdentityProviders_0(ctx context.Context, marshaler runtime.Marshaler, server IdentityProviderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListIdentityProvidersRequest + var metadata runtime.ServerMetadata + + msg, err := server.ListIdentityProviders(ctx, &protoReq) + return msg, metadata, err + +} + +func request_IdentityProviderService_GetIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, client IdentityProviderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetIdentityProviderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + 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.GetIdentityProvider(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_IdentityProviderService_GetIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, server IdentityProviderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetIdentityProviderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + 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.GetIdentityProvider(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_IdentityProviderService_CreateIdentityProvider_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_IdentityProviderService_CreateIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, client IdentityProviderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateIdentityProviderRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""%v"", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_IdentityProviderService_CreateIdentityProvider_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""%v"", err) + } + + msg, err := client.CreateIdentityProvider(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_IdentityProviderService_CreateIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, server IdentityProviderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateIdentityProviderRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""%v"", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_IdentityProviderService_CreateIdentityProvider_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""%v"", err) + } + + msg, err := server.CreateIdentityProvider(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_IdentityProviderService_UpdateIdentityProvider_0 = &utilities.DoubleArray{Encoding: map[string]int{""identity_provider"": 0, ""identityProvider"": 1, ""name"": 2}, Base: []int{1, 3, 4, 5, 2, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 5, 2, 3, 4}} +) + +func request_IdentityProviderService_UpdateIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, client IdentityProviderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateIdentityProviderRequest + var metadata runtime.ServerMetadata + + 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.IdentityProvider); err != nil && 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.IdentityProvider); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""%v"", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams[""identity_provider.name""] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""missing parameter %s"", ""identity_provider.name"") + } + + err = runtime.PopulateFieldFromPath(&protoReq, ""identity_provider.name"", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""type mismatch, parameter: %s, error: %v"", ""identity_provider.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_IdentityProviderService_UpdateIdentityProvider_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""%v"", err) + } + + msg, err := client.UpdateIdentityProvider(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_IdentityProviderService_UpdateIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, server IdentityProviderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateIdentityProviderRequest + var metadata runtime.ServerMetadata + + 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.IdentityProvider); err != nil && 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.IdentityProvider); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""%v"", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams[""identity_provider.name""] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""missing parameter %s"", ""identity_provider.name"") + } + + err = runtime.PopulateFieldFromPath(&protoReq, ""identity_provider.name"", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""type mismatch, parameter: %s, error: %v"", ""identity_provider.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_IdentityProviderService_UpdateIdentityProvider_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, ""%v"", err) + } + + msg, err := server.UpdateIdentityProvider(ctx, &protoReq) + return msg, metadata, err + +} + +func request_IdentityProviderService_DeleteIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, client IdentityProviderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteIdentityProviderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + 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.DeleteIdentityProvider(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_IdentityProviderService_DeleteIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, server IdentityProviderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteIdentityProviderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + 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.DeleteIdentityProvider(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterIdentityProviderServiceHandlerServer registers the http handlers for service IdentityProviderService to ""mux"". +// UnaryRPC :call IdentityProviderServiceServer 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 RegisterIdentityProviderServiceHandlerFromEndpoint instead. +func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server IdentityProviderServiceServer) error { + + mux.Handle(""GET"", pattern_IdentityProviderService_ListIdentityProviders_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, ""/memos.api.v2.IdentityProviderService/ListIdentityProviders"", runtime.WithHTTPPathPattern(""/api/v2/identityProviders"")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_IdentityProviderService_ListIdentityProviders_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_IdentityProviderService_ListIdentityProviders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle(""GET"", pattern_IdentityProviderService_GetIdentityProvider_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, ""/memos.api.v2.IdentityProviderService/GetIdentityProvider"", runtime.WithHTTPPathPattern(""/api/v2/{name=identityProviders/*}"")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_IdentityProviderService_GetIdentityProvider_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_IdentityProviderService_GetIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle(""POST"", pattern_IdentityProviderService_CreateIdentityProvider_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, ""/memos.api.v2.IdentityProviderService/CreateIdentityProvider"", runtime.WithHTTPPathPattern(""/api/v2/identityProviders"")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_IdentityProviderService_CreateIdentityProvider_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_IdentityProviderService_CreateIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle(""PATCH"", pattern_IdentityProviderService_UpdateIdentityProvider_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, ""/memos.api.v2.IdentityProviderService/UpdateIdentityProvider"", runtime.WithHTTPPathPattern(""/api/v2/{identity_provider.name=identityProviders/*}"")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_IdentityProviderService_UpdateIdentityProvider_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_IdentityProviderService_UpdateIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle(""DELETE"", pattern_IdentityProviderService_DeleteIdentityProvider_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, ""/memos.api.v2.IdentityProviderService/DeleteIdentityProvider"", runtime.WithHTTPPathPattern(""/api/v2/{name=identityProviders/*}"")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_IdentityProviderService_DeleteIdentityProvider_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_IdentityProviderService_DeleteIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterIdentityProviderServiceHandlerFromEndpoint is same as RegisterIdentityProviderServiceHandler but +// automatically dials to ""endpoint"" and closes the connection when ""ctx"" gets done. +func RegisterIdentityProviderServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof(""Failed to close conn to %s: %v"", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof(""Failed to close conn to %s: %v"", endpoint, cerr) + } + }() + }() + + return RegisterIdentityProviderServiceHandler(ctx, mux, conn) +} + +// RegisterIdentityProviderServiceHandler registers the http handlers for service IdentityProviderService to ""mux"". +// The handlers forward requests to the grpc endpoint over ""conn"". +func RegisterIdentityProviderServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterIdentityProviderServiceHandlerClient(ctx, mux, NewIdentityProviderServiceClient(conn)) +} + +// RegisterIdentityProviderServiceHandlerClient registers the http handlers for service IdentityProviderService +// to ""mux"". The handlers forward requests to the grpc endpoint over the given implementation of ""IdentityProviderServiceClient"". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in ""IdentityProviderServiceClient"" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// ""IdentityProviderServiceClient"" to call the correct interceptors. +func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client IdentityProviderServiceClient) error { + + mux.Handle(""GET"", pattern_IdentityProviderService_ListIdentityProviders_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, ""/memos.api.v2.IdentityProviderService/ListIdentityProviders"", runtime.WithHTTPPathPattern(""/api/v2/identityProviders"")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_IdentityProviderService_ListIdentityProviders_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_IdentityProviderService_ListIdentityProviders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle(""GET"", pattern_IdentityProviderService_GetIdentityProvider_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, ""/memos.api.v2.IdentityProviderService/GetIdentityProvider"", runtime.WithHTTPPathPattern(""/api/v2/{name=identityProviders/*}"")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_IdentityProviderService_GetIdentityProvider_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_IdentityProviderService_GetIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle(""POST"", pattern_IdentityProviderService_CreateIdentityProvider_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, ""/memos.api.v2.IdentityProviderService/CreateIdentityProvider"", runtime.WithHTTPPathPattern(""/api/v2/identityProviders"")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_IdentityProviderService_CreateIdentityProvider_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_IdentityProviderService_CreateIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle(""PATCH"", pattern_IdentityProviderService_UpdateIdentityProvider_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, ""/memos.api.v2.IdentityProviderService/UpdateIdentityProvider"", runtime.WithHTTPPathPattern(""/api/v2/{identity_provider.name=identityProviders/*}"")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_IdentityProviderService_UpdateIdentityProvider_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_IdentityProviderService_UpdateIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle(""DELETE"", pattern_IdentityProviderService_DeleteIdentityProvider_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, ""/memos.api.v2.IdentityProviderService/DeleteIdentityProvider"", runtime.WithHTTPPathPattern(""/api/v2/{name=identityProviders/*}"")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_IdentityProviderService_DeleteIdentityProvider_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_IdentityProviderService_DeleteIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_IdentityProviderService_ListIdentityProviders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{""api"", ""v2"", ""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"", ""v2"", ""identityProviders"", ""name""}, """")) + + pattern_IdentityProviderService_CreateIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{""api"", ""v2"", ""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"", ""v2"", ""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"", ""v2"", ""identityProviders"", ""name""}, """")) +) + +var ( + forward_IdentityProviderService_ListIdentityProviders_0 = runtime.ForwardResponseMessage + + forward_IdentityProviderService_GetIdentityProvider_0 = runtime.ForwardResponseMessage + + forward_IdentityProviderService_CreateIdentityProvider_0 = runtime.ForwardResponseMessage + + forward_IdentityProviderService_UpdateIdentityProvider_0 = runtime.ForwardResponseMessage + + forward_IdentityProviderService_DeleteIdentityProvider_0 = runtime.ForwardResponseMessage +) diff --git a/proto/gen/api/v2/idp_service_grpc.pb.go b/proto/gen/api/v2/idp_service_grpc.pb.go new file mode 100644 index 0000000000000..ead15d0607fcf --- /dev/null +++ b/proto/gen/api/v2/idp_service_grpc.pb.go @@ -0,0 +1,262 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: api/v2/idp_service.proto + +package apiv2 + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + IdentityProviderService_ListIdentityProviders_FullMethodName = ""/memos.api.v2.IdentityProviderService/ListIdentityProviders"" + IdentityProviderService_GetIdentityProvider_FullMethodName = ""/memos.api.v2.IdentityProviderService/GetIdentityProvider"" + IdentityProviderService_CreateIdentityProvider_FullMethodName = ""/memos.api.v2.IdentityProviderService/CreateIdentityProvider"" + IdentityProviderService_UpdateIdentityProvider_FullMethodName = ""/memos.api.v2.IdentityProviderService/UpdateIdentityProvider"" + IdentityProviderService_DeleteIdentityProvider_FullMethodName = ""/memos.api.v2.IdentityProviderService/DeleteIdentityProvider"" +) + +// IdentityProviderServiceClient is the client API for IdentityProviderService 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 IdentityProviderServiceClient interface { + ListIdentityProviders(ctx context.Context, in *ListIdentityProvidersRequest, opts ...grpc.CallOption) (*ListIdentityProvidersResponse, error) + GetIdentityProvider(ctx context.Context, in *GetIdentityProviderRequest, opts ...grpc.CallOption) (*GetIdentityProviderResponse, error) + CreateIdentityProvider(ctx context.Context, in *CreateIdentityProviderRequest, opts ...grpc.CallOption) (*CreateIdentityProviderResponse, error) + // UpdateIdentityProvider updates an identity provider. + UpdateIdentityProvider(ctx context.Context, in *UpdateIdentityProviderRequest, opts ...grpc.CallOption) (*UpdateIdentityProviderResponse, error) + // DeleteIdentityProvider deletes an identity provider. + DeleteIdentityProvider(ctx context.Context, in *DeleteIdentityProviderRequest, opts ...grpc.CallOption) (*DeleteIdentityProviderResponse, error) +} + +type identityProviderServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewIdentityProviderServiceClient(cc grpc.ClientConnInterface) IdentityProviderServiceClient { + return &identityProviderServiceClient{cc} +} + +func (c *identityProviderServiceClient) ListIdentityProviders(ctx context.Context, in *ListIdentityProvidersRequest, opts ...grpc.CallOption) (*ListIdentityProvidersResponse, error) { + out := new(ListIdentityProvidersResponse) + err := c.cc.Invoke(ctx, IdentityProviderService_ListIdentityProviders_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *identityProviderServiceClient) GetIdentityProvider(ctx context.Context, in *GetIdentityProviderRequest, opts ...grpc.CallOption) (*GetIdentityProviderResponse, error) { + out := new(GetIdentityProviderResponse) + err := c.cc.Invoke(ctx, IdentityProviderService_GetIdentityProvider_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *identityProviderServiceClient) CreateIdentityProvider(ctx context.Context, in *CreateIdentityProviderRequest, opts ...grpc.CallOption) (*CreateIdentityProviderResponse, error) { + out := new(CreateIdentityProviderResponse) + err := c.cc.Invoke(ctx, IdentityProviderService_CreateIdentityProvider_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *identityProviderServiceClient) UpdateIdentityProvider(ctx context.Context, in *UpdateIdentityProviderRequest, opts ...grpc.CallOption) (*UpdateIdentityProviderResponse, error) { + out := new(UpdateIdentityProviderResponse) + err := c.cc.Invoke(ctx, IdentityProviderService_UpdateIdentityProvider_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *identityProviderServiceClient) DeleteIdentityProvider(ctx context.Context, in *DeleteIdentityProviderRequest, opts ...grpc.CallOption) (*DeleteIdentityProviderResponse, error) { + out := new(DeleteIdentityProviderResponse) + err := c.cc.Invoke(ctx, IdentityProviderService_DeleteIdentityProvider_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// IdentityProviderServiceServer is the server API for IdentityProviderService service. +// All implementations must embed UnimplementedIdentityProviderServiceServer +// for forward compatibility +type IdentityProviderServiceServer interface { + ListIdentityProviders(context.Context, *ListIdentityProvidersRequest) (*ListIdentityProvidersResponse, error) + GetIdentityProvider(context.Context, *GetIdentityProviderRequest) (*GetIdentityProviderResponse, error) + CreateIdentityProvider(context.Context, *CreateIdentityProviderRequest) (*CreateIdentityProviderResponse, error) + // UpdateIdentityProvider updates an identity provider. + UpdateIdentityProvider(context.Context, *UpdateIdentityProviderRequest) (*UpdateIdentityProviderResponse, error) + // DeleteIdentityProvider deletes an identity provider. + DeleteIdentityProvider(context.Context, *DeleteIdentityProviderRequest) (*DeleteIdentityProviderResponse, error) + mustEmbedUnimplementedIdentityProviderServiceServer() +} + +// UnimplementedIdentityProviderServiceServer must be embedded to have forward compatible implementations. +type UnimplementedIdentityProviderServiceServer struct { +} + +func (UnimplementedIdentityProviderServiceServer) ListIdentityProviders(context.Context, *ListIdentityProvidersRequest) (*ListIdentityProvidersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, ""method ListIdentityProviders not implemented"") +} +func (UnimplementedIdentityProviderServiceServer) GetIdentityProvider(context.Context, *GetIdentityProviderRequest) (*GetIdentityProviderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, ""method GetIdentityProvider not implemented"") +} +func (UnimplementedIdentityProviderServiceServer) CreateIdentityProvider(context.Context, *CreateIdentityProviderRequest) (*CreateIdentityProviderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, ""method CreateIdentityProvider not implemented"") +} +func (UnimplementedIdentityProviderServiceServer) UpdateIdentityProvider(context.Context, *UpdateIdentityProviderRequest) (*UpdateIdentityProviderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, ""method UpdateIdentityProvider not implemented"") +} +func (UnimplementedIdentityProviderServiceServer) DeleteIdentityProvider(context.Context, *DeleteIdentityProviderRequest) (*DeleteIdentityProviderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, ""method DeleteIdentityProvider not implemented"") +} +func (UnimplementedIdentityProviderServiceServer) mustEmbedUnimplementedIdentityProviderServiceServer() { +} + +// UnsafeIdentityProviderServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to IdentityProviderServiceServer will +// result in compilation errors. +type UnsafeIdentityProviderServiceServer interface { + mustEmbedUnimplementedIdentityProviderServiceServer() +} + +func RegisterIdentityProviderServiceServer(s grpc.ServiceRegistrar, srv IdentityProviderServiceServer) { + s.RegisterService(&IdentityProviderService_ServiceDesc, srv) +} + +func _IdentityProviderService_ListIdentityProviders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListIdentityProvidersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IdentityProviderServiceServer).ListIdentityProviders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: IdentityProviderService_ListIdentityProviders_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IdentityProviderServiceServer).ListIdentityProviders(ctx, req.(*ListIdentityProvidersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IdentityProviderService_GetIdentityProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetIdentityProviderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IdentityProviderServiceServer).GetIdentityProvider(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: IdentityProviderService_GetIdentityProvider_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IdentityProviderServiceServer).GetIdentityProvider(ctx, req.(*GetIdentityProviderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IdentityProviderService_CreateIdentityProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateIdentityProviderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IdentityProviderServiceServer).CreateIdentityProvider(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: IdentityProviderService_CreateIdentityProvider_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IdentityProviderServiceServer).CreateIdentityProvider(ctx, req.(*CreateIdentityProviderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IdentityProviderService_UpdateIdentityProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateIdentityProviderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IdentityProviderServiceServer).UpdateIdentityProvider(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: IdentityProviderService_UpdateIdentityProvider_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IdentityProviderServiceServer).UpdateIdentityProvider(ctx, req.(*UpdateIdentityProviderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IdentityProviderService_DeleteIdentityProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteIdentityProviderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IdentityProviderServiceServer).DeleteIdentityProvider(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: IdentityProviderService_DeleteIdentityProvider_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IdentityProviderServiceServer).DeleteIdentityProvider(ctx, req.(*DeleteIdentityProviderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// IdentityProviderService_ServiceDesc is the grpc.ServiceDesc for IdentityProviderService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var IdentityProviderService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: ""memos.api.v2.IdentityProviderService"", + HandlerType: (*IdentityProviderServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: ""ListIdentityProviders"", + Handler: _IdentityProviderService_ListIdentityProviders_Handler, + }, + { + MethodName: ""GetIdentityProvider"", + Handler: _IdentityProviderService_GetIdentityProvider_Handler, + }, + { + MethodName: ""CreateIdentityProvider"", + Handler: _IdentityProviderService_CreateIdentityProvider_Handler, + }, + { + MethodName: ""UpdateIdentityProvider"", + Handler: _IdentityProviderService_UpdateIdentityProvider_Handler, + }, + { + MethodName: ""DeleteIdentityProvider"", + Handler: _IdentityProviderService_DeleteIdentityProvider_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: ""api/v2/idp_service.proto"", +} diff --git a/proto/gen/api/v2/inbox_service.pb.go b/proto/gen/api/v2/inbox_service.pb.go index 6359d599caa29..3d4f05671118d 100644 --- a/proto/gen/api/v2/inbox_service.pb.go +++ b/proto/gen/api/v2/inbox_service.pb.go @@ -127,11 +127,11 @@ type Inbox struct { unknownFields protoimpl.UnknownFields // The name of the inbox. - // Format: inboxes/{uid} + // Format: inboxes/{id} Name string `protobuf:""bytes,1,opt,name=name,proto3"" json:""name,omitempty""` - // Format: users/{username} + // Format: users/{id} Sender string `protobuf:""bytes,2,opt,name=sender,proto3"" json:""sender,omitempty""` - // Format: users/{username} + // Format: users/{id} Receiver string `protobuf:""bytes,3,opt,name=receiver,proto3"" json:""receiver,omitempty""` Status Inbox_Status `protobuf:""varint,4,opt,name=status,proto3,enum=memos.api.v2.Inbox_Status"" json:""status,omitempty""` CreateTime *timestamppb.Timestamp `protobuf:""bytes,5,opt,name=create_time,json=createTime,proto3"" json:""create_time,omitempty""` @@ -225,7 +225,7 @@ type ListInboxesRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Format: users/{username} + // Format: users/{id} User string `protobuf:""bytes,1,opt,name=user,proto3"" json:""user,omitempty""` } @@ -423,7 +423,7 @@ type DeleteInboxRequest struct { unknownFields protoimpl.UnknownFields // The name of the inbox to delete. - // Format: inboxes/{uid} + // Format: inboxes/{id} Name string `protobuf:""bytes,1,opt,name=name,proto3"" json:""name,omitempty""` } diff --git a/proto/gen/store/README.md b/proto/gen/store/README.md index 5164aa2fb41db..e8a4257e073fb 100644 --- a/proto/gen/store/README.md +++ b/proto/gen/store/README.md @@ -11,6 +11,11 @@ - [store/common.proto](#store_common-proto) - [RowStatus](#memos-store-RowStatus) +- [store/idp.proto](#store_idp-proto) + - [IdentityProviderConfig](#memos-store-IdentityProviderConfig) + - [IdentityProviderConfig.FieldMapping](#memos-store-IdentityProviderConfig-FieldMapping) + - [IdentityProviderConfig.OAuth2](#memos-store-IdentityProviderConfig-OAuth2) + - [store/inbox.proto](#store_inbox-proto) - [InboxMessage](#memos-store-InboxMessage) @@ -133,6 +138,75 @@ + +

Top

+ +## store/idp.proto + + + + + +### IdentityProviderConfig + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| oauth2 | [IdentityProviderConfig.OAuth2](#memos-store-IdentityProviderConfig-OAuth2) | | | + + + + + + + + +### IdentityProviderConfig.FieldMapping + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| identifier | [string](#string) | | | +| display_name | [string](#string) | | | +| email | [string](#string) | | | + + + + + + + + +### IdentityProviderConfig.OAuth2 + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| client_id | [string](#string) | | | +| client_secret | [string](#string) | | | +| auth_url | [string](#string) | | | +| token_url | [string](#string) | | | +| user_info_url | [string](#string) | | | +| scopes | [string](#string) | repeated | | +| field_mapping | [IdentityProviderConfig.FieldMapping](#memos-store-IdentityProviderConfig-FieldMapping) | | | + + + + + + + + + + + + + + +

Top

diff --git a/proto/gen/store/idp.pb.go b/proto/gen/store/idp.pb.go new file mode 100644 index 0000000000000..318e1cd97c362 --- /dev/null +++ b/proto/gen/store/idp.pb.go @@ -0,0 +1,388 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: store/idp.proto + +package store + +import ( + protoreflect ""google.golang.org/protobuf/reflect/protoreflect"" + protoimpl ""google.golang.org/protobuf/runtime/protoimpl"" + reflect ""reflect"" + sync ""sync"" +) + +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) +) + +type IdentityProviderConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Config: + // + // *IdentityProviderConfig_Oauth2 + Config isIdentityProviderConfig_Config `protobuf_oneof:""config""` +} + +func (x *IdentityProviderConfig) Reset() { + *x = IdentityProviderConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_store_idp_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityProviderConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityProviderConfig) ProtoMessage() {} + +func (x *IdentityProviderConfig) ProtoReflect() protoreflect.Message { + mi := &file_store_idp_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityProviderConfig.ProtoReflect.Descriptor instead. +func (*IdentityProviderConfig) Descriptor() ([]byte, []int) { + return file_store_idp_proto_rawDescGZIP(), []int{0} +} + +func (m *IdentityProviderConfig) GetConfig() isIdentityProviderConfig_Config { + if m != nil { + return m.Config + } + return nil +} + +func (x *IdentityProviderConfig) GetOauth2() *IdentityProviderConfig_OAuth2 { + if x, ok := x.GetConfig().(*IdentityProviderConfig_Oauth2); ok { + return x.Oauth2 + } + return nil +} + +type isIdentityProviderConfig_Config interface { + isIdentityProviderConfig_Config() +} + +type IdentityProviderConfig_Oauth2 struct { + Oauth2 *IdentityProviderConfig_OAuth2 `protobuf:""bytes,1,opt,name=oauth2,proto3,oneof""` +} + +func (*IdentityProviderConfig_Oauth2) isIdentityProviderConfig_Config() {} + +type IdentityProviderConfig_FieldMapping struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Identifier string `protobuf:""bytes,1,opt,name=identifier,proto3"" json:""identifier,omitempty""` + DisplayName string `protobuf:""bytes,2,opt,name=display_name,json=displayName,proto3"" json:""display_name,omitempty""` + Email string `protobuf:""bytes,3,opt,name=email,proto3"" json:""email,omitempty""` +} + +func (x *IdentityProviderConfig_FieldMapping) Reset() { + *x = IdentityProviderConfig_FieldMapping{} + if protoimpl.UnsafeEnabled { + mi := &file_store_idp_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityProviderConfig_FieldMapping) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityProviderConfig_FieldMapping) ProtoMessage() {} + +func (x *IdentityProviderConfig_FieldMapping) ProtoReflect() protoreflect.Message { + mi := &file_store_idp_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityProviderConfig_FieldMapping.ProtoReflect.Descriptor instead. +func (*IdentityProviderConfig_FieldMapping) Descriptor() ([]byte, []int) { + return file_store_idp_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *IdentityProviderConfig_FieldMapping) GetIdentifier() string { + if x != nil { + return x.Identifier + } + return """" +} + +func (x *IdentityProviderConfig_FieldMapping) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return """" +} + +func (x *IdentityProviderConfig_FieldMapping) GetEmail() string { + if x != nil { + return x.Email + } + return """" +} + +type IdentityProviderConfig_OAuth2 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ClientId string `protobuf:""bytes,1,opt,name=client_id,json=clientId,proto3"" json:""client_id,omitempty""` + ClientSecret string `protobuf:""bytes,2,opt,name=client_secret,json=clientSecret,proto3"" json:""client_secret,omitempty""` + AuthUrl string `protobuf:""bytes,3,opt,name=auth_url,json=authUrl,proto3"" json:""auth_url,omitempty""` + TokenUrl string `protobuf:""bytes,4,opt,name=token_url,json=tokenUrl,proto3"" json:""token_url,omitempty""` + UserInfoUrl string `protobuf:""bytes,5,opt,name=user_info_url,json=userInfoUrl,proto3"" json:""user_info_url,omitempty""` + Scopes []string `protobuf:""bytes,6,rep,name=scopes,proto3"" json:""scopes,omitempty""` + FieldMapping *IdentityProviderConfig_FieldMapping `protobuf:""bytes,7,opt,name=field_mapping,json=fieldMapping,proto3"" json:""field_mapping,omitempty""` +} + +func (x *IdentityProviderConfig_OAuth2) Reset() { + *x = IdentityProviderConfig_OAuth2{} + if protoimpl.UnsafeEnabled { + mi := &file_store_idp_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityProviderConfig_OAuth2) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityProviderConfig_OAuth2) ProtoMessage() {} + +func (x *IdentityProviderConfig_OAuth2) ProtoReflect() protoreflect.Message { + mi := &file_store_idp_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityProviderConfig_OAuth2.ProtoReflect.Descriptor instead. +func (*IdentityProviderConfig_OAuth2) Descriptor() ([]byte, []int) { + return file_store_idp_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *IdentityProviderConfig_OAuth2) GetClientId() string { + if x != nil { + return x.ClientId + } + return """" +} + +func (x *IdentityProviderConfig_OAuth2) GetClientSecret() string { + if x != nil { + return x.ClientSecret + } + return """" +} + +func (x *IdentityProviderConfig_OAuth2) GetAuthUrl() string { + if x != nil { + return x.AuthUrl + } + return """" +} + +func (x *IdentityProviderConfig_OAuth2) GetTokenUrl() string { + if x != nil { + return x.TokenUrl + } + return """" +} + +func (x *IdentityProviderConfig_OAuth2) GetUserInfoUrl() string { + if x != nil { + return x.UserInfoUrl + } + return """" +} + +func (x *IdentityProviderConfig_OAuth2) GetScopes() []string { + if x != nil { + return x.Scopes + } + return nil +} + +func (x *IdentityProviderConfig_OAuth2) GetFieldMapping() *IdentityProviderConfig_FieldMapping { + if x != nil { + return x.FieldMapping + } + return nil +} + +var File_store_idp_proto protoreflect.FileDescriptor + +var file_store_idp_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x69, 0x64, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0xe9, + 0x03, 0x0a, 0x16, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x44, 0x0a, 0x06, 0x6f, 0x61, 0x75, + 0x74, 0x68, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4f, + 0x41, 0x75, 0x74, 0x68, 0x32, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x1a, + 0x67, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, + 0x1e, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, + 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x1a, 0x95, 0x02, 0x0a, 0x06, 0x4f, 0x41, 0x75, + 0x74, 0x68, 0x32, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, + 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x75, 0x72, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x75, 0x74, 0x68, 0x55, 0x72, 0x6c, + 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x22, 0x0a, + 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x55, 0x72, + 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x55, 0x0a, 0x0d, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x30, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x70, 0x70, 0x69, + 0x6e, 0x67, 0x52, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, + 0x42, 0x08, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x93, 0x01, 0x0a, 0x0f, 0x63, + 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x08, + 0x49, 0x64, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, + 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_store_idp_proto_rawDescOnce sync.Once + file_store_idp_proto_rawDescData = file_store_idp_proto_rawDesc +) + +func file_store_idp_proto_rawDescGZIP() []byte { + file_store_idp_proto_rawDescOnce.Do(func() { + file_store_idp_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_idp_proto_rawDescData) + }) + return file_store_idp_proto_rawDescData +} + +var file_store_idp_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_store_idp_proto_goTypes = []interface{}{ + (*IdentityProviderConfig)(nil), // 0: memos.store.IdentityProviderConfig + (*IdentityProviderConfig_FieldMapping)(nil), // 1: memos.store.IdentityProviderConfig.FieldMapping + (*IdentityProviderConfig_OAuth2)(nil), // 2: memos.store.IdentityProviderConfig.OAuth2 +} +var file_store_idp_proto_depIdxs = []int32{ + 2, // 0: memos.store.IdentityProviderConfig.oauth2:type_name -> memos.store.IdentityProviderConfig.OAuth2 + 1, // 1: memos.store.IdentityProviderConfig.OAuth2.field_mapping:type_name -> memos.store.IdentityProviderConfig.FieldMapping + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_store_idp_proto_init() } +func file_store_idp_proto_init() { + if File_store_idp_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_store_idp_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityProviderConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_store_idp_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityProviderConfig_FieldMapping); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_store_idp_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityProviderConfig_OAuth2); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_store_idp_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*IdentityProviderConfig_Oauth2)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_store_idp_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_store_idp_proto_goTypes, + DependencyIndexes: file_store_idp_proto_depIdxs, + MessageInfos: file_store_idp_proto_msgTypes, + }.Build() + File_store_idp_proto = out.File + file_store_idp_proto_rawDesc = nil + file_store_idp_proto_goTypes = nil + file_store_idp_proto_depIdxs = nil +} diff --git a/proto/store/idp.proto b/proto/store/idp.proto new file mode 100644 index 0000000000000..b60c7cedafc7f --- /dev/null +++ b/proto/store/idp.proto @@ -0,0 +1,27 @@ +syntax = ""proto3""; + +package memos.store; + +option go_package = ""gen/store""; + +message IdentityProviderConfig { + message FieldMapping { + string identifier = 1; + string display_name = 2; + string email = 3; + } + + message OAuth2 { + string client_id = 1; + string client_secret = 2; + string auth_url = 3; + string token_url = 4; + string user_info_url = 5; + repeated string scopes = 6; + FieldMapping field_mapping = 7; + } + + oneof config { + OAuth2 oauth2 = 1; + } +} diff --git a/server/route/api/v2/apidocs.swagger.yaml b/server/route/api/v2/apidocs.swagger.yaml index d6652e275799e..0917623d6f4c5 100644 --- a/server/route/api/v2/apidocs.swagger.yaml +++ b/server/route/api/v2/apidocs.swagger.yaml @@ -6,6 +6,7 @@ tags: - name: ActivityService - name: UserService - name: AuthService + - name: IdentityProviderService - name: InboxService - name: LinkService - name: ResourceService @@ -130,6 +131,96 @@ paths: $ref: '#/definitions/googlerpcStatus' tags: - AuthService + /api/v2/identityProviders: + get: + operationId: IdentityProviderService_ListIdentityProviders + responses: + ""200"": + description: A successful response. + schema: + $ref: '#/definitions/v2ListIdentityProvidersResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + tags: + - IdentityProviderService + post: + operationId: IdentityProviderService_CreateIdentityProvider + responses: + ""200"": + description: A successful response. + schema: + $ref: '#/definitions/v2CreateIdentityProviderResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: identityProvider.name + description: |- + The name of the identityProvider. + Format: identityProviders/{id} + in: query + required: false + type: string + - name: identityProvider.type + in: query + required: false + type: string + enum: + - TYPE_UNSPECIFIED + - OAUTH2 + default: TYPE_UNSPECIFIED + - name: identityProvider.title + in: query + required: false + type: string + - name: identityProvider.identifierFilter + in: query + required: false + type: string + - name: identityProvider.config.oauth2.clientId + in: query + required: false + type: string + - name: identityProvider.config.oauth2.clientSecret + in: query + required: false + type: string + - name: identityProvider.config.oauth2.authUrl + in: query + required: false + type: string + - name: identityProvider.config.oauth2.tokenUrl + in: query + required: false + type: string + - name: identityProvider.config.oauth2.userInfoUrl + in: query + required: false + type: string + - name: identityProvider.config.oauth2.scopes + in: query + required: false + type: array + items: + type: string + collectionFormat: multi + - name: identityProvider.config.oauth2.fieldMapping.identifier + in: query + required: false + type: string + - name: identityProvider.config.oauth2.fieldMapping.displayName + in: query + required: false + type: string + - name: identityProvider.config.oauth2.fieldMapping.email + in: query + required: false + type: string + tags: + - IdentityProviderService /api/v2/inboxes: get: summary: ListInboxes lists inboxes for a user. @@ -145,7 +236,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: user - description: 'Format: users/{username}' + description: 'Format: users/{id}' in: query required: false type: string @@ -768,6 +859,46 @@ paths: title: setting is the setting to update. tags: - WorkspaceSettingService + /api/v2/{identityProvider.name}: + patch: + summary: UpdateIdentityProvider updates an identity provider. + operationId: IdentityProviderService_UpdateIdentityProvider + responses: + ""200"": + description: A successful response. + schema: + $ref: '#/definitions/v2UpdateIdentityProviderResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: identityProvider.name + description: |- + The name of the identityProvider. + Format: identityProviders/{id} + in: path + required: true + type: string + pattern: identityProviders/[^/]+ + - name: identityProvider + description: The identityProvider to update. + in: body + required: true + schema: + type: object + properties: + type: + $ref: '#/definitions/v2IdentityProviderType' + title: + type: string + identifierFilter: + type: string + config: + $ref: '#/definitions/IdentityProviderConfig' + title: The identityProvider to update. + tags: + - IdentityProviderService /api/v2/{inbox.name}: patch: summary: UpdateInbox updates an inbox. @@ -785,7 +916,7 @@ paths: - name: inbox.name description: |- The name of the inbox. - Format: inboxes/{uid} + Format: inboxes/{id} in: path required: true type: string @@ -798,10 +929,10 @@ paths: properties: sender: type: string - title: 'Format: users/{username}' + title: 'Format: users/{id}' receiver: type: string - title: 'Format: users/{username}' + title: 'Format: users/{id}' status: $ref: '#/definitions/v2InboxStatus' createTime: @@ -893,6 +1024,52 @@ paths: tags: - MemoService /api/v2/{name_1}: + get: + operationId: IdentityProviderService_GetIdentityProvider + responses: + ""200"": + description: A successful response. + schema: + $ref: '#/definitions/v2GetIdentityProviderResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: name_1 + description: |- + The name of the identityProvider to get. + Format: identityProviders/{id} + in: path + required: true + type: string + pattern: identityProviders/[^/]+ + tags: + - IdentityProviderService + delete: + summary: DeleteIdentityProvider deletes an identity provider. + operationId: IdentityProviderService_DeleteIdentityProvider + responses: + ""200"": + description: A successful response. + schema: + $ref: '#/definitions/v2DeleteIdentityProviderResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: name_1 + description: |- + The name of the identityProvider to delete. + Format: identityProviders/{id} + in: path + required: true + type: string + pattern: identityProviders/[^/]+ + tags: + - IdentityProviderService + /api/v2/{name_2}: get: summary: GetResource returns a resource by name. operationId: ResourceService_GetResource @@ -906,7 +1083,7 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: name_1 + - name: name_2 in: path required: true type: string @@ -926,17 +1103,17 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: name_1 + - name: name_2 description: |- The name of the inbox to delete. - Format: inboxes/{uid} + Format: inboxes/{id} in: path required: true type: string pattern: inboxes/[^/]+ tags: - InboxService - /api/v2/{name_2}: + /api/v2/{name_3}: get: summary: GetMemo gets a memo. operationId: MemoService_GetMemo @@ -950,7 +1127,7 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: name_2 + - name: name_3 description: |- The name of the memo. Format: memos/{id} @@ -973,14 +1150,14 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: name_2 + - name: name_3 in: path required: true type: string pattern: resources/[^/]+ tags: - ResourceService - /api/v2/{name_3}: + /api/v2/{name_4}: delete: summary: DeleteMemo deletes a memo. operationId: MemoService_DeleteMemo @@ -994,7 +1171,7 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: name_3 + - name: name_4 description: |- The name of the memo. Format: memos/{id} @@ -1601,6 +1778,39 @@ paths: tags: - ActivityService definitions: + IdentityProviderConfig: + type: object + properties: + oauth2: + $ref: '#/definitions/IdentityProviderConfigOAuth2' + IdentityProviderConfigFieldMapping: + type: object + properties: + identifier: + type: string + displayName: + type: string + email: + type: string + IdentityProviderConfigOAuth2: + type: object + properties: + clientId: + type: string + clientSecret: + type: string + authUrl: + type: string + tokenUrl: + type: string + userInfoUrl: + type: string + scopes: + type: array + items: + type: string + fieldMapping: + $ref: '#/definitions/IdentityProviderConfigFieldMapping' MemoServiceSetMemoRelationsBody: type: object properties: @@ -1802,6 +2012,12 @@ definitions: $ref: '#/definitions/apiv2ActivityPayload' v2BatchUpsertTagResponse: type: object + v2CreateIdentityProviderResponse: + type: object + properties: + identityProvider: + $ref: '#/definitions/v2IdentityProvider' + description: The created identityProvider. v2CreateMemoCommentResponse: type: object properties: @@ -1846,6 +2062,8 @@ definitions: properties: webhook: $ref: '#/definitions/apiv2Webhook' + v2DeleteIdentityProviderResponse: + type: object v2DeleteInboxResponse: type: object v2DeleteMemoReactionResponse: @@ -1878,6 +2096,12 @@ definitions: properties: user: $ref: '#/definitions/v2User' + v2GetIdentityProviderResponse: + type: object + properties: + identityProvider: + $ref: '#/definitions/v2IdentityProvider' + description: The identityProvider. v2GetLinkMetadataResponse: type: object properties: @@ -1936,6 +2160,28 @@ definitions: properties: setting: $ref: '#/definitions/apiv2WorkspaceSetting' + v2IdentityProvider: + type: object + properties: + name: + type: string + title: |- + The name of the identityProvider. + Format: identityProviders/{id} + type: + $ref: '#/definitions/v2IdentityProviderType' + title: + type: string + identifierFilter: + type: string + config: + $ref: '#/definitions/IdentityProviderConfig' + v2IdentityProviderType: + type: string + enum: + - TYPE_UNSPECIFIED + - OAUTH2 + default: TYPE_UNSPECIFIED v2Inbox: type: object properties: @@ -1943,13 +2189,13 @@ definitions: type: string title: |- The name of the inbox. - Format: inboxes/{uid} + Format: inboxes/{id} sender: type: string - title: 'Format: users/{username}' + title: 'Format: users/{id}' receiver: type: string - title: 'Format: users/{username}' + title: 'Format: users/{id}' status: $ref: '#/definitions/v2InboxStatus' createTime: @@ -1983,6 +2229,14 @@ definitions: type: string image: type: string + v2ListIdentityProvidersResponse: + type: object + properties: + identityProviders: + type: array + items: + type: object + $ref: '#/definitions/v2IdentityProvider' v2ListInboxesResponse: type: object properties: @@ -2246,6 +2500,12 @@ definitions: title: |- The creator of tags. Format: users/{id} + v2UpdateIdentityProviderResponse: + type: object + properties: + identityProvider: + $ref: '#/definitions/v2IdentityProvider' + description: The updated identityProvider. v2UpdateInboxResponse: type: object properties: diff --git a/server/route/api/v2/inbox_service.go b/server/route/api/v2/inbox_service.go index 51b170b2e1ba4..c8a9c0b27cf18 100644 --- a/server/route/api/v2/inbox_service.go +++ b/server/route/api/v2/inbox_service.go @@ -105,9 +105,9 @@ func (s *APIV2Service) convertInboxFromStore(ctx context.Context, inbox *store.I } return &apiv2pb.Inbox{ - Name: fmt.Sprintf(""inboxes/%d"", inbox.ID), - Sender: fmt.Sprintf(""users/%s"", sender.Username), - Receiver: fmt.Sprintf(""users/%s"", receiver.Username), + Name: fmt.Sprintf(""%s%d"", InboxNamePrefix, inbox.ID), + Sender: fmt.Sprintf(""%s%d"", UserNamePrefix, sender.ID), + Receiver: fmt.Sprintf(""%s%d"", UserNamePrefix, receiver.ID), Status: convertInboxStatusFromStore(inbox.Status), CreateTime: timestamppb.New(time.Unix(inbox.CreatedTs, 0)), Type: apiv2pb.Inbox_Type(inbox.Message.Type),",chore,add idp definition 1bf6db81541e60652a8fe7d9b655c973df848d02,2024-06-19 19:38:42,dependabot[bot],chore: bump google.golang.org/protobuf from 1.34.1 to 1.34.2 (#3580),False,"diff --git a/go.mod b/go.mod index 5037f8eb6e1dc..c2a3459f804c7 100644 --- a/go.mod +++ b/go.mod @@ -102,7 +102,7 @@ require ( golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/protobuf v1.34.1 + google.golang.org/protobuf v1.34.2 gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 60b17b54c4155..2bf953f429804 100644 --- a/go.sum +++ b/go.sum @@ -644,8 +644,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=",chore,bump google.golang.org/protobuf from 1.34.1 to 1.34.2 (#3580) d4b88c6c8608e4e18c2b7a40bc0ed0b360126a70,2023-07-11 21:46:32,boojack,chore: remove auto signout in auth page (#1927),False,"diff --git a/web/src/pages/Auth.tsx b/web/src/pages/Auth.tsx index 0d88ef6c06aef..0014e0737d5e8 100644 --- a/web/src/pages/Auth.tsx +++ b/web/src/pages/Auth.tsx @@ -22,7 +22,6 @@ const Auth = () => { const [identityProviderList, setIdentityProviderList] = useState([]); useEffect(() => { - userStore.doSignOut().catch(); const fetchIdentityProviderList = async () => { const { data: identityProviderList } = await api.getIdentityProviderList(); setIdentityProviderList(identityProviderList);",chore,remove auto signout in auth page (#1927) a73f979f966eae977e8cb87cb27856595378d0c2,2024-05-07 06:23:35,dependabot[bot],chore: bump lucide-react from 0.368.0 to 0.378.0 in /web (#3313),False,"diff --git a/web/package.json b/web/package.json index 4d2e7a7fe3775..e0c6d950ce290 100644 --- a/web/package.json +++ b/web/package.json @@ -21,7 +21,7 @@ ""i18next"": ""^23.11.3"", ""katex"": ""^0.16.10"", ""lodash-es"": ""^4.17.21"", - ""lucide-react"": ""^0.368.0"", + ""lucide-react"": ""^0.378.0"", ""mermaid"": ""^10.9.0"", ""react"": ""^18.3.1"", ""react-dom"": ""^18.3.1"", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 1e28952e200c2..d61a3b58208d2 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -45,8 +45,8 @@ dependencies: specifier: ^4.17.21 version: 4.17.21 lucide-react: - specifier: ^0.368.0 - version: 0.368.0(react@18.3.1) + specifier: ^0.378.0 + version: 0.378.0(react@18.3.1) mermaid: specifier: ^10.9.0 version: 10.9.0 @@ -3784,8 +3784,8 @@ packages: yallist: 4.0.0 dev: true - /lucide-react@0.368.0(react@18.3.1): - resolution: {integrity: sha512-soryVrCjheZs8rbXKdINw9B8iPi5OajBJZMJ1HORig89ljcOcEokKKAgGbg3QWxSXel7JwHOfDFUdDHAKyUAMw==} + /lucide-react@0.378.0(react@18.3.1): + resolution: {integrity: sha512-u6EPU8juLUk9ytRcyapkWI18epAv3RU+6+TC23ivjR0e+glWKBobFeSgRwOIJihzktILQuy6E0E80P2jVTDR5g==} peerDependencies: react: ^16.5.1 || ^17.0.0 || ^18.0.0 dependencies:",chore,bump lucide-react from 0.368.0 to 0.378.0 in /web (#3313) 1da07529222bd8fb6754c8b5ac6353dc7429fc44,2024-09-14 05:53:39,johnnyjoy,chore: add schema version to workspace setting,False,"diff --git a/docs/apidocs.swagger.yaml b/docs/apidocs.swagger.yaml index 840542fb2cad3..f7274f4e665d5 100644 --- a/docs/apidocs.swagger.yaml +++ b/docs/apidocs.swagger.yaml @@ -300,16 +300,12 @@ paths: type: integer format: int32 - name: pageToken - description: |- - A page token, received from a previous `ListMemos` call. - Provide this to retrieve the subsequent page. + description: ""A page token, received from a previous `ListMemos` call.\r\nProvide this to retrieve the subsequent page."" in: query required: false type: string - name: filter - description: |- - Filter is used to filter memos returned in the list. - Format: ""creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']"" + description: ""Filter is used to filter memos returned in the list.\r\nFormat: \""creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']\"""" in: query required: false type: string @@ -484,9 +480,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: filter - description: |- - Filter is used to filter users returned in the list. - Format: ""username == 'frank'"" + description: ""Filter is used to filter users returned in the list.\r\nFormat: \""username == 'frank'\"""" in: query required: false type: string @@ -647,9 +641,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The resource name of the workspace setting. - Format: settings/{setting} + description: ""The resource name of the workspace setting.\r\nFormat: settings/{setting}"" in: path required: true type: string @@ -671,9 +663,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: setting.name - description: |- - name is the name of the setting. - Format: settings/{setting} + description: ""name is the name of the setting.\r\nFormat: settings/{setting}"" in: path required: true type: string @@ -709,9 +699,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: identityProvider.name - description: |- - The name of the identityProvider. - Format: identityProviders/{id} + description: ""The name of the identityProvider.\r\nFormat: identityProviders/{id}"" in: path required: true type: string @@ -749,9 +737,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: inbox.name - description: |- - The name of the inbox. - Format: inboxes/{id} + description: ""The name of the inbox.\r\nFormat: inboxes/{id}"" in: path required: true type: string @@ -795,10 +781,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: memo.name - description: |- - The name of the memo. - Format: memos/{id} - id is the system generated id. + description: ""The name of the memo.\r\nFormat: memos/{id}\r\nid is the system generated id."" in: path required: true type: string @@ -816,9 +799,7 @@ paths: $ref: '#/definitions/v1RowStatus' creator: type: string - title: |- - The name of the creator. - Format: users/{id} + title: ""The name of the creator.\r\nFormat: users/{id}"" createTime: type: string format: date-time @@ -871,9 +852,7 @@ paths: readOnly: true parent: type: string - title: |- - The name of the parent memo. - Format: memos/{id} + title: ""The name of the parent memo.\r\nFormat: memos/{id}"" readOnly: true snippet: type: string @@ -895,9 +874,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: |- - The name of the user. - Format: users/{id} + description: ""The name of the user.\r\nFormat: users/{id}"" in: path required: true type: string @@ -919,9 +896,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: |- - The name of the identityProvider to delete. - Format: identityProviders/{id} + description: ""The name of the identityProvider to delete.\r\nFormat: identityProviders/{id}"" in: path required: true type: string @@ -943,9 +918,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 - description: |- - The name of the identityProvider to get. - Format: identityProviders/{id} + description: ""The name of the identityProvider to get.\r\nFormat: identityProviders/{id}"" in: path required: true type: string @@ -967,9 +940,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 - description: |- - The name of the inbox to delete. - Format: inboxes/{id} + description: ""The name of the inbox to delete.\r\nFormat: inboxes/{id}"" in: path required: true type: string @@ -991,10 +962,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 - description: |- - The name of the resource. - Format: resources/{id} - id is the system generated unique identifier. + description: ""The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier."" in: path required: true type: string @@ -1016,10 +984,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 - description: |- - The name of the resource. - Format: resources/{id} - id is the system generated unique identifier. + description: ""The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier."" in: path required: true type: string @@ -1041,9 +1006,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_4 - description: |- - The name of the memo. - Format: memos/{id} + description: ""The name of the memo.\r\nFormat: memos/{id}"" in: path required: true type: string @@ -1065,9 +1028,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_4 - description: |- - The name of the memo. - Format: memos/{id} + description: ""The name of the memo.\r\nFormat: memos/{id}"" in: path required: true type: string @@ -1089,9 +1050,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the activity. - Format: activities/{id} + description: ""The name of the activity.\r\nFormat: activities/{id}"" in: path required: true type: string @@ -1113,9 +1072,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: ""The name of the user.\r\nFormat: users/{id}"" in: path required: true type: string @@ -1137,9 +1094,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: ""The name of the user.\r\nFormat: users/{id}"" in: path required: true type: string @@ -1160,9 +1115,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: ""The name of the user.\r\nFormat: users/{id}"" in: path required: true type: string @@ -1190,9 +1143,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: ""The name of the user.\r\nFormat: users/{id}"" in: path required: true type: string @@ -1219,9 +1170,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: ""The name of the memo.\r\nFormat: memos/{id}"" in: path required: true type: string @@ -1242,9 +1191,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: ""The name of the memo.\r\nFormat: memos/{id}"" in: path required: true type: string @@ -1271,9 +1218,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id}. Use ""memos/-"" to list all properties. + description: ""The name of the memo.\r\nFormat: memos/{id}. Use \""memos/-\"" to list all properties."" in: path required: true type: string @@ -1296,9 +1241,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id}. Use ""memos/-"" to rebuild all memos. + description: ""The name of the memo.\r\nFormat: memos/{id}. Use \""memos/-\"" to rebuild all memos."" in: path required: true type: string @@ -1325,9 +1268,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: ""The name of the memo.\r\nFormat: memos/{id}"" in: path required: true type: string @@ -1348,9 +1289,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: ""The name of the memo.\r\nFormat: memos/{id}"" in: path required: true type: string @@ -1377,9 +1316,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: ""The name of the memo.\r\nFormat: memos/{id}"" in: path required: true type: string @@ -1401,9 +1338,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: ""The name of the memo.\r\nFormat: memos/{id}"" in: path required: true type: string @@ -1430,9 +1365,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: ""The name of the memo.\r\nFormat: memos/{id}"" in: path required: true type: string @@ -1454,9 +1387,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: ""The name of the memo.\r\nFormat: memos/{id}"" in: path required: true type: string @@ -1483,9 +1414,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: ""The name of the user.\r\nFormat: users/{id}"" in: path required: true type: string @@ -1507,17 +1436,13 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: |- - The parent, who owns the tags. - Format: memos/{id}. Use ""memos/-"" to list all tags. + description: ""The parent, who owns the tags.\r\nFormat: memos/{id}. Use \""memos/-\"" to list all tags."" in: path required: true type: string pattern: memos/[^/]+ - name: filter - description: |- - Filter is used to filter memos. - Format: ""creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']"" + description: ""Filter is used to filter memos.\r\nFormat: \""creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']\"""" in: query required: false type: string @@ -1539,9 +1464,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: |- - The parent, who owns the tags. - Format: memos/{id}. Use ""memos/-"" to delete all tags. + description: ""The parent, who owns the tags.\r\nFormat: memos/{id}. Use \""memos/-\"" to delete all tags."" in: path required: true type: string @@ -1572,9 +1495,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: |- - The parent, who owns the tags. - Format: memos/{id}. Use ""memos/-"" to rename all tags. + description: ""The parent, who owns the tags.\r\nFormat: memos/{id}. Use \""memos/-\"" to rename all tags."" in: path required: true type: string @@ -1601,10 +1522,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: resource.name - description: |- - The name of the resource. - Format: resources/{id} - id is the system generated unique identifier. + description: ""The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier."" in: path required: true type: string @@ -1636,9 +1554,7 @@ paths: format: int64 memo: type: string - title: |- - The related memo. - Format: memos/{id} + title: ""The related memo.\r\nFormat: memos/{id}"" tags: - ResourceService /api/v1/{setting.name}: @@ -1656,9 +1572,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: setting.name - description: |- - The name of the user. - Format: users/{id} + description: ""The name of the user.\r\nFormat: users/{id}"" in: path required: true type: string @@ -1695,9 +1609,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: user.name - description: |- - The name of the user. - Format: users/{id} + description: ""The name of the user.\r\nFormat: users/{id}"" in: path required: true type: string @@ -1751,9 +1663,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: ""The name of the user.\r\nFormat: users/{id}"" in: path required: true type: string @@ -1786,10 +1696,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the resource. - Format: resources/{id} - id is the system generated unique identifier. + description: ""The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier."" in: path required: true type: string @@ -1976,9 +1883,7 @@ definitions: properties: name: type: string - title: |- - The name of the identityProvider. - Format: identityProviders/{id} + title: ""The name of the identityProvider.\r\nFormat: identityProviders/{id}"" type: $ref: '#/definitions/apiv1IdentityProviderType' title: @@ -2022,9 +1927,7 @@ definitions: properties: name: type: string - title: |- - The name of the user. - Format: users/{id} + title: ""The name of the user.\r\nFormat: users/{id}"" locale: type: string description: The preferred locale of the user. @@ -2068,10 +1971,7 @@ definitions: weekStartDayOffset: type: integer format: int32 - 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. + description: ""week_start_day_offset is the week start day offset from Sunday.\r\n0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday\r\nDefault is Sunday."" disallowChangeUsername: type: boolean description: disallow_change_username disallows changing username. @@ -2108,9 +2008,7 @@ definitions: properties: name: type: string - title: |- - name is the name of the setting. - Format: settings/{setting} + title: ""name is the name of the setting.\r\nFormat: settings/{setting}"" generalSetting: $ref: '#/definitions/apiv1WorkspaceGeneralSetting' storageSetting: @@ -2125,9 +2023,7 @@ definitions: description: storage_type is the storage type. filepathTemplate: type: string - title: |- - The template of file path. - e.g. assets/{timestamp}_{filename} + title: ""The template of file path.\r\ne.g. assets/{timestamp}_{filename}"" uploadSizeLimitMb: type: string format: int64 @@ -2286,9 +2182,7 @@ definitions: properties: name: type: string - title: |- - The name of the activity. - Format: activities/{id} + title: ""The name of the activity.\r\nFormat: activities/{id}"" creatorId: type: integer format: int32 @@ -2419,9 +2313,7 @@ definitions: properties: name: type: string - title: |- - The name of the inbox. - Format: inboxes/{id} + title: ""The name of the inbox.\r\nFormat: inboxes/{id}"" sender: type: string title: 'Format: users/{id}' @@ -2541,10 +2433,7 @@ definitions: additionalProperties: type: integer format: int32 - description: |- - tag_amounts is the amount of tags. - key is the tag name. e.g. ""tag1"". - value is the amount of the tag. + description: ""tag_amounts is the amount of tags.\r\nkey is the tag name. e.g. \""tag1\"".\r\nvalue is the amount of the tag."" v1ListMemosResponse: type: object properties: @@ -2555,9 +2444,7 @@ definitions: $ref: '#/definitions/v1Memo' nextPageToken: type: string - description: |- - A token, which can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. + description: ""A token, which can be sent as `page_token` to retrieve the next page.\r\nIf this field is omitted, there are no subsequent pages."" v1ListResourcesResponse: type: object properties: @@ -2605,10 +2492,7 @@ definitions: properties: name: type: string - description: |- - The name of the memo. - Format: memos/{id} - id is the system generated id. + description: ""The name of the memo.\r\nFormat: memos/{id}\r\nid is the system generated id."" uid: type: string description: The user defined id of the memo. @@ -2616,9 +2500,7 @@ definitions: $ref: '#/definitions/v1RowStatus' creator: type: string - title: |- - The name of the creator. - Format: users/{id} + title: ""The name of the creator.\r\nFormat: users/{id}"" createTime: type: string format: date-time @@ -2671,9 +2553,7 @@ definitions: readOnly: true parent: type: string - title: |- - The name of the parent memo. - Format: memos/{id} + title: ""The name of the parent memo.\r\nFormat: memos/{id}"" readOnly: true snippet: type: string @@ -2698,9 +2578,7 @@ definitions: properties: name: type: string - title: |- - The name of the memo property. - Format: memos/{id}/properties/{property_id} + title: ""The name of the memo property.\r\nFormat: memos/{id}/properties/{property_id}"" property: $ref: '#/definitions/v1MemoProperty' readOnly: true @@ -2713,14 +2591,10 @@ definitions: properties: memo: type: string - title: |- - The name of memo. - Format: ""memos/{uid}"" + title: ""The name of memo.\r\nFormat: \""memos/{uid}\"""" relatedMemo: type: string - title: |- - The name of related memo. - Format: ""memos/{uid}"" + title: ""The name of related memo.\r\nFormat: \""memos/{uid}\"""" type: $ref: '#/definitions/v1MemoRelationType' v1MemoRelationType: @@ -2872,9 +2746,7 @@ definitions: format: int32 creator: type: string - title: |- - The name of the creator. - Format: users/{id} + title: ""The name of the creator.\r\nFormat: users/{id}"" contentId: type: string reactionType: @@ -2908,10 +2780,7 @@ definitions: properties: name: type: string - description: |- - The name of the resource. - Format: resources/{id} - id is the system generated unique identifier. + description: ""The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier."" uid: type: string description: The user defined id of the resource. @@ -2933,9 +2802,7 @@ definitions: format: int64 memo: type: string - title: |- - The related memo. - Format: memos/{id} + title: ""The related memo.\r\nFormat: memos/{id}"" v1RestoreMarkdownNodesRequest: type: object properties: @@ -3057,9 +2924,7 @@ definitions: properties: name: type: string - title: |- - The name of the user. - Format: users/{id} + title: ""The name of the user.\r\nFormat: users/{id}"" id: type: integer format: int32 @@ -3133,9 +2998,7 @@ definitions: properties: owner: type: string - title: |- - The name of instance owner. - Format: ""users/{id}"" + title: ""The name of instance owner.\r\nFormat: \""users/{id}\"""" version: type: string title: version is the current version of instance diff --git a/proto/gen/store/workspace_setting.pb.go b/proto/gen/store/workspace_setting.pb.go index 32ab428f7f4e8..827c08c3cad4e 100644 --- a/proto/gen/store/workspace_setting.pb.go +++ b/proto/gen/store/workspace_setting.pb.go @@ -256,7 +256,10 @@ type WorkspaceBasicSetting struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // The secret key for workspace. 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""` } func (x *WorkspaceBasicSetting) Reset() { @@ -298,6 +301,13 @@ func (x *WorkspaceBasicSetting) GetSecretKey() string { return """" } +func (x *WorkspaceBasicSetting) GetSchemaVersion() string { + if x != nil { + return x.SchemaVersion + } + return """" +} + type WorkspaceGeneralSetting struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -779,126 +789,128 @@ var file_store_workspace_setting_proto_rawDesc = []byte{ 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x12, 0x6d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x36, 0x0a, 0x15, 0x57, 0x6f, 0x72, + 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5d, 0x0a, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x61, 0x73, 0x69, 0x63, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, - 0x79, 0x22, 0xd8, 0x03, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x47, - 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3c, 0x0a, - 0x1a, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x72, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x18, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x55, 0x73, 0x65, 0x72, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x16, 0x64, - 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x5f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x64, 0x69, 0x73, - 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x75, 0x74, - 0x68, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x64, - 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x29, - 0x0a, 0x10, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x79, - 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x12, 0x4a, 0x0a, 0x0e, 0x63, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, - 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x50, - 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x0d, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x50, 0x72, - 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x31, 0x0a, 0x15, 0x77, 0x65, 0x65, 0x6b, 0x5f, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x79, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x77, 0x65, 0x65, 0x6b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, - 0x61, 0x79, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x69, 0x73, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x64, 0x69, 0x73, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x63, - 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x43, 0x68, - 0x61, 0x6e, 0x67, 0x65, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xa3, 0x01, 0x0a, - 0x16, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, - 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x19, 0x0a, 0x08, 0x6c, 0x6f, 0x67, 0x6f, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x6c, 0x6f, 0x67, 0x6f, 0x55, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, - 0x63, 0x61, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x61, - 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x61, 0x6e, 0x63, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x61, 0x6e, - 0x63, 0x65, 0x22, 0xd5, 0x02, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x53, - 0x0a, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x66, 0x69, 0x6c, 0x65, 0x70, 0x61, 0x74, 0x68, 0x5f, - 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, - 0x66, 0x69, 0x6c, 0x65, 0x70, 0x61, 0x74, 0x68, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, - 0x12, 0x2f, 0x0a, 0x14, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, - 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x6d, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, - 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x4d, - 0x62, 0x12, 0x39, 0x0a, 0x09, 0x73, 0x33, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x33, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x08, 0x73, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x4c, 0x0a, 0x0b, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x53, - 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x41, 0x54, - 0x41, 0x42, 0x41, 0x53, 0x45, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x4f, 0x43, 0x41, 0x4c, - 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x33, 0x10, 0x03, 0x22, 0xad, 0x01, 0x0a, 0x0f, 0x53, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, - 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, - 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, - 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x1a, - 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, - 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, - 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x22, 0x86, 0x03, 0x0a, 0x1b, 0x57, - 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, - 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3c, 0x0a, 0x1a, 0x64, 0x69, - 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x76, 0x69, - 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, - 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x56, 0x69, - 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x37, 0x0a, 0x18, 0x64, 0x69, 0x73, 0x70, - 0x6c, 0x61, 0x79, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, - 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x70, - 0x6c, 0x61, 0x79, 0x57, 0x69, 0x74, 0x68, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, - 0x65, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x75, - 0x74, 0x6f, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x11, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x75, 0x74, 0x6f, 0x43, 0x6f, 0x6d, 0x70, - 0x61, 0x63, 0x74, 0x12, 0x37, 0x0a, 0x18, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x6f, - 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6c, 0x69, 0x63, 0x6b, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x6f, 0x75, - 0x62, 0x6c, 0x65, 0x43, 0x6c, 0x69, 0x63, 0x6b, 0x45, 0x64, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x13, - 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x70, 0x72, 0x65, 0x76, - 0x69, 0x65, 0x77, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x65, 0x6e, 0x61, 0x62, 0x6c, - 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x25, 0x0a, 0x0e, - 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x2a, 0x73, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x21, 0x57, 0x4f, - 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, - 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x41, 0x53, 0x49, 0x43, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, - 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, - 0x52, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x52, - 0x45, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x04, 0x42, 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x15, 0x57, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, - 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, - 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, - 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xd8, 0x03, 0x0a, 0x17, 0x57, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3c, 0x0a, 0x1a, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, + 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x16, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x14, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x41, 0x75, 0x74, 0x68, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x64, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x79, 0x6c, 0x65, + 0x12, 0x4a, 0x0a, 0x0e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, + 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x0d, 0x63, + 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x31, 0x0a, 0x15, + 0x77, 0x65, 0x65, 0x6b, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x79, 0x5f, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x77, 0x65, 0x65, + 0x6b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, 0x61, 0x79, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, + 0x38, 0x0a, 0x18, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x63, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x16, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x69, 0x73, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6e, 0x69, 0x63, + 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x64, 0x69, 0x73, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4e, 0x69, 0x63, 0x6b, 0x6e, + 0x61, 0x6d, 0x65, 0x22, 0xa3, 0x01, 0x0a, 0x16, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, + 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x6f, 0x67, 0x6f, 0x5f, 0x75, + 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x6f, 0x67, 0x6f, 0x55, 0x72, + 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x70, 0x70, + 0x65, 0x61, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, + 0x70, 0x70, 0x65, 0x61, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x22, 0xd5, 0x02, 0x0a, 0x17, 0x57, 0x6f, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x53, 0x0a, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x73, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x66, 0x69, + 0x6c, 0x65, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x66, 0x69, 0x6c, 0x65, 0x70, 0x61, 0x74, 0x68, 0x54, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x14, 0x75, 0x70, 0x6c, 0x6f, 0x61, + 0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x6d, 0x62, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, 0x7a, + 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x4d, 0x62, 0x12, 0x39, 0x0a, 0x09, 0x73, 0x33, 0x5f, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x53, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x33, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x22, 0x4c, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x10, 0x01, 0x12, 0x09, + 0x0a, 0x05, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x33, 0x10, + 0x03, 0x22, 0xad, 0x01, 0x0a, 0x0f, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x33, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, + 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x53, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x63, + 0x6b, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, + 0x74, 0x22, 0x86, 0x03, 0x0a, 0x1b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, + 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x12, 0x3c, 0x0a, 0x1a, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, + 0x37, 0x0a, 0x18, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x57, 0x69, 0x74, 0x68, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x65, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, + 0x75, 0x74, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0x12, 0x37, 0x0a, 0x18, 0x65, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6c, 0x69, 0x63, + 0x6b, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x65, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x43, 0x6c, 0x69, 0x63, 0x6b, 0x45, + 0x64, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6c, 0x69, + 0x6e, 0x6b, 0x5f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x11, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x72, 0x65, 0x76, + 0x69, 0x65, 0x77, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2a, 0x73, 0x0a, 0x13, 0x57, 0x6f, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, + 0x79, 0x12, 0x25, 0x0a, 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, + 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x41, 0x53, 0x49, + 0x43, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x02, + 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, 0x10, 0x0a, + 0x0c, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x04, 0x42, + 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x42, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, + 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, + 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, + 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, + 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, + 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/store/workspace_setting.proto b/proto/store/workspace_setting.proto index 01d7126f763dc..6d74a5d817c3e 100644 --- a/proto/store/workspace_setting.proto +++ b/proto/store/workspace_setting.proto @@ -27,7 +27,10 @@ message WorkspaceSetting { } message WorkspaceBasicSetting { + // The secret key for workspace. Mainly used for session management. string secret_key = 1; + // The current schema version of database. + string schema_version = 2; } message WorkspaceGeneralSetting { diff --git a/store/migrator.go b/store/migrator.go index f50300fb02aac..7ac5445e542e8 100644 --- a/store/migrator.go +++ b/store/migrator.go @@ -14,6 +14,7 @@ import ( ""github.com/pkg/errors"" + storepb ""github.com/usememos/memos/proto/gen/store"" ""github.com/usememos/memos/server/version"" ) @@ -96,11 +97,15 @@ func (s *Store) Migrate(ctx context.Context) error { slog.Info(""end migrate"") // Upsert the current schema version to migration_history. + // TODO: retire using migration history later. if _, err = s.driver.UpsertMigrationHistory(ctx, &UpsertMigrationHistory{ Version: schemaVersion, }); err != nil { return errors.Wrapf(err, ""failed to upsert migration history with version: %s"", schemaVersion) } + if err := s.updateCurrentSchemaVersion(ctx, schemaVersion); err != nil { + return errors.Wrap(err, ""failed to update current schema version"") + } } } else if s.Profile.Mode == ""demo"" { // In demo mode, we should seed the database. @@ -112,6 +117,7 @@ func (s *Store) Migrate(ctx context.Context) error { } func (s *Store) preMigrate(ctx context.Context) error { + // TODO: using schema version in basic setting instead of migration history. migrationHistoryList, err := s.driver.FindMigrationHistoryList(ctx, &FindMigrationHistory{}) // If any error occurs or no migration history found, apply the latest schema. if err != nil || len(migrationHistoryList) == 0 { @@ -141,11 +147,15 @@ func (s *Store) preMigrate(ctx context.Context) error { return errors.Wrap(err, ""failed to commit transaction"") } + // TODO: using schema version in basic setting instead of migration history. if _, err := s.driver.UpsertMigrationHistory(ctx, &UpsertMigrationHistory{ Version: schemaVersion, }); err != nil { return errors.Wrap(err, ""failed to upsert migration history"") } + if err := s.updateCurrentSchemaVersion(ctx, schemaVersion); err != nil { + return errors.Wrap(err, ""failed to update current schema version"") + } } if s.Profile.Mode == ""prod"" { if err := s.normalizedMigrationHistoryList(ctx); err != nil { @@ -295,3 +305,18 @@ func (s *Store) normalizedMigrationHistoryList(ctx context.Context) error { } return tx.Commit() } + +func (s *Store) updateCurrentSchemaVersion(ctx context.Context, schemaVersion string) error { + workspaceBasicSetting, err := s.GetWorkspaceBasicSetting(ctx) + if err != nil { + return errors.Wrap(err, ""failed to get workspace basic setting"") + } + workspaceBasicSetting.SchemaVersion = schemaVersion + if _, err := s.UpsertWorkspaceSetting(ctx, &storepb.WorkspaceSetting{ + Key: storepb.WorkspaceSettingKey_BASIC, + Value: &storepb.WorkspaceSetting_BasicSetting{BasicSetting: workspaceBasicSetting}, + }); err != nil { + return errors.Wrap(err, ""failed to upsert workspace setting"") + } + return nil +}",chore,add schema version to workspace setting cc759bef5601c419d89e527cad69a08373b09599,2022-10-15 03:41:17,Steven,fix: handle highlight unknown language error,False,"diff --git a/web/src/labs/marked/parser/CodeBlock.ts b/web/src/labs/marked/parser/CodeBlock.ts index ca5afb3a89aa1..52e9454016cfb 100644 --- a/web/src/labs/marked/parser/CodeBlock.ts +++ b/web/src/labs/marked/parser/CodeBlock.ts @@ -10,11 +10,18 @@ const renderer = (rawStr: string): string => { } const language = escape(matchResult[1]) || ""plaintext""; - const highlightedCodes = hljs.highlight(matchResult[2], { - language, - }).value; + let highlightedCode = hljs.highlightAuto(matchResult[2]).value; - return `
${highlightedCodes}
${matchResult[3]}`; + try { + const temp = hljs.highlight(matchResult[2], { + language, + }).value; + highlightedCode = temp; + } catch (error) { + // do nth + } + + return `
${highlightedCode}
${matchResult[3]}`; }; export default {",fix,handle highlight unknown language error af1ad2f2dbb0f8c5c50bdc4549fb92431b66d2cb,2024-05-06 05:32:39,Steven,chore: add memo content length limit setting,False,"diff --git a/docs/apidocs.swagger.yaml b/docs/apidocs.swagger.yaml index a8a9716a88024..5d541e4d76120 100644 --- a/docs/apidocs.swagger.yaml +++ b/docs/apidocs.swagger.yaml @@ -2096,6 +2096,10 @@ definitions: displayWithUpdateTime: type: boolean description: display_with_update_time orders and displays memo with update time. + contentLengthLimit: + type: string + format: int64 + description: content_length_limit is the limit of content length. apiv1WorkspaceSetting: type: object properties: diff --git a/proto/api/v1/workspace_setting_service.proto b/proto/api/v1/workspace_setting_service.proto index 9a669187f4a86..f079844cb27a9 100644 --- a/proto/api/v1/workspace_setting_service.proto +++ b/proto/api/v1/workspace_setting_service.proto @@ -96,6 +96,8 @@ message WorkspaceMemoRelatedSetting { bool disallow_public_visible = 1; // display_with_update_time orders and displays memo with update time. bool display_with_update_time = 2; + // content_length_limit is the limit of content length. + int64 content_length_limit = 3; } message ListWorkspaceSettingsRequest {} diff --git a/proto/gen/api/v1/workspace_setting_service.pb.go b/proto/gen/api/v1/workspace_setting_service.pb.go index fb7be1990d857..e81987fb8059a 100644 --- a/proto/gen/api/v1/workspace_setting_service.pb.go +++ b/proto/gen/api/v1/workspace_setting_service.pb.go @@ -438,6 +438,8 @@ type WorkspaceMemoRelatedSetting struct { DisallowPublicVisible bool `protobuf:""varint,1,opt,name=disallow_public_visible,json=disallowPublicVisible,proto3"" json:""disallow_public_visible,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. + ContentLengthLimit int64 `protobuf:""varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3"" json:""content_length_limit,omitempty""` } func (x *WorkspaceMemoRelatedSetting) Reset() { @@ -486,6 +488,13 @@ func (x *WorkspaceMemoRelatedSetting) GetDisplayWithUpdateTime() bool { return false } +func (x *WorkspaceMemoRelatedSetting) GetContentLengthLimit() int64 { + if x != nil { + return x.ContentLengthLimit + } + return 0 +} + type ListWorkspaceSettingsRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -845,7 +854,7 @@ var file_api_v1_workspace_setting_service_proto_rawDesc = []byte{ 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x33, 0x10, 0x03, 0x22, 0x8e, 0x01, 0x0a, 0x1b, 0x57, 0x6f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x33, 0x10, 0x03, 0x22, 0xc0, 0x01, 0x0a, 0x1b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x36, 0x0a, 0x17, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x76, 0x69, 0x73, @@ -854,67 +863,70 @@ var file_api_v1_workspace_setting_service_proto_rawDesc = []byte{ 0x65, 0x12, 0x37, 0x0a, 0x18, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x57, 0x69, 0x74, 0x68, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x1e, 0x0a, 0x1c, 0x4c, 0x69, - 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5b, 0x0a, 0x1d, 0x4c, 0x69, - 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x08, 0x73, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x73, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x36, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x57, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, - 0x56, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, - 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5f, 0x6c, 0x69, 0x6d, + 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x1e, 0x0a, 0x1c, + 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5b, 0x0a, 0x1d, + 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, + 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, + 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, + 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x36, 0x0a, 0x1a, 0x47, 0x65, 0x74, + 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x22, 0x56, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x38, 0x0a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x52, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xf0, 0x03, 0x0a, 0x17, 0x57, 0x6f, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x94, 0x01, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, + 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, + 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, + 0x12, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x93, 0x01, 0x0a, + 0x13, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x07, - 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xf0, 0x03, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x94, 0x01, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x2a, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x93, 0x01, 0x0a, 0x13, 0x47, - 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x32, 0xda, 0x41, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x7b, - 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, - 0x12, 0xa7, 0x01, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x22, 0x46, 0xda, 0x41, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x36, 0x3a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x2b, 0x2f, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x32, + 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x2f, 0x7b, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xb4, 0x01, 0x0a, 0x10, 0x63, - 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, - 0x1c, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, - 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, - 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, - 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, - 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, + 0x2a, 0x7d, 0x12, 0xa7, 0x01, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x22, 0x46, 0xda, 0x41, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x36, 0x3a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, + 0x2b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x2f, 0x7b, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x6e, 0x61, 0x6d, 0x65, + 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xb4, 0x01, 0x0a, + 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x42, 0x1c, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, + 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, + 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, + 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, + 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, + 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/gen/store/workspace_setting.pb.go b/proto/gen/store/workspace_setting.pb.go index f6dd403a73b7f..b9698108f4380 100644 --- a/proto/gen/store/workspace_setting.pb.go +++ b/proto/gen/store/workspace_setting.pb.go @@ -555,6 +555,8 @@ type WorkspaceMemoRelatedSetting struct { DisallowPublicVisible bool `protobuf:""varint,1,opt,name=disallow_public_visible,json=disallowPublicVisible,proto3"" json:""disallow_public_visible,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. + ContentLengthLimit int64 `protobuf:""varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3"" json:""content_length_limit,omitempty""` } func (x *WorkspaceMemoRelatedSetting) Reset() { @@ -603,6 +605,13 @@ func (x *WorkspaceMemoRelatedSetting) GetDisplayWithUpdateTime() bool { return false } +func (x *WorkspaceMemoRelatedSetting) GetContentLengthLimit() int64 { + if x != nil { + return x.ContentLengthLimit + } + return 0 +} + // Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ type WorkspaceStorageSetting_S3Config struct { state protoimpl.MessageState @@ -784,7 +793,7 @@ var file_store_workspace_setting_proto_rawDesc = []byte{ 0x41, 0x42, 0x41, 0x53, 0x45, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x53, 0x33, 0x10, 0x03, 0x22, 0x8e, 0x01, 0x0a, 0x1b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x53, 0x33, 0x10, 0x03, 0x22, 0xc0, 0x01, 0x0a, 0x1b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x36, 0x0a, 0x17, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, @@ -793,29 +802,32 @@ var file_store_workspace_setting_proto_rawDesc = []byte{ 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x57, 0x69, 0x74, 0x68, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x54, 0x69, 0x6d, 0x65, 0x2a, 0xbb, 0x01, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, - 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, - 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, - 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x42, 0x41, 0x53, 0x49, 0x43, 0x10, - 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, - 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x02, - 0x12, 0x1d, 0x0a, 0x19, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, - 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, - 0x22, 0x0a, 0x1e, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, - 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x45, - 0x44, 0x10, 0x04, 0x42, 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, - 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, - 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, - 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, - 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2a, 0xbb, 0x01, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, + 0x25, 0x0a, 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, + 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, + 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x42, 0x41, 0x53, 0x49, + 0x43, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, + 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, + 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x19, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, + 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, + 0x03, 0x12, 0x22, 0x0a, 0x1e, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, + 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x52, 0x45, 0x4c, 0x41, + 0x54, 0x45, 0x44, 0x10, 0x04, 0x42, 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, + 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, + 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, + 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, + 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/store/workspace_setting.proto b/proto/store/workspace_setting.proto index 092f1f8c1e545..2525946c12db3 100644 --- a/proto/store/workspace_setting.proto +++ b/proto/store/workspace_setting.proto @@ -87,4 +87,6 @@ message WorkspaceMemoRelatedSetting { bool disallow_public_visible = 1; // display_with_update_time orders and displays memo with update time. bool display_with_update_time = 2; + // content_length_limit is the limit of content length. + int64 content_length_limit = 3; } diff --git a/server/router/api/v1/memo_service.go b/server/router/api/v1/memo_service.go index 8ac95c944a943..118bf52805a5c 100644 --- a/server/router/api/v1/memo_service.go +++ b/server/router/api/v1/memo_service.go @@ -27,9 +27,7 @@ import ( ) const ( - DefaultPageSize = 10 - MaxContentLength = 8 * 1024 - ChunkSize = 64 * 1024 // 64 KiB + DefaultPageSize = 10 ) func (s *APIV1Service) CreateMemo(ctx context.Context, request *v1pb.CreateMemoRequest) (*v1pb.Memo, error) { @@ -40,9 +38,6 @@ func (s *APIV1Service) CreateMemo(ctx context.Context, request *v1pb.CreateMemoR if user == nil { return nil, status.Errorf(codes.PermissionDenied, ""permission denied"") } - if len(request.Content) > MaxContentLength { - return nil, status.Errorf(codes.InvalidArgument, ""content too long"") - } create := &store.Memo{ UID: shortuuid.New(), @@ -57,6 +52,13 @@ func (s *APIV1Service) CreateMemo(ctx context.Context, request *v1pb.CreateMemoR if workspaceMemoRelatedSetting.DisallowPublicVisible && create.Visibility == store.Public { return nil, status.Errorf(codes.PermissionDenied, ""disable public memos system setting is enabled"") } + contentLengthLimit, err := s.getContentLengthLimit(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, ""failed to get content length limit"") + } + if len(create.Content) > contentLengthLimit { + return nil, status.Errorf(codes.InvalidArgument, ""content too long (max %d characters)"", contentLengthLimit) + } memo, err := s.Store.CreateMemo(ctx, create) if err != nil { @@ -257,8 +259,12 @@ func (s *APIV1Service) UpdateMemo(ctx context.Context, request *v1pb.UpdateMemoR } } } - if update.Content != nil && len(*update.Content) > MaxContentLength { - return nil, status.Errorf(codes.InvalidArgument, ""content too long"") + contentLengthLimit, err := s.getContentLengthLimit(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, ""failed to get content length limit"") + } + if update.Content != nil && len(*update.Content) > contentLengthLimit { + return nil, status.Errorf(codes.InvalidArgument, ""content too long (max %d characters)"", contentLengthLimit) } if err = s.Store.UpdateMemo(ctx, update); err != nil { @@ -702,6 +708,14 @@ func (s *APIV1Service) buildMemoFindWithFilter(ctx context.Context, find *store. return nil } +func (s *APIV1Service) getContentLengthLimit(ctx context.Context) (int, error) { + workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx) + if err != nil { + return 0, status.Errorf(codes.Internal, ""failed to get workspace memo related setting"") + } + return int(workspaceMemoRelatedSetting.ContentLengthLimit), nil +} + // SearchMemosFilterCELAttributes are the CEL attributes. var SearchMemosFilterCELAttributes = []cel.EnvOption{ cel.Variable(""content_search"", cel.ListType(cel.StringType)), diff --git a/server/router/api/v1/workspace_setting_service.go b/server/router/api/v1/workspace_setting_service.go index 517294bc18f11..a6cf1f0935279 100644 --- a/server/router/api/v1/workspace_setting_service.go +++ b/server/router/api/v1/workspace_setting_service.go @@ -211,6 +211,7 @@ func convertWorkspaceMemoRelatedSettingFromStore(setting *storepb.WorkspaceMemoR return &v1pb.WorkspaceMemoRelatedSetting{ DisallowPublicVisible: setting.DisallowPublicVisible, DisplayWithUpdateTime: setting.DisplayWithUpdateTime, + ContentLengthLimit: setting.ContentLengthLimit, } } @@ -221,5 +222,6 @@ func convertWorkspaceMemoRelatedSettingToStore(setting *v1pb.WorkspaceMemoRelate return &storepb.WorkspaceMemoRelatedSetting{ DisallowPublicVisible: setting.DisallowPublicVisible, DisplayWithUpdateTime: setting.DisplayWithUpdateTime, + ContentLengthLimit: setting.ContentLengthLimit, } } diff --git a/store/workspace_setting.go b/store/workspace_setting.go index f45f34d6aaa05..d1f91d9482fc6 100644 --- a/store/workspace_setting.go +++ b/store/workspace_setting.go @@ -123,6 +123,11 @@ func (s *Store) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.Worksp return workspaceGeneralSetting, nil } +const ( + // DefaultContentLengthLimit is the default limit of content length in bytes. 8KB. + DefaultContentLengthLimit = 8 * 1024 +) + func (s *Store) GetWorkspaceMemoRelatedSetting(ctx context.Context) (*storepb.WorkspaceMemoRelatedSetting, error) { workspaceSetting, err := s.GetWorkspaceSetting(ctx, &FindWorkspaceSetting{ Name: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED.String(), @@ -135,6 +140,9 @@ func (s *Store) GetWorkspaceMemoRelatedSetting(ctx context.Context) (*storepb.Wo if workspaceSetting != nil { workspaceMemoRelatedSetting = workspaceSetting.GetMemoRelatedSetting() } + if workspaceMemoRelatedSetting.ContentLengthLimit < DefaultContentLengthLimit { + workspaceMemoRelatedSetting.ContentLengthLimit = DefaultContentLengthLimit + } return workspaceMemoRelatedSetting, nil } diff --git a/web/src/components/Settings/WorkspaceSection.tsx b/web/src/components/Settings/WorkspaceSection.tsx index 6bcc5a57a8f40..fc6822f60fc33 100644 --- a/web/src/components/Settings/WorkspaceSection.tsx +++ b/web/src/components/Settings/WorkspaceSection.tsx @@ -144,6 +144,20 @@ const WorkspaceSection = () => { }); }; + const handleMemoContentLengthLimitChanges = async (value: number) => { + if (value < 8 * 1024) { + toast.error(""Content length limit should be greater than 8KB""); + return; + } + + const update: WorkspaceMemoRelatedSetting = { ...workspaceMemoRelatedSetting, contentLengthLimit: value }; + setWorkspaceMemoRelatedSetting(update); + await workspaceSettingStore.setWorkspaceSetting({ + name: `${WorkspaceSettingPrefix}${WorkspaceSettingKey.WORKSPACE_SETTING_MEMO_RELATED}`, + memoRelatedSetting: update, + }); + }; + return (

{t(""common.basic"")}

@@ -179,10 +193,6 @@ const WorkspaceSection = () => {
handleInstanceUrlChanged(event.target.value)} @@ -263,6 +273,15 @@ const WorkspaceSection = () => { onChange={(event) => handleMemoDisplayWithUpdatedTs(event.target.checked)} />
+
+ Content length limit(Byte) + handleMemoContentLengthLimitChanges(Number(event.target.value))} + /> +
); };",chore,add memo content length limit setting 6e2e7ac78299d3e209f07baf4196e8475c754e0a,2023-02-24 18:41:12,boojack,fix: remove memo list api (#1151),False,"diff --git a/server/memo.go b/server/memo.go index 2354ecce38580..c479586348b85 100644 --- a/server/memo.go +++ b/server/memo.go @@ -334,23 +334,6 @@ func (s *Server) registerMemoRoutes(g *echo.Group) { return c.JSON(http.StatusOK, composeResponse(resourceList)) }) - g.GET(""/memo/amount"", func(c echo.Context) error { - ctx := c.Request().Context() - normalRowStatus := api.Normal - memoFind := &api.MemoFind{ - RowStatus: &normalRowStatus, - } - if userID, err := strconv.Atoi(c.QueryParam(""userId"")); err == nil { - memoFind.CreatorID = &userID - } - - memoList, err := s.Store.FindMemoList(ctx, memoFind) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, ""Failed to find memo list"").SetInternal(err) - } - return c.JSON(http.StatusOK, composeResponse(memoList)) - }) - g.GET(""/memo/stats"", func(c echo.Context) error { ctx := c.Request().Context() normalStatus := api.Normal",fix,remove memo list api (#1151) bfc6e4dd0f57457b0ecab4321d755b6b9254ed2c,2022-06-30 20:06:19,boojack,chore: update seed data,False,"diff --git a/store/db/migration/10000__reset.sql b/store/db/migration/00000__reset.sql similarity index 100% rename from store/db/migration/10000__reset.sql rename to store/db/migration/00000__reset.sql diff --git a/store/db/migration/10001__schema.sql b/store/db/migration/00000__schema.sql similarity index 100% rename from store/db/migration/10001__schema.sql rename to store/db/migration/00000__schema.sql diff --git a/store/db/seed/10002__memo.sql b/store/db/seed/10002__memo.sql index 8282882210dcd..0e8d1f9ae34f1 100644 --- a/store/db/seed/10002__memo.sql +++ b/store/db/seed/10002__memo.sql @@ -7,7 +7,8 @@ INSERT INTO VALUES ( 101, - '#memos 👋 Welcome to memos', + '#memos +👋 Welcome to memos', 101 ); diff --git a/store/db/seed/10003__memo_organizer.sql b/store/db/seed/10003__memo_organizer.sql index 0318518c3d711..5c3ade8e9cf91 100644 --- a/store/db/seed/10003__memo_organizer.sql +++ b/store/db/seed/10003__memo_organizer.sql @@ -6,7 +6,7 @@ INSERT INTO ) VALUES ( - 102, + 101, 101, 1 );",chore,update seed data fbce43870f0b43cc6ab33169f3623a6377a418e2,2022-09-09 05:10:21,Steven,chore: update resource base url,False,"diff --git a/server/server.go b/server/server.go index 766934b0906d7..ed17905e75596 100644 --- a/server/server.go +++ b/server/server.go @@ -56,8 +56,11 @@ func NewServer(profile *profile.Profile) *Server { Profile: profile, } - publicRouteGroup := e.Group(""/h"") - s.registerResourcePublicRoutes(publicRouteGroup) + webhookGroup := e.Group(""/h"") + s.registerResourcePublicRoutes(webhookGroup) + + publicGroup := e.Group(""/o"") + s.registerResourcePublicRoutes(publicGroup) apiGroup := e.Group(""/api"") apiGroup.Use(func(next echo.HandlerFunc) echo.HandlerFunc { diff --git a/web/src/components/MemoEditor.tsx b/web/src/components/MemoEditor.tsx index 7c12810f6061f..a6edbaa367442 100644 --- a/web/src/components/MemoEditor.tsx +++ b/web/src/components/MemoEditor.tsx @@ -116,7 +116,7 @@ const MemoEditor = () => { try { const image = await resourceService.upload(file); - const url = `/h/r/${image.id}/${image.filename}`; + const url = `/o/r/${image.id}/${image.filename}`; return url; } catch (error: any) { console.error(error); diff --git a/web/src/components/ResourcesDialog.tsx b/web/src/components/ResourcesDialog.tsx index 4978cb2d9e03a..4c4ea71a57bcf 100644 --- a/web/src/components/ResourcesDialog.tsx +++ b/web/src/components/ResourcesDialog.tsx @@ -90,11 +90,11 @@ const ResourcesDialog: React.FC = (props: Props) => { }; const handlPreviewBtnClick = (resource: Resource) => { - showPreviewImageDialog(`${window.location.origin}/h/r/${resource.id}/${resource.filename}`); + showPreviewImageDialog(`${window.location.origin}/o/r/${resource.id}/${resource.filename}`); }; const handleCopyResourceLinkBtnClick = (resource: Resource) => { - utils.copyTextToClipboard(`${window.location.origin}/h/r/${resource.id}/${resource.filename}`); + utils.copyTextToClipboard(`${window.location.origin}/o/r/${resource.id}/${resource.filename}`); toastHelper.success(""Succeed to copy resource link to clipboard""); }; diff --git a/web/vite.config.ts b/web/vite.config.ts index ed99b8bd5eb00..3f640eee661fd 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -6,13 +6,17 @@ import { resolve } from ""path""; export default defineConfig({ plugins: [react()], server: { - cors: true, + host: ""0.0.0.0"", port: 3000, proxy: { ""/api"": { target: ""http://localhost:8080/"", changeOrigin: true, }, + ""/o/"": { + target: ""http://localhost:8080/"", + changeOrigin: true, + }, ""/h/"": { target: ""http://localhost:8080/"", changeOrigin: true,",chore,update resource base url ff0db82dc3cb5af47ed3eacf5a2dbafcf9884c40,2022-11-25 17:39:42,Zeng1998,chore: empty query text (#566),False,"diff --git a/web/src/components/SearchBar.tsx b/web/src/components/SearchBar.tsx index a80b3f207bf58..e2521878fe863 100644 --- a/web/src/components/SearchBar.tsx +++ b/web/src/components/SearchBar.tsx @@ -27,7 +27,7 @@ const SearchBar = () => { const handleTextQueryInput = (event: React.FormEvent) => { const text = event.currentTarget.value; setQueryText(text); - locationService.setTextQuery(text); + locationService.setTextQuery(text.length === 0 ? undefined : text); }; return (",chore,empty query text (#566) dedea0dd27625aed8b2c3d165ce6e8dd2f35b140,2022-03-23 21:45:15,email,fix: tags initial,False,"diff --git a/web/src/components/MemoList.tsx b/web/src/components/MemoList.tsx index 91fcad9045889..b09cd60fe22c5 100644 --- a/web/src/components/MemoList.tsx +++ b/web/src/components/MemoList.tsx @@ -81,6 +81,7 @@ const MemoList: React.FC = () => { .fetchAllMemos() .then(() => { setFetchStatus(false); + memoService.updateTagsState(); }) .catch(() => { toastHelper.error(""😭 Refresh failed, please try again later.""); diff --git a/web/src/less/create-shortcut-dialog.less b/web/src/less/create-shortcut-dialog.less index 4cae31f54d719..f1275b5929f93 100644 --- a/web/src/less/create-shortcut-dialog.less +++ b/web/src/less/create-shortcut-dialog.less @@ -2,47 +2,30 @@ .create-shortcut-dialog { > .dialog-container { - width: 420px; + @apply w-128; > .dialog-content-container { .flex(column, flex-start, flex-start); > .form-item-container { .flex(row, flex-start, flex-start); - width: 100%; - margin-top: 8px; - padding: 4px 0; + @apply w-full mt-2 py-1; > .normal-text { - display: block; - flex-shrink: 0; - width: 40px; - margin-right: 12px; - text-align: right; + @apply block flex-shrink-0 w-12 mr-3 text-right text-sm leading-8; color: gray; - font-size: 13px; - line-height: 32px; } > .title-input { - width: 100%; - padding: 0 8px; - font-size: 13px; - line-height: 32px; - border-radius: 4px; - border: 1px solid @bg-gray; - resize: none; + @apply w-full px-2 text-base leading-8 rounded border resize-none; } > .filters-wrapper { - width: calc(100% - 56px); .flex(column, flex-start, flex-start); + @apply w-full; > .create-filter-btn { - color: @text-green; - font-size: 13px; - line-height: 32px; - cursor: pointer; + @apply text-sm leading-8 cursor-pointer text-green-500 hover:text-green-600; } } } @@ -50,8 +33,7 @@ > .dialog-footer-container { .flex(row, space-between, center); - width: 100%; - margin-top: 0; + @apply w-full mt-0; > .btns-container { .flex(row, flex-start, center); @@ -108,21 +90,20 @@ flex-shrink: 0; &.relation-selector { - width: 48px; - margin-left: -52px; + @apply w-16; + margin-left: -68px; } &.type-selector { - width: 62px; + @apply w-20; } &.operator-selector { - width: 62px; + @apply w-24; } &.value-selector { flex-grow: 1; - max-width: calc(100% - 152px); } }",fix,tags initial 8c774316aeec6b94c56d83739762bfc45bd821fd,2023-03-09 20:11:48,Cologler,refactor: build storage key (#1326),False,"diff --git a/server/resource.go b/server/resource.go index 484d781757e67..13dd8879a68c6 100644 --- a/server/resource.go +++ b/server/resource.go @@ -8,6 +8,7 @@ import ( ""net/http"" ""net/url"" ""path"" + ""regexp"" ""strconv"" ""strings"" ""time"" @@ -24,6 +25,8 @@ const ( maxFileSize = 32 << 20 ) +var fileKeyPattern = regexp.MustCompile(`\{[a-z]{1,9}\}`) + func (s *Server) registerResourceRoutes(g *echo.Group) { g.POST(""/resource"", func(c echo.Context) error { ctx := c.Request().Context() @@ -136,22 +139,39 @@ func (s *Server) registerResourceRoutes(g *echo.Group) { if storage.Type == api.StorageS3 { s3Config := storage.Config.S3Config t := time.Now() - s3FileKey := s3Config.Path + var s3FileKey string if s3Config.Path == """" { s3FileKey = filename - } else if !strings.Contains(s3Config.Path, ""{filename}"") { - s3FileKey = path.Join(s3Config.Path, filename) } else { - s3FileKey = strings.ReplaceAll(s3FileKey, ""{filename}"", filename) - s3FileKey = strings.ReplaceAll(s3FileKey, ""{filetype}"", filetype) - s3FileKey = strings.ReplaceAll(s3FileKey, ""{timestamp}"", fmt.Sprintf(""%d"", t.Unix())) - s3FileKey = strings.ReplaceAll(s3FileKey, ""{year}"", fmt.Sprintf(""%d"", t.Year())) - s3FileKey = strings.ReplaceAll(s3FileKey, ""{month}"", fmt.Sprintf(""%02d"", t.Month())) - s3FileKey = strings.ReplaceAll(s3FileKey, ""{day}"", fmt.Sprintf(""%02d"", t.Day())) - s3FileKey = strings.ReplaceAll(s3FileKey, ""{hour}"", fmt.Sprintf(""%02d"", t.Hour())) - s3FileKey = strings.ReplaceAll(s3FileKey, ""{minute}"", fmt.Sprintf(""%02d"", t.Minute())) - s3FileKey = strings.ReplaceAll(s3FileKey, ""{second}"", fmt.Sprintf(""%02d"", t.Second())) + s3FileKey = fileKeyPattern.ReplaceAllStringFunc(s3Config.Path, func(s string) string { + switch s { + case ""{filename}"": + return filename + case ""{filetype}"": + return filetype + case ""{timestamp}"": + return fmt.Sprintf(""%d"", t.Unix()) + case ""{year}"": + return fmt.Sprintf(""%d"", t.Year()) + case ""{month}"": + return fmt.Sprintf(""%02d"", t.Month()) + case ""{day}"": + return fmt.Sprintf(""%02d"", t.Day()) + case ""{hour}"": + return fmt.Sprintf(""%02d"", t.Hour()) + case ""{minute}"": + return fmt.Sprintf(""%02d"", t.Minute()) + case ""{second}"": + return fmt.Sprintf(""%02d"", t.Second()) + } + return s + }) + + if !strings.Contains(s3Config.Path, ""{filename}"") { + s3FileKey = path.Join(s3FileKey, filename) + } } + s3client, err := s3.NewClient(ctx, &s3.Config{ AccessKey: s3Config.AccessKey, SecretKey: s3Config.SecretKey,",refactor,build storage key (#1326) 020b211660572802a27ef5f3f42d4ab8b3c2776e,2022-09-09 17:11:12,Steven,chore: update explore page style,False,"diff --git a/web/src/pages/Explore.tsx b/web/src/pages/Explore.tsx index 88f48fdef63f9..2f7394241c9e9 100644 --- a/web/src/pages/Explore.tsx +++ b/web/src/pages/Explore.tsx @@ -4,6 +4,7 @@ import { locationService, memoService, userService } from ""../services""; import { useAppSelector } from ""../store""; import useI18n from ""../hooks/useI18n""; import useLoading from ""../hooks/useLoading""; +import Only from ""../components/common/OnlyWhen""; import MemoContent from ""../components/MemoContent""; import MemoResources from ""../components/MemoResources""; import ""../less/explore.less""; @@ -48,18 +49,20 @@ const Explore = () => {
- {user ? ( - - ) : ( - - )} + + {user ? ( + + ) : ( + + )} +
- {loadingState.isLoading ? null : ( +
{state.memos.map((memo) => { const createdAtStr = dayjs(memo.createdTs).locale(locale).format(""YYYY/MM/DD HH:mm:ss""); @@ -78,7 +81,7 @@ const Explore = () => { ); })}
- )} +
);",chore,update explore page style 66f9bc48bb765fb51361a329a97f6158998d9c59,2022-11-15 18:52:08,boojack,chore: remove mark memo (#476),False,"diff --git a/web/src/components/Memo.tsx b/web/src/components/Memo.tsx index 969142d613534..25f05bc10783d 100644 --- a/web/src/components/Memo.tsx +++ b/web/src/components/Memo.tsx @@ -5,7 +5,6 @@ import { memo, useEffect, useRef, useState } from ""react""; import { useTranslation } from ""react-i18next""; import { useNavigate } from ""react-router-dom""; import ""dayjs/locale/zh""; -import { UNKNOWN_ID } from ""../helpers/consts""; import { editorStateService, locationService, memoService, userService } from ""../services""; import Icon from ""./Icon""; import toastHelper from ""./Toast""; @@ -71,10 +70,6 @@ const Memo: React.FC = (props: Props) => { } }; - const handleMarkMemoClick = () => { - editorStateService.setMarkMemoWithId(memo.id); - }; - const handleEditMemoClick = () => { editorStateService.setEditMemoWithId(memo.id); }; @@ -102,17 +97,7 @@ const Memo: React.FC = (props: Props) => { const handleMemoContentClick = async (e: React.MouseEvent) => { const targetEl = e.target as HTMLElement; - if (targetEl.className === ""memo-link-text"") { - const memoId = targetEl.dataset?.value; - const memoTemp = await memoService.getMemoById(Number(memoId) ?? UNKNOWN_ID); - - if (memoTemp) { - navigate(`/m/${memoTemp.id}`); - } else { - toastHelper.error(t(""message.memo-not-found"")); - targetEl.classList.remove(""memo-link-text""); - } - } else if (targetEl.className === ""tag-span"") { + if (targetEl.className === ""tag-span"") { const tagName = targetEl.innerText.slice(1); const currTagQuery = locationService.getState().query?.tag; if (currTagQuery === tagName) { @@ -231,9 +216,6 @@ const Memo: React.FC = (props: Props) => { {t(""common.share"")}
- - {t(""common.mark"")} - {t(""memo.copy"")} diff --git a/web/src/components/MemoEditor.tsx b/web/src/components/MemoEditor.tsx index 93c19ad5cfbfd..6c547c917dd4b 100644 --- a/web/src/components/MemoEditor.tsx +++ b/web/src/components/MemoEditor.tsx @@ -73,15 +73,6 @@ const MemoEditor = () => { } }, []); - useEffect(() => { - if (editorState.markMemoId && editorState.markMemoId !== UNKNOWN_ID) { - const editorCurrentValue = editorRef.current?.getContent(); - const memoLinkText = `${editorCurrentValue ? ""\n"" : """"}Mark: @[MEMO](${editorState.markMemoId})`; - editorRef.current?.insertText(memoLinkText); - editorStateService.clearMarkMemo(); - } - }, [editorState.markMemoId]); - useEffect(() => { if (editorState.editMemoId) { memoService.getMemoById(editorState.editMemoId ?? UNKNOWN_ID).then((memo) => { diff --git a/web/src/labs/marked/parser/Mark.ts b/web/src/labs/marked/parser/Mark.ts deleted file mode 100644 index 3b30ce23537fa..0000000000000 --- a/web/src/labs/marked/parser/Mark.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { escape } from ""lodash-es""; - -export const MARK_REG = /@\[(.+?)\]\((\S+?)\)/; - -const renderer = (rawStr: string): string => { - const matchResult = rawStr.match(MARK_REG); - if (!matchResult) { - return rawStr; - } - - return `${escape(matchResult[1])}`; -}; - -export default { - name: ""mark"", - regex: MARK_REG, - renderer, -}; diff --git a/web/src/labs/marked/parser/index.ts b/web/src/labs/marked/parser/index.ts index 9d5eb97d13b45..04e2684b5d43b 100644 --- a/web/src/labs/marked/parser/index.ts +++ b/web/src/labs/marked/parser/index.ts @@ -7,7 +7,6 @@ import Paragraph from ""./Paragraph""; import Tag from ""./Tag""; import Image from ""./Image""; import Link from ""./Link""; -import Mark from ""./Mark""; import Bold from ""./Bold""; import Emphasis from ""./Emphasis""; import PlainLink from ""./PlainLink""; @@ -23,10 +22,9 @@ export { DONE_LIST_REG } from ""./DoneList""; export { TAG_REG } from ""./Tag""; export { IMAGE_REG } from ""./Image""; export { LINK_REG } from ""./Link""; -export { MARK_REG } from ""./Mark""; export { TABLE_REG } from ""./Table""; // The order determines the order of execution. export const blockElementParserList = [Table, CodeBlock, Blockquote, TodoList, DoneList, OrderedList, UnorderedList, Paragraph]; -export const inlineElementParserList = [Image, Mark, BoldEmphasis, Bold, Emphasis, Link, InlineCode, PlainLink, Tag, PlainText]; +export const inlineElementParserList = [Image, BoldEmphasis, Bold, Emphasis, Link, InlineCode, PlainLink, Tag, PlainText]; export const parserList = [...blockElementParserList, ...inlineElementParserList]; diff --git a/web/src/locales/en.json b/web/src/locales/en.json index bf4a0b4647150..255353d0e10c5 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -22,7 +22,6 @@ ""delete"": ""Delete"", ""null"": ""Null"", ""share"": ""Share"", - ""mark"": ""Mark"", ""archive"": ""Archive"", ""basic"": ""Basic"", ""admin"": ""Admin"", diff --git a/web/src/locales/vi.json b/web/src/locales/vi.json index 17e75f7773d8f..1b2ce25a2acf7 100644 --- a/web/src/locales/vi.json +++ b/web/src/locales/vi.json @@ -22,7 +22,6 @@ ""delete"": ""Xóa"", ""null"": ""Null"", ""share"": ""Chia sẻ"", - ""mark"": ""Đánh dấu"", ""archive"": ""Lưu trữ"", ""basic"": ""Cơ bản"", ""admin"": ""Admin"", diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index a70e864afc4fb..6bdc2688eb7e1 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -22,7 +22,6 @@ ""delete"": ""删除"", ""null"": ""空"", ""share"": ""分享"", - ""mark"": ""标注"", ""archive"": ""归档"", ""basic"": ""基础"", ""admin"": ""管理员"", diff --git a/web/src/services/editorStateService.ts b/web/src/services/editorStateService.ts index 110010fd30726..fe11a812485e3 100644 --- a/web/src/services/editorStateService.ts +++ b/web/src/services/editorStateService.ts @@ -1,5 +1,5 @@ import store from ""../store""; -import { setEditMemoId, setMarkMemoId, setMemoVisibility } from ""../store/modules/editor""; +import { setEditMemoId, setMemoVisibility } from ""../store/modules/editor""; const editorStateService = { getState: () => { @@ -14,14 +14,6 @@ const editorStateService = { store.dispatch(setEditMemoId()); }, - setMarkMemoWithId: (markMemoId: MemoId) => { - store.dispatch(setMarkMemoId(markMemoId)); - }, - - clearMarkMemo: () => { - store.dispatch(setMarkMemoId()); - }, - setMemoVisibility: (memoVisibility: Visibility) => { store.dispatch(setMemoVisibility(memoVisibility)); }, diff --git a/web/src/store/modules/editor.ts b/web/src/store/modules/editor.ts index 15f8654be84e3..e88f823a2718b 100644 --- a/web/src/store/modules/editor.ts +++ b/web/src/store/modules/editor.ts @@ -1,7 +1,6 @@ import { createSlice, PayloadAction } from ""@reduxjs/toolkit""; interface State { - markMemoId?: MemoId; editMemoId?: MemoId; memoVisibility: Visibility; } @@ -10,12 +9,6 @@ const editorSlice = createSlice({ name: ""editor"", initialState: {} as State, reducers: { - setMarkMemoId: (state, action: PayloadAction>) => { - return { - ...state, - markMemoId: action.payload, - }; - }, setEditMemoId: (state, action: PayloadAction>) => { return { ...state, @@ -31,6 +24,6 @@ const editorSlice = createSlice({ }, }); -export const { setEditMemoId, setMarkMemoId, setMemoVisibility } = editorSlice.actions; +export const { setEditMemoId, setMemoVisibility } = editorSlice.actions; export default editorSlice.reducer;",chore,remove mark memo (#476) c5a5f67fdb6944e49850aed6b04d5f3c33245dd4,2024-01-29 20:42:02,Steven,refactor: migrate auth service,False,"diff --git a/api/v2/acl_config.go b/api/v2/acl_config.go index 72f7240ae1089..7bb54422e6d54 100644 --- a/api/v2/acl_config.go +++ b/api/v2/acl_config.go @@ -5,6 +5,10 @@ import ""strings"" var authenticationAllowlistMethods = map[string]bool{ ""/memos.api.v2.WorkspaceService/GetWorkspaceProfile"": true, ""/memos.api.v2.AuthService/GetAuthStatus"": true, + ""/memos.api.v2.AuthService/SignIn"": true, + ""/memos.api.v2.AuthService/SignInWithSSO"": true, + ""/memos.api.v2.AuthService/SignOut"": true, + ""/memos.api.v2.AuthService/SignUp"": true, ""/memos.api.v2.UserService/GetUser"": true, ""/memos.api.v2.MemoService/ListMemos"": true, ""/memos.api.v2.MemoService/GetMemo"": true, diff --git a/api/v2/apidocs.swagger.yaml b/api/v2/apidocs.swagger.yaml index a1630073e0c4e..1cd0b12869e92 100644 --- a/api/v2/apidocs.swagger.yaml +++ b/api/v2/apidocs.swagger.yaml @@ -40,6 +40,10 @@ paths: in: query required: false type: string + - name: neverExpire + in: query + required: false + type: boolean tags: - AuthService /api/v2/auth/signin/sso: diff --git a/api/v2/auth_service.go b/api/v2/auth_service.go index 98b96e9747a5d..35cd01c934b97 100644 --- a/api/v2/auth_service.go +++ b/api/v2/auth_service.go @@ -3,15 +3,25 @@ package v2 import ( ""context"" ""fmt"" + ""regexp"" + ""time"" ""github.com/pkg/errors"" + ""golang.org/x/crypto/bcrypt"" ""google.golang.org/grpc"" ""google.golang.org/grpc/codes"" ""google.golang.org/grpc/metadata"" ""google.golang.org/grpc/status"" + ""google.golang.org/protobuf/proto"" ""github.com/usememos/memos/api/auth"" + ""github.com/usememos/memos/internal/util"" + ""github.com/usememos/memos/plugin/idp"" + ""github.com/usememos/memos/plugin/idp/oauth2"" apiv2pb ""github.com/usememos/memos/proto/gen/api/v2"" + storepb ""github.com/usememos/memos/proto/gen/store"" + ""github.com/usememos/memos/server/service/metric"" + ""github.com/usememos/memos/store"" ) func (s *APIV2Service) GetAuthStatus(ctx context.Context, _ *apiv2pb.GetAuthStatusRequest) (*apiv2pb.GetAuthStatusResponse, error) { @@ -31,6 +41,190 @@ func (s *APIV2Service) GetAuthStatus(ctx context.Context, _ *apiv2pb.GetAuthStat }, nil } +func (s *APIV2Service) SignIn(ctx context.Context, request *apiv2pb.SignInRequest) (*apiv2pb.SignInResponse, error) { + user, err := s.Store.GetUser(ctx, &store.FindUser{ + Username: &request.Username, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to find user by username %s"", request.Username)) + } + if user == nil { + return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf(""user not found with username %s"", request.Username)) + } else if user.RowStatus == store.Archived { + return nil, status.Errorf(codes.PermissionDenied, fmt.Sprintf(""user has been archived with username %s"", request.Username)) + } + + // Compare the stored hashed password, with the hashed version of the password that was received. + if err := bcrypt.CompareHashAndPassword([]byte(user.PasswordHash), []byte(request.Password)); err != nil { + return nil, status.Errorf(codes.InvalidArgument, ""unmatched email and password"") + } + + expireTime := time.Now().Add(auth.AccessTokenDuration) + if request.NeverExpire { + // Zero time means never expire. + expireTime = time.Time{} + } + if err := s.doSignIn(ctx, user, expireTime); err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to sign in, err: %s"", err)) + } + return &apiv2pb.SignInResponse{ + User: convertUserFromStore(user), + }, nil +} + +func (s *APIV2Service) SignInWithSSO(ctx context.Context, request *apiv2pb.SignInWithSSORequest) (*apiv2pb.SignInWithSSOResponse, error) { + identityProvider, err := s.Store.GetIdentityProvider(ctx, &store.FindIdentityProvider{ + ID: &request.IdpId, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to get identity provider, err: %s"", err)) + } + if identityProvider == nil { + return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf(""identity provider not found with id %d"", request.IdpId)) + } + + var userInfo *idp.IdentityProviderUserInfo + if identityProvider.Type == store.IdentityProviderOAuth2Type { + oauth2IdentityProvider, err := oauth2.NewIdentityProvider(identityProvider.Config.OAuth2Config) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to create oauth2 identity provider, err: %s"", err)) + } + token, err := oauth2IdentityProvider.ExchangeToken(ctx, request.RedirectUri, request.Code) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to exchange token, err: %s"", err)) + } + userInfo, err = oauth2IdentityProvider.UserInfo(token) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to get user info, err: %s"", err)) + } + } + + identifierFilter := identityProvider.IdentifierFilter + if identifierFilter != """" { + identifierFilterRegex, err := regexp.Compile(identifierFilter) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to compile identifier filter regex, err: %s"", err)) + } + if !identifierFilterRegex.MatchString(userInfo.Identifier) { + return nil, status.Errorf(codes.PermissionDenied, fmt.Sprintf(""identifier %s is not allowed"", userInfo.Identifier)) + } + } + + user, err := s.Store.GetUser(ctx, &store.FindUser{ + Username: &userInfo.Identifier, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to find user by username %s"", userInfo.Identifier)) + } + if user == nil { + userCreate := &store.User{ + Username: userInfo.Identifier, + // The new signup user should be normal user by default. + Role: store.RoleUser, + Nickname: userInfo.DisplayName, + Email: userInfo.Email, + } + password, err := util.RandomString(20) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to generate random password, err: %s"", err)) + } + passwordHash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to generate password hash, err: %s"", err)) + } + userCreate.PasswordHash = string(passwordHash) + user, err = s.Store.CreateUser(ctx, userCreate) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to create user, err: %s"", err)) + } + } + if user.RowStatus == store.Archived { + return nil, status.Errorf(codes.PermissionDenied, fmt.Sprintf(""user has been archived with username %s"", userInfo.Identifier)) + } + + if err := s.doSignIn(ctx, user, time.Now().Add(auth.AccessTokenDuration)); err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to sign in, err: %s"", err)) + } + return &apiv2pb.SignInWithSSOResponse{ + User: convertUserFromStore(user), + }, nil +} + +func (s *APIV2Service) doSignIn(ctx context.Context, user *store.User, expireTime time.Time) error { + accessToken, err := auth.GenerateAccessToken(user.Email, user.ID, expireTime, []byte(s.Secret)) + if err != nil { + return status.Errorf(codes.Internal, fmt.Sprintf(""failed to generate tokens, err: %s"", err)) + } + if err := s.UpsertAccessTokenToStore(ctx, user, accessToken, ""user login""); err != nil { + return status.Errorf(codes.Internal, fmt.Sprintf(""failed to upsert access token to store, err: %s"", err)) + } + + cookieExpires := time.Now().Add(auth.CookieExpDuration) + if expireTime.IsZero() { + // Set cookie expires to 100 years. + cookieExpires = time.Now().AddDate(100, 0, 0) + } + if err := grpc.SetHeader(ctx, metadata.New(map[string]string{ + ""Set-Cookie"": fmt.Sprintf(""%s=%s; Path=/; Expires=%s; HttpOnly; SameSite=Strict"", auth.AccessTokenCookieName, accessToken, cookieExpires.Format(time.RFC1123)), + })); err != nil { + return status.Errorf(codes.Internal, ""failed to set grpc header, error: %v"", err) + } + + metric.Enqueue(""user sign in"") + return nil +} + +func (s *APIV2Service) SignUp(ctx context.Context, request *apiv2pb.SignUpRequest) (*apiv2pb.SignUpResponse, error) { + workspaceGeneralSetting, err := s.GetWorkspaceGeneralSetting(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to get workspace setting, err: %s"", err)) + } + if workspaceGeneralSetting.DisallowSignup { + return nil, status.Errorf(codes.PermissionDenied, ""sign up is not allowed"") + } + + passwordHash, err := bcrypt.GenerateFromPassword([]byte(request.Password), bcrypt.DefaultCost) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to generate password hash, err: %s"", err)) + } + + create := &store.User{ + Username: request.Username, + Nickname: request.Username, + PasswordHash: string(passwordHash), + } + existingUsers, err := s.Store.ListUsers(ctx, &store.FindUser{}) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to list users, err: %s"", err)) + } + // The first user to sign up is an admin by default. + if len(existingUsers) == 0 { + create.Role = store.RoleAdmin + } else { + create.Role = store.RoleUser + } + + user, err := s.Store.CreateUser(ctx, create) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to create user, err: %s"", err)) + } + + if err := s.doSignIn(ctx, user, time.Now().Add(auth.AccessTokenDuration)); err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to sign in, err: %s"", err)) + } + metric.Enqueue(""user sign up"") + return &apiv2pb.SignUpResponse{ + User: convertUserFromStore(user), + }, nil +} + +func (*APIV2Service) SignOut(ctx context.Context, _ *apiv2pb.SignOutRequest) (*apiv2pb.SignOutResponse, error) { + if err := clearAccessTokenCookie(ctx); err != nil { + return nil, status.Errorf(codes.Internal, ""failed to set grpc header, error: %v"", err) + } + return &apiv2pb.SignOutResponse{}, nil +} + func clearAccessTokenCookie(ctx context.Context) error { if err := grpc.SetHeader(ctx, metadata.New(map[string]string{ ""Set-Cookie"": fmt.Sprintf(""%s=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; SameSite=Strict"", auth.AccessTokenCookieName), @@ -39,3 +233,19 @@ func clearAccessTokenCookie(ctx context.Context) error { } return nil } + +func (s *APIV2Service) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.WorkspaceGeneralSetting, error) { + workspaceSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ + Name: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL.String(), + }) + if err != nil { + return nil, errors.Wrap(err, ""failed to get workspace setting"") + } + workspaceGeneralSetting := &storepb.WorkspaceGeneralSetting{} + if workspaceSetting != nil { + if err := proto.Unmarshal([]byte(workspaceSetting.Value), workspaceGeneralSetting); err != nil { + return nil, errors.Wrap(err, ""failed to unmarshal workspace setting"") + } + } + return workspaceGeneralSetting, nil +} diff --git a/proto/api/v2/auth_service.proto b/proto/api/v2/auth_service.proto index e3f6443aa6ee6..7dbc898190cb3 100644 --- a/proto/api/v2/auth_service.proto +++ b/proto/api/v2/auth_service.proto @@ -39,6 +39,7 @@ message GetAuthStatusResponse { message SignInRequest { string username = 1; string password = 2; + bool never_expire = 3; } message SignInResponse { diff --git a/proto/gen/api/v2/README.md b/proto/gen/api/v2/README.md index 028790bc5920b..05f1bfc9628eb 100644 --- a/proto/gen/api/v2/README.md +++ b/proto/gen/api/v2/README.md @@ -823,6 +823,7 @@ Used internally for obfuscating the page token. | ----- | ---- | ----- | ----------- | | username | [string](#string) | | | | password | [string](#string) | | | +| never_expire | [bool](#bool) | | | diff --git a/proto/gen/api/v2/auth_service.pb.go b/proto/gen/api/v2/auth_service.pb.go index c2e054cdf39b1..cc274573180d0 100644 --- a/proto/gen/api/v2/auth_service.pb.go +++ b/proto/gen/api/v2/auth_service.pb.go @@ -111,8 +111,9 @@ type SignInRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Username string `protobuf:""bytes,1,opt,name=username,proto3"" json:""username,omitempty""` - Password string `protobuf:""bytes,2,opt,name=password,proto3"" json:""password,omitempty""` + Username string `protobuf:""bytes,1,opt,name=username,proto3"" json:""username,omitempty""` + Password string `protobuf:""bytes,2,opt,name=password,proto3"" json:""password,omitempty""` + NeverExpire bool `protobuf:""varint,3,opt,name=never_expire,json=neverExpire,proto3"" json:""never_expire,omitempty""` } func (x *SignInRequest) Reset() { @@ -161,6 +162,13 @@ func (x *SignInRequest) GetPassword() string { return """" } +func (x *SignInRequest) GetNeverExpire() bool { + if x != nil { + return x.NeverExpire + } + return false +} + type SignInResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -510,82 +518,84 @@ var file_api_v2_auth_service_proto_rawDesc = []byte{ 0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x47, 0x0a, 0x0d, 0x53, + 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x6a, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, - 0x77, 0x6f, 0x72, 0x64, 0x22, 0x38, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x64, - 0x0a, 0x14, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x53, 0x53, 0x4f, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x69, 0x64, 0x70, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x64, 0x70, 0x49, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, - 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, - 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x55, 0x72, 0x69, 0x22, 0x3f, 0x0a, 0x15, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x57, 0x69, - 0x74, 0x68, 0x53, 0x53, 0x4f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, - 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, - 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x47, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x38, - 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x77, 0x6f, 0x72, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x65, 0x76, 0x65, 0x72, 0x5f, 0x65, 0x78, + 0x70, 0x69, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6e, 0x65, 0x76, 0x65, + 0x72, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x22, 0x38, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x49, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, + 0x72, 0x22, 0x64, 0x0a, 0x14, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x53, + 0x53, 0x4f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x69, 0x64, 0x70, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x64, 0x70, 0x49, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x63, 0x6f, 0x64, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x5f, 0x75, 0x72, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x55, 0x72, 0x69, 0x22, 0x3f, 0x0a, 0x15, 0x53, 0x69, 0x67, 0x6e, 0x49, + 0x6e, 0x57, 0x69, 0x74, 0x68, 0x53, 0x53, 0x4f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, - 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x11, 0x0a, 0x0f, 0x53, 0x69, - 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xa9, 0x04, - 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x75, 0x0a, - 0x0d, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x22, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, - 0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, - 0x13, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x60, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x12, 0x1b, + 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x47, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, + 0x55, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x22, 0x38, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x10, 0x0a, 0x0e, 0x53, + 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x11, 0x0a, + 0x0f, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x32, 0xa9, 0x04, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x75, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x15, 0x22, 0x13, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x74, 0x68, + 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x60, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x49, + 0x6e, 0x12, 0x1b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x15, 0x22, 0x13, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, - 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x12, 0x79, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, - 0x57, 0x69, 0x74, 0x68, 0x53, 0x53, 0x4f, 0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x57, 0x69, 0x74, - 0x68, 0x53, 0x53, 0x4f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, - 0x6e, 0x57, 0x69, 0x74, 0x68, 0x53, 0x53, 0x4f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x17, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x32, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x2f, 0x73, 0x73, - 0x6f, 0x12, 0x60, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x12, 0x1b, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x55, - 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, 0x13, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73, 0x69, 0x67, - 0x6e, 0x75, 0x70, 0x12, 0x64, 0x0a, 0x07, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x12, 0x1c, + 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x15, 0x22, 0x13, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, + 0x74, 0x68, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x12, 0x79, 0x0a, 0x0d, 0x53, 0x69, 0x67, + 0x6e, 0x49, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x53, 0x53, 0x4f, 0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, + 0x57, 0x69, 0x74, 0x68, 0x53, 0x53, 0x4f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, - 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x16, 0x22, 0x14, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x74, - 0x68, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x6f, 0x75, 0x74, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, - 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x10, - 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, - 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, - 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, - 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, - 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, - 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x6e, 0x49, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x53, 0x53, 0x4f, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x17, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, + 0x2f, 0x73, 0x73, 0x6f, 0x12, 0x60, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x12, 0x1b, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x55, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x55, + 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x15, 0x22, 0x13, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, + 0x73, 0x69, 0x67, 0x6e, 0x75, 0x70, 0x12, 0x64, 0x0a, 0x07, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, + 0x74, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, 0x14, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, + 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x6f, 0x75, 0x74, 0x42, 0xa8, 0x01, 0x0a, + 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x42, 0x10, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, + 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, + 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, + 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, + 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/web/src/components/UserBanner.tsx b/web/src/components/UserBanner.tsx index 5686e2ea25551..cb1cc7acd1cb5 100644 --- a/web/src/components/UserBanner.tsx +++ b/web/src/components/UserBanner.tsx @@ -1,6 +1,6 @@ import { Dropdown, Menu, MenuButton, MenuItem } from ""@mui/joy""; import classNames from ""classnames""; -import * as api from ""@/helpers/api""; +import { authServiceClient } from ""@/grpcweb""; import useCurrentUser from ""@/hooks/useCurrentUser""; import { useGlobalStore } from ""@/store/module""; import { useTranslate } from ""@/utils/i18n""; @@ -21,7 +21,7 @@ const UserBanner = (props: Props) => { const avatarUrl = user ? user.avatarUrl : systemStatus.customizedProfile.logoUrl; const handleSignOut = async () => { - await api.signout(); + await authServiceClient.signOut({}); window.location.href = ""/auth""; }; diff --git a/web/src/helpers/api.ts b/web/src/helpers/api.ts index 2083b2f6b0194..6fa1bf85c22a1 100644 --- a/web/src/helpers/api.ts +++ b/web/src/helpers/api.ts @@ -13,33 +13,6 @@ export function upsertSystemSetting(systemSetting: SystemSetting) { return axios.post(""/api/v1/system/setting"", systemSetting); } -export function signin(username: string, password: string, remember: boolean) { - return axios.post(""/api/v1/auth/signin"", { - username, - password, - remember, - }); -} - -export function signinWithSSO(identityProviderId: IdentityProviderId, code: string, redirectUri: string) { - return axios.post(""/api/v1/auth/signin/sso"", { - identityProviderId, - code, - redirectUri, - }); -} - -export function signup(username: string, password: string) { - return axios.post(""/api/v1/auth/signup"", { - username, - password, - }); -} - -export function signout() { - return axios.post(""/api/v1/auth/signout""); -} - export function createResourceWithBlob(formData: FormData) { return axios.post(""/api/v1/resource/blob"", formData); } diff --git a/web/src/pages/AuthCallback.tsx b/web/src/pages/AuthCallback.tsx index 04f5c1009c9d9..c4756bca0efce 100644 --- a/web/src/pages/AuthCallback.tsx +++ b/web/src/pages/AuthCallback.tsx @@ -3,7 +3,7 @@ import { useEffect, useState } from ""react""; import { toast } from ""react-hot-toast""; import { useSearchParams } from ""react-router-dom""; import Icon from ""@/components/Icon""; -import * as api from ""@/helpers/api""; +import { authServiceClient } from ""@/grpcweb""; import { absolutifyLink } from ""@/helpers/utils""; import useNavigateTo from ""@/hooks/useNavigateTo""; import { useUserStore } from ""@/store/v1""; @@ -32,9 +32,13 @@ const AuthCallback = () => { const redirectUri = absolutifyLink(""/auth/callback""); const identityProviderId = Number(last(state.split(""-""))); if (identityProviderId) { - api - .signinWithSSO(identityProviderId, code, redirectUri) - .then(async ({ data: user }) => { + authServiceClient + .signInWithSSO({ + idpId: identityProviderId, + code, + redirectUri, + }) + .then(async ({ user }) => { setState({ loading: false, errorMessage: """", diff --git a/web/src/pages/SignIn.tsx b/web/src/pages/SignIn.tsx index 04b8c70e6c1a0..4372ef2e30733 100644 --- a/web/src/pages/SignIn.tsx +++ b/web/src/pages/SignIn.tsx @@ -4,6 +4,7 @@ import { toast } from ""react-hot-toast""; import { Link } from ""react-router-dom""; import AppearanceSelect from ""@/components/AppearanceSelect""; import LocaleSelect from ""@/components/LocaleSelect""; +import { authServiceClient } from ""@/grpcweb""; import * as api from ""@/helpers/api""; import { absolutifyLink } from ""@/helpers/utils""; import useLoading from ""@/hooks/useLoading""; @@ -75,7 +76,7 @@ const SignIn = () => { try { actionBtnLoadingState.setLoading(); - const { data: user } = await api.signin(username, password, remember); + const { user } = await authServiceClient.signIn({ username, password, neverExpire: remember }); if (user) { await userStore.fetchCurrentUser(); navigateTo(""/""); diff --git a/web/src/pages/SignUp.tsx b/web/src/pages/SignUp.tsx index 96b6e90fce99b..2b665716b5fac 100644 --- a/web/src/pages/SignUp.tsx +++ b/web/src/pages/SignUp.tsx @@ -4,7 +4,7 @@ import { toast } from ""react-hot-toast""; import { Link } from ""react-router-dom""; import AppearanceSelect from ""@/components/AppearanceSelect""; import LocaleSelect from ""@/components/LocaleSelect""; -import * as api from ""@/helpers/api""; +import { authServiceClient } from ""@/grpcweb""; import useLoading from ""@/hooks/useLoading""; import useNavigateTo from ""@/hooks/useNavigateTo""; import { useGlobalStore } from ""@/store/module""; @@ -55,7 +55,7 @@ const SignUp = () => { try { actionBtnLoadingState.setLoading(); - const { data: user } = await api.signup(username, password); + const { user } = await authServiceClient.signUp({ username, password }); if (user) { await userStore.fetchCurrentUser(); navigateTo(""/"");",refactor,migrate auth service 97ef5a8871c94b282bb558e2d6b853a5f33dd115,2024-11-27 11:30:50,KidLoveToPlay,chore: apply styles to the correct month (#4151),False,"diff --git a/web/src/components/ActivityCalendar.tsx b/web/src/components/ActivityCalendar.tsx index b41810bd3f38d..dd4e0b7ba1337 100644 --- a/web/src/components/ActivityCalendar.tsx +++ b/web/src/components/ActivityCalendar.tsx @@ -84,9 +84,10 @@ const ActivityCalendar = (props: Props) => { ""w-6 h-6 text-xs rounded-xl flex justify-center items-center border cursor-default"", ""text-gray-400"", item.isCurrentMonth ? getCellAdditionalStyles(count, maxCount) : ""opacity-60"", - isToday && ""border-zinc-400"", - isSelected && ""font-bold border-zinc-400"", - !isToday && !isSelected && ""border-transparent"", + item.isCurrentMonth && isToday && ""border-zinc-400"", + item.isCurrentMonth && isSelected && ""bg-success font-bold"", + item.isCurrentMonth && !isToday && !isSelected && ""border-transparent"", + !item.isCurrentMonth && ""border-transparent"", )} onClick={() => count && onClick && onClick(date)} >",chore,apply styles to the correct month (#4151) e0290b94b40e731dec079a6455fb47e17a1fea8f,2023-12-14 20:03:20,Steven,chore: use gomark in rss api,False,"diff --git a/api/v1/rss.go b/api/v1/rss.go index 32cddd5818b4f..490f3b41a9375 100644 --- a/api/v1/rss.go +++ b/api/v1/rss.go @@ -1,7 +1,6 @@ package v1 import ( - ""bytes"" ""context"" ""encoding/json"" ""fmt"" @@ -12,9 +11,11 @@ import ( ""github.com/gorilla/feeds"" ""github.com/labstack/echo/v4"" - ""github.com/yuin/goldmark"" ""github.com/usememos/memos/internal/util"" + ""github.com/usememos/memos/plugin/gomark/parser"" + ""github.com/usememos/memos/plugin/gomark/parser/tokenizer"" + ""github.com/usememos/memos/plugin/gomark/render/html"" ""github.com/usememos/memos/store"" ) @@ -117,10 +118,14 @@ func (s *APIV1Service) generateRSSFromMemoList(ctx context.Context, memoList []* if err != nil { return """", err } + description, err := getRSSItemDescription(memoMessage.Content) + if err != nil { + return """", err + } feed.Items[i] = &feeds.Item{ Title: getRSSItemTitle(memoMessage.Content), Link: &feeds.Link{Href: baseURL + ""/m/"" + fmt.Sprintf(""%d"", memoMessage.ID)}, - Description: getRSSItemDescription(memoMessage.Content), + Description: description, Created: time.Unix(memoMessage.CreatedTs, 0), Enclosure: &feeds.Enclosure{Url: baseURL + ""/m/"" + fmt.Sprintf(""%d"", memoMessage.ID) + ""/image""}, } @@ -182,7 +187,7 @@ func getRSSItemTitle(content string) string { return title } -func getRSSItemDescription(content string) string { +func getRSSItemDescription(content string) (string, error) { var description string if isTitleDefined(content) { var firstLineEnd = strings.Index(content, ""\n"") @@ -191,12 +196,13 @@ func getRSSItemDescription(content string) string { description = content } - // TODO: use our `./plugin/gomark` parser to handle markdown-like content. - var buf bytes.Buffer - if err := goldmark.Convert([]byte(description), &buf); err != nil { - panic(err) + tokens := tokenizer.Tokenize(description) + nodes, err := parser.Parse(tokens) + if err != nil { + return """", err } - return buf.String() + result := html.NewHTMLRender().Render(nodes) + return result, nil } func isTitleDefined(content string) bool { diff --git a/go.mod b/go.mod index 5fcb25fd3b859..2498521729e1d 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,6 @@ require ( github.com/stretchr/testify v1.8.4 github.com/swaggo/echo-swagger v1.4.1 github.com/swaggo/swag v1.16.2 - github.com/yuin/goldmark v1.6.0 go.uber.org/zap v1.26.0 golang.org/x/crypto v0.16.0 golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb diff --git a/go.sum b/go.sum index e942d03cafd34..7605752bda8a2 100644 --- a/go.sum +++ b/go.sum @@ -486,8 +486,6 @@ github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQ github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.6.0 h1:boZcn2GTjpsynOsC0iJHnBWa4Bi0qzfJjthwauItG68= -github.com/yuin/goldmark v1.6.0/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=",chore,use gomark in rss api d264f459797b88ca876ff715be3c3b99cf99175f,2024-07-19 06:02:58,andrigamerita,fix: code blocks of unknown languages cause HTML injection (#3711),False,"diff --git a/web/src/components/MemoContent/CodeBlock.tsx b/web/src/components/MemoContent/CodeBlock.tsx index e96838eb890f7..d9177a5d2c48a 100644 --- a/web/src/components/MemoContent/CodeBlock.tsx +++ b/web/src/components/MemoContent/CodeBlock.tsx @@ -42,7 +42,10 @@ const CodeBlock: React.FC = ({ language, content }: Props) => { // Skip error and use default highlighted code. } - return content; + // escape any HTML entities when rendering original content + return Object.assign(document.createElement(""span""), { + textContent: content, + }).innerHTML; }, [formatedLanguage, content]); const handleCopyButtonClick = useCallback(() => {",fix,code blocks of unknown languages cause HTML injection (#3711) 3a5deefe111d04d94e8abd5cd4d66797df1501a6,2023-10-25 07:30:45,Athurg Gooth,chore: disable NPM update notice while running lint (#2438),False,"diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index 7830ec97ef1ba..5cc8de6288b02 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -60,7 +60,7 @@ services: profiles: [""tools""] image: node:18-alpine working_dir: /work - command: npm run lint + command: npm --no-update-notifier run lint volumes: - ./web:/work - ./.air/node_modules/:/work/node_modules/",chore,disable NPM update notice while running lint (#2438) e1977df14b100780aa45be4d45811bbcd0d09268,2024-01-26 18:53:36,Steven,chore: remove check underscores,False,"diff --git a/plugin/gomark/parser/bold.go b/plugin/gomark/parser/bold.go index 698fa5b82d857..401f217eac737 100644 --- a/plugin/gomark/parser/bold.go +++ b/plugin/gomark/parser/bold.go @@ -22,7 +22,7 @@ func (*BoldParser) Match(tokens []*tokenizer.Token) (ast.Node, int) { return nil, 0 } prefixTokenType := prefixTokens[0].Type - if prefixTokenType != tokenizer.Asterisk && prefixTokenType != tokenizer.Underscore { + if prefixTokenType != tokenizer.Asterisk { return nil, 0 } diff --git a/plugin/gomark/parser/bold_italic.go b/plugin/gomark/parser/bold_italic.go index b830588034b6d..d34d0ad28b5fa 100644 --- a/plugin/gomark/parser/bold_italic.go +++ b/plugin/gomark/parser/bold_italic.go @@ -21,7 +21,7 @@ func (*BoldItalicParser) Match(tokens []*tokenizer.Token) (ast.Node, int) { return nil, 0 } prefixTokenType := prefixTokens[0].Type - if prefixTokenType != tokenizer.Asterisk && prefixTokenType != tokenizer.Underscore { + if prefixTokenType != tokenizer.Asterisk { return nil, 0 } diff --git a/plugin/gomark/parser/horizontal_rule.go b/plugin/gomark/parser/horizontal_rule.go index 0edf4e3da2f8f..4a9c0e79f1a3b 100644 --- a/plugin/gomark/parser/horizontal_rule.go +++ b/plugin/gomark/parser/horizontal_rule.go @@ -22,7 +22,7 @@ func (*HorizontalRuleParser) Match(tokens []*tokenizer.Token) (ast.Node, int) { if matchedTokens[0].Type != matchedTokens[1].Type || matchedTokens[0].Type != matchedTokens[2].Type || matchedTokens[1].Type != matchedTokens[2].Type { return nil, 0 } - if matchedTokens[0].Type != tokenizer.Hyphen && matchedTokens[0].Type != tokenizer.Underscore && matchedTokens[0].Type != tokenizer.Asterisk { + if matchedTokens[0].Type != tokenizer.Hyphen && matchedTokens[0].Type != tokenizer.Asterisk { return nil, 0 } return &ast.HorizontalRule{ diff --git a/plugin/gomark/parser/horizontal_rule_test.go b/plugin/gomark/parser/horizontal_rule_test.go index dffc064ce5349..c2faa39da4c32 100644 --- a/plugin/gomark/parser/horizontal_rule_test.go +++ b/plugin/gomark/parser/horizontal_rule_test.go @@ -41,12 +41,6 @@ func TestHorizontalRuleParser(t *testing.T) { text: ""-*-"", horizontalRule: nil, }, - { - text: ""___"", - horizontalRule: &ast.HorizontalRule{ - Symbol: ""_"", - }, - }, } for _, test := range tests { diff --git a/plugin/gomark/parser/italic.go b/plugin/gomark/parser/italic.go index 3c93a8d00b93f..9b586c043cba2 100644 --- a/plugin/gomark/parser/italic.go +++ b/plugin/gomark/parser/italic.go @@ -20,7 +20,7 @@ func (*ItalicParser) Match(tokens []*tokenizer.Token) (ast.Node, int) { } prefixTokens := matchedTokens[:1] - if prefixTokens[0].Type != tokenizer.Asterisk && prefixTokens[0].Type != tokenizer.Underscore { + if prefixTokens[0].Type != tokenizer.Asterisk { return nil, 0 } prefixTokenType := prefixTokens[0].Type",chore,remove check underscores 526fbbba453f4e5151ff48fd44ad34121b5c0e4e,2023-03-29 16:29:51,CorrectRoadH,feat: empty selected resource when search resource (#1423),False,"diff --git a/web/src/pages/ResourcesDashboard.tsx b/web/src/pages/ResourcesDashboard.tsx index bdc63325a7453..7be16069bdbdf 100644 --- a/web/src/pages/ResourcesDashboard.tsx +++ b/web/src/pages/ResourcesDashboard.tsx @@ -150,6 +150,11 @@ const ResourcesDashboard = () => { toast.success(t(""message.succeed-copy-resource-link"")); }; + const handleSearchResourceInputChange = (query: string) => { + setQueryText(query); + setSelectedList([]); + }; + const resourceList = useMemo( () => resources @@ -233,7 +238,7 @@ const ResourcesDashboard = () => {

{t(""common.resources"")}

- +
{isVisible && (",feat,empty selected resource when search resource (#1423) 7776a6b7c66d42f6f454c1883b075bd69cb06b89,2023-04-25 19:57:02,Barry,docs: update readme with MemosGallery (#1590),False,"diff --git a/README.md b/README.md index 8bbc3dcc77c4c..a72bb7bf4b754 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Contributions are what make the open-source community such an amazing place to l - [Send to memos](https://sharecuts.cn/shortcut/12640) - A shortcut for iOS - [Memos Raycast Extension](https://www.raycast.com/JakeYu/memos) - Raycast extension - [Memos Desktop](https://github.com/xudaolong/memos-desktop) - Third party client for MacOS and Windows +- [MemosGallery](https://github.com/BarryYangi/MemosGallery) - A static Gallery rendered with the Memos API ## Acknowledgements",docs,update readme with MemosGallery (#1590) 49c7f4982036926e25b0565cda8e80249a26d0fc,2022-12-23 19:55:24,boojack,chore: add `linux/arm/v7` to platforms (#842),False,"diff --git a/.github/workflows/build-and-push-release-image.yml b/.github/workflows/build-and-push-release-image.yml index ae235067d7476..4fbb8895cd99d 100644 --- a/.github/workflows/build-and-push-release-image.yml +++ b/.github/workflows/build-and-push-release-image.yml @@ -39,6 +39,6 @@ jobs: with: context: ./ file: ./Dockerfile - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true tags: neosmemo/memos:latest, neosmemo/memos:${{ env.VERSION }}",chore,add `linux/arm/v7` to platforms (#842) 735cfda7683af4ff25a80d022d15d59341685373,2023-08-18 06:11:24,Maciej Kasprzyk,fix: tag suggestions positioning (#2151),False,"diff --git a/web/src/components/MemoEditor/Editor/TagSuggestions.tsx b/web/src/components/MemoEditor/Editor/TagSuggestions.tsx index 434c8db2815b1..d059e4f95f4e9 100644 --- a/web/src/components/MemoEditor/Editor/TagSuggestions.tsx +++ b/web/src/components/MemoEditor/Editor/TagSuggestions.tsx @@ -94,8 +94,8 @@ const TagSuggestions = ({ editorRef, editorActions }: Props) => { if (!isVisibleRef.current || !position) return null; return (
{suggestionsRef.current.map((tag, i) => (
.tag-list { @apply bottom-7; top: unset !important; @@ -22,6 +27,11 @@ } } + .tag-suggestions { + margin-left: -10px; + margin-top: 2px; + } + > .memo-editor { @apply mt-4 flex flex-col justify-start items-start relative w-full h-auto bg-inherit dark:text-gray-200; }",fix,tag suggestions positioning (#2151) bbc5ac9f0ea1f0bf7655a0dd719f6e85a708936a,2023-02-20 19:47:01,Yoshino-s,feat: make file uplaod support drag/drop (#1129),False,"diff --git a/web/src/components/CreateResourceDialog.tsx b/web/src/components/CreateResourceDialog.tsx index 6d5e36545588c..e3aba12770bfd 100644 --- a/web/src/components/CreateResourceDialog.tsx +++ b/web/src/components/CreateResourceDialog.tsx @@ -170,7 +170,7 @@ const CreateResourceDialog: React.FC = (props: Props) => { Choose a file... = (props: Props) => { )} - + {commentRelations.length} diff --git a/web/src/pages/MemoDetail.tsx b/web/src/pages/MemoDetail.tsx index 6891e358c3433..32ee194eaadd9 100644 --- a/web/src/pages/MemoDetail.tsx +++ b/web/src/pages/MemoDetail.tsx @@ -1,4 +1,4 @@ -import { Select, Tooltip, Option, IconButton, Divider } from ""@mui/joy""; +import { Select, Tooltip, Option, IconButton } from ""@mui/joy""; import copy from ""copy-to-clipboard""; import { useEffect, useState } from ""react""; import { toast } from ""react-hot-toast""; @@ -108,8 +108,8 @@ const MemoDetail = () => { return ( <> -
-
+
+

{systemStatus.customizedProfile.name}

@@ -186,16 +186,16 @@ const MemoDetail = () => {
{comments.length === 0 ? ( -
+

No comments

) : ( <> -
- +
+ Comments - ({comments.length}) + ({comments.length})
{comments.map((comment) => ( @@ -205,15 +205,12 @@ const MemoDetail = () => { {/* Only show comment editor when user login */} {currentUser && ( - <> - {comments.length === 0 && } - fetchMemoComments()} - /> - + fetchMemoComments()} + /> )}
",chore,update memo detail styles 9ed503fd6d3a550a10b460f079953f67e8e42671,2023-01-18 16:19:48,Zeng1998,feat: add qrcode in share dialog (#964),False,"diff --git a/web/package.json b/web/package.json index 42146993d4461..302ce87145e16 100644 --- a/web/package.json +++ b/web/package.json @@ -17,6 +17,7 @@ ""highlight.js"": ""^11.6.0"", ""i18next"": ""^21.9.2"", ""lodash-es"": ""^4.17.21"", + ""qrcode.react"": ""^3.1.0"", ""qs"": ""^6.11.0"", ""react"": ""^18.2.0"", ""react-dom"": ""^18.2.0"", diff --git a/web/src/components/ShareMemoDialog.tsx b/web/src/components/ShareMemoDialog.tsx index 6a08fa18bd401..2458bbc737263 100644 --- a/web/src/components/ShareMemoDialog.tsx +++ b/web/src/components/ShareMemoDialog.tsx @@ -1,4 +1,5 @@ import { Select, Option } from ""@mui/joy""; +import { QRCodeSVG } from ""qrcode.react""; import React, { useEffect, useRef, useState } from ""react""; import { useTranslation } from ""react-i18next""; import copy from ""copy-to-clipboard""; @@ -69,7 +70,6 @@ const ShareMemoDialog: React.FC = (props: Props) => { if (!memoElRef.current) { return; } - toImage(memoElRef.current, { pixelRatio: window.devicePixelRatio * 2, }) @@ -138,13 +138,23 @@ const ShareMemoDialog: React.FC = (props: Props) => {
+
+ +
{user.nickname || user.username} {state.memoAmount} MEMOS / {createdDays} DAYS
- +
diff --git a/web/src/less/share-memo-dialog.less b/web/src/less/share-memo-dialog.less index 641dccc0a29eb..f7c1be5d94d68 100644 --- a/web/src/less/share-memo-dialog.less +++ b/web/src/less/share-memo-dialog.less @@ -70,8 +70,12 @@ } } - > .logo-img { - @apply h-10 shrink-0 w-auto; + > .logo-container{ + @apply mr-2; + + > .logo-img { + @apply h-10 shrink-0 w-auto; + } } } } diff --git a/web/yarn.lock b/web/yarn.lock index fab74cd957cd3..17048e5345aca 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -3795,6 +3795,11 @@ punycode@^2.1.0: resolved ""https://registry.yarnpkg.com/punycode/-/punycode-2.2.0.tgz#2092cc57cd2582c38e4e7e8bb869dc8d3148bc74"" integrity sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw== +qrcode.react@^3.1.0: + version ""3.1.0"" + resolved ""https://registry.yarnpkg.com/qrcode.react/-/qrcode.react-3.1.0.tgz#5c91ddc0340f768316fbdb8fff2765134c2aecd8"" + integrity sha512-oyF+Urr3oAMUG/OiOuONL3HXM+53wvuH3mtIWQrYmsXoAq0DkvZp2RYUWFSMFtbdOpuS++9v+WAkzNVkMlNW6Q== + qs@^6.11.0: version ""6.11.0"" resolved ""https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a""",feat,add qrcode in share dialog (#964) ce2d37b90c64f9ab7cd47d144ae45b4b678934d7,2024-01-05 06:13:30,Steven,chore: fix find sibling node,False,"diff --git a/plugin/gomark/ast/utils.go b/plugin/gomark/ast/utils.go index 58e91e19b3212..a5a5fd55f3876 100644 --- a/plugin/gomark/ast/utils.go +++ b/plugin/gomark/ast/utils.go @@ -5,7 +5,7 @@ func FindPrevSiblingExceptLineBreak(node Node) Node { return nil } prev := node.PrevSibling() - if prev != nil && prev.Type() == LineBreakNode { + if prev != nil && prev.Type() == LineBreakNode && prev.PrevSibling() != nil && prev.PrevSibling().Type() != LineBreakNode { return FindPrevSiblingExceptLineBreak(prev) } return prev @@ -16,7 +16,7 @@ func FindNextSiblingExceptLineBreak(node Node) Node { return nil } next := node.NextSibling() - if next != nil && next.Type() == LineBreakNode { + if next != nil && next.Type() == LineBreakNode && next.NextSibling() != nil && next.NextSibling().Type() != LineBreakNode { return FindNextSiblingExceptLineBreak(next) } return next",chore,fix find sibling node 0711ac4ecbf935d0f2cdab0bc88ac9288d8084b2,2024-09-22 19:18:01,auphone,feat: allow mobile user zooming in image preview (#3880),False,"diff --git a/web/src/components/PreviewImageDialog.tsx b/web/src/components/PreviewImageDialog.tsx index 705bfc4f26d7b..1688400e4adf2 100644 --- a/web/src/components/PreviewImageDialog.tsx +++ b/web/src/components/PreviewImageDialog.tsx @@ -1,5 +1,5 @@ import { XIcon } from ""lucide-react""; -import React, { useState } from ""react""; +import React, { useEffect, useState } from ""react""; import { generateDialog } from ""./Dialog""; import ""@/less/preview-image-dialog.less""; @@ -31,7 +31,7 @@ const PreviewImageDialog: React.FC = ({ destroy, imgUrls, initialIndex }: let endX = -1; const handleCloseBtnClick = () => { - destroy(); + destroyAndResetViewport(); }; const handleTouchStart = (event: React.TouchEvent) => { @@ -73,7 +73,7 @@ const PreviewImageDialog: React.FC = ({ destroy, imgUrls, initialIndex }: setState(defaultState); setCurrentIndex(currentIndex - 1); } else { - destroy(); + destroyAndResetViewport(); } }; @@ -82,7 +82,7 @@ const PreviewImageDialog: React.FC = ({ destroy, imgUrls, initialIndex }: setState(defaultState); setCurrentIndex(currentIndex + 1); } else { - destroy(); + destroyAndResetViewport(); } }; @@ -107,11 +107,36 @@ const PreviewImageDialog: React.FC = ({ destroy, imgUrls, initialIndex }: }); }; + const setViewportScalable = () => { + const viewport = document.querySelector(""meta[name=viewport]""); + if (viewport) { + const contentAttrs = viewport.getAttribute(""content""); + if (contentAttrs) { + viewport.setAttribute(""content"", contentAttrs.replace(""user-scalable=no"", ""user-scalable=yes"")); + } + } + }; + + const destroyAndResetViewport = () => { + const viewport = document.querySelector(""meta[name=viewport]""); + if (viewport) { + const contentAttrs = viewport.getAttribute(""content""); + if (contentAttrs) { + viewport.setAttribute(""content"", contentAttrs.replace(""user-scalable=yes"", ""user-scalable=no"")); + } + } + destroy(); + }; + const imageComputedStyle = { transform: `scale(${state.scale})`, transformOrigin: `${state.originX === -1 ? ""center"" : `${state.originX}px`} ${state.originY === -1 ? ""center"" : `${state.originY}px`}`, }; + useEffect(() => { + setViewportScalable(); + }, []); + return ( <>
",feat,allow mobile user zooming in image preview (#3880) 158745704e867be1de2e20e1e40565b911ba72af,2024-08-02 22:52:40,Steven,feat: add memo display setting menu,False,"diff --git a/web/src/components/HomeSidebar/TagsSection.tsx b/web/src/components/HomeSidebar/TagsSection.tsx index 2e64dbbd75892..8411de151272f 100644 --- a/web/src/components/HomeSidebar/TagsSection.tsx +++ b/web/src/components/HomeSidebar/TagsSection.tsx @@ -68,7 +68,7 @@ const TagsSection = (props: Props) => { - +
Tree mode setTreeMode(event.target.checked)} /> diff --git a/web/src/components/MemoDisplaySettingMenu.tsx b/web/src/components/MemoDisplaySettingMenu.tsx new file mode 100644 index 0000000000000..97e242cea8277 --- /dev/null +++ b/web/src/components/MemoDisplaySettingMenu.tsx @@ -0,0 +1,43 @@ +import { Option, Select } from ""@mui/joy""; +import clsx from ""clsx""; +import { useMemoFilterStore } from ""@/store/v1""; +import Icon from ""./Icon""; +import { Popover, PopoverContent, PopoverTrigger } from ""./ui/Popover""; + +interface Props { + className?: string; +} + +const MemoDisplaySettingMenu = ({ className }: Props) => { + const memoFilterStore = useMemoFilterStore(); + const isApplying = Boolean(memoFilterStore.orderByTimeAsc) !== false; + + return ( + + + + + +
+
+ Order by + +
+
+ Direction + +
+
+
+
+ ); +}; + +export default MemoDisplaySettingMenu; diff --git a/web/src/components/MemoFilters.tsx b/web/src/components/MemoFilters.tsx index 639b43b101162..70fd6f3911191 100644 --- a/web/src/components/MemoFilters.tsx +++ b/web/src/components/MemoFilters.tsx @@ -40,15 +40,6 @@ const MemoFilters = () => {
))} -
memoFilterStore.setOrderByTimeAsc(!memoFilterStore.orderByTimeAsc)} - > - - - {memoFilterStore.orderByTimeAsc ? ""Asc"" : ""Desc""} - -
); diff --git a/web/src/components/SearchBar.tsx b/web/src/components/SearchBar.tsx index 392381b28cf40..27450fdd0b36e 100644 --- a/web/src/components/SearchBar.tsx +++ b/web/src/components/SearchBar.tsx @@ -2,6 +2,7 @@ import { useState } from ""react""; import { useMemoFilterStore } from ""@/store/v1""; import { useTranslate } from ""@/utils/i18n""; import Icon from ""./Icon""; +import MemoDisplaySettingMenu from ""./MemoDisplaySettingMenu""; const SearchBar = () => { const t = useTranslate(); @@ -28,7 +29,7 @@ const SearchBar = () => { return (
- + { onChange={onTextChange} onKeyDown={onKeyDown} /> +
); }; diff --git a/web/src/components/UserStatisticsView.tsx b/web/src/components/UserStatisticsView.tsx index be1cb5b34282a..0421217d26573 100644 --- a/web/src/components/UserStatisticsView.tsx +++ b/web/src/components/UserStatisticsView.tsx @@ -90,7 +90,7 @@ const UserStatisticsView = () => { - +
- {t(""common.filters"")} + {t(""common.filter"")}
{filters.map((f, index) => { return ( @@ -127,7 +127,7 @@ const CreateShortcutDialog: React.FC = (props: Props) => { ); })}
- {t(""common.new-filter"")} + {t(""shortcut-list.new-filter"")}
@@ -136,7 +136,7 @@ const CreateShortcutDialog: React.FC = (props: Props) => {
- {shownMemoLength} {t(""common.eligible-memo"")} + {shownMemoLength} {t(""shortcut-list.eligible-memo"")}
-

{t(""common.quickly-filter"")}

+

{t(""search.quickly-filter"").toUpperCase()}

- {t(""common.types"")}: + {t(""common.type"").toUpperCase()}:
{memoSpecialTypes.map((t, idx) => { return ( diff --git a/web/src/labs/i18n/useI18n.ts b/web/src/labs/i18n/useI18n.ts index 0819590bf378a..cfa6f0d7ae109 100644 --- a/web/src/labs/i18n/useI18n.ts +++ b/web/src/labs/i18n/useI18n.ts @@ -21,7 +21,7 @@ const useI18n = () => { }; }, []); - const translate = (key: string) => { + const translate = (key: string): string => { const keys = key.split("".""); let value = resources[locale]; for (const k of keys) { diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 30b941002622d..8d8af0e9abed4 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -26,17 +26,11 @@ ""sign-in"": ""Sign in"", ""sign-out"": ""Sign out"", ""back-to-home"": ""Back to Home"", + ""type"": ""Type"", ""shortcuts"": ""Shortcuts"", - ""create-shortcut"" : ""Create Shortcut"", - ""edit-shortcut"": ""Edit Shortcut"", ""title"": ""Title"", ""filter"": ""Filter"", - ""filters"": ""Filters"", - ""new-filter"": ""New Filter"", - ""eligible-memo"": ""eligible memo"", - ""tags"": ""Tags"", - ""quickly-filter"": ""QUICKLY FILTER"", - ""types"": ""TYPE"" + ""tags"": ""Tags"" }, ""slogan"": ""An open source, self-hosted knowledge base that works with a SQLite db file."", ""auth"": { @@ -77,9 +71,18 @@ ""memo-list"": { ""fetching-data"": ""fetching data..."" }, + ""shortcut-list"": { + ""create-shortcut"": ""Create Shortcut"", + ""edit-shortcut"": ""Edit Shortcut"", + ""new-filter"": ""New Filter"", + ""eligible-memo"": ""eligible memo"" + }, ""tag-list"": { ""tip-text"": ""Enter `#tag ` to create"" }, + ""search"": { + ""quickly-filter"": ""Quickly filter"" + }, ""setting"": { ""my-account"": ""My Account"", ""preference"": ""Preference"", @@ -95,4 +98,4 @@ ""create-a-member"": ""Create a member"" } } -} \ No newline at end of file +} diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index d1273fde54169..173567eaf2214 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -26,17 +26,11 @@ ""sign-in"": ""登录"", ""sign-out"": ""退出登录"", ""back-to-home"": ""回到主页"", - ""shortcuts"": ""快捷方式"", - ""create-shortcut"" : ""创建快捷方式"", - ""edit-shortcut"": ""编辑快捷方式"", + ""type"": ""类型"", + ""shortcuts"": ""捷径"", ""title"": ""标题"", - ""filter"": ""过滤"", - ""filters"": ""全部过滤"", - ""new-filter"": ""新建过滤"", - ""eligible-memo"": ""符合条件的memo"", - ""tags"": ""全部标签"", - ""quickly-filter"": ""快速过滤"", - ""types"": ""类型"" + ""filter"": ""过滤器"", + ""tags"": ""全部标签"" }, ""slogan"": ""一个开源的、支持私有化部署的碎片化知识卡片管理工具。"", ""auth"": { @@ -77,9 +71,18 @@ ""memo-list"": { ""fetching-data"": ""请求数据中..."" }, + ""shortcut-list"": { + ""create-shortcut"": ""创建捷径"", + ""edit-shortcut"": ""编辑捷径"", + ""new-filter"": ""新建过滤器"", + ""eligible-memo"": ""符合条件的 memo"" + }, ""tag-list"": { ""tip-text"": ""输入`#tag `来创建标签"" }, + ""search"": { + ""quickly-filter"": ""快速过滤"" + }, ""setting"": { ""my-account"": ""我的账号"", ""preference"": ""偏好设置"", @@ -95,4 +98,4 @@ ""create-a-member"": ""创建成员"" } } -} \ No newline at end of file +}",chore,update common locales 9c4d25cc4d045e6792c9d863d91399241b27f518,2024-09-25 17:17:12,boojack,chore: update README.md,False,"diff --git a/README.md b/README.md index aaa2caa46236b..022a70eae1fe3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ - +# Memos - Open Source, Self-hosted, Your Notes, Your Way -A privacy-first, lightweight note-taking service. Easily capture and share your great thoughts. + + +An open-source, self-hosted note-taking solution designed for seamless deployment and multi-platform access. Experience effortless plain text writing with pain-free, complemented by robust Markdown syntax support for enhanced formatting. Home PageBlogs • @@ -14,13 +16,14 @@ A privacy-first, lightweight note-taking service. Easily capture and share your ![demo](https://www.usememos.com/demo.png) -## Key points +## Main Features -- **Open source and free to use**. Embrace a future where creativity knows no boundaries with our open-source solution. All features are free to use and will never be charged in any form or content. -- **Self-hosting with Docker in just seconds**. Enjoy the flexibility, scalability, and ease of setup that Docker provides, allowing you to have full control over your data and privacy. -- **Pure text with added Markdown support.** Say goodbye to the overwhelming mental burden of rich formatting and embrace a minimalist approach. -- **Customize and share your notes effortlessly**. With our intuitive sharing features, you can easily collaborate and distribute your notes with others. -- **RESTful API for third-party services.** Embrace the power of integration and unleash new possibilities with our RESTful API support. +- **Privacy First** 🏠: Take control of your data. All runtime data is securely stored in your local database. +- **Create at Speed** ✍️: Save content as plain text for quick access, with Markdown support for fast formatting and easy sharing. +- **Lightweight but Powerful** 🤲: Built with Go, React.js, and a compact architecture, our application delivers powerful performance in a lightweight package. +- **Customizable** 🧩: Easily customize your server name, icon, description, system style, and execution scripts to make it uniquely yours. +- **Open Source** 🦦: Memos embraces the future of open source, with all code available on GitHub for transparency and collaboration. +- **Free to Use** 💸: Enjoy all features completely free, with no charges ever for any content. ## Deploy with Docker in seconds @@ -49,7 +52,7 @@ If you find Memos helpful, please consider sponsoring us. Your support will help [![Star History Chart](https://api.star-history.com/svg?repos=usememos/memos&type=Date)](https://star-history.com/#usememos/memos&Date) -## Other projects +## Other Projects - [**Slash**](https://github.com/yourselfhosted/slash): An open source, self-hosted bookmarks and link sharing platform. Save and share your links very easily. - [**Gomark**](https://github.com/usememos/gomark): A markdown parser written in Go for Memos. And its [WebAssembly version](https://github.com/usememos/gomark-wasm) is also available.",chore,update README.md 3266c3a58a9ea2df25d78dda9a39c696b76edb73,2023-11-05 19:56:09,Steven,chore: update link styles,False,"diff --git a/web/src/components/BetaBadge.tsx b/web/src/components/BetaBadge.tsx index 917af1eceacf0..26822674f39b4 100644 --- a/web/src/components/BetaBadge.tsx +++ b/web/src/components/BetaBadge.tsx @@ -10,7 +10,9 @@ const BetaBadge: React.FC = (props: Props) => { return ( {t(""common.beta"")} diff --git a/web/src/components/CreateMemoRelationDialog.tsx b/web/src/components/CreateMemoRelationDialog.tsx index cc78d4a17b4bd..a491dfedc59c5 100644 --- a/web/src/components/CreateMemoRelationDialog.tsx +++ b/web/src/components/CreateMemoRelationDialog.tsx @@ -96,7 +96,7 @@ const CreateMemoRelationDialog: React.FC = (props: Props) => {
{memoList.map((memo) => (
handleDeleteMemoRelation(memo)} > diff --git a/web/src/components/MemoEditor/RelationListView.tsx b/web/src/components/MemoEditor/RelationListView.tsx index 5dc9e78c43e84..7915a7b45a493 100644 --- a/web/src/components/MemoEditor/RelationListView.tsx +++ b/web/src/components/MemoEditor/RelationListView.tsx @@ -38,7 +38,7 @@ const RelationListView = (props: Props) => { return (
handleDeleteRelation(memo)} > diff --git a/web/src/components/MemoRelationListView.tsx b/web/src/components/MemoRelationListView.tsx index 9b33086fc3304..a7f186b0f65e6 100644 --- a/web/src/components/MemoRelationListView.tsx +++ b/web/src/components/MemoRelationListView.tsx @@ -40,7 +40,7 @@ const MemoRelationListView = (props: Props) => { return (
@@ -60,7 +60,7 @@ const MemoRelationListView = (props: Props) => { return (
diff --git a/web/src/components/Settings/SSOSection.tsx b/web/src/components/Settings/SSOSection.tsx index 4b709d3520930..5c67b34f56103 100644 --- a/web/src/components/Settings/SSOSection.tsx +++ b/web/src/components/Settings/SSOSection.tsx @@ -107,10 +107,10 @@ const SSOSection = () => { ))}
-

{t(""common.learn-more"")}

+

{t(""common.learn-more"")}:

- + Configuring Keycloak for Authentication diff --git a/web/src/components/Settings/StorageSection.tsx b/web/src/components/Settings/StorageSection.tsx index 2f970838f0eb9..9367da889b9b4 100644 --- a/web/src/components/Settings/StorageSection.tsx +++ b/web/src/components/Settings/StorageSection.tsx @@ -124,21 +124,15 @@ const StorageSection = () => { ))}
-

{t(""common.learn-more"")}

+

{t(""common.learn-more"")}:

- + Docs - Local storage - + Choosing a Storage for Your Resource: Database, S3 or Local Storage? ",chore,update link styles 1591fdf61c9efa9b4fac61b0ec2fdfa0765ecf6b,2022-09-16 18:55:39,Steven,chore: update i18n structures,False,"diff --git a/web/src/components/ArchivedMemo.tsx b/web/src/components/ArchivedMemo.tsx index 7b237ba4986dd..c378fddae5155 100644 --- a/web/src/components/ArchivedMemo.tsx +++ b/web/src/components/ArchivedMemo.tsx @@ -1,4 +1,3 @@ -import { IMAGE_URL_REG } from ""../helpers/marked""; import * as utils from ""../helpers/utils""; import useI18n from ""../hooks/useI18n""; import useToggle from ""../hooks/useToggle""; @@ -44,7 +43,7 @@ const ArchivedMemo: React.FC = (props: Props) => { rowStatus: ""NORMAL"", }); await memoService.fetchMemos(); - toastHelper.info(t(""common.restored-successfully"")); + toastHelper.info(t(""message.restored-successfully"")); } catch (error: any) { console.error(error); toastHelper.error(error.response.data.message); diff --git a/web/src/components/ChangeMemoCreatedTsDialog.tsx b/web/src/components/ChangeMemoCreatedTsDialog.tsx index fd0f31871e069..cc2ddf8643315 100644 --- a/web/src/components/ChangeMemoCreatedTsDialog.tsx +++ b/web/src/components/ChangeMemoCreatedTsDialog.tsx @@ -23,7 +23,7 @@ const ChangeMemoCreatedTsDialog: React.FC = (props: Props) => { const datetime = dayjs(memo.createdTs).format(""YYYY-MM-DDTHH:mm""); setCreatedAt(datetime); } else { - toastHelper.error(t(""common.memo-not-found"")); + toastHelper.error(t(""message.memo-not-found"")); destroy(); } }, []); @@ -42,7 +42,7 @@ const ChangeMemoCreatedTsDialog: React.FC = (props: Props) => { const createdTs = dayjs(createdAt).unix(); if (createdTs > nowTs) { - toastHelper.error(t(""common.invalid-created-datetime"")); + toastHelper.error(t(""message.invalid-created-datetime"")); return; } @@ -51,7 +51,7 @@ const ChangeMemoCreatedTsDialog: React.FC = (props: Props) => { id: memoId, createdTs, }); - toastHelper.info(t(""common.memo-updated-datetime"")); + toastHelper.info(t(""message.memo-updated-datetime"")); handleCloseBtnClick(); } catch (error: any) { console.error(error); @@ -62,7 +62,7 @@ const ChangeMemoCreatedTsDialog: React.FC = (props: Props) => { return ( <>
-

{t(""common.change-memo-created-time"")}

+

{t(""message.change-memo-created-time"")}

diff --git a/web/src/components/ChangePasswordDialog.tsx b/web/src/components/ChangePasswordDialog.tsx index 6d3ca3a9b8b89..a565d045eb6b7 100644 --- a/web/src/components/ChangePasswordDialog.tsx +++ b/web/src/components/ChangePasswordDialog.tsx @@ -41,12 +41,12 @@ const ChangePasswordDialog: React.FC = ({ destroy }: Props) => { const handleSaveBtnClick = async () => { if (newPassword === """" || newPasswordAgain === """") { - toastHelper.error(t(""common.fill-all"")); + toastHelper.error(t(""message.fill-all"")); return; } if (newPassword !== newPasswordAgain) { - toastHelper.error(t(""common.new-password-not-match"")); + toastHelper.error(t(""message.new-password-not-match"")); setNewPasswordAgain(""""); return; } diff --git a/web/src/components/CreateShortcutDialog.tsx b/web/src/components/CreateShortcutDialog.tsx index afb60dc06f62c..ab40200bd040d 100644 --- a/web/src/components/CreateShortcutDialog.tsx +++ b/web/src/components/CreateShortcutDialog.tsx @@ -113,7 +113,7 @@ const CreateShortcutDialog: React.FC = (props: Props) => { diff --git a/web/src/components/Memo.tsx b/web/src/components/Memo.tsx index 866bd469887ec..fa6858eb719e0 100644 --- a/web/src/components/Memo.tsx +++ b/web/src/components/Memo.tsx @@ -105,7 +105,7 @@ const Memo: React.FC = (props: Props) => { if (memoTemp) { showMemoCardDialog(memoTemp); } else { - toastHelper.error(t(""common.memo-not-found"")); + toastHelper.error(t(""message.memo-not-found"")); targetEl.classList.remove(""memo-link-text""); } } else if (targetEl.className === ""tag-span"") { diff --git a/web/src/components/MemoCardDialog.tsx b/web/src/components/MemoCardDialog.tsx index 4de8e29defd2a..7b89fc2d084d7 100644 --- a/web/src/components/MemoCardDialog.tsx +++ b/web/src/components/MemoCardDialog.tsx @@ -97,7 +97,7 @@ const MemoCardDialog: React.FC = (props: Props) => { setLinkedMemos([]); setMemo(nextMemo); } else { - toastHelper.error(t(""common.memo-not-found"")); + toastHelper.error(t(""message.memo-not-found"")); targetEl.classList.remove(""memo-link-text""); } } diff --git a/web/src/components/MemoList.tsx b/web/src/components/MemoList.tsx index b39956f112f6e..6ec896aa23466 100644 --- a/web/src/components/MemoList.tsx +++ b/web/src/components/MemoList.tsx @@ -108,7 +108,7 @@ const MemoList = () => { ))}
-

{sortedMemos.length === 0 ? t(""common.no-memos"") : showMemoFilter ? """" : t(""common.memos-ready"")}

+

{sortedMemos.length === 0 ? t(""message.no-memos"") : showMemoFilter ? """" : t(""message.memos-ready"")}

diff --git a/web/src/components/Settings/MemberSection.tsx b/web/src/components/Settings/MemberSection.tsx index 8644eb49b1433..be1bee01f51cd 100644 --- a/web/src/components/Settings/MemberSection.tsx +++ b/web/src/components/Settings/MemberSection.tsx @@ -48,7 +48,7 @@ const PreferencesSection = () => { const handleCreateUserBtnClick = async () => { if (isEmpty(state.createUserEmail) || isEmpty(state.createUserPassword)) { - toastHelper.error(t(""common.fill-form"")); + toastHelper.error(t(""message.fill-form"")); return; } diff --git a/web/src/components/ShareMemoImageDialog.tsx b/web/src/components/ShareMemoImageDialog.tsx index 786d68dbca2a5..e76489532cd46 100644 --- a/web/src/components/ShareMemoImageDialog.tsx +++ b/web/src/components/ShareMemoImageDialog.tsx @@ -59,7 +59,7 @@ const ShareMemoImageDialog: React.FC = (props: Props) => { const handleImageOnLoad = (event: React.SyntheticEvent) => { if (event.type === ""error"") { - toastHelper.error(t(""common.image-load-failed"")); + toastHelper.error(t(""message.image-load-failed"")); (event.target as HTMLImageElement).remove(); } setImgAmount(imgAmount - 1); diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 81bd29b289f0c..0f25eaab3c9ba 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -30,27 +30,12 @@ ""back-to-home"": ""Back to Home"", ""type"": ""Type"", ""shortcuts"": ""Shortcuts"", - ""shortcut-title"": ""shortcut title"", ""title"": ""Title"", ""filter"": ""Filter"", ""tags"": ""Tags"", - ""no-memos"": ""no memos 🌃"", - ""memos-ready"": ""all memos are ready 🎉"", ""yourself"": ""Yourself"", ""archived-at"": ""Archived at"", - ""restored-successfully"": ""Restored successfully"", - ""memo-updated-datetime"":""Memo created datetime changed."", - ""invalid-created-datetime"": ""Invalid created datetime."", - ""change-memo-created-time"": ""Change memo created time"", - ""memo-not-found"": ""Memo not found."", - ""fill-all"": ""Please fill in all fields."", - ""new-password-not-match"": ""New passwords do not match."", - ""changed"": ""changed"", - ""image-load-failed"": ""Image load failed"", - ""fill-form"": ""Please fill out this form"", - ""login-failed"": ""Login failed"", - ""signup-failed"": ""Signup failed"", - ""user-not-found"": ""User not found"" + ""changed"": ""changed"" }, ""slogan"": ""An open source, self-hosted knowledge base that works with a SQLite db file."", ""auth"": { @@ -94,6 +79,7 @@ ""fetching-data"": ""fetching data..."" }, ""shortcut-list"": { + ""shortcut-title"": ""shortcut title"", ""create-shortcut"": ""Create Shortcut"", ""edit-shortcut"": ""Edit Shortcut"", ""new-filter"": ""New Filter"", @@ -122,5 +108,21 @@ ""member-section"": { ""create-a-member"": ""Create a member"" } + }, + ""message"": { + ""no-memos"": ""no memos 🌃"", + ""memos-ready"": ""all memos are ready 🎉"", + ""restored-successfully"": ""Restored successfully"", + ""memo-updated-datetime"": ""Memo created datetime changed."", + ""invalid-created-datetime"": ""Invalid created datetime."", + ""change-memo-created-time"": ""Change memo created time"", + ""memo-not-found"": ""Memo not found."", + ""fill-all"": ""Please fill in all fields."", + ""new-password-not-match"": ""New passwords do not match."", + ""image-load-failed"": ""Image load failed"", + ""fill-form"": ""Please fill out this form"", + ""login-failed"": ""Login failed"", + ""signup-failed"": ""Signup failed"", + ""user-not-found"": ""User not found"" } } diff --git a/web/src/locales/vi.json b/web/src/locales/vi.json index aabdea33fdc3b..30d996e8f0bfc 100644 --- a/web/src/locales/vi.json +++ b/web/src/locales/vi.json @@ -30,27 +30,12 @@ ""back-to-home"": ""Quay về trang chủ"", ""type"": ""Kiểu"", ""shortcuts"": ""Lối tắt"", - ""shortcut-title"": ""Tên lối tắt"", ""title"": ""Tên"", ""filter"": ""Bộ lọc"", ""tags"": ""Thẻ"", - ""no-memos"": ""Không có memo nào 🌃"", - ""memos-ready"": ""Tất cả memo ở đây rồi 🎉"", ""yourself"": ""Của bạn"", ""archived-at"": ""Lưu trữ lúc"", - ""restored-successfully"": ""Đã khôi phục thành công"", - ""memo-updated-datetime"":""Memo đã thay đổi ngày giờ tạo."", - ""invalid-created-datetime"": ""Ngày giờ tạo không hợp lệ."", - ""change-memo-created-time"": ""Thay đổi thời gian tạo memo"", - ""memo-not-found"": ""Không tìm thấy memo."", - ""fill-all"": ""Vui lòng nhập tất cả các mục."", - ""new-password-not-match"": ""Mật khẩu mới không giống nhau."", - ""changed"": ""đã thay đổi"", - ""image-load-failed"": ""Tải ảnh bị lỗi"", - ""fill-form"": ""Please fill out this form"", - ""login-failed"": ""Đăng nhập thất bại"", - ""signup-failed"": ""Đăng ký thất bại"", - ""user-not-found"": ""Không tìm thấy người dùng này"" + ""changed"": ""đã thay đổi"" }, ""slogan"": ""Một mã nguồn mở, tự lưu lại mọi thứ bạn biết dựa trên SQLite db."", ""auth"": { @@ -94,6 +79,7 @@ ""fetching-data"": ""đang tải dữ liệu..."" }, ""shortcut-list"": { + ""shortcut-title"": ""Tên lối tắt"", ""create-shortcut"": ""Tạo lối tắt"", ""edit-shortcut"": ""Chỉnh sửa lối tắt"", ""new-filter"": ""Bộ lọc mới"", @@ -122,5 +108,21 @@ ""member-section"": { ""create-a-member"": ""Tạo một thành viên"" } + }, + ""message"": { + ""no-memos"": ""Không có memo nào 🌃"", + ""memos-ready"": ""Tất cả memo ở đây rồi 🎉"", + ""restored-successfully"": ""Đã khôi phục thành công"", + ""memo-updated-datetime"": ""Memo đã thay đổi ngày giờ tạo."", + ""invalid-created-datetime"": ""Ngày giờ tạo không hợp lệ."", + ""change-memo-created-time"": ""Thay đổi thời gian tạo memo"", + ""memo-not-found"": ""Không tìm thấy memo."", + ""fill-all"": ""Vui lòng nhập tất cả các mục."", + ""new-password-not-match"": ""Mật khẩu mới không giống nhau."", + ""image-load-failed"": ""Tải ảnh bị lỗi"", + ""fill-form"": ""Please fill out this form"", + ""login-failed"": ""Đăng nhập thất bại"", + ""signup-failed"": ""Đăng ký thất bại"", + ""user-not-found"": ""Không tìm thấy người dùng này"" } } diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index b384b0378fd6c..3448f9d788f6f 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -30,27 +30,12 @@ ""back-to-home"": ""回到主页"", ""type"": ""类型"", ""shortcuts"": ""捷径"", - ""shortcut-title"": ""捷径标题"", ""title"": ""标题"", ""filter"": ""过滤器"", ""tags"": ""全部标签"", - ""no-memos"": ""没有 memo 了 🌃"", - ""memos-ready"": ""所有 memo 已就绪 🎉"", ""yourself"": ""你自己"", ""archived-at"": ""归档于"", - ""restored-successfully"": ""恢复成功"", - ""memo-updated-datetime"": ""Memo创建日期时间已更改。"", - ""invalid-created-datetime"": ""创建的日期时间无效。"", - ""change-memo-created-time"": ""更改Memo创建时间"", - ""memo-not-found"": ""找不到Memo。"", - ""fill-all"": ""请填写所有字段。"", - ""new-password-not-match"": ""新密码不匹配。"", - ""changed"": ""已更改"", - ""image-load-failed"": ""图片加载失败"", - ""fill-form"": ""请填写此表单"", - ""login-failed"": ""登录失败"", - ""signup-failed"": ""注册失败"", - ""user-not-found"": ""未找到用户"" + ""changed"": ""已更改"" }, ""slogan"": ""一个开源的、支持私有化部署的碎片化知识卡片管理工具。"", ""auth"": { @@ -94,6 +79,7 @@ ""fetching-data"": ""请求数据中..."" }, ""shortcut-list"": { + ""shortcut-title"": ""捷径标题"", ""create-shortcut"": ""创建捷径"", ""edit-shortcut"": ""编辑捷径"", ""new-filter"": ""新建过滤器"", @@ -122,5 +108,21 @@ ""member-section"": { ""create-a-member"": ""创建成员"" } + }, + ""message"": { + ""no-memos"": ""没有 memo 了 🌃"", + ""memos-ready"": ""所有 memo 已就绪 🎉"", + ""restored-successfully"": ""恢复成功"", + ""memo-updated-datetime"": ""Memo创建日期时间已更改。"", + ""invalid-created-datetime"": ""创建的日期时间无效。"", + ""change-memo-created-time"": ""更改Memo创建时间"", + ""memo-not-found"": ""找不到Memo。"", + ""fill-all"": ""请填写所有字段。"", + ""new-password-not-match"": ""新密码不匹配。"", + ""image-load-failed"": ""图片加载失败"", + ""fill-form"": ""请填写此表单"", + ""login-failed"": ""登录失败"", + ""signup-failed"": ""注册失败"", + ""user-not-found"": ""未找到用户"" } } diff --git a/web/src/pages/Auth.tsx b/web/src/pages/Auth.tsx index 6125a5b0daa71..dfbcd0a09b439 100644 --- a/web/src/pages/Auth.tsx +++ b/web/src/pages/Auth.tsx @@ -70,7 +70,7 @@ const Auth = () => { if (user) { locationService.replaceHistory(""/""); } else { - toastHelper.error(t(""common.login-failed"")); + toastHelper.error(t(""message.login-failed"")); } } catch (error: any) { console.error(error); diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index e8f1b6716b5d8..0f93ff2aa17d5 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -31,7 +31,7 @@ function Home() { if (userService.isVisitorMode()) { if (!owner) { - toastHelper.error(t(""common.user-not-found"")); + toastHelper.error(t(""message.user-not-found"")); } } else { if (!user) {",chore,update i18n structures cc23f69f6648a16fa8ec37ec95a144424f0730d6,2023-04-05 21:01:15,boojack,chore: update import path (#1477),False,"diff --git a/web/src/labs/marked/parser/Image.tsx b/web/src/labs/marked/parser/Image.tsx index b9dc835e0a0ff..96437c56a034b 100644 --- a/web/src/labs/marked/parser/Image.tsx +++ b/web/src/labs/marked/parser/Image.tsx @@ -1,4 +1,4 @@ -import { absolutifyLink } from ""../../../helpers/utils""; +import { absolutifyLink } from ""@/helpers/utils""; import { matcher } from ""../matcher""; export const IMAGE_REG = /!\[.*?\]\((.+?)\)/; diff --git a/web/src/store/module/global.ts b/web/src/store/module/global.ts index e1492c23a27bd..f36dab5951ad1 100644 --- a/web/src/store/module/global.ts +++ b/web/src/store/module/global.ts @@ -1,9 +1,9 @@ -import * as api from ""../../helpers/api""; -import * as storage from ""../../helpers/storage""; +import * as api from ""@/helpers/api""; +import * as storage from ""@/helpers/storage""; +import i18n from ""@/i18n""; +import { convertLanguageCodeToLocale } from ""@/utils/i18n""; import store, { useAppSelector } from ""../""; import { setAppearance, setGlobalState, setLocale } from ""../reducer/global""; -import i18n from ""../../i18n""; -import { convertLanguageCodeToLocale } from ""../../utils/convertLanguageCodeToLocale""; export const initialGlobalState = async () => { const defaultGlobalState = { diff --git a/web/src/store/module/memo.ts b/web/src/store/module/memo.ts index ee707b3066fd9..cbd4aace5b145 100644 --- a/web/src/store/module/memo.ts +++ b/web/src/store/module/memo.ts @@ -1,6 +1,6 @@ import { omit } from ""lodash-es""; -import * as api from ""../../helpers/api""; -import { DEFAULT_MEMO_LIMIT } from ""../../helpers/consts""; +import * as api from ""@/helpers/api""; +import { DEFAULT_MEMO_LIMIT } from ""@/helpers/consts""; import { useUserStore } from ""./""; import store, { useAppSelector } from ""../""; import { createMemo, deleteMemo, patchMemo, setIsFetching, upsertMemos } from ""../reducer/memo""; diff --git a/web/src/store/module/resource.ts b/web/src/store/module/resource.ts index 052af42ad94e1..8c1577dc13638 100644 --- a/web/src/store/module/resource.ts +++ b/web/src/store/module/resource.ts @@ -1,7 +1,7 @@ +import * as api from ""@/helpers/api""; +import { DEFAULT_MEMO_LIMIT } from ""@/helpers/consts""; import store, { useAppSelector } from ""../""; import { patchResource, setResources, deleteResource, upsertResources } from ""../reducer/resource""; -import * as api from ""../../helpers/api""; -import { DEFAULT_MEMO_LIMIT } from ""../../helpers/consts""; const MAX_FILE_SIZE = 32 << 20; diff --git a/web/src/store/module/shortcut.ts b/web/src/store/module/shortcut.ts index ffd8a88ea6d6c..af42b93c2bd54 100644 --- a/web/src/store/module/shortcut.ts +++ b/web/src/store/module/shortcut.ts @@ -1,6 +1,6 @@ +import * as api from ""@/helpers/api""; import store, { useAppSelector } from ""../""; import { createShortcut, deleteShortcut, patchShortcut, setShortcuts } from ""../reducer/shortcut""; -import * as api from ""../../helpers/api""; const convertResponseModelShortcut = (shortcut: Shortcut): Shortcut => { return { diff --git a/web/src/store/module/tag.ts b/web/src/store/module/tag.ts index 661305c33bc3a..7a27ff3415f79 100644 --- a/web/src/store/module/tag.ts +++ b/web/src/store/module/tag.ts @@ -1,5 +1,5 @@ +import * as api from ""@/helpers/api""; import store, { useAppSelector } from ""..""; -import * as api from ""../../helpers/api""; import { deleteTag, setTags, upsertTag } from ""../reducer/tag""; import { useUserStore } from ""./""; diff --git a/web/src/store/module/user.ts b/web/src/store/module/user.ts index eb971deb0a278..b1a8d67cf5ba3 100644 --- a/web/src/store/module/user.ts +++ b/web/src/store/module/user.ts @@ -1,9 +1,9 @@ import { camelCase } from ""lodash-es""; +import * as api from ""@/helpers/api""; +import * as storage from ""@/helpers/storage""; +import { UNKNOWN_ID } from ""@/helpers/consts""; +import { getSystemColorScheme } from ""@/helpers/utils""; import store, { useAppSelector } from ""..""; -import * as api from ""../../helpers/api""; -import * as storage from ""../../helpers/storage""; -import { UNKNOWN_ID } from ""../../helpers/consts""; -import { getSystemColorScheme } from ""../../helpers/utils""; import { setAppearance, setLocale } from ""../reducer/global""; import { setUser, patchUser, setHost, setUserById } from ""../reducer/user""; diff --git a/web/src/utils/convertLanguageCodeToLocale.ts b/web/src/utils/i18n.ts similarity index 100% rename from web/src/utils/convertLanguageCodeToLocale.ts rename to web/src/utils/i18n.ts",chore,update import path (#1477) 46ea16ef7e5c4ed2731fe7842ae22f477c42678e,2024-02-05 19:44:58,Steven,chore: fix cookie attrs,False,"diff --git a/api/v2/auth_service.go b/api/v2/auth_service.go index 0109d05f519bf..25a43a4ac6520 100644 --- a/api/v2/auth_service.go +++ b/api/v2/auth_service.go @@ -165,7 +165,7 @@ func (s *APIV2Service) doSignIn(ctx context.Context, user *store.User, expireTim cookieExpires = time.Now().AddDate(100, 0, 0) } if err := grpc.SetHeader(ctx, metadata.New(map[string]string{ - ""Set-Cookie"": fmt.Sprintf(""%s=%s; Path=/; Expires=%s; HttpOnly; SameSite=None"", auth.AccessTokenCookieName, accessToken, cookieExpires.Format(time.RFC1123)), + ""Set-Cookie"": fmt.Sprintf(""%s=%s; Path=/; Expires=%s; HttpOnly; SameSite=Strict"", auth.AccessTokenCookieName, accessToken, cookieExpires.Format(time.RFC1123)), })); err != nil { return status.Errorf(codes.Internal, ""failed to set grpc header, error: %v"", err) } @@ -231,7 +231,7 @@ func (*APIV2Service) SignOut(ctx context.Context, _ *apiv2pb.SignOutRequest) (*a func clearAccessTokenCookie(ctx context.Context) error { if err := grpc.SetHeader(ctx, metadata.New(map[string]string{ - ""Set-Cookie"": fmt.Sprintf(""%s=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; SameSite=None"", auth.AccessTokenCookieName), + ""Set-Cookie"": fmt.Sprintf(""%s=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; SameSite=Strict"", auth.AccessTokenCookieName), })); err != nil { return errors.Wrap(err, ""failed to set grpc header"") }",chore,fix cookie attrs 18107248aaa651aa2bcecc56722290b99724c225,2023-10-27 21:38:42,Steven,chore: rename list inbox,False,"diff --git a/api/v2/inbox_service .go b/api/v2/inbox_service .go index 1d78dc525e789..e474aec15052e 100644 --- a/api/v2/inbox_service .go +++ b/api/v2/inbox_service .go @@ -3,37 +3,39 @@ package v2 import ( ""context"" ""fmt"" + ""time"" ""github.com/pkg/errors"" ""google.golang.org/grpc/codes"" ""google.golang.org/grpc/status"" + ""google.golang.org/protobuf/types/known/timestamppb"" apiv2pb ""github.com/usememos/memos/proto/gen/api/v2"" ""github.com/usememos/memos/store"" ) -func (s *APIV2Service) ListInbox(ctx context.Context, _ *apiv2pb.ListInboxRequest) (*apiv2pb.ListInboxResponse, error) { +func (s *APIV2Service) ListInboxes(ctx context.Context, _ *apiv2pb.ListInboxesRequest) (*apiv2pb.ListInboxesResponse, error) { user, err := getCurrentUser(ctx, s.Store) if err != nil { return nil, status.Errorf(codes.Internal, ""failed to get user"") } - inboxList, err := s.Store.ListInbox(ctx, &store.FindInbox{ + inboxes, err := s.Store.ListInboxes(ctx, &store.FindInbox{ ReceiverID: &user.ID, }) if err != nil { return nil, status.Errorf(codes.Internal, ""failed to list inbox: %v"", err) } - response := &apiv2pb.ListInboxResponse{ - Inbox: []*apiv2pb.Inbox{}, + response := &apiv2pb.ListInboxesResponse{ + Inboxes: []*apiv2pb.Inbox{}, } - for _, inbox := range inboxList { + for _, inbox := range inboxes { inboxMessage, err := s.convertInboxFromStore(ctx, inbox) if err != nil { return nil, status.Errorf(codes.Internal, ""failed to convert inbox from store: %v"", err) } - response.Inbox = append(response.Inbox, inboxMessage) + response.Inboxes = append(response.Inboxes, inboxMessage) } return response, nil @@ -103,10 +105,11 @@ func (s *APIV2Service) convertInboxFromStore(ctx context.Context, inbox *store.I } return &apiv2pb.Inbox{ - Name: fmt.Sprintf(""inbox/%d"", inbox.ID), + Name: fmt.Sprintf(""inboxes/%d"", inbox.ID), Sender: fmt.Sprintf(""users/%s"", sender.Username), Receiver: fmt.Sprintf(""users/%s"", receiver.Username), Status: convertInboxStatusFromStore(inbox.Status), + CreateTime: timestamppb.New(time.Unix(inbox.CreatedTs, 0)), Type: apiv2pb.Inbox_Type(inbox.Message.Type), ActivityId: inbox.Message.ActivityId, }, nil diff --git a/proto/api/v2/inbox_service.proto b/proto/api/v2/inbox_service.proto index eb68b7b9d8c39..954781934edbc 100644 --- a/proto/api/v2/inbox_service.proto +++ b/proto/api/v2/inbox_service.proto @@ -5,31 +5,32 @@ package memos.api.v2; import ""google/api/annotations.proto""; import ""google/api/client.proto""; import ""google/protobuf/field_mask.proto""; +import ""google/protobuf/timestamp.proto""; option go_package = ""gen/api/v2""; service InboxService { - rpc ListInbox(ListInboxRequest) returns (ListInboxResponse) { - option (google.api.http) = {get: ""/api/v2/inbox""}; + rpc ListInboxes(ListInboxesRequest) returns (ListInboxesResponse) { + option (google.api.http) = {get: ""/api/v2/inboxes""}; } rpc UpdateInbox(UpdateInboxRequest) returns (UpdateInboxResponse) { option (google.api.http) = { - patch: ""/v2/inbox"" + patch: ""/v2/inboxes"" body: ""inbox"" }; option (google.api.method_signature) = ""inbox,update_mask""; } rpc DeleteInbox(DeleteInboxRequest) returns (DeleteInboxResponse) { - option (google.api.http) = {delete: ""/v2/{name=inbox/*}""}; + option (google.api.http) = {delete: ""/v2/{name=inboxes/*}""}; option (google.api.method_signature) = ""name""; } } message Inbox { // The name of the inbox. - // Format: inbox/{id} + // Format: inboxes/{id} string name = 1; // Format: users/{username} string sender = 2; @@ -44,22 +45,24 @@ message Inbox { } Status status = 4; + google.protobuf.Timestamp create_time = 5; + enum Type { TYPE_UNSPECIFIED = 0; TYPE_MEMO_COMMENT = 1; } - Type type = 5; + Type type = 6; - optional int32 activity_id = 6; + optional int32 activity_id = 7; } -message ListInboxRequest { - // Format: /users/{username} +message ListInboxesRequest { + // Format: users/{username} string user = 1; } -message ListInboxResponse { - repeated Inbox inbox = 1; +message ListInboxesResponse { + repeated Inbox inboxes = 1; } message UpdateInboxRequest { @@ -74,7 +77,7 @@ message UpdateInboxResponse { message DeleteInboxRequest { // The name of the inbox to delete. - // Format: inbox/{inbox} + // Format: inboxes/{inbox} string name = 1; } diff --git a/proto/gen/api/v2/README.md b/proto/gen/api/v2/README.md index 31f5baba0e7eb..66ed6e63fbc1b 100644 --- a/proto/gen/api/v2/README.md +++ b/proto/gen/api/v2/README.md @@ -10,8 +10,8 @@ - [DeleteInboxRequest](#memos-api-v2-DeleteInboxRequest) - [DeleteInboxResponse](#memos-api-v2-DeleteInboxResponse) - [Inbox](#memos-api-v2-Inbox) - - [ListInboxRequest](#memos-api-v2-ListInboxRequest) - - [ListInboxResponse](#memos-api-v2-ListInboxResponse) + - [ListInboxesRequest](#memos-api-v2-ListInboxesRequest) + - [ListInboxesResponse](#memos-api-v2-ListInboxesResponse) - [UpdateInboxRequest](#memos-api-v2-UpdateInboxRequest) - [UpdateInboxResponse](#memos-api-v2-UpdateInboxResponse) @@ -138,7 +138,7 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| name | [string](#string) | | The name of the inbox to delete. Format: inbox/{inbox} | +| name | [string](#string) | | The name of the inbox to delete. Format: inboxes/{inbox} | @@ -163,10 +163,11 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| name | [string](#string) | | The name of the inbox. Format: inbox/{id} | +| name | [string](#string) | | The name of the inbox. Format: inboxes/{id} | | sender | [string](#string) | | Format: users/{username} | | receiver | [string](#string) | | Format: users/{username} | | status | [Inbox.Status](#memos-api-v2-Inbox-Status) | | | +| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | | type | [Inbox.Type](#memos-api-v2-Inbox-Type) | | | | activity_id | [int32](#int32) | optional | | @@ -175,30 +176,30 @@ - + -### ListInboxRequest +### ListInboxesRequest | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| user | [string](#string) | | Format: /users/{username} | +| user | [string](#string) | | Format: users/{username} | - + -### ListInboxResponse +### ListInboxesResponse | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| inbox | [Inbox](#memos-api-v2-Inbox) | repeated | | +| inboxes | [Inbox](#memos-api-v2-Inbox) | repeated | | @@ -275,7 +276,7 @@ | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| -| ListInbox | [ListInboxRequest](#memos-api-v2-ListInboxRequest) | [ListInboxResponse](#memos-api-v2-ListInboxResponse) | | +| ListInboxes | [ListInboxesRequest](#memos-api-v2-ListInboxesRequest) | [ListInboxesResponse](#memos-api-v2-ListInboxesResponse) | | | UpdateInbox | [UpdateInboxRequest](#memos-api-v2-UpdateInboxRequest) | [UpdateInboxResponse](#memos-api-v2-UpdateInboxResponse) | | | DeleteInbox | [DeleteInboxRequest](#memos-api-v2-DeleteInboxRequest) | [DeleteInboxResponse](#memos-api-v2-DeleteInboxResponse) | | diff --git a/proto/gen/api/v2/inbox_service.pb.go b/proto/gen/api/v2/inbox_service.pb.go index f7bba2d35e0e5..4752c673a7104 100644 --- a/proto/gen/api/v2/inbox_service.pb.go +++ b/proto/gen/api/v2/inbox_service.pb.go @@ -11,6 +11,7 @@ import ( protoreflect ""google.golang.org/protobuf/reflect/protoreflect"" protoimpl ""google.golang.org/protobuf/runtime/protoimpl"" fieldmaskpb ""google.golang.org/protobuf/types/known/fieldmaskpb"" + timestamppb ""google.golang.org/protobuf/types/known/timestamppb"" reflect ""reflect"" sync ""sync"" ) @@ -126,15 +127,16 @@ type Inbox struct { unknownFields protoimpl.UnknownFields // The name of the inbox. - // Format: inbox/{id} + // Format: inboxes/{id} Name string `protobuf:""bytes,1,opt,name=name,proto3"" json:""name,omitempty""` // Format: users/{username} Sender string `protobuf:""bytes,2,opt,name=sender,proto3"" json:""sender,omitempty""` // Format: users/{username} - Receiver string `protobuf:""bytes,3,opt,name=receiver,proto3"" json:""receiver,omitempty""` - Status Inbox_Status `protobuf:""varint,4,opt,name=status,proto3,enum=memos.api.v2.Inbox_Status"" json:""status,omitempty""` - Type Inbox_Type `protobuf:""varint,5,opt,name=type,proto3,enum=memos.api.v2.Inbox_Type"" json:""type,omitempty""` - ActivityId *int32 `protobuf:""varint,6,opt,name=activity_id,json=activityId,proto3,oneof"" json:""activity_id,omitempty""` + Receiver string `protobuf:""bytes,3,opt,name=receiver,proto3"" json:""receiver,omitempty""` + Status Inbox_Status `protobuf:""varint,4,opt,name=status,proto3,enum=memos.api.v2.Inbox_Status"" json:""status,omitempty""` + CreateTime *timestamppb.Timestamp `protobuf:""bytes,5,opt,name=create_time,json=createTime,proto3"" json:""create_time,omitempty""` + Type Inbox_Type `protobuf:""varint,6,opt,name=type,proto3,enum=memos.api.v2.Inbox_Type"" json:""type,omitempty""` + ActivityId *int32 `protobuf:""varint,7,opt,name=activity_id,json=activityId,proto3,oneof"" json:""activity_id,omitempty""` } func (x *Inbox) Reset() { @@ -197,6 +199,13 @@ func (x *Inbox) GetStatus() Inbox_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 @@ -211,17 +220,17 @@ func (x *Inbox) GetActivityId() int32 { return 0 } -type ListInboxRequest struct { +type ListInboxesRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Format: /users/{username} + // Format: users/{username} User string `protobuf:""bytes,1,opt,name=user,proto3"" json:""user,omitempty""` } -func (x *ListInboxRequest) Reset() { - *x = ListInboxRequest{} +func (x *ListInboxesRequest) Reset() { + *x = ListInboxesRequest{} if protoimpl.UnsafeEnabled { mi := &file_api_v2_inbox_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -229,13 +238,13 @@ func (x *ListInboxRequest) Reset() { } } -func (x *ListInboxRequest) String() string { +func (x *ListInboxesRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListInboxRequest) ProtoMessage() {} +func (*ListInboxesRequest) ProtoMessage() {} -func (x *ListInboxRequest) ProtoReflect() protoreflect.Message { +func (x *ListInboxesRequest) ProtoReflect() protoreflect.Message { mi := &file_api_v2_inbox_service_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -247,28 +256,28 @@ func (x *ListInboxRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListInboxRequest.ProtoReflect.Descriptor instead. -func (*ListInboxRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ListInboxesRequest.ProtoReflect.Descriptor instead. +func (*ListInboxesRequest) Descriptor() ([]byte, []int) { return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{1} } -func (x *ListInboxRequest) GetUser() string { +func (x *ListInboxesRequest) GetUser() string { if x != nil { return x.User } return """" } -type ListInboxResponse struct { +type ListInboxesResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Inbox []*Inbox `protobuf:""bytes,1,rep,name=inbox,proto3"" json:""inbox,omitempty""` + Inboxes []*Inbox `protobuf:""bytes,1,rep,name=inboxes,proto3"" json:""inboxes,omitempty""` } -func (x *ListInboxResponse) Reset() { - *x = ListInboxResponse{} +func (x *ListInboxesResponse) Reset() { + *x = ListInboxesResponse{} if protoimpl.UnsafeEnabled { mi := &file_api_v2_inbox_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -276,13 +285,13 @@ func (x *ListInboxResponse) Reset() { } } -func (x *ListInboxResponse) String() string { +func (x *ListInboxesResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListInboxResponse) ProtoMessage() {} +func (*ListInboxesResponse) ProtoMessage() {} -func (x *ListInboxResponse) ProtoReflect() protoreflect.Message { +func (x *ListInboxesResponse) ProtoReflect() protoreflect.Message { mi := &file_api_v2_inbox_service_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -294,14 +303,14 @@ func (x *ListInboxResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListInboxResponse.ProtoReflect.Descriptor instead. -func (*ListInboxResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use ListInboxesResponse.ProtoReflect.Descriptor instead. +func (*ListInboxesResponse) Descriptor() ([]byte, []int) { return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{2} } -func (x *ListInboxResponse) GetInbox() []*Inbox { +func (x *ListInboxesResponse) GetInboxes() []*Inbox { if x != nil { - return x.Inbox + return x.Inboxes } return nil } @@ -414,7 +423,7 @@ type DeleteInboxRequest struct { unknownFields protoimpl.UnknownFields // The name of the inbox to delete. - // Format: inbox/{inbox} + // Format: inboxes/{inbox} Name string `protobuf:""bytes,1,opt,name=name,proto3"" json:""name,omitempty""` } @@ -506,86 +515,93 @@ var file_api_v2_inbox_service_proto_rawDesc = []byte{ 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xe2, 0x02, 0x0a, 0x05, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, - 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x63, - 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x2e, 0x54, 0x79, 0x70, - 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x76, - 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0a, - 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x49, 0x64, 0x88, 0x01, 0x01, 0x22, 0x44, 0x0a, - 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, - 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x0a, 0x0a, 0x06, 0x55, 0x4e, 0x52, 0x45, 0x41, 0x44, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, - 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45, - 0x44, 0x10, 0x03, 0x22, 0x33, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x43, - 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x61, 0x63, 0x74, - 0x69, 0x76, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x22, 0x26, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, - 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9f, 0x03, 0x0a, 0x05, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, + 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, + 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, + 0x79, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x49, 0x64, 0x88, 0x01, 0x01, 0x22, 0x44, 0x0a, 0x06, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, + 0x06, 0x55, 0x4e, 0x52, 0x45, 0x41, 0x44, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x41, + 0x44, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45, 0x44, 0x10, + 0x03, 0x22, 0x33, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x15, 0x0a, 0x11, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x43, 0x4f, 0x4d, + 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, + 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x22, 0x28, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, + 0x62, 0x6f, 0x78, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, - 0x22, 0x3e, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, - 0x22, 0x7c, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, - 0x78, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, - 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x40, - 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, - 0x22, 0x28, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x32, 0xed, 0x02, 0x0a, 0x0c, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, - 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x32, 0x2f, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x80, 0x01, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x22, 0x44, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x69, 0x6e, 0x62, 0x6f, 0x78, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x07, 0x69, + 0x6e, 0x62, 0x6f, 0x78, 0x65, 0x73, 0x22, 0x7c, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x05, + 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, + 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x40, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, + 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x05, 0x69, + 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, + 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x22, 0x28, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x22, 0x15, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf9, 0x02, 0x0a, 0x0c, 0x49, 0x6e, 0x62, 0x6f, + 0x78, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, + 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, + 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, + 0x6f, 0x78, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x69, 0x6e, + 0x62, 0x6f, 0x78, 0x65, 0x73, 0x12, 0x82, 0x01, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, - 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, - 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0xda, 0x41, - 0x11, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, - 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x32, - 0x09, 0x2f, 0x76, 0x32, 0x2f, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x75, 0x0a, 0x0b, 0x44, 0x65, + 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0xda, 0x41, 0x11, 0x69, + 0x6e, 0x62, 0x6f, 0x78, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x32, 0x0b, 0x2f, + 0x76, 0x32, 0x2f, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x65, 0x73, 0x12, 0x77, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, - 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, - 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x2f, 0x2a, - 0x7d, 0x42, 0xa9, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x11, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, - 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, - 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, - 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, - 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, + 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x2a, 0x14, 0x2f, + 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x65, 0x73, + 0x2f, 0x2a, 0x7d, 0x42, 0xa9, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x11, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, + 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, + 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, + 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, + 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -606,32 +622,34 @@ var file_api_v2_inbox_service_proto_goTypes = []interface{}{ (Inbox_Status)(0), // 0: memos.api.v2.Inbox.Status (Inbox_Type)(0), // 1: memos.api.v2.Inbox.Type (*Inbox)(nil), // 2: memos.api.v2.Inbox - (*ListInboxRequest)(nil), // 3: memos.api.v2.ListInboxRequest - (*ListInboxResponse)(nil), // 4: memos.api.v2.ListInboxResponse + (*ListInboxesRequest)(nil), // 3: memos.api.v2.ListInboxesRequest + (*ListInboxesResponse)(nil), // 4: memos.api.v2.ListInboxesResponse (*UpdateInboxRequest)(nil), // 5: memos.api.v2.UpdateInboxRequest (*UpdateInboxResponse)(nil), // 6: memos.api.v2.UpdateInboxResponse (*DeleteInboxRequest)(nil), // 7: memos.api.v2.DeleteInboxRequest (*DeleteInboxResponse)(nil), // 8: memos.api.v2.DeleteInboxResponse - (*fieldmaskpb.FieldMask)(nil), // 9: google.protobuf.FieldMask + (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp + (*fieldmaskpb.FieldMask)(nil), // 10: google.protobuf.FieldMask } var file_api_v2_inbox_service_proto_depIdxs = []int32{ - 0, // 0: memos.api.v2.Inbox.status:type_name -> memos.api.v2.Inbox.Status - 1, // 1: memos.api.v2.Inbox.type:type_name -> memos.api.v2.Inbox.Type - 2, // 2: memos.api.v2.ListInboxResponse.inbox:type_name -> memos.api.v2.Inbox - 2, // 3: memos.api.v2.UpdateInboxRequest.inbox:type_name -> memos.api.v2.Inbox - 9, // 4: memos.api.v2.UpdateInboxRequest.update_mask:type_name -> google.protobuf.FieldMask - 2, // 5: memos.api.v2.UpdateInboxResponse.inbox:type_name -> memos.api.v2.Inbox - 3, // 6: memos.api.v2.InboxService.ListInbox:input_type -> memos.api.v2.ListInboxRequest - 5, // 7: memos.api.v2.InboxService.UpdateInbox:input_type -> memos.api.v2.UpdateInboxRequest - 7, // 8: memos.api.v2.InboxService.DeleteInbox:input_type -> memos.api.v2.DeleteInboxRequest - 4, // 9: memos.api.v2.InboxService.ListInbox:output_type -> memos.api.v2.ListInboxResponse - 6, // 10: memos.api.v2.InboxService.UpdateInbox:output_type -> memos.api.v2.UpdateInboxResponse - 8, // 11: memos.api.v2.InboxService.DeleteInbox:output_type -> memos.api.v2.DeleteInboxResponse - 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 + 0, // 0: memos.api.v2.Inbox.status:type_name -> memos.api.v2.Inbox.Status + 9, // 1: memos.api.v2.Inbox.create_time:type_name -> google.protobuf.Timestamp + 1, // 2: memos.api.v2.Inbox.type:type_name -> memos.api.v2.Inbox.Type + 2, // 3: memos.api.v2.ListInboxesResponse.inboxes:type_name -> memos.api.v2.Inbox + 2, // 4: memos.api.v2.UpdateInboxRequest.inbox:type_name -> memos.api.v2.Inbox + 10, // 5: memos.api.v2.UpdateInboxRequest.update_mask:type_name -> google.protobuf.FieldMask + 2, // 6: memos.api.v2.UpdateInboxResponse.inbox:type_name -> memos.api.v2.Inbox + 3, // 7: memos.api.v2.InboxService.ListInboxes:input_type -> memos.api.v2.ListInboxesRequest + 5, // 8: memos.api.v2.InboxService.UpdateInbox:input_type -> memos.api.v2.UpdateInboxRequest + 7, // 9: memos.api.v2.InboxService.DeleteInbox:input_type -> memos.api.v2.DeleteInboxRequest + 4, // 10: memos.api.v2.InboxService.ListInboxes:output_type -> memos.api.v2.ListInboxesResponse + 6, // 11: memos.api.v2.InboxService.UpdateInbox:output_type -> memos.api.v2.UpdateInboxResponse + 8, // 12: memos.api.v2.InboxService.DeleteInbox:output_type -> memos.api.v2.DeleteInboxResponse + 10, // [10:13] is the sub-list for method output_type + 7, // [7:10] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_api_v2_inbox_service_proto_init() } @@ -653,7 +671,7 @@ func file_api_v2_inbox_service_proto_init() { } } file_api_v2_inbox_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListInboxRequest); i { + switch v := v.(*ListInboxesRequest); i { case 0: return &v.state case 1: @@ -665,7 +683,7 @@ func file_api_v2_inbox_service_proto_init() { } } file_api_v2_inbox_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListInboxResponse); i { + switch v := v.(*ListInboxesResponse); i { case 0: return &v.state case 1: diff --git a/proto/gen/api/v2/inbox_service.pb.gw.go b/proto/gen/api/v2/inbox_service.pb.gw.go index 2abf1513fcc88..b8ca6f1efcf74 100644 --- a/proto/gen/api/v2/inbox_service.pb.gw.go +++ b/proto/gen/api/v2/inbox_service.pb.gw.go @@ -32,37 +32,37 @@ var _ = utilities.NewDoubleArray var _ = metadata.Join var ( - filter_InboxService_ListInbox_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_InboxService_ListInboxes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_InboxService_ListInbox_0(ctx context.Context, marshaler runtime.Marshaler, client InboxServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListInboxRequest +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 var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, ""%v"", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InboxService_ListInbox_0); err != nil { + 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.ListInbox(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ListInboxes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_InboxService_ListInbox_0(ctx context.Context, marshaler runtime.Marshaler, server InboxServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListInboxRequest +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 var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, ""%v"", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InboxService_ListInbox_0); err != nil { + 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.ListInbox(ctx, &protoReq) + msg, err := server.ListInboxes(ctx, &protoReq) return msg, metadata, err } @@ -191,7 +191,7 @@ func local_request_InboxService_DeleteInbox_0(ctx context.Context, marshaler run // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterInboxServiceHandlerFromEndpoint instead. func RegisterInboxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InboxServiceServer) error { - mux.Handle(""GET"", pattern_InboxService_ListInbox_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(""GET"", 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 @@ -199,12 +199,12 @@ func RegisterInboxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, ""/memos.api.v2.InboxService/ListInbox"", runtime.WithHTTPPathPattern(""/api/v2/inbox"")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, ""/memos.api.v2.InboxService/ListInboxes"", runtime.WithHTTPPathPattern(""/api/v2/inboxes"")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_InboxService_ListInbox_0(annotatedContext, inboundMarshaler, server, req, pathParams) + 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 { @@ -212,7 +212,7 @@ func RegisterInboxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu return } - forward_InboxService_ListInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_InboxService_ListInboxes_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -224,7 +224,7 @@ func RegisterInboxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, ""/memos.api.v2.InboxService/UpdateInbox"", runtime.WithHTTPPathPattern(""/v2/inbox"")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, ""/memos.api.v2.InboxService/UpdateInbox"", runtime.WithHTTPPathPattern(""/v2/inboxes"")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -249,7 +249,7 @@ func RegisterInboxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, ""/memos.api.v2.InboxService/DeleteInbox"", runtime.WithHTTPPathPattern(""/v2/{name=inbox/*}"")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, ""/memos.api.v2.InboxService/DeleteInbox"", runtime.WithHTTPPathPattern(""/v2/{name=inboxes/*}"")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -307,25 +307,25 @@ func RegisterInboxServiceHandler(ctx context.Context, mux *runtime.ServeMux, con // ""InboxServiceClient"" to call the correct interceptors. func RegisterInboxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InboxServiceClient) error { - mux.Handle(""GET"", pattern_InboxService_ListInbox_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(""GET"", 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) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, ""/memos.api.v2.InboxService/ListInbox"", runtime.WithHTTPPathPattern(""/api/v2/inbox"")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, ""/memos.api.v2.InboxService/ListInboxes"", runtime.WithHTTPPathPattern(""/api/v2/inboxes"")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_InboxService_ListInbox_0(annotatedContext, inboundMarshaler, client, req, pathParams) + 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_ListInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_InboxService_ListInboxes_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -335,7 +335,7 @@ func RegisterInboxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, ""/memos.api.v2.InboxService/UpdateInbox"", runtime.WithHTTPPathPattern(""/v2/inbox"")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, ""/memos.api.v2.InboxService/UpdateInbox"", runtime.WithHTTPPathPattern(""/v2/inboxes"")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -357,7 +357,7 @@ func RegisterInboxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, ""/memos.api.v2.InboxService/DeleteInbox"", runtime.WithHTTPPathPattern(""/v2/{name=inbox/*}"")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, ""/memos.api.v2.InboxService/DeleteInbox"", runtime.WithHTTPPathPattern(""/v2/{name=inboxes/*}"")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -377,15 +377,15 @@ func RegisterInboxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu } var ( - pattern_InboxService_ListInbox_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{""api"", ""v2"", ""inbox""}, """")) + pattern_InboxService_ListInboxes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{""api"", ""v2"", ""inboxes""}, """")) - pattern_InboxService_UpdateInbox_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{""v2"", ""inbox""}, """")) + pattern_InboxService_UpdateInbox_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{""v2"", ""inboxes""}, """")) - pattern_InboxService_DeleteInbox_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{""v2"", ""inbox"", ""name""}, """")) + pattern_InboxService_DeleteInbox_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{""v2"", ""inboxes"", ""name""}, """")) ) var ( - forward_InboxService_ListInbox_0 = runtime.ForwardResponseMessage + forward_InboxService_ListInboxes_0 = runtime.ForwardResponseMessage forward_InboxService_UpdateInbox_0 = runtime.ForwardResponseMessage diff --git a/proto/gen/api/v2/inbox_service_grpc.pb.go b/proto/gen/api/v2/inbox_service_grpc.pb.go index 5b2ba2a8d04ab..806ae7ade8350 100644 --- a/proto/gen/api/v2/inbox_service_grpc.pb.go +++ b/proto/gen/api/v2/inbox_service_grpc.pb.go @@ -19,7 +19,7 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - InboxService_ListInbox_FullMethodName = ""/memos.api.v2.InboxService/ListInbox"" + InboxService_ListInboxes_FullMethodName = ""/memos.api.v2.InboxService/ListInboxes"" InboxService_UpdateInbox_FullMethodName = ""/memos.api.v2.InboxService/UpdateInbox"" InboxService_DeleteInbox_FullMethodName = ""/memos.api.v2.InboxService/DeleteInbox"" ) @@ -28,7 +28,7 @@ const ( // // 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 { - ListInbox(ctx context.Context, in *ListInboxRequest, opts ...grpc.CallOption) (*ListInboxResponse, error) + ListInboxes(ctx context.Context, in *ListInboxesRequest, opts ...grpc.CallOption) (*ListInboxesResponse, error) UpdateInbox(ctx context.Context, in *UpdateInboxRequest, opts ...grpc.CallOption) (*UpdateInboxResponse, error) DeleteInbox(ctx context.Context, in *DeleteInboxRequest, opts ...grpc.CallOption) (*DeleteInboxResponse, error) } @@ -41,9 +41,9 @@ func NewInboxServiceClient(cc grpc.ClientConnInterface) InboxServiceClient { return &inboxServiceClient{cc} } -func (c *inboxServiceClient) ListInbox(ctx context.Context, in *ListInboxRequest, opts ...grpc.CallOption) (*ListInboxResponse, error) { - out := new(ListInboxResponse) - err := c.cc.Invoke(ctx, InboxService_ListInbox_FullMethodName, in, out, opts...) +func (c *inboxServiceClient) ListInboxes(ctx context.Context, in *ListInboxesRequest, opts ...grpc.CallOption) (*ListInboxesResponse, error) { + out := new(ListInboxesResponse) + err := c.cc.Invoke(ctx, InboxService_ListInboxes_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -72,7 +72,7 @@ func (c *inboxServiceClient) DeleteInbox(ctx context.Context, in *DeleteInboxReq // All implementations must embed UnimplementedInboxServiceServer // for forward compatibility type InboxServiceServer interface { - ListInbox(context.Context, *ListInboxRequest) (*ListInboxResponse, error) + ListInboxes(context.Context, *ListInboxesRequest) (*ListInboxesResponse, error) UpdateInbox(context.Context, *UpdateInboxRequest) (*UpdateInboxResponse, error) DeleteInbox(context.Context, *DeleteInboxRequest) (*DeleteInboxResponse, error) mustEmbedUnimplementedInboxServiceServer() @@ -82,8 +82,8 @@ type InboxServiceServer interface { type UnimplementedInboxServiceServer struct { } -func (UnimplementedInboxServiceServer) ListInbox(context.Context, *ListInboxRequest) (*ListInboxResponse, error) { - return nil, status.Errorf(codes.Unimplemented, ""method ListInbox not implemented"") +func (UnimplementedInboxServiceServer) ListInboxes(context.Context, *ListInboxesRequest) (*ListInboxesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, ""method ListInboxes not implemented"") } func (UnimplementedInboxServiceServer) UpdateInbox(context.Context, *UpdateInboxRequest) (*UpdateInboxResponse, error) { return nil, status.Errorf(codes.Unimplemented, ""method UpdateInbox not implemented"") @@ -104,20 +104,20 @@ func RegisterInboxServiceServer(s grpc.ServiceRegistrar, srv InboxServiceServer) s.RegisterService(&InboxService_ServiceDesc, srv) } -func _InboxService_ListInbox_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListInboxRequest) +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).ListInbox(ctx, in) + return srv.(InboxServiceServer).ListInboxes(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: InboxService_ListInbox_FullMethodName, + FullMethod: InboxService_ListInboxes_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(InboxServiceServer).ListInbox(ctx, req.(*ListInboxRequest)) + return srv.(InboxServiceServer).ListInboxes(ctx, req.(*ListInboxesRequest)) } return interceptor(ctx, in, info, handler) } @@ -166,8 +166,8 @@ var InboxService_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*InboxServiceServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: ""ListInbox"", - Handler: _InboxService_ListInbox_Handler, + MethodName: ""ListInboxes"", + Handler: _InboxService_ListInboxes_Handler, }, { MethodName: ""UpdateInbox"", diff --git a/store/db/mysql/inbox.go b/store/db/mysql/inbox.go index 6c4fa65e7d6b7..10be427872202 100644 --- a/store/db/mysql/inbox.go +++ b/store/db/mysql/inbox.go @@ -12,7 +12,7 @@ func (d *DB) CreateInbox(ctx context.Context, create *store.Inbox) (*store.Inbox } // nolint -func (d *DB) ListInbox(ctx context.Context, find *store.FindInbox) ([]*store.Inbox, error) { +func (d *DB) ListInboxes(ctx context.Context, find *store.FindInbox) ([]*store.Inbox, error) { return nil, nil } diff --git a/store/db/sqlite/inbox.go b/store/db/sqlite/inbox.go index 1b0e6e090d239..bb99e91a45303 100644 --- a/store/db/sqlite/inbox.go +++ b/store/db/sqlite/inbox.go @@ -36,7 +36,7 @@ func (d *DB) CreateInbox(ctx context.Context, create *store.Inbox) (*store.Inbox return create, nil } -func (d *DB) ListInbox(ctx context.Context, find *store.FindInbox) ([]*store.Inbox, error) { +func (d *DB) ListInboxes(ctx context.Context, find *store.FindInbox) ([]*store.Inbox, error) { where, args := []string{""1 = 1""}, []any{} if find.ID != nil { diff --git a/store/driver.go b/store/driver.go index d05ed1c283702..f434fecb7c051 100644 --- a/store/driver.go +++ b/store/driver.go @@ -84,7 +84,7 @@ type Driver interface { // Inbox model related methods. CreateInbox(ctx context.Context, create *Inbox) (*Inbox, error) - ListInbox(ctx context.Context, find *FindInbox) ([]*Inbox, error) + ListInboxes(ctx context.Context, find *FindInbox) ([]*Inbox, error) UpdateInbox(ctx context.Context, update *UpdateInbox) (*Inbox, error) DeleteInbox(ctx context.Context, delete *DeleteInbox) error } diff --git a/store/inbox.go b/store/inbox.go index e94cbae9d3389..fd3e407137eef 100644 --- a/store/inbox.go +++ b/store/inbox.go @@ -44,8 +44,8 @@ func (s *Store) CreateInbox(ctx context.Context, create *Inbox) (*Inbox, error) return s.driver.CreateInbox(ctx, create) } -func (s *Store) ListInbox(ctx context.Context, find *FindInbox) ([]*Inbox, error) { - return s.driver.ListInbox(ctx, find) +func (s *Store) ListInboxes(ctx context.Context, find *FindInbox) ([]*Inbox, error) { + return s.driver.ListInboxes(ctx, find) } func (s *Store) UpdateInbox(ctx context.Context, update *UpdateInbox) (*Inbox, error) { diff --git a/test/store/inbox_test.go b/test/store/inbox_test.go index dc88363aea4a2..02f512b1858b5 100644 --- a/test/store/inbox_test.go +++ b/test/store/inbox_test.go @@ -28,7 +28,7 @@ func TestInboxStore(t *testing.T) { require.NoError(t, err) require.NotNil(t, inbox) require.Equal(t, create.Message, inbox.Message) - inboxes, err := ts.ListInbox(ctx, &store.FindInbox{ + inboxes, err := ts.ListInboxes(ctx, &store.FindInbox{ ReceiverID: &user.ID, }) require.NoError(t, err) @@ -45,7 +45,7 @@ func TestInboxStore(t *testing.T) { ID: inbox.ID, }) require.NoError(t, err) - inboxes, err = ts.ListInbox(ctx, &store.FindInbox{ + inboxes, err = ts.ListInboxes(ctx, &store.FindInbox{ ReceiverID: &user.ID, }) require.NoError(t, err)",chore,rename list inbox cd3a98c0956cebc640310988468ce6c5cb588286,2024-01-15 17:38:14,THELOSTSOUL,fix: change use-set priority (#2760),False,"diff --git a/web/src/store/module/global.ts b/web/src/store/module/global.ts index 680134ea838f5..efd5a41ca3110 100644 --- a/web/src/store/module/global.ts +++ b/web/src/store/module/global.ts @@ -45,8 +45,8 @@ export const initialGlobalState = async () => { }, }; defaultGlobalState.locale = - defaultGlobalState.locale || defaultGlobalState.systemStatus.customizedProfile.locale || findNearestLanguageMatch(i18n.language); - defaultGlobalState.appearance = defaultGlobalState.appearance || defaultGlobalState.systemStatus.customizedProfile.appearance; + defaultGlobalState.systemStatus.customizedProfile.locale || defaultGlobalState.locale || findNearestLanguageMatch(i18n.language); + defaultGlobalState.appearance = defaultGlobalState.systemStatus.customizedProfile.appearance || defaultGlobalState.appearance; } store.dispatch(setGlobalState(defaultGlobalState)); };",fix,change use-set priority (#2760) 7564c40c8d846c4c30b8fb1357d23b924e16bd6c,2024-07-27 20:38:22,Steven,chore: fix env init,False,"diff --git a/bin/memos/main.go b/bin/memos/main.go index 62a302199f125..4df196a7496be 100644 --- a/bin/memos/main.go +++ b/bin/memos/main.go @@ -31,12 +31,25 @@ const ( ) var ( - instanceProfile *profile.Profile - rootCmd = &cobra.Command{ Use: ""memos"", Short: `An open source, lightweight note-taking service. Easily capture and share your great thoughts.`, Run: func(_ *cobra.Command, _ []string) { + instanceProfile := &profile.Profile{ + Mode: viper.GetString(""mode""), + Addr: viper.GetString(""addr""), + Port: viper.GetInt(""port""), + Data: viper.GetString(""data""), + Driver: viper.GetString(""driver""), + DSN: viper.GetString(""dsn""), + Public: viper.GetBool(""public""), + PasswordAuth: viper.GetBool(""password-auth""), + Version: version.GetCurrentVersion(viper.GetString(""mode"")), + } + if err := instanceProfile.Validate(); err != nil { + panic(err) + } + ctx, cancel := context.WithCancel(context.Background()) dbDriver, err := db.NewDBDriver(instanceProfile) if err != nil { @@ -77,7 +90,7 @@ var ( } } - printGreetings() + printGreetings(instanceProfile) go func() { <-c @@ -91,11 +104,14 @@ var ( } ) -func Execute() error { - return rootCmd.Execute() -} - func init() { + viper.SetDefault(""mode"", ""demo"") + viper.SetDefault(""driver"", ""sqlite"") + viper.SetDefault(""addr"", """") + viper.SetDefault(""port"", 8081) + viper.SetDefault(""public"", false) + viper.SetDefault(""password-auth"", true) + rootCmd.PersistentFlags().String(""mode"", ""demo"", `mode of server, can be ""prod"" or ""dev"" or ""demo""`) rootCmd.PersistentFlags().String(""addr"", """", ""address of server"") rootCmd.PersistentFlags().Int(""port"", 8081, ""port of server"") @@ -143,29 +159,9 @@ func init() { if err := viper.BindEnv(""password-auth"", ""MEMOS_PASSWORD_AUTH""); err != nil { panic(err) } +} - viper.SetDefault(""mode"", ""demo"") - viper.SetDefault(""driver"", ""sqlite"") - viper.SetDefault(""addr"", """") - viper.SetDefault(""port"", 8081) - viper.SetDefault(""public"", false) - viper.SetDefault(""password-auth"", true) - - instanceProfile = &profile.Profile{ - Mode: viper.GetString(""mode""), - Addr: viper.GetString(""addr""), - Port: viper.GetInt(""port""), - Data: viper.GetString(""data""), - Driver: viper.GetString(""driver""), - DSN: viper.GetString(""dsn""), - Public: viper.GetBool(""public""), - PasswordAuth: viper.GetBool(""password-auth""), - Version: version.GetCurrentVersion(viper.GetString(""mode"")), - } - if err := instanceProfile.Validate(); err != nil { - panic(err) - } - +func printGreetings(profile *profile.Profile) { fmt.Printf(`--- Server profile version: %s @@ -178,15 +174,13 @@ public: %t password-auth: %t driver: %s --- -`, instanceProfile.Version, instanceProfile.Data, instanceProfile.DSN, instanceProfile.Addr, instanceProfile.Port, instanceProfile.Mode, instanceProfile.Public, instanceProfile.PasswordAuth, instanceProfile.Driver) -} +`, profile.Version, profile.Data, profile.DSN, profile.Addr, profile.Port, profile.Mode, profile.Public, profile.PasswordAuth, profile.Driver) -func printGreetings() { print(greetingBanner) - if len(instanceProfile.Addr) == 0 { - fmt.Printf(""Version %s has been started on port %d\n"", instanceProfile.Version, instanceProfile.Port) + if len(profile.Addr) == 0 { + fmt.Printf(""Version %s has been started on port %d\n"", profile.Version, profile.Port) } else { - fmt.Printf(""Version %s has been started on address '%s' and port %d\n"", instanceProfile.Version, instanceProfile.Addr, instanceProfile.Port) + fmt.Printf(""Version %s has been started on address '%s' and port %d\n"", profile.Version, profile.Addr, profile.Port) } fmt.Printf(`--- See more in: @@ -197,8 +191,7 @@ See more in: } func main() { - err := Execute() - if err != nil { + if err := rootCmd.Execute(); err != nil { panic(err) } } diff --git a/scripts/.air.toml b/scripts/.air.toml index 110e099aee1f3..761b408bb63c7 100644 --- a/scripts/.air.toml +++ b/scripts/.air.toml @@ -2,7 +2,7 @@ root = ""."" tmp_dir = "".air"" [build] -bin = ""./.air/memos --mode dev"" +bin = ""./.air/memos --mode dev --public true"" cmd = ""go build -o ./.air/memos ./bin/memos/main.go"" delay = 1000 exclude_dir = ["".air"", ""web"", ""build""] diff --git a/server/router/api/v1/memo_service.go b/server/router/api/v1/memo_service.go index 5a7a5c57adc9b..2a638447bf5ca 100644 --- a/server/router/api/v1/memo_service.go +++ b/server/router/api/v1/memo_service.go @@ -772,11 +772,6 @@ func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Mem displayTs = memo.UpdatedTs } - creator, err := s.Store.GetUser(ctx, &store.FindUser{ID: &memo.CreatorID}) - if err != nil { - return nil, errors.Wrap(err, ""failed to get creator"") - } - name := fmt.Sprintf(""%s%d"", MemoNamePrefix, memo.ID) listMemoRelationsResponse, err := s.ListMemoRelations(ctx, &v1pb.ListMemoRelationsRequest{Name: name}) if err != nil { @@ -807,7 +802,7 @@ func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Mem Name: name, Uid: memo.UID, RowStatus: convertRowStatusFromStore(memo.RowStatus), - Creator: fmt.Sprintf(""%s%d"", UserNamePrefix, creator.ID), + Creator: fmt.Sprintf(""%s%d"", UserNamePrefix, memo.CreatorID), CreateTime: timestamppb.New(time.Unix(memo.CreatedTs, 0)), UpdateTime: timestamppb.New(time.Unix(memo.UpdatedTs, 0)), DisplayTime: timestamppb.New(time.Unix(displayTs, 0)),",chore,fix env init 5caa8cdec5364227490ec9093aea6ebc319c6815,2023-04-03 14:32:47,boojack,chore: delete resource related file (#1456),False,"diff --git a/server/resource.go b/server/resource.go index 78fb1ba9a4a97..39c264ddcfa41 100644 --- a/server/resource.go +++ b/server/resource.go @@ -19,7 +19,9 @@ import ( ""github.com/pkg/errors"" ""github.com/usememos/memos/api"" ""github.com/usememos/memos/common"" + ""github.com/usememos/memos/common/log"" ""github.com/usememos/memos/plugin/storage/s3"" + ""go.uber.org/zap"" ) const ( @@ -294,6 +296,13 @@ func (s *Server) registerResourceRoutes(g *echo.Group) { return echo.NewHTTPError(http.StatusUnauthorized, ""Unauthorized"") } + if resource.InternalPath != """" { + err := os.Remove(resource.InternalPath) + if err != nil { + log.Warn(fmt.Sprintf(""failed to delete local file with path %s"", resource.InternalPath), zap.Error(err)) + } + } + resourceDelete := &api.ResourceDelete{ ID: resourceID, }",chore,delete resource related file (#1456) 0020498c101bbb93ef8fb8246652202fa4a879b1,2023-04-09 18:27:50,Peng Ding,feat: update Chinese translations in zh.json and zh-Hant.json using locale_updater.py (#1506),False,"diff --git a/web/src/locales/locale_updater.py b/web/src/locales/locale_updater.py new file mode 100644 index 0000000000000..8ce91aa22439b --- /dev/null +++ b/web/src/locales/locale_updater.py @@ -0,0 +1,202 @@ +# Author: Oaklight +# GitHub profile: https://github.com/Oaklight +# Date: April 9, 2023 +# Description: This script is used to patch missing translations in a locale file. + +# The script uses 'en.json' as the reference file to find missing keys in other locale files. +# It iterates through each field and their entries in 'en.json' and checks if the same field/entry exists in other files. +# If a field/entry is missing, the script prompts the source string, reference Google translation, and asks for confirmation or correction. +# The resulting file is saved as './*.proposed.json', and you should review it before merging and uploading. + +# usage: locale_updater.py [-h] ref_locale tgt_locale + +#TODO: add other NMT system for different preference and accuracy + +import json +import requests + + +def flatten_json(nested_json, parent_key="""", sep="":""): + flattened_dict = {} + for key, value in nested_json.items(): + new_key = parent_key + sep + key if parent_key else key + if isinstance(value, dict): + flattened_dict.update(flatten_json(value, new_key, sep)) + else: + flattened_dict[new_key] = value + return flattened_dict + + +def unflatten_json(flattened_dict, sep="":""): + nested_json = {} + for key, value in flattened_dict.items(): + parts = key.split(sep) + current = nested_json + for part in parts[:-1]: + if part not in current: + current[part] = {} + current = current[part] + current[parts[-1]] = value + return nested_json + + +def sort_nested_json(nested_json): + if isinstance(nested_json, dict): + sorted_dict = {} + for key in sorted(nested_json.keys()): + sorted_dict[key] = sort_nested_json(nested_json[key]) + return sorted_dict + elif isinstance(nested_json, list): + sorted_list = [] + for item in nested_json: + sorted_list.append(sort_nested_json(item)) + return sorted_list + else: + return nested_json + + +def google_translate( + source_text, source_language=""en"", target_language=""zh-CN"" +): + # Create post content + new_line = ""\r\n"" + post_content = ""q="" + source_text.replace(new_line, "" "") + + # Send post request and get JSON response, using source_language and target_language + # url = ""https://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=zh-CN&dt=t"" + url = f""https://translate.googleapis.com/translate_a/single?client=gtx&sl={source_language}&tl={target_language}&dt=t"" + headers = {""Content-type"": ""application/x-www-form-urlencoded""} + response = requests.post(url, headers=headers, data=post_content.encode(""utf-8"")) + json_value = response.json() + + # Extract translations from JSON + translations = [item[0] for item in json_value[0]] + translations = [t.replace(new_line, """") for t in translations] + target_text = translations[0] + + return target_text + + +def get_code_name(json_filename): + # Remove extension and split language and country codes + file_parts = json_filename.split(""."")[0].split(""_"") + lang_code = file_parts[0] + country_code = file_parts[1] if len(file_parts) > 1 else """" + + # Map language code to code name + lang_map = { + ""de"": ""de"", + ""en"": ""en"", + ""es"": ""es"", + ""fr"": ""fr"", + ""it"": ""it"", + ""ko"": ""ko"", + ""nl"": ""nl"", + ""pl"": ""pl"", + ""pt"": ""pt-BR"", + ""ru"": ""ru"", + ""sl"": ""sl"", + ""sv"": ""sv"", + ""tr"": ""tr"", + ""uk"": ""uk"", + ""vi"": ""vi"", + ""zh-Hant"": ""zh-TW"", + ""zh"": ""zh-CN"", + } + code_name = lang_map.get(lang_code, """") + + # Add country code if available + if country_code: + code_name += ""-"" + country_code.upper() + + return code_name + + +if __name__ == ""__main__"": + # ref_locale = ""./en.json"" + # tgt_locale = ""./zh.json"" + # receive the reference locale and target locale from the command line using argparse + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument(""ref_locale"", help=""reference locale file"") + parser.add_argument(""tgt_locale"", help=""target locale file"") + args = parser.parse_args() + ref_locale = args.ref_locale + tgt_locale = args.tgt_locale + + ref_codename = get_code_name(ref_locale) + tgt_codename = get_code_name(tgt_locale) + + with open(ref_locale, ""r"") as f: + ref = json.load(f) + + with open(tgt_locale, ""r"") as f: + tgt = json.load(f) + + # using the flatten_json function, produce a temp json for each locale and save to the disk + ref_flat = flatten_json(ref) + tgt_flat = flatten_json(tgt) + + # # save the flattened json to the disk + # with open(""ref_flat.json"", ""w"") as f: + # json.dump(ref_flat, f, indent=2, ensure_ascii=False) + # with open(""tgt_flat.json"", ""w"") as f: + # json.dump(tgt_flat, f, indent=2, ensure_ascii=False) + + # first diff the keys to inform the user of the missing keys + missing_keys = set(ref_flat.keys()) - set(tgt_flat.keys()) + # print total number of missing keys, in red color, number as default + if len(missing_keys) == 0: + print(""\033[92m All keys are present in the target locale \033[0m"") + exit() + else: + print(f""\033[91m Total missing keys: \033[0m {len(missing_keys)}"") + + + # formatted print line by line, wrap the missing key in red color, and the English translation in green color + for key in missing_keys: + # print(f""Missing key: {key} | English: {ref_flat[key]}"") + print( + ""\033[91m"" + + f""Missing key: {key}"" + + ""\033[0m"" + + "" | "" + + ""\033[92m"" + + f""English: {ref_flat[key]}"" + + ""\033[0m"" + ) + print(""============================================="") + print(f""\033[91m Total missing keys: \033[0m {len(missing_keys)}"") + + + # now compare the tgt_flat with ref_flat to find all missing keys and prompt to terminal for translation. Then save back to the tgt_flat + + # iterate over the missing key and their corresponding values in ref_flat, to get reference google translation using google_translate_to_chinese function + # then present the reference translation to the user in the terminal + # then present the user with a prompt to ask for translation + for i, key in enumerate(missing_keys): + print( + f""============================================= {i + 1}/{len(missing_keys)}"" + ) + # print wrap the missing key in red color, and the English translation in green color + print(""\033[91m"" + ""Missing key: "" + ""\033[0m"" + key) + print(""\033[92m"" + f""{ref_codename}: "" + ""\033[0m"" + ref_flat[key]) + # get reference translation from google translate, print in blue + proposal_google = google_translate(ref_flat[key], ref_codename, tgt_codename) + print(""\033[94m"" + f""Reference {tgt_codename} translation: "" + ""\033[0m"" + proposal_google) + # prompt user for translation, or enter to use the reference translation, in green color + proposal = input(""\033[92m"" + ""Enter translation: "" + ""\033[0m"") + if proposal == """": + proposal = proposal_google + # save the translation to the tgt_flat + tgt_flat[key] = proposal + + # unflatten the ref_flat.json and tgt_flat.json back to the original format. save to another file + ref_unflat = unflatten_json(ref_flat) + tgt_unflat = unflatten_json(tgt_flat) + # save the unflattened json to the disk, with original tgt file name with "".proposed"" appended before .json + # by getting the file name from from the tgt_locale path + tgt_locale_name = tgt_locale.split(""/"")[-1].split(""."")[0] + with open(f""{tgt_locale_name}.proposed.json"", ""w"") as f: + json.dump(tgt_unflat, f, indent=2, ensure_ascii=False) diff --git a/web/src/locales/zh-Hant.json b/web/src/locales/zh-Hant.json index c791dae587665..5ec9b58bafc87 100644 --- a/web/src/locales/zh-Hant.json +++ b/web/src/locales/zh-Hant.json @@ -52,12 +52,20 @@ ""vacuum"": ""清理"", ""select"": ""選擇"", ""database"": ""資料庫"", - ""avatar"": ""頭像"" + ""avatar"": ""頭像"", + ""upload"": ""上傳"", + ""rename"": ""改名"", + ""name"": ""姓名"", + ""visibility"": ""能見度"", + ""clear"": ""清除"", + ""preview"": ""預覽"" }, ""auth"": { ""signup-as-host"": ""註冊為管理員"", ""host-tip"": ""你正在註冊為管理員帳號。"", - ""not-host-tip"": ""如果你沒有帳號,請聯絡網站管理員。"" + ""not-host-tip"": ""如果你沒有帳號,請聯絡網站管理員。"", + ""new-password"": ""新密碼"", + ""repeat-new-password"": ""重複新密碼"" }, ""resource"": { ""description"": ""查看在 Memo 中的靜態資源。例如:圖片"", @@ -78,7 +86,24 @@ ""no-files-selected"": ""沒有文件被選中❗"", ""upload-successfully"": ""上傳成功"", ""file-drag-drop-prompt"": ""將您的文件拖放到此處以上傳文件"", - ""select"": ""選擇"" + ""select"": ""選擇"", + ""create-dialog"": { + ""upload-method"": ""上傳方式"", + ""local-file"": { + ""choose"": ""選擇一個文件..."", + ""option"": ""本地文件"" + }, + ""external-link"": { + ""file-name-placeholder"": ""文件名"", + ""option"": ""外部鏈接"", + ""type-placeholder"": ""文件類型"", + ""link"": ""鏈接"", + ""type"": ""類型"", + ""file-name"": ""文件名"" + }, + ""title"": ""創建資源"" + }, + ""search-bar-placeholder"": ""搜索資源"" }, ""archived"": { ""archived-memos"": ""已封存的 Memo"", @@ -104,7 +129,14 @@ ""protected"": ""登入使用者可見"", ""public"": ""所有人可見"", ""disabled"": ""公共memos已禁用"" - } + }, + ""fetching-data"": ""正在獲取數據..."", + ""archived-memos"": ""歸檔備忘錄"", + ""archived-at"": ""存檔於"", + ""fetch-more"": ""點擊此處獲取更多"", + ""embed"": ""嵌入"", + ""no-archived-memos"": ""沒有存檔的備忘錄。"", + ""search-placeholder"": ""搜索備忘錄"" }, ""memo-list"": { ""fetching-data"": ""讀取資料中..."", @@ -144,7 +176,10 @@ ""text-placeholder"": ""以 ^ 開頭使用正則表達式"" }, ""tag-list"": { - ""tip-text"": ""輸入`#tag `來新增標籤"" + ""tip-text"": ""輸入`#tag `來新增標籤"", + ""create-tag"": ""創建標籤"", + ""tag-name"": ""標籤名"", + ""all-tags"": ""所有標籤"" }, ""search"": { ""quickly-filter"": ""快速過濾"" @@ -170,7 +205,9 @@ ""mobile-editor-style"": ""手機版編輯器樣式"", ""default-memo-sort-option"": ""Memo 顯示時間"", ""created_ts"": ""建立時間"", - ""updated_ts"": ""更新時間"" + ""updated_ts"": ""更新時間"", + ""daily-review-time-offset"": ""每日回顧時間偏移"", + ""default-resource-visibility"": ""默認資源可見性"" }, ""storage-section"": { ""storage-services-list"": ""存儲服務列表"", @@ -252,7 +289,8 @@ ""succeed-update-additional-script"": ""更新附加腳本成功"", ""update-succeed"": ""更新成功"", ""page-not-found"": ""404 - 未找到網頁 😥"", - ""succeed-vacuum-database"": ""清理資料庫成功"" + ""succeed-vacuum-database"": ""清理資料庫成功"", + ""resource-ready"": ""所有資源都準備好了"" }, ""days"": { ""monday"": ""星期一"", @@ -269,5 +307,23 @@ ""sat"": ""六"", ""sunday"": ""星期天"", ""sun"": ""日"" + }, + ""router"": { + ""back-to-home"": ""回到首頁"" + }, + ""ask-ai"": { + ""not-enabled"": ""您尚未設置 OpenAI API 密鑰。"", + ""title"": ""問AI"", + ""placeholder"": ""隨便問"", + ""go-to-settings"": ""前往設置"" + }, + ""embed-memo"": { + ""only-public-supported"": ""* 僅公開備忘錄支持。"", + ""title"": ""嵌入備忘錄"", + ""copy"": ""複製"", + ""text"": ""將以下代碼複製並粘貼到您的博客或網站中。"" + }, + ""daily-review"": { + ""title"": ""每日回顧"" } -} +} \ No newline at end of file diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index aba4d6ce6f7fe..22ddee566a093 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -52,12 +52,20 @@ ""vacuum"": ""清理"", ""select"": ""选择"", ""database"": ""数据库"", - ""avatar"": ""头像"" + ""avatar"": ""头像"", + ""rename"": ""改名"", + ""upload"": ""上传"", + ""visibility"": ""能见度"", + ""preview"": ""预览"", + ""name"": ""姓名"", + ""clear"": ""清除"" }, ""auth"": { ""signup-as-host"": ""注册为 Host"", ""host-tip"": ""你正在注册为 Host 用户账号。"", - ""not-host-tip"": ""如果你没有账号,请联系站点 Host"" + ""not-host-tip"": ""如果你没有账号,请联系站点 Host"", + ""new-password"": ""新密码"", + ""repeat-new-password"": ""重复新密码"" }, ""resource"": { ""description"": ""查看在 Memo 中的静态资源。例如:图片"", @@ -78,7 +86,24 @@ ""no-files-selected"": ""没有文件被选中❗"", ""upload-successfully"": ""上传成功"", ""file-drag-drop-prompt"": ""将您的文件拖放到此处以上传文件"", - ""select"": ""选择"" + ""select"": ""选择"", + ""create-dialog"": { + ""external-link"": { + ""type-placeholder"": ""文件类型"", + ""link"": ""链接"", + ""file-name"": ""文件名"", + ""type"": ""类型"", + ""file-name-placeholder"": ""文件名"", + ""option"": ""外部链接"" + }, + ""local-file"": { + ""choose"": ""选择一个文件..."", + ""option"": ""本地文件"" + }, + ""upload-method"": ""上传方式"", + ""title"": ""创建资源"" + }, + ""search-bar-placeholder"": ""搜索资源"" }, ""archived"": { ""archived-memos"": ""已归档的 Memo"", @@ -104,7 +129,14 @@ ""protected"": ""登录用户可见"", ""public"": ""所有人可见"", ""disabled"": ""公共memos已禁用"" - } + }, + ""embed"": ""嵌入"", + ""search-placeholder"": ""搜索备忘录"", + ""archived-at"": ""存档于"", + ""no-archived-memos"": ""没有存档的备忘录。"", + ""fetching-data"": ""正在获取数据..."", + ""archived-memos"": ""归档备忘录"", + ""fetch-more"": ""点击此处获取更多"" }, ""memo-list"": { ""fetching-data"": ""请求数据中..."", @@ -173,7 +205,9 @@ ""mobile-editor-style"": ""移动端编辑器样式"", ""default-memo-sort-option"": ""Memo 显示时间"", ""created_ts"": ""创建时间"", - ""updated_ts"": ""更新时间"" + ""updated_ts"": ""更新时间"", + ""daily-review-time-offset"": ""每日回顾时间偏移"", + ""default-resource-visibility"": ""默认资源可见性"" }, ""storage-section"": { ""storage-services-list"": ""存储服务列表"", @@ -272,5 +306,23 @@ ""sat"": ""六"", ""sunday"": ""星期天"", ""sun"": ""日"" + }, + ""embed-memo"": { + ""title"": ""嵌入备忘录"", + ""copy"": ""复制"", + ""only-public-supported"": ""* 仅支持公开备忘录。"", + ""text"": ""将以下代码复制并粘贴到您的博客或网站中。"" + }, + ""ask-ai"": { + ""placeholder"": ""随便问"", + ""title"": ""问AI"", + ""not-enabled"": ""您尚未设置 OpenAI API 密钥。"", + ""go-to-settings"": ""前往设置"" + }, + ""daily-review"": { + ""title"": ""每日回顾"" + }, + ""router"": { + ""back-to-home"": ""回到首页"" } -} +} \ No newline at end of file",feat,update Chinese translations in zh.json and zh-Hant.json using locale_updater.py (#1506) cdbd934c4e4287fcc984a3d12c080e7bdc2e2e02,2022-08-25 16:54:21,boojack,fix: tag regexp (#173),False,"diff --git a/server/tag.go b/server/tag.go index f6226da3cfa2a..19c123daf48af 100644 --- a/server/tag.go +++ b/server/tag.go @@ -47,7 +47,7 @@ func (s *Server) registerTagRoutes(g *echo.Group) { tagMapSet := make(map[string]bool) - r := regexp.MustCompile(""#(.+?) "") + r := regexp.MustCompile(`#([^\s]+?) `) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, ""Failed to compile regexp"").SetInternal(err) }",fix,tag regexp (#173) b0b2776d03501c25d6a38d5dd4ab933934113140,2022-09-08 21:54:41,boojack,chore: update button entries (#206),False,"diff --git a/web/src/components/MenuBtnsPopup.tsx b/web/src/components/MenuBtnsPopup.tsx index 75176a83a1774..50a76c22a420e 100644 --- a/web/src/components/MenuBtnsPopup.tsx +++ b/web/src/components/MenuBtnsPopup.tsx @@ -1,10 +1,10 @@ import { useEffect, useRef } from ""react""; -import * as api from ""../helpers/api""; import { locationService, userService } from ""../services""; import useI18n from ""../hooks/useI18n""; -import toastHelper from ""./Toast""; import Only from ""./common/OnlyWhen""; import showAboutSiteDialog from ""./AboutSiteDialog""; +import showArchivedMemoDialog from ""./ArchivedMemoDialog""; +import showResourcesDialog from ""./ResourcesDialog""; import ""../less/menu-btns-popup.less""; interface Props { @@ -32,27 +32,16 @@ const MenuBtnsPopup: React.FC = (props: Props) => { } }, [shownStatus]); - const handlePingBtnClick = () => { - api - .getSystemStatus() - .then(({ data }) => { - const { - data: { profile }, - } = data; - toastHelper.info(JSON.stringify(profile, null, 4)); - }) - .catch((error) => { - console.error(error); - toastHelper.error(error.response.data.message); - }); + const handleResourcesBtnClick = () => { + showResourcesDialog(); }; - const handleAboutBtnClick = () => { - showAboutSiteDialog(); + const handleArchivedBtnClick = () => { + showArchivedMemoDialog(); }; - const handleExploreBtnClick = () => { - locationService.pushHistory(""/explore""); + const handleAboutBtnClick = () => { + showAboutSiteDialog(); }; const handleSignOutBtnClick = async () => { @@ -69,12 +58,14 @@ const MenuBtnsPopup: React.FC = (props: Props) => { return (
- - + + + + diff --git a/web/src/components/Sidebar.tsx b/web/src/components/Sidebar.tsx index 6d563891fb682..38c02b296e908 100644 --- a/web/src/components/Sidebar.tsx +++ b/web/src/components/Sidebar.tsx @@ -1,11 +1,9 @@ -import { userService } from ""../services""; +import { locationService, userService } from ""../services""; import useI18n from ""../hooks/useI18n""; import Icon from ""./Icon""; import Only from ""./common/OnlyWhen""; import showDailyReviewDialog from ""./DailyReviewDialog""; import showSettingDialog from ""./SettingDialog""; -import showArchivedMemoDialog from ""./ArchivedMemoDialog""; -import showResourcesDialog from ""./ResourcesDialog""; import UserBanner from ""./UserBanner""; import UsageHeatMap from ""./UsageHeatMap""; import ShortcutList from ""./ShortcutList""; @@ -15,14 +13,12 @@ import ""../less/siderbar.less""; const Sidebar = () => { const { t } = useI18n(); - const handleMyAccountBtnClick = () => { + const handleSettingBtnClick = () => { showSettingDialog(); }; - const handleResourcesBtnClick = () => { - showResourcesDialog(); - }; - const handleArchivedBtnClick = () => { - showArchivedMemoDialog(); + + const handleExploreBtnClick = () => { + locationService.pushHistory(""/explore""); }; return ( @@ -39,14 +35,11 @@ const Sidebar = () => { 📅 {t(""sidebar.daily-review"")} - - -
diff --git a/web/src/less/explore.less b/web/src/less/explore.less index 27c09d85a983b..2e911a142fbb3 100644 --- a/web/src/less/explore.less +++ b/web/src/less/explore.less @@ -8,10 +8,20 @@ @apply relative w-full min-h-screen mx-auto flex flex-col justify-start items-center; > .page-header { - @apply relative max-w-2xl w-full min-h-full flex flex-row justify-start items-center px-4 sm:pr-6; + @apply relative max-w-2xl w-full min-h-full flex flex-row justify-between items-center px-4 sm:pr-6 mt-6 mb-2; > .logo-img { - @apply h-14 w-auto mt-6 mb-2; + @apply h-14 w-auto; + } + + > .action-button-container { + > .btn { + @apply text-blue-600 py-1 hover:opacity-80; + + > .icon { + @apply text-lg mr-1; + } + } } } @@ -42,17 +52,5 @@ } } } - - > .addtion-btn-container { - @apply fixed bottom-12 left-1/2 -translate-x-1/2; - - > .btn { - @apply bg-blue-600 text-white px-4 py-2 rounded-3xl shadow-2xl hover:opacity-80; - - > .icon { - @apply text-lg mr-1; - } - } - } } } diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 31690adbb5ea1..262d331076554 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -22,6 +22,7 @@ ""archive"": ""Archive"", ""basic"": ""Basic"", ""admin"": ""Admin"", + ""explore"": ""Explore"", ""sign-in"": ""Sign in"", ""sign-out"": ""Sign out"", ""back-to-home"": ""Back to Home"" diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index 019d9734fe260..660b584c88fc1 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -22,6 +22,7 @@ ""archive"": ""归档"", ""basic"": ""基础"", ""admin"": ""管理员"", + ""explore"": ""探索"", ""sign-in"": ""登录"", ""sign-out"": ""退出登录"", ""back-to-home"": ""回到主页"" diff --git a/web/src/pages/Explore.tsx b/web/src/pages/Explore.tsx index 76b81c7d7336e..6c25b124af71b 100644 --- a/web/src/pages/Explore.tsx +++ b/web/src/pages/Explore.tsx @@ -47,6 +47,17 @@ const Explore = () => {
+
+ {user ? ( + + ) : ( + + )} +
{state.memos.map((memo) => { @@ -65,18 +76,6 @@ const Explore = () => { ); })}
- -
- {user ? ( - - ) : ( - - )} -
)}
",chore,update button entries (#206) 626ff5e3a75b8b02e417582e561e8ae0e0480ba6,2023-09-13 19:06:43,Athurg Gooth,feat: notify by telegram while new memo create by HTTP (#2215),False,"diff --git a/api/v1/memo.go b/api/v1/memo.go index da7b72368f163..95aeb899b2ef3 100644 --- a/api/v1/memo.go +++ b/api/v1/memo.go @@ -11,8 +11,10 @@ import ( ""github.com/labstack/echo/v4"" ""github.com/pkg/errors"" ""github.com/usememos/memos/api/auth"" + ""github.com/usememos/memos/common/log"" ""github.com/usememos/memos/common/util"" ""github.com/usememos/memos/store"" + ""go.uber.org/zap"" ) // Visibility is the type of a visibility. @@ -351,6 +353,38 @@ func (s *APIV1Service) CreateMemo(c echo.Context) error { if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, ""Failed to compose memo response"").SetInternal(err) } + + // send notification by telegram bot if memo is not Private + if memoResponse.Visibility != Private { + // fetch all telegram UserID + userSettings, err := s.Store.ListUserSettings(ctx, &store.FindUserSetting{Key: UserSettingTelegramUserIDKey.String()}) + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, ""Failed to ListUserSettings"").SetInternal(err) + } + for _, userSetting := range userSettings { + // parse telegram UserID setting value into a int64 + var tgUserIDStr string + err := json.Unmarshal([]byte(userSetting.Value), &tgUserIDStr) + if err != nil { + log.Error(""failed to parse Telegram UserID"", zap.Error(err)) + continue + } + + tgUserID, err := strconv.ParseInt(tgUserIDStr, 10, 64) + if err != nil { + log.Error(""failed to parse Telegram UserID"", zap.Error(err)) + continue + } + + // send notification to telegram + content := memoResponse.CreatorName + "" Says:\n\n"" + memoResponse.Content + _, err = s.telegramBot.SendMessage(ctx, tgUserID, content) + if err != nil { + log.Error(""Failed to send Telegram notification"", zap.Error(err)) + continue + } + } + } return c.JSON(http.StatusOK, memoResponse) } diff --git a/api/v1/v1.go b/api/v1/v1.go index 328cfddc2465d..1051ade83d193 100644 --- a/api/v1/v1.go +++ b/api/v1/v1.go @@ -2,14 +2,16 @@ package v1 import ( ""github.com/labstack/echo/v4"" + ""github.com/usememos/memos/plugin/telegram"" ""github.com/usememos/memos/server/profile"" ""github.com/usememos/memos/store"" ) type APIV1Service struct { - Secret string - Profile *profile.Profile - Store *store.Store + Secret string + Profile *profile.Profile + Store *store.Store + telegramBot *telegram.Bot } // @title memos API @@ -31,11 +33,12 @@ type APIV1Service struct { // @in query // @name openId // @description Insert your Open ID API Key here. -func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store) *APIV1Service { +func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store, telegramBot *telegram.Bot) *APIV1Service { return &APIV1Service{ - Secret: secret, - Profile: profile, - Store: store, + Secret: secret, + Profile: profile, + Store: store, + telegramBot: telegramBot, } } diff --git a/plugin/telegram/api_send_message.go b/plugin/telegram/api_send_message.go index b53f9115f0c80..f4bce9a86aafe 100644 --- a/plugin/telegram/api_send_message.go +++ b/plugin/telegram/api_send_message.go @@ -9,9 +9,12 @@ import ( // SendReplyMessage make a sendMessage api request. func (b *Bot) SendReplyMessage(ctx context.Context, chatID, replyID int64, text string) (*Message, error) { formData := url.Values{ - ""reply_to_message_id"": {strconv.FormatInt(replyID, 10)}, - ""chat_id"": {strconv.FormatInt(chatID, 10)}, - ""text"": {text}, + ""chat_id"": {strconv.FormatInt(chatID, 10)}, + ""text"": {text}, + } + + if replyID > 0 { + formData.Set(""reply_to_message_id"", strconv.FormatInt(replyID, 10)) } var result Message @@ -22,3 +25,8 @@ func (b *Bot) SendReplyMessage(ctx context.Context, chatID, replyID int64, text return &result, nil } + +// SendMessage make a sendMessage api request. +func (b *Bot) SendMessage(ctx context.Context, chatID int64, text string) (*Message, error) { + return b.SendReplyMessage(ctx, chatID, 0, text) +} diff --git a/server/server.go b/server/server.go index 3edd4c857fdbf..c879ea3d24c83 100644 --- a/server/server.go +++ b/server/server.go @@ -46,6 +46,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store e.HideBanner = true e.HidePort = true + telegramBot := telegram.NewBotWithHandler(newTelegramHandler(store)) s := &Server{ e: e, Store: store, @@ -53,7 +54,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store // Asynchronous runners. backupRunner: service.NewBackupRunner(store), - telegramBot: telegram.NewBotWithHandler(newTelegramHandler(store)), + telegramBot: telegramBot, } e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{ @@ -103,7 +104,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store s.Secret = secret rootGroup := e.Group("""") - apiV1Service := apiv1.NewAPIV1Service(s.Secret, profile, store) + apiV1Service := apiv1.NewAPIV1Service(s.Secret, profile, store, telegramBot) apiV1Service.Register(rootGroup) s.apiV2Service = apiv2.NewAPIV2Service(s.Secret, profile, store, s.Profile.Port+1)",feat,notify by telegram while new memo create by HTTP (#2215) c5900b355e64da3f3f91ff7a734a59e5f6cd8093,2024-07-24 21:08:51,Steven,chore: tweak signup checks,False,"diff --git a/server/router/api/v1/auth_service.go b/server/router/api/v1/auth_service.go index ad5e76c552bdd..0a41aa2e3ceb4 100644 --- a/server/router/api/v1/auth_service.go +++ b/server/router/api/v1/auth_service.go @@ -167,7 +167,11 @@ func (s *APIV1Service) doSignIn(ctx context.Context, user *store.User, expireTim } func (s *APIV1Service) SignUp(ctx context.Context, request *v1pb.SignUpRequest) (*v1pb.User, error) { - if !s.Profile.Public { + workspaceProfile, err := s.GetWorkspaceProfile(ctx, &v1pb.GetWorkspaceProfileRequest{}) + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf(""failed to get workspace profile, err: %s"", err)) + } + if !workspaceProfile.Public { return nil, status.Errorf(codes.PermissionDenied, ""sign up is not allowed"") }",chore,tweak signup checks 4fcc682a15b9973f1d3e6b098e087d0352673aa6,2024-10-21 17:53:34,Steven,chore: add beta badge to relation graph,False,"diff --git a/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx b/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx index 87f15abfc9c9a..f78368d55bde3 100644 --- a/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx +++ b/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx @@ -28,7 +28,10 @@ const MemoDetailSidebar = ({ memo, className }: Props) => { {shouldShowRelationGraph && (
- Relations +
+ Relations + (Beta) +
)}
",chore,add beta badge to relation graph 7a685d64350a711342dded76f51f93091405098b,2025-02-20 18:13:28,johnnyjoy,fix: fetch user by username,False,"diff --git a/web/src/pages/UserProfile.tsx b/web/src/pages/UserProfile.tsx index 10c9294cd40c4..a845758e51345 100644 --- a/web/src/pages/UserProfile.tsx +++ b/web/src/pages/UserProfile.tsx @@ -32,7 +32,7 @@ const UserProfile = () => { } userStore - .getOrFetchUserByName(username) + .fetchUserByUsername(username) .then((user) => { setUser(user); loadingState.setFinish(); diff --git a/web/src/store/v2/user.ts b/web/src/store/v2/user.ts index d7aa72d9bd786..a2ceb76cf5647 100644 --- a/web/src/store/v2/user.ts +++ b/web/src/store/v2/user.ts @@ -40,6 +40,19 @@ const userStore = (() => { return user; }; + const fetchUserByUsername = async (username: string) => { + const user = await userServiceClient.getUser({ + name: username, + }); + state.setPartial({ + userMapByName: { + ...state.userMapByName, + [user.name]: user, + }, + }); + return user; + }; + const getUserByName = (name: string) => { return state.userMapByName[name]; }; @@ -128,6 +141,7 @@ const userStore = (() => { return { state, getOrFetchUserByName, + fetchUserByUsername, getUserByName, fetchUsers, updateUser,",fix,fetch user by username 595dbdb0ecb1eada129e21f1c1580d86dd256534,2023-03-06 18:43:35,boojack,feat: add root layout (#1294),False,"diff --git a/web/src/layouts/Root.tsx b/web/src/layouts/Root.tsx new file mode 100644 index 0000000000000..daf9c994e09b8 --- /dev/null +++ b/web/src/layouts/Root.tsx @@ -0,0 +1,21 @@ +import { Outlet } from ""react-router-dom""; +import Header from ""../components/Header""; +import UpdateVersionBanner from ""../components/UpdateVersionBanner""; + +function Root() { + return ( +
+
+ +
+
+
+
+ +
+
+
+ ); +} + +export default Root; diff --git a/web/src/less/home-sidebar.less b/web/src/less/home-sidebar.less index e827907637c80..4cf97bc786576 100644 --- a/web/src/less/home-sidebar.less +++ b/web/src/less/home-sidebar.less @@ -1,5 +1,5 @@ .home-sidebar-wrapper { - @apply flex-shrink-0 fixed sm:sticky top-0 z-30 sm:z-0 translate-x-56 sm:translate-x-0 hidden md:flex flex-col justify-start items-start w-56 md:mr-2 h-full py-4 bg-white dark:bg-zinc-800 sm:bg-transparent overflow-x-hidden overflow-y-auto transition-transform duration-300 overscroll-contain hide-scrollbar; + @apply flex-shrink-0 fixed sm:sticky top-0 z-30 sm:z-0 translate-x-56 sm:translate-x-0 hidden md:flex flex-col justify-start items-start w-56 py-4 pr-2 md:mr-2 h-full bg-white dark:bg-zinc-800 sm:bg-transparent overflow-x-hidden overflow-y-auto transition-transform duration-300 overscroll-contain hide-scrollbar; &.show { @apply flex translate-x-0 right-0 shadow-2xl sm:shadow-none; diff --git a/web/src/less/home.less b/web/src/less/home.less deleted file mode 100644 index d3577da925b2b..0000000000000 --- a/web/src/less/home.less +++ /dev/null @@ -1,23 +0,0 @@ -.page-wrapper.home { - @apply w-full h-full overflow-y-auto bg-zinc-100 dark:bg-zinc-800; - - > .banner-wrapper { - @apply w-full flex flex-col justify-start items-center; - } - - > .page-container { - @apply relative w-full h-auto mx-auto flex flex-row justify-start sm:justify-center items-start; - - > .header-wrapper { - @apply flex-shrink-0 h-full; - } - - > .memos-wrapper { - @apply relative flex-grow max-w-2xl w-full h-auto flex flex-col justify-start items-start px-4 sm:px-2 sm:pt-4; - - > .memos-editor-wrapper { - @apply w-full h-auto flex flex-col justify-start items-start bg-zinc-100 dark:bg-zinc-800 rounded-lg; - } - } - } -} diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index 1be40dc1bba88..2b0935745aafc 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -3,14 +3,11 @@ import { useTranslation } from ""react-i18next""; import { useLocation } from ""react-router-dom""; import { useGlobalStore, useUserStore } from ""../store/module""; import toastHelper from ""../components/Toast""; -import Header from ""../components/Header""; import MemoEditor from ""../components/MemoEditor""; import MemoFilter from ""../components/MemoFilter""; import MemoList from ""../components/MemoList""; -import UpdateVersionBanner from ""../components/UpdateVersionBanner""; import MobileHeader from ""../components/MobileHeader""; import HomeSidebar from ""../components/HomeSidebar""; -import ""../less/home.less""; function Home() { const { t } = useTranslation(); @@ -36,23 +33,17 @@ function Home() { }, [user?.setting.locale]); return ( -
-
- +
+
+ +
+ {!userStore.isVisitorMode() && } + +
+
-
-
-
- -
- {!userStore.isVisitorMode() && } - -
- -
- {!userStore.isVisitorMode() && } -
-
+ {!userStore.isVisitorMode() && } +
); } diff --git a/web/src/router/index.tsx b/web/src/router/index.tsx index 0563bf57e0850..4471070c909ee 100644 --- a/web/src/router/index.tsx +++ b/web/src/router/index.tsx @@ -4,6 +4,7 @@ import { isNullorUndefined } from ""../helpers/utils""; import store from ""../store""; import { initialGlobalState, initialUserState } from ""../store/module""; +const Root = lazy(() => import(""../layouts/Root"")); const Auth = lazy(() => import(""../pages/Auth"")); const AuthCallback = lazy(() => import(""../pages/AuthCallback"")); const Explore = lazy(() => import(""../pages/Explore"")); @@ -43,24 +44,30 @@ const router = createBrowserRouter([ }, { path: ""/"", - element: , - loader: async () => { - await initialGlobalStateLoader(); + element: , + children: [ + { + path: """", + element: , + loader: async () => { + await initialGlobalStateLoader(); - try { - await initialUserState(); - } catch (error) { - // do nth - } + try { + await initialUserState(); + } catch (error) { + // do nth + } - const { host, user } = store.getState().user; - if (isNullorUndefined(host)) { - return redirect(""/auth""); - } else if (isNullorUndefined(user)) { - return redirect(""/explore""); - } - return null; - }, + const { host, user } = store.getState().user; + if (isNullorUndefined(host)) { + return redirect(""/auth""); + } else if (isNullorUndefined(user)) { + return redirect(""/explore""); + } + return null; + }, + }, + ], }, { path: ""/u/:userId"", diff --git a/web/yarn.lock b/web/yarn.lock index 8abe978924507..3850cf707460c 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -54,6 +54,13 @@ dependencies: regenerator-runtime ""^0.13.11"" +""@babel/runtime@^7.19.4"": + version ""7.21.0"" + resolved ""https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673"" + integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw== + dependencies: + regenerator-runtime ""^0.13.11"" + ""@babel/types@^7.18.6"": version ""7.20.7"" resolved ""https://registry.yarnpkg.com/@babel/types/-/types-7.20.7.tgz#54ec75e252318423fc07fb644dc6a58a64c09b7f"" @@ -1703,6 +1710,13 @@ html-parse-stringify@^3.0.1: dependencies: void-elements ""3.1.0"" +i18next-browser-languagedetector@^7.0.1: + version ""7.0.1"" + resolved ""https://registry.yarnpkg.com/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.0.1.tgz#ead34592edc96c6c3a618a51cb57ad027c5b5d87"" + integrity sha512-Pa5kFwaczXJAeHE56CHG2aWzFBMJNUNghf0Pm4SwSrEMps/PTKqW90EYWlIvhuYStf3Sn1K0vw+gH3+TLdkH1g== + dependencies: + ""@babel/runtime"" ""^7.19.4"" + i18next@^21.9.2: version ""21.10.0"" resolved ""https://registry.yarnpkg.com/i18next/-/i18next-21.10.0.tgz#85429af55fdca4858345d0e16b584ec29520197d""",feat,add root layout (#1294) f8c0d73d2de181880ee44c3fc4d3c46d8811c37c,2022-11-01 19:54:54,boojack,chore: update resource dialog style (#395),False,"diff --git a/web/src/components/ResourcesDialog.tsx b/web/src/components/ResourcesDialog.tsx index 637f6ffebe889..3fa7e47a89844 100644 --- a/web/src/components/ResourcesDialog.tsx +++ b/web/src/components/ResourcesDialog.tsx @@ -168,16 +168,18 @@ const ResourcesDialog: React.FC = (props: Props) => {
-
handleUploadFileBtnClick()}> -
- - {t(""resources.upload"")} +
+
+
handleUploadFileBtnClick()}> + + {t(""resources.upload"")} +
+
+
+
-
-
-
{loadingState.isLoading ? (
@@ -188,7 +190,6 @@ const ResourcesDialog: React.FC = (props: Props) => {
ID NAME - TYPE
{resources.length === 0 ? ( @@ -205,14 +206,6 @@ const ResourcesDialog: React.FC = (props: Props) => { {resource.filename} - - handleResourceNameOrTypeMouseEnter(e, resource.type)} - onMouseLeave={handleResourceNameOrTypeMouseLeave} - > - {resource.type} - -
.dialog-container { - @apply w-180 max-w-full mb-8; + @apply w-112 max-w-full mb-8; > .dialog-content-container { @apply flex flex-col justify-start items-start w-full; - > .upload-resource-container { - @apply mt-2 mb-4 py-8 cursor-pointer w-full rounded flex flex-row justify-center items-center bg-blue-50 border border-blue-600 hover:opacity-80; + > .action-buttons-container { + @apply w-full flex flex-row justify-between items-center mb-2; - > .upload-resource-btn { - @apply px-3 py-1 rounded flex flex-row justify-center items-center border border-dashed border-blue-600 text-blue-600 bg-blue-50; + > .buttons-wrapper { + @apply flex flex-row justify-start items-center; - > .icon-img { - @apply w-4 h-auto mr-1; - } - } - } + > .upload-resource-btn { + @apply text-sm cursor-pointer px-3 py-1 rounded flex flex-row justify-center items-center border border-blue-600 text-blue-600 bg-blue-50 hover:opacity-80; - > .delete-unused-resource-container { - @apply flex w-full justify-end; + > .icon-img { + @apply w-4 h-auto mr-1; + } + } - > .delete-unused-resource-btn { - @apply text-sm py-1 px-3 mr-2 rounded-md hover:opacity-80 bg-red-100 border border-solid border-red-600 text-red-600; + > .delete-unused-resource-btn { + @apply text-sm py-1 px-3 mr-2 rounded bg-red-100 border border-solid border-red-600 text-red-600 hover:opacity-80; + } } } @@ -37,7 +37,7 @@ @apply flex flex-col justify-start items-start w-full; > .fields-container { - @apply px-2 py-2 w-full grid grid-cols-10 border-b; + @apply px-2 py-2 w-full grid grid-cols-7 border-b; > .field-text { @apply font-mono text-gray-400; @@ -49,7 +49,7 @@ } > .resource-container { - @apply px-2 py-2 w-full grid grid-cols-10; + @apply px-2 py-2 w-full grid grid-cols-7; > .buttons-container { @apply w-full flex flex-row justify-end items-center; @@ -66,38 +66,6 @@ &.name-text { @apply col-span-4; } - - &.type-text { - @apply col-span-3; - } - - > .form-label { - min-height: 28px; - - &.filename-label { - @apply w-full flex flex-row justify-between; - - > input { - @apply grow-0 w-40 shadow-inner px-2 mr-2 border rounded leading-7 bg-transparent focus:border-black; - } - - > .btns-container { - @apply shrink-0 grow flex flex-row justify-end items-center; - - > .btn { - @apply text-sm shadow px-2 leading-7 rounded border hover:opacity-80 bg-gray-50; - - &.cancel-btn { - @apply shadow-none border-none bg-transparent; - } - - &.confirm-btn { - @apply bg-green-600 border-green-600 text-white; - } - } - } - } - } } } }",chore,update resource dialog style (#395) ebe36782888d1e0b8d6e5ac318be073c8972a5dc,2024-02-13 06:58:16,Brilliant Hanabi,feat: add visibility select in ShareMemoDialog (#2941),False,"diff --git a/web/src/components/MemoActionMenu.tsx b/web/src/components/MemoActionMenu.tsx index 9d99b36479f3c..673f049c38efc 100644 --- a/web/src/components/MemoActionMenu.tsx +++ b/web/src/components/MemoActionMenu.tsx @@ -101,7 +101,7 @@ const MemoActionMenu = (props: Props) => { {t(""common.edit"")} - showShareMemoDialog(memo)}> + showShareMemoDialog(memo.id)}> {t(""common.share"")} diff --git a/web/src/components/ShareMemoDialog.tsx b/web/src/components/ShareMemoDialog.tsx index b8d487787a190..9e84b9f8c29eb 100644 --- a/web/src/components/ShareMemoDialog.tsx +++ b/web/src/components/ShareMemoDialog.tsx @@ -1,33 +1,40 @@ -import { Button, IconButton } from ""@mui/joy""; +import { Button, IconButton, Select, Option } from ""@mui/joy""; import copy from ""copy-to-clipboard""; import React, { useEffect, useRef } from ""react""; import { toast } from ""react-hot-toast""; import { getDateTimeString } from ""@/helpers/datetime""; import { downloadFileFromUrl } from ""@/helpers/utils""; +import useCurrentUser from ""@/hooks/useCurrentUser""; import useLoading from ""@/hooks/useLoading""; import toImage from ""@/labs/html2image""; -import { useUserStore, extractUsernameFromName } from ""@/store/v1""; -import { Memo, Visibility } from ""@/types/proto/api/v2/memo_service""; +import { useUserStore, extractUsernameFromName, useMemoStore } from ""@/store/v1""; +import { Visibility } from ""@/types/proto/api/v2/memo_service""; import { useTranslate } from ""@/utils/i18n""; +import { convertVisibilityToString } from ""@/utils/memo""; import { generateDialog } from ""./Dialog""; import Icon from ""./Icon""; import MemoContent from ""./MemoContent""; import MemoResourceListView from ""./MemoResourceListView""; import UserAvatar from ""./UserAvatar""; +import VisibilityIcon from ""./VisibilityIcon""; import ""@/less/share-memo-dialog.less""; interface Props extends DialogProps { - memo: Memo; + memoId: number; } const ShareMemoDialog: React.FC = (props: Props) => { - const { memo, destroy } = props; + const { memoId, destroy } = props; const t = useTranslate(); const userStore = useUserStore(); const downloadingImageState = useLoading(false); const loadingState = useLoading(); const memoElRef = useRef(null); + const memoStore = useMemoStore(); + const memo = memoStore.getMemoById(memoId); const user = userStore.getUserByUsername(extractUsernameFromName(memo.creator)); + const currentUser = useCurrentUser(); + const readonly = memo?.creatorId !== currentUser?.id; useEffect(() => { (async () => { @@ -75,6 +82,20 @@ const ShareMemoDialog: React.FC = (props: Props) => { } }; + const handleMemoVisibilityOptionChanged = async (visibility: Visibility) => { + const updatedMemo = await memoStore.updateMemo( + { + id: memo.id, + visibility: visibility, + }, + [""visibility""], + ); + + if (updatedMemo.visibility == visibility) { + toast.success(t(""common.changed"")); + } + }; + if (loadingState.isLoading) { return null; } @@ -88,23 +109,44 @@ const ShareMemoDialog: React.FC = (props: Props) => {
-
- - - +
+
+ + + +
+ {!readonly && ( + + )}
= (props: Props) => { ); }; -export default function showShareMemoDialog(memo: Memo): void { +export default function showShareMemoDialog(memoId: number): void { generateDialog( { className: ""share-memo-dialog"", dialogName: ""share-memo-dialog"", }, ShareMemoDialog, - { memo }, + { memoId }, ); } diff --git a/web/src/pages/MemoDetail.tsx b/web/src/pages/MemoDetail.tsx index b99f403ad1442..1fc7d973655db 100644 --- a/web/src/pages/MemoDetail.tsx +++ b/web/src/pages/MemoDetail.tsx @@ -180,7 +180,7 @@ const MemoDetail = () => { - showShareMemoDialog(memo)}> + showShareMemoDialog(memo.id)}> ",feat,add visibility select in ShareMemoDialog (#2941) bff41a8957a546c7f7b193ca49c9ed949ccb2bd2,2023-09-18 20:04:31,Steven,fix: invalid username checks,False,"diff --git a/api/v1/auth.go b/api/v1/auth.go index 0dae91bc7ac2e..d124be94206a5 100644 --- a/api/v1/auth.go +++ b/api/v1/auth.go @@ -20,6 +20,10 @@ import ( ""github.com/usememos/memos/store"" ) +var ( + usernameMatcher = regexp.MustCompile(""^[a-z]([a-z0-9-]{2,30}[a-z0-9])?$"") +) + type SignIn struct { Username string `json:""username""` Password string `json:""password""` @@ -279,6 +283,9 @@ func (s *APIV1Service) SignUp(c echo.Context) error { if err != nil { return echo.NewHTTPError(http.StatusBadRequest, ""Failed to find users"").SetInternal(err) } + if !usernameMatcher.MatchString(signup.Username) { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(""Invalid username %s"", signup.Username)).SetInternal(err) + } userCreate := &store.User{ Username: signup.Username, diff --git a/api/v1/user.go b/api/v1/user.go index a2f8f870fafa5..ed5093307a36e 100644 --- a/api/v1/user.go +++ b/api/v1/user.go @@ -140,6 +140,9 @@ func (s *APIV1Service) CreateUser(c echo.Context) error { if err := userCreate.Validate(); err != nil { return echo.NewHTTPError(http.StatusBadRequest, ""Invalid user create format"").SetInternal(err) } + if !usernameMatcher.MatchString(userCreate.Username) { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(""Invalid username %s"", userCreate.Username)).SetInternal(err) + } // Disallow host user to be created. if userCreate.Role == RoleHost { return echo.NewHTTPError(http.StatusForbidden, ""Could not create host user"") @@ -362,6 +365,9 @@ func (s *APIV1Service) UpdateUser(c echo.Context) error { userUpdate.RowStatus = &rowStatus } if request.Username != nil { + if !usernameMatcher.MatchString(*request.Username) { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(""Invalid username %s"", *request.Username)).SetInternal(err) + } userUpdate.Username = request.Username } if request.Email != nil { diff --git a/api/v2/user_service.go b/api/v2/user_service.go index 2a57d37a77404..0d22b2002937b 100644 --- a/api/v2/user_service.go +++ b/api/v2/user_service.go @@ -3,6 +3,7 @@ package v2 import ( ""context"" ""net/http"" + ""regexp"" ""time"" ""github.com/golang-jwt/jwt/v4"" @@ -20,6 +21,10 @@ import ( ""github.com/usememos/memos/store"" ) +var ( + usernameMatcher = regexp.MustCompile(""^[a-z]([a-z0-9-]{2,30}[a-z0-9])?$"") +) + type UserService struct { apiv2pb.UnimplementedUserServiceServer @@ -72,6 +77,9 @@ func (s *UserService) UpdateUser(ctx context.Context, request *apiv2pb.UpdateUse } for _, path := range request.UpdateMask { if path == ""username"" { + if !usernameMatcher.MatchString(request.User.Username) { + return nil, status.Errorf(codes.InvalidArgument, ""invalid username: %s"", request.User.Username) + } update.Username = &request.User.Username } else if path == ""nickname"" { update.Nickname = &request.User.Nickname diff --git a/web/src/components/CreateAccessTokenDialog.tsx b/web/src/components/CreateAccessTokenDialog.tsx index 7be95b448e515..79575a23f0b15 100644 --- a/web/src/components/CreateAccessTokenDialog.tsx +++ b/web/src/components/CreateAccessTokenDialog.tsx @@ -1,7 +1,7 @@ import { Button, Input, Radio, RadioGroup } from ""@mui/joy""; -import axios from ""axios""; import React, { useState } from ""react""; import { toast } from ""react-hot-toast""; +import { userServiceClient } from ""@/grpcweb""; import useCurrentUser from ""@/hooks/useCurrentUser""; import useLoading from ""@/hooks/useLoading""; import { useTranslate } from ""@/utils/i18n""; @@ -68,9 +68,12 @@ const CreateAccessTokenDialog: React.FC = (props: Props) => { } try { - await axios.post(`/api/v2/users/${currentUser.id}/access_tokens`, { - description: state.description, - expiresAt: new Date(Date.now() + state.expiration * 1000), + await userServiceClient.createUserAccessToken({ + username: currentUser.username, + userAccessToken: { + description: state.description, + expiresAt: new Date(Date.now() + state.expiration * 1000), + }, }); onConfirm(); diff --git a/web/src/components/Header.tsx b/web/src/components/Header.tsx index 31e15326085cd..41591854fa794 100644 --- a/web/src/components/Header.tsx +++ b/web/src/components/Header.tsx @@ -1,7 +1,8 @@ import classNames from ""classnames""; import { useEffect } from ""react""; import { NavLink, useLocation } from ""react-router-dom""; -import { useLayoutStore, useUserStore } from ""@/store/module""; +import useCurrentUser from ""@/hooks/useCurrentUser""; +import { useLayoutStore } from ""@/store/module""; import { useTranslate } from ""@/utils/i18n""; import { resolution } from ""@/utils/layout""; import Icon from ""./Icon""; @@ -17,10 +18,9 @@ interface NavLinkItem { const Header = () => { const t = useTranslate(); const location = useLocation(); - const userStore = useUserStore(); const layoutStore = useLayoutStore(); const showHeader = layoutStore.state.showHeader; - const isVisitorMode = userStore.isVisitorMode() && !userStore.state.user; + const user = useCurrentUser(); useEffect(() => { const handleWindowResize = () => { @@ -77,7 +77,7 @@ const Header = () => { icon: , }; - const navLinks: NavLinkItem[] = !isVisitorMode + const navLinks: NavLinkItem[] = user ? [homeNavLink, dailyReviewNavLink, resourcesNavLink, exploreNavLink, archivedNavLink, settingNavLink] : [exploreNavLink, authNavLink]; diff --git a/web/src/components/HomeSidebar.tsx b/web/src/components/HomeSidebar.tsx index b75e77f42bd25..d09c675455bf0 100644 --- a/web/src/components/HomeSidebar.tsx +++ b/web/src/components/HomeSidebar.tsx @@ -1,11 +1,10 @@ -import { useLayoutStore, useUserStore } from ""../store/module""; +import { useLayoutStore } from ""../store/module""; import SearchBar from ""./SearchBar""; import TagList from ""./TagList""; import UsageHeatMap from ""./UsageHeatMap""; const HomeSidebar = () => { const layoutStore = useLayoutStore(); - const userStore = useUserStore(); const showHomeSidebar = layoutStore.state.showHomeSidebar; return ( @@ -29,11 +28,7 @@ const HomeSidebar = () => {
- {!userStore.isVisitorMode() && ( - <> - - - )} +
); diff --git a/web/src/components/Memo.tsx b/web/src/components/Memo.tsx index 5aad3d4f07d95..e148d87b15ef0 100644 --- a/web/src/components/Memo.tsx +++ b/web/src/components/Memo.tsx @@ -5,6 +5,7 @@ import { useTranslation } from ""react-i18next""; import { Link } from ""react-router-dom""; import { UNKNOWN_ID } from ""@/helpers/consts""; import { getRelativeTimeString } from ""@/helpers/datetime""; +import useCurrentUser from ""@/hooks/useCurrentUser""; import { useFilterStore, useMemoStore, useUserStore } from ""@/store/module""; import { useUserV1Store } from ""@/store/v1""; import { useTranslate } from ""@/utils/i18n""; @@ -28,16 +29,17 @@ interface Props { const Memo: React.FC = (props: Props) => { const { memo, lazyRendering } = props; - const { i18n } = useTranslation(); const t = useTranslate(); + const { i18n } = useTranslation(); const filterStore = useFilterStore(); const userStore = useUserStore(); const memoStore = useMemoStore(); const userV1Store = useUserV1Store(); + const user = useCurrentUser(); const [shouldRender, setShouldRender] = useState(lazyRendering ? false : true); const [displayTime, setDisplayTime] = useState(getRelativeTimeString(memo.displayTs)); const memoContainerRef = useRef(null); - const readonly = userStore.isVisitorMode() || userStore.getCurrentUsername() !== memo.creatorUsername; + const readonly = memo.creatorUsername !== user?.username; const creator = userV1Store.getUserByUsername(memo.creatorUsername); // Prepare memo creator. @@ -227,7 +229,7 @@ const Memo: React.FC = (props: Props) => {
{creator && ( <> - + {creator.nickname} diff --git a/web/src/components/MemoList.tsx b/web/src/components/MemoList.tsx index 90120346c6058..cdffb5a4bd4f7 100644 --- a/web/src/components/MemoList.tsx +++ b/web/src/components/MemoList.tsx @@ -1,9 +1,11 @@ -import { useEffect, useRef, useState } from ""react""; +import { useEffect, useState } from ""react""; import { toast } from ""react-hot-toast""; +import { useParams } from ""react-router-dom""; import { DEFAULT_MEMO_LIMIT } from ""@/helpers/consts""; import { getTimeStampByDate } from ""@/helpers/datetime""; +import useCurrentUser from ""@/hooks/useCurrentUser""; import { TAG_REG } from ""@/labs/marked/parser""; -import { useFilterStore, useMemoStore, useUserStore } from ""@/store/module""; +import { useFilterStore, useMemoStore } from ""@/store/module""; import { useTranslate } from ""@/utils/i18n""; import Empty from ""./Empty""; import Memo from ""./Memo""; @@ -11,17 +13,17 @@ import ""@/less/memo-list.less""; const MemoList: React.FC = () => { const t = useTranslate(); + const params = useParams(); const memoStore = useMemoStore(); - const userStore = useUserStore(); const filterStore = useFilterStore(); const filter = filterStore.state; const { memos } = memoStore.state; const [isFetching, setIsFetching] = useState(true); const [isComplete, setIsComplete] = useState(false); - - const currentUsername = userStore.getCurrentUsername(); + const user = useCurrentUser(); const { tag: tagQuery, duration, text: textQuery, visibility } = filter; const showMemoFilter = Boolean(tagQuery || (duration && duration.from < duration.to) || textQuery || visibility); + const username = params.username || user?.username || """"; const shownMemos = ( showMemoFilter @@ -61,7 +63,7 @@ const MemoList: React.FC = () => { return shouldShow; }) : memos - ).filter((memo) => memo.creatorUsername === currentUsername && memo.rowStatus === ""NORMAL""); + ).filter((memo) => memo.creatorUsername === username && memo.rowStatus === ""NORMAL""); const pinnedMemos = shownMemos.filter((m) => m.pinned); const unpinnedMemos = shownMemos.filter((m) => !m.pinned); @@ -72,11 +74,9 @@ const MemoList: React.FC = () => { unpinnedMemos.sort(memoSort); const sortedMemos = pinnedMemos.concat(unpinnedMemos).filter((m) => m.rowStatus === ""NORMAL""); - const statusRef = useRef(null); - useEffect(() => { memoStore - .fetchMemos() + .fetchMemos(username) .then((fetchedMemos) => { if (fetchedMemos.length < DEFAULT_MEMO_LIMIT) { setIsComplete(true); @@ -89,7 +89,7 @@ const MemoList: React.FC = () => { console.error(error); toast.error(error.response.data.message); }); - }, [currentUsername]); + }, [user?.username]); useEffect(() => { const pageWrapper = document.body.querySelector("".page-wrapper""); @@ -112,20 +112,12 @@ const MemoList: React.FC = () => { observer.unobserve(entry.target); } }); - if (statusRef?.current) { - observer.observe(statusRef.current); - } - return () => { - if (statusRef?.current) { - observer.unobserve(statusRef.current); - } - }; - }, [isFetching, isComplete, filter, sortedMemos.length, statusRef]); + }, [isFetching, isComplete, filter, sortedMemos.length]); const handleFetchMoreClick = async () => { try { setIsFetching(true); - const fetchedMemos = await memoStore.fetchMemos(DEFAULT_MEMO_LIMIT, memos.length); + const fetchedMemos = await memoStore.fetchMemos(username, DEFAULT_MEMO_LIMIT, memos.length); if (fetchedMemos.length < DEFAULT_MEMO_LIMIT) { setIsComplete(true); } else { @@ -148,8 +140,8 @@ const MemoList: React.FC = () => {

{t(""memo.fetching-data"")}

) : ( -
-

+

+
{isComplete ? ( sortedMemos.length === 0 && (
@@ -164,7 +156,7 @@ const MemoList: React.FC = () => { )} -

+
)}
diff --git a/web/src/components/Settings/AccessTokenSection.tsx b/web/src/components/Settings/AccessTokenSection.tsx index 92f2a83fc2e86..4bc1b16b67368 100644 --- a/web/src/components/Settings/AccessTokenSection.tsx +++ b/web/src/components/Settings/AccessTokenSection.tsx @@ -1,10 +1,10 @@ import { Button, IconButton } from ""@mui/joy""; -import axios from ""axios""; import copy from ""copy-to-clipboard""; import { useEffect, useState } from ""react""; import { toast } from ""react-hot-toast""; +import { userServiceClient } from ""@/grpcweb""; import useCurrentUser from ""@/hooks/useCurrentUser""; -import { ListUserAccessTokensResponse, UserAccessToken } from ""@/types/proto/api/v2/user_service""; +import { UserAccessToken } from ""@/types/proto/api/v2/user_service""; import { useTranslate } from ""@/utils/i18n""; import showCreateAccessTokenDialog from ""../CreateAccessTokenDialog""; import { showCommonDialog } from ""../Dialog/CommonDialog""; @@ -12,8 +12,8 @@ import Icon from ""../Icon""; import LearnMore from ""../LearnMore""; const listAccessTokens = async (username: string) => { - const { data } = await axios.get(`/api/v2/users/${username}/access_tokens`); - return data.accessTokens; + const { accessTokens } = await userServiceClient.listUserAccessTokens({ username: username }); + return accessTokens; }; const AccessTokenSection = () => { @@ -44,7 +44,7 @@ const AccessTokenSection = () => { style: ""danger"", dialogName: ""delete-access-token-dialog"", onConfirm: async () => { - await axios.delete(`/api/v2/users/${currentUser.id}/access_tokens/${accessToken}`); + await userServiceClient.deleteUserAccessToken({ username: currentUser.username, accessToken: accessToken }); setUserAccessTokens(userAccessTokens.filter((token) => token.accessToken !== accessToken)); }, }); diff --git a/web/src/components/UsageHeatMap.tsx b/web/src/components/UsageHeatMap.tsx index 9f543cb226a62..dba8ed976b616 100644 --- a/web/src/components/UsageHeatMap.tsx +++ b/web/src/components/UsageHeatMap.tsx @@ -3,9 +3,10 @@ import { getMemoStats } from ""@/helpers/api""; import { DAILY_TIMESTAMP } from ""@/helpers/consts""; import { getDateStampByDate, getDateString, getTimeStampByDate } from ""@/helpers/datetime""; import * as utils from ""@/helpers/utils""; +import useCurrentUser from ""@/hooks/useCurrentUser""; import { useUserV1Store } from ""@/store/v1""; import { useTranslate } from ""@/utils/i18n""; -import { useFilterStore, useMemoStore, useUserStore } from ""../store/module""; +import { useFilterStore, useMemoStore } from ""../store/module""; import ""@/less/usage-heat-map.less""; const tableConfig = { @@ -32,8 +33,8 @@ interface DailyUsageStat { const UsageHeatMap = () => { const t = useTranslate(); const filterStore = useFilterStore(); - const userStore = useUserStore(); const userV1Store = useUserV1Store(); + const user = useCurrentUser(); const memoStore = useMemoStore(); const todayTimeStamp = getDateStampByDate(Date.now()); const todayDay = new Date(todayTimeStamp).getDay() + 1; @@ -46,23 +47,22 @@ const UsageHeatMap = () => { const [allStat, setAllStat] = useState(getInitialUsageStat(usedDaysAmount, beginDayTimestamp)); const [currentStat, setCurrentStat] = useState(null); const containerElRef = useRef(null); - const currentUsername = userStore.getCurrentUsername(); useEffect(() => { - userV1Store.getOrFetchUserByUsername(currentUsername).then((user) => { + userV1Store.getOrFetchUserByUsername(user.username).then((user) => { if (!user) { return; } setCreatedDays(Math.ceil((Date.now() - getTimeStampByDate(user.createTime)) / 1000 / 3600 / 24)); }); - }, [currentUsername]); + }, [user.username]); useEffect(() => { if (memos.length === 0) { return; } - getMemoStats(currentUsername) + getMemoStats(user.username) .then(({ data }) => { setMemoAmount(data.length); const newStat: DailyUsageStat[] = getInitialUsageStat(usedDaysAmount, beginDayTimestamp); @@ -81,7 +81,7 @@ const UsageHeatMap = () => { .catch((error) => { console.error(error); }); - }, [memos.length, currentUsername]); + }, [memos.length, user.username]); const handleUsageStatItemMouseEnter = useCallback((event: React.MouseEvent, item: DailyUsageStat) => { const tempDiv = document.createElement(""div""); diff --git a/web/src/components/UserBanner.tsx b/web/src/components/UserBanner.tsx index f1d1e1854b3e8..f0ba8348f9668 100644 --- a/web/src/components/UserBanner.tsx +++ b/web/src/components/UserBanner.tsx @@ -1,6 +1,7 @@ -import { useEffect, useState } from ""react""; import { useNavigate } from ""react-router-dom""; +import useCurrentUser from ""@/hooks/useCurrentUser""; import { useGlobalStore, useUserStore } from ""@/store/module""; +import { User_Role } from ""@/types/proto/api/v2/user_service""; import { useTranslate } from ""@/utils/i18n""; import showAboutSiteDialog from ""./AboutSiteDialog""; import Icon from ""./Icon""; @@ -13,17 +14,11 @@ const UserBanner = () => { const globalStore = useGlobalStore(); const userStore = useUserStore(); const { systemStatus } = globalStore.state; - const { user } = userStore.state; - const [username, setUsername] = useState(""Memos""); - - useEffect(() => { - if (user) { - setUsername(user.nickname || user.username); - } - }, [user]); + const user = useCurrentUser(); + const title = user ? user.nickname : systemStatus.customizedProfile.name || ""memos""; const handleMyAccountClick = () => { - navigate(`/u/${user?.username}`); + navigate(`/u/${encodeURIComponent(user.username)}`); }; const handleAboutBtnClick = () => { @@ -42,10 +37,8 @@ const UserBanner = () => { trigger={
- - {user != undefined ? username : systemStatus.customizedProfile.name} - - {user?.role === ""HOST"" ? ( + {title} + {user?.role === User_Role.HOST ? ( MOD ) : null}
diff --git a/web/src/components/kit/DatePicker.tsx b/web/src/components/kit/DatePicker.tsx index d014bd6dad892..dc9a81e50275e 100644 --- a/web/src/components/kit/DatePicker.tsx +++ b/web/src/components/kit/DatePicker.tsx @@ -4,7 +4,7 @@ import { useEffect, useState } from ""react""; import { getMemoStats } from ""@/helpers/api""; import { DAILY_TIMESTAMP } from ""@/helpers/consts""; import { getDateStampByDate, isFutureDate } from ""@/helpers/datetime""; -import { useUserStore } from ""@/store/module""; +import useCurrentUser from ""@/hooks/useCurrentUser""; import { useTranslate } from ""@/utils/i18n""; import Icon from ""../Icon""; import ""@/less/common/date-picker.less""; @@ -21,14 +21,14 @@ const DatePicker: React.FC = (props: DatePickerProps) => { const { className, isFutureDateDisabled, datestamp, handleDateStampChange } = props; const [currentDateStamp, setCurrentDateStamp] = useState(getMonthFirstDayDateStamp(datestamp)); const [countByDate, setCountByDate] = useState(new Map()); - const currentUsername = useUserStore().getCurrentUsername(); + const user = useCurrentUser(); useEffect(() => { setCurrentDateStamp(getMonthFirstDayDateStamp(datestamp)); }, [datestamp]); useEffect(() => { - getMemoStats(currentUsername).then(({ data }) => { + getMemoStats(user.username).then(({ data }) => { const m = new Map(); for (const record of data) { const date = getDateStampByDate(record * 1000); @@ -36,7 +36,7 @@ const DatePicker: React.FC = (props: DatePickerProps) => { } setCountByDate(m); }); - }, [currentUsername]); + }, [user.username]); const firstDate = new Date(currentDateStamp); const firstDateDay = firstDate.getDay() === 0 ? 7 : firstDate.getDay(); diff --git a/web/src/helpers/api.ts b/web/src/helpers/api.ts index b83795f6d62ca..f2849480a86cb 100644 --- a/web/src/helpers/api.ts +++ b/web/src/helpers/api.ts @@ -1,6 +1,5 @@ import axios from ""axios""; import { Resource } from ""@/types/proto/api/v2/resource_service""; -import { GetUserResponse } from ""@/types/proto/api/v2/user_service""; export function getSystemStatus() { return axios.get(""/api/v1/status""); @@ -56,10 +55,6 @@ export function getUserList() { return axios.get(""/api/v1/user""); } -export function getUserByUsername(username: string) { - return axios.get(`/api/v2/users/${username}`); -} - export function upsertUserSetting(upsert: UserSettingUpsert) { return axios.post(`/api/v1/user/setting`, upsert); } diff --git a/web/src/hooks/useCurrentUser.ts b/web/src/hooks/useCurrentUser.ts index bf530eb330196..22a8b6ba99c77 100644 --- a/web/src/hooks/useCurrentUser.ts +++ b/web/src/hooks/useCurrentUser.ts @@ -5,7 +5,7 @@ import { useUserV1Store } from ""@/store/v1""; const useCurrentUser = () => { const userStore = useUserStore(); const userV1Store = useUserV1Store(); - const currentUsername = userStore.getCurrentUsername(); + const currentUsername = userStore.state.user?.username; useEffect(() => { if (currentUsername) { @@ -13,7 +13,7 @@ const useCurrentUser = () => { } }, [currentUsername]); - return userV1Store.getUserByUsername(currentUsername); + return userV1Store.getUserByUsername(currentUsername || """"); }; export default useCurrentUser; diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index a3b04ed282ece..ccc39555e1490 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -3,17 +3,14 @@ import MemoEditor from ""@/components/MemoEditor""; import MemoFilter from ""@/components/MemoFilter""; import MemoList from ""@/components/MemoList""; import MobileHeader from ""@/components/MobileHeader""; -import { useUserStore } from ""@/store/module""; const Home = () => { - const userStore = useUserStore(); - return (
- {!userStore.isVisitorMode() && } +
diff --git a/web/src/pages/Resources.tsx b/web/src/pages/Resources.tsx index 143a72971a263..7ee0aa12caa56 100644 --- a/web/src/pages/Resources.tsx +++ b/web/src/pages/Resources.tsx @@ -1,17 +1,17 @@ -import axios from ""axios""; import { useEffect, useState } from ""react""; import { Link } from ""react-router-dom""; import Empty from ""@/components/Empty""; import Icon from ""@/components/Icon""; import MobileHeader from ""@/components/MobileHeader""; import ResourceIcon from ""@/components/ResourceIcon""; +import { resourceServiceClient } from ""@/grpcweb""; import useLoading from ""@/hooks/useLoading""; -import { ListResourcesResponse, Resource } from ""@/types/proto/api/v2/resource_service""; +import { Resource } from ""@/types/proto/api/v2/resource_service""; import { useTranslate } from ""@/utils/i18n""; const fetchAllResources = async () => { - const { data } = await axios.get(""/api/v2/resources""); - return data.resources; + const { resources } = await resourceServiceClient.listResources({}); + return resources; }; function groupResourcesByDate(resources: Resource[]) { diff --git a/web/src/pages/Setting.tsx b/web/src/pages/Setting.tsx index 707d2a6b2c36d..7585273afa96e 100644 --- a/web/src/pages/Setting.tsx +++ b/web/src/pages/Setting.tsx @@ -1,5 +1,4 @@ import { Option, Select } from ""@mui/joy""; -import { isEqual } from ""lodash-es""; import { useState } from ""react""; import BetaBadge from ""@/components/BetaBadge""; import Icon from ""@/components/Icon""; @@ -11,6 +10,7 @@ import SSOSection from ""@/components/Settings/SSOSection""; import StorageSection from ""@/components/Settings/StorageSection""; import SystemSection from ""@/components/Settings/SystemSection""; import useCurrentUser from ""@/hooks/useCurrentUser""; +import { User_Role } from ""@/types/proto/api/v2/user_service""; import { useTranslate } from ""@/utils/i18n""; import ""@/less/setting.less""; @@ -26,7 +26,7 @@ const Setting = () => { const [state, setState] = useState({ selectedSection: ""my-account"", }); - const isHost = isEqual(user.role, ""HOST""); + const isHost = user.role === User_Role.HOST; const handleSectionSelectorItemClick = (settingSection: SettingSection) => { setState({ diff --git a/web/src/pages/UserProfile.tsx b/web/src/pages/UserProfile.tsx index 990f2bab4928c..abb0ad7f0dc28 100644 --- a/web/src/pages/UserProfile.tsx +++ b/web/src/pages/UserProfile.tsx @@ -1,26 +1,30 @@ import { useEffect, useState } from ""react""; import { toast } from ""react-hot-toast""; +import { useParams } from ""react-router-dom""; import FloatingNavButton from ""@/components/FloatingNavButton""; import MemoFilter from ""@/components/MemoFilter""; import MemoList from ""@/components/MemoList""; import UserAvatar from ""@/components/UserAvatar""; import useLoading from ""@/hooks/useLoading""; -import { useUserStore } from ""@/store/module""; import { useUserV1Store } from ""@/store/v1""; import { User } from ""@/types/proto/api/v2/user_service""; import { useTranslate } from ""@/utils/i18n""; const UserProfile = () => { const t = useTranslate(); - const userStore = useUserStore(); + const params = useParams(); const userV1Store = useUserV1Store(); const loadingState = useLoading(); const [user, setUser] = useState(); useEffect(() => { - const currentUsername = userStore.getCurrentUsername(); + const username = params.username; + if (!username) { + throw new Error(""username is required""); + } + userV1Store - .getOrFetchUserByUsername(currentUsername) + .getOrFetchUserByUsername(username) .then((user) => { setUser(user); loadingState.setFinish(); @@ -29,7 +33,7 @@ const UserProfile = () => { console.error(error); toast.error(t(""message.user-not-found"")); }); - }, [userStore.getCurrentUsername()]); + }, [params.username]); return ( <> diff --git a/web/src/store/module/global.ts b/web/src/store/module/global.ts index 5cc422374b90a..1469b2660cb9f 100644 --- a/web/src/store/module/global.ts +++ b/web/src/store/module/global.ts @@ -1,4 +1,4 @@ -import axios from ""axios""; +import { systemServiceClient } from ""@/grpcweb""; import * as api from ""@/helpers/api""; import storage from ""@/helpers/storage""; import i18n from ""@/i18n""; @@ -75,11 +75,8 @@ export const useGlobalStore = () => { }, fetchSystemStatus: async () => { const { data: systemStatus } = await api.getSystemStatus(); - // TODO: update this when api v2 is ready. - const { - data: { systemInfo }, - } = await axios.get(""/api/v2/system/info""); - systemStatus.dbSize = Number(systemInfo.dbSize); + const { systemInfo } = await systemServiceClient.getSystemInfo({}); + systemStatus.dbSize = systemInfo?.dbSize || 0; store.dispatch(setGlobalState({ systemStatus: systemStatus })); return systemStatus; }, diff --git a/web/src/store/module/memo.ts b/web/src/store/module/memo.ts index 2cd6da7775152..664b0b623cf1e 100644 --- a/web/src/store/module/memo.ts +++ b/web/src/store/module/memo.ts @@ -4,7 +4,6 @@ import { DEFAULT_MEMO_LIMIT } from ""@/helpers/consts""; import store, { useAppSelector } from ""../""; import { createMemo, deleteMemo, patchMemo, upsertMemos } from ""../reducer/memo""; import { useMemoCacheStore } from ""../v1""; -import { getUsernameFromPath, useUserStore } from ""./""; export const convertResponseModelMemo = (memo: Memo): Memo => { return { @@ -17,7 +16,6 @@ export const convertResponseModelMemo = (memo: Memo): Memo => { export const useMemoStore = () => { const state = useAppSelector((state) => state.memo); - const userStore = useUserStore(); const memoCacheStore = useMemoCacheStore(); const fetchMemoById = async (memoId: MemoId) => { @@ -33,14 +31,14 @@ export const useMemoStore = () => { getState: () => { return store.getState().memo; }, - fetchMemos: async (limit = DEFAULT_MEMO_LIMIT, offset = 0) => { + fetchMemos: async (username = """", limit = DEFAULT_MEMO_LIMIT, offset = 0) => { const memoFind: MemoFind = { rowStatus: ""NORMAL"", limit, offset, }; - if (userStore.isVisitorMode()) { - memoFind.creatorUsername = getUsernameFromPath(); + if (username) { + memoFind.creatorUsername = username; } const { data } = await api.getMemoList(memoFind); const fetchedMemos = data.map((m) => convertResponseModelMemo(m)); diff --git a/web/src/store/module/user.ts b/web/src/store/module/user.ts index 471e8d0d2013f..23b281108add6 100644 --- a/web/src/store/module/user.ts +++ b/web/src/store/module/user.ts @@ -1,6 +1,5 @@ import { camelCase } from ""lodash-es""; import * as api from ""@/helpers/api""; -import { UNKNOWN_USERNAME } from ""@/helpers/consts""; import storage from ""@/helpers/storage""; import { getSystemColorScheme } from ""@/helpers/utils""; import store, { useAppSelector } from ""..""; @@ -86,38 +85,16 @@ const doSignOut = async () => { await api.signout(); }; -export const getUsernameFromPath = () => { - const pathname = window.location.pathname; - const usernameRegex = /^\/u\/(\w+).*/; - const result = pathname.match(usernameRegex); - if (result && result.length === 2) { - return String(result[1]); - } - return undefined; -}; - export const useUserStore = () => { const state = useAppSelector((state) => state.user); - const isVisitorMode = () => { - return state.user === undefined || getUsernameFromPath(); - }; - return { state, getState: () => { return store.getState().user; }, - isVisitorMode, doSignIn, doSignOut, - getCurrentUsername: () => { - if (isVisitorMode()) { - return getUsernameFromPath() || UNKNOWN_USERNAME; - } else { - return state.user?.username || UNKNOWN_USERNAME; - } - }, upsertUserSetting: async (key: string, value: any) => { await api.upsertUserSetting({ key: key as any, @@ -130,10 +107,10 @@ export const useUserStore = () => { store.dispatch(patchUser({ localSetting })); }, patchUser: async (userPatch: UserPatch): Promise => { - const { data } = await api.patchUser(userPatch); - if (userPatch.id === store.getState().user.user?.id) { - const user = convertResponseModelUser(data); - store.dispatch(patchUser(user)); + await api.patchUser(userPatch); + // If the user is the current user and the username is changed, reload the page. + if (userPatch.id === store.getState().user.user?.id && userPatch.username) { + window.location.reload(); } }, deleteUser: async (userDelete: UserDelete) => { diff --git a/web/vite.config.ts b/web/vite.config.ts index adaa75114e634..d92719d99a197 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -27,7 +27,7 @@ export default defineConfig({ target: devProxyServer, xfwd: true, }, - ""/explore/rss.xml"": { + ""^/explore/rss.xml"": { target: devProxyServer, xfwd: true, },",fix,invalid username checks e5ff1829a514bdc0655c7b115a0bc7d9fe949165,2024-01-26 06:14:12,Steven,chore: add Hungarian locale,False,"diff --git a/web/src/i18n.ts b/web/src/i18n.ts index 840e9af96bb71..8e1feb7a27dd1 100644 --- a/web/src/i18n.ts +++ b/web/src/i18n.ts @@ -11,6 +11,7 @@ export const availableLocales = [ ""fr"", ""hi"", ""hr"", + ""hu"", ""it"", ""ja"", ""ko"",",chore,add Hungarian locale 0292f472e064b89d6c7da52050d79c74493e26b9,2023-07-08 10:34:12,boojack,chore: add data empty placeholder (#1913),False,"diff --git a/web/public/assets/empty.png b/web/public/assets/empty.png new file mode 100644 index 0000000000000..79b825960124b Binary files /dev/null and b/web/public/assets/empty.png differ diff --git a/web/src/components/ArchivedMemo.tsx b/web/src/components/ArchivedMemo.tsx index 7ca8249256831..a9e9418c0a6de 100644 --- a/web/src/components/ArchivedMemo.tsx +++ b/web/src/components/ArchivedMemo.tsx @@ -3,10 +3,10 @@ import { toast } from ""react-hot-toast""; import { useTranslation } from ""react-i18next""; import { useMemoStore } from ""@/store/module""; import { getDateTimeString } from ""@/helpers/datetime""; -import useToggle from ""@/hooks/useToggle""; import Icon from ""./Icon""; import MemoContent from ""./MemoContent""; import MemoResourceListView from ""./MemoResourceListView""; +import { showCommonDialog } from ""./Dialog/CommonDialog""; import ""@/less/memo.less""; interface Props { @@ -17,19 +17,17 @@ const ArchivedMemo: React.FC = (props: Props) => { const { memo } = props; const { t } = useTranslation(); const memoStore = useMemoStore(); - const [showConfirmDeleteBtn, toggleConfirmDeleteBtn] = useToggle(false); const handleDeleteMemoClick = async () => { - if (showConfirmDeleteBtn) { - try { + showCommonDialog({ + title: t(""memo.delete-memo""), + content: t(""memo.delete-confirm""), + style: ""warning"", + dialogName: ""delete-memo-dialog"", + onConfirm: async () => { await memoStore.deleteMemoById(memo.id); - } catch (error: any) { - console.error(error); - toast.error(error.response.data.message); - } - } else { - toggleConfirmDeleteBtn(); - } + }, + }); }; const handleRestoreMemoClick = async () => { @@ -46,14 +44,8 @@ const ArchivedMemo: React.FC = (props: Props) => { } }; - const handleMouseLeaveMemoWrapper = () => { - if (showConfirmDeleteBtn) { - toggleConfirmDeleteBtn(false); - } - }; - return ( -
+
{getDateTimeString(memo.updatedTs)} @@ -65,10 +57,7 @@ const ArchivedMemo: React.FC = (props: Props) => { - diff --git a/web/src/components/CreateIdentityProviderDialog.tsx b/web/src/components/CreateIdentityProviderDialog.tsx index 3c58783c9abd2..4e7392f414161 100644 --- a/web/src/components/CreateIdentityProviderDialog.tsx +++ b/web/src/components/CreateIdentityProviderDialog.tsx @@ -1,12 +1,12 @@ +import { Button, Divider, Input, Option, Select, Typography } from ""@mui/joy""; import { useEffect, useState } from ""react""; +import { useTranslation } from ""react-i18next""; import { toast } from ""react-hot-toast""; -import { Button, Divider, Input, Option, Select, Typography } from ""@mui/joy""; import * as api from ""@/helpers/api""; import { UNKNOWN_ID } from ""@/helpers/consts""; import { absolutifyLink } from ""@/helpers/utils""; import { generateDialog } from ""./Dialog""; import Icon from ""./Icon""; -import { useTranslation } from ""react-i18next""; const templateList: IdentityProvider[] = [ { @@ -170,7 +170,6 @@ const CreateIdentityProviderDialog: React.FC = (props: Props) => { if (type === ""OAUTH2"") { if ( oauth2Config.clientId === """" || - oauth2Config.clientSecret === """" || oauth2Config.authUrl === """" || oauth2Config.tokenUrl === """" || oauth2Config.userInfoUrl === """" || @@ -179,7 +178,13 @@ const CreateIdentityProviderDialog: React.FC = (props: Props) => { ) { return false; } + if (isCreating) { + if (oauth2Config.clientSecret === """") { + return false; + } + } } + return true; }; diff --git a/web/src/components/CreateStorageServiceDialog.tsx b/web/src/components/CreateStorageServiceDialog.tsx index 108f471262e6e..4bb072b7d4d4a 100644 --- a/web/src/components/CreateStorageServiceDialog.tsx +++ b/web/src/components/CreateStorageServiceDialog.tsx @@ -6,7 +6,7 @@ import * as api from ""@/helpers/api""; import { generateDialog } from ""./Dialog""; import Icon from ""./Icon""; import RequiredBadge from ""./RequiredBadge""; -import HelpButton from ""./kit/HelpButton""; +import LearnMore from ""./LearnMore""; interface Props extends DialogProps { storage?: ObjectStorage; @@ -183,11 +183,9 @@ const CreateStorageServiceDialog: React.FC = (props: Props) => { onChange={(e) => setPartialS3Config({ bucket: e.target.value })} fullWidth /> -
- - {t(""setting.storage-section.path"")} - - +
+ {t(""setting.storage-section.path"")} +
{ + return ( +
+ +
+ ); +}; + +export default Empty; diff --git a/web/src/components/Header.tsx b/web/src/components/Header.tsx index 52f7c4df6ffb1..bb5c0b7f0c3d1 100644 --- a/web/src/components/Header.tsx +++ b/web/src/components/Header.tsx @@ -132,12 +132,12 @@ const Header = () => { {t(""common.settings"")} -
+
diff --git a/web/src/components/Memo.tsx b/web/src/components/Memo.tsx index 2e770ed4a4fc8..24d30d09857a4 100644 --- a/web/src/components/Memo.tsx +++ b/web/src/components/Memo.tsx @@ -21,12 +21,13 @@ import ""@/less/memo.less""; interface Props { memo: Memo; - readonly?: boolean; + showCreator?: boolean; + showVisibility?: boolean; showRelatedMemos?: boolean; } const Memo: React.FC = (props: Props) => { - const { memo, readonly, showRelatedMemos } = props; + const { memo, showCreator, showVisibility, showRelatedMemos } = props; const { t, i18n } = useTranslation(); const filterStore = useFilterStore(); const userStore = useUserStore(); @@ -35,7 +36,7 @@ const Memo: React.FC = (props: Props) => { const [createdTimeStr, setCreatedTimeStr] = useState(getRelativeTimeString(memo.displayTs)); const [relatedMemoList, setRelatedMemoList] = useState([]); const memoContainerRef = useRef(null); - const isVisitorMode = userStore.isVisitorMode() || readonly; + const readonly = userStore.isVisitorMode() || userStore.getCurrentUserId() !== memo.creatorId; useEffect(() => { Promise.allSettled(memo.relationList.map((memoRelation) => memoCacheStore.getOrFetchMemoById(memoRelation.relatedMemoId))).then( @@ -134,7 +135,7 @@ const Memo: React.FC = (props: Props) => { filterStore.setTagFilter(tagName); } } else if (targetEl.classList.contains(""todo-block"")) { - if (isVisitorMode) { + if (readonly) { return; } @@ -173,7 +174,7 @@ const Memo: React.FC = (props: Props) => { }; const handleMemoContentDoubleClick = (e: React.MouseEvent) => { - if (isVisitorMode) { + if (readonly) { return; } @@ -216,60 +217,62 @@ const Memo: React.FC = (props: Props) => { {createdTimeStr} - {isVisitorMode && ( + {showCreator && ( @{memo.creatorName} )}
- {!isVisitorMode && ( -
- {memo.visibility !== ""PRIVATE"" && ( - -
handleMemoVisibilityClick(memo.visibility)}> - {memo.visibility === ""PUBLIC"" ? ( - - ) : ( - - )} +
+ {showVisibility && memo.visibility !== ""PRIVATE"" && ( + +
handleMemoVisibilityClick(memo.visibility)}> + {memo.visibility === ""PUBLIC"" ? ( + + ) : ( + + )} +
+
+ )} + {memo.pinned && } + {!readonly && ( + <> + + + +
+
+ + {memo.pinned ? : } + {memo.pinned ? t(""common.unpin"") : t(""common.pin"")} + + + + {t(""common.edit"")} + + + + {t(""common.share"")} + + + + Mark + + + + + {t(""common.archive"")} + + + + {t(""common.delete"")} +
- - )} - {memo.pinned && } - - - -
-
- - {memo.pinned ? : } - {memo.pinned ? t(""common.unpin"") : t(""common.pin"")} - - - - {t(""common.edit"")} - - - - {t(""common.share"")} - - - - Mark - - - - - {t(""common.archive"")} - - - - {t(""common.delete"")} -
-
-
- )} + + )} +
= (props: Props) => { {showRelatedMemos && relatedMemoList.length > 0 && ( <> -

+

Related memos

{relatedMemoList.map((relatedMemo) => { return (
- +
); })} diff --git a/web/src/components/MemoContent.tsx b/web/src/components/MemoContent.tsx index 5f650ec4bbe4b..ba5c4a81eb1be 100644 --- a/web/src/components/MemoContent.tsx +++ b/web/src/components/MemoContent.tsx @@ -24,14 +24,11 @@ interface State { const MemoContent: React.FC = (props: Props) => { const { className, content, showFull, onMemoContentClick, onMemoContentDoubleClick } = props; const { t } = useTranslation(); - + const userStore = useUserStore(); const [state, setState] = useState({ expandButtonStatus: -1, }); const memoContentContainerRef = useRef(null); - - //variable for auto-collapse - const userStore = useUserStore(); const isVisitorMode = userStore.isVisitorMode(); const autoCollapse: boolean = isVisitorMode ? true : (userStore.state.user as User).localSetting.enableAutoCollapse; diff --git a/web/src/components/MemoList.tsx b/web/src/components/MemoList.tsx index 4e5799f131490..f30ba483e6133 100644 --- a/web/src/components/MemoList.tsx +++ b/web/src/components/MemoList.tsx @@ -2,13 +2,13 @@ import { useEffect, useRef, useState } from ""react""; import { toast } from ""react-hot-toast""; import { useTranslation } from ""react-i18next""; import { useFilterStore, useMemoStore, useShortcutStore, useUserStore } from ""@/store/module""; -import { TAG_REG, LINK_REG } from ""@/labs/marked/parser""; +import { TAG_REG, LINK_REG, PLAIN_LINK_REG } from ""@/labs/marked/parser""; import { getTimeStampByDate } from ""@/helpers/datetime""; import { DEFAULT_MEMO_LIMIT } from ""@/helpers/consts""; import { checkShouldShowMemoWithFilters } from ""@/helpers/filter""; +import Empty from ""./Empty""; import Memo from ""./Memo""; import ""@/less/memo-list.less""; -import { PLAIN_LINK_REG } from ""@/labs/marked/parser""; const MemoList = () => { const { t } = useTranslation(); @@ -153,7 +153,7 @@ const MemoList = () => { return (
{sortedMemos.map((memo) => ( - + ))} {isFetching ? (
@@ -163,10 +163,11 @@ const MemoList = () => {

{isComplete ? ( - sortedMemos.length === 0 ? ( - t(""message.no-memos"") - ) : ( - t(""message.memos-ready"") + sortedMemos.length === 0 && ( +

+ +

{t(""message.no-data"")}

+
) ) : ( <> diff --git a/web/src/components/Settings/MyAccountSection.tsx b/web/src/components/Settings/MyAccountSection.tsx index d911544072576..839beb7d4b8d1 100644 --- a/web/src/components/Settings/MyAccountSection.tsx +++ b/web/src/components/Settings/MyAccountSection.tsx @@ -28,6 +28,8 @@ const MyAccountSection = () => { }); }; + const exampleWithCurl = `curl '${openAPIRoute}' -H 'Content-Type: application/json' --data-raw '{""content"":""Hello world!""}'`; + return ( <>
@@ -48,22 +50,15 @@ const MyAccountSection = () => {
-

{t(""setting.account-section.openapi-title"")}

- - -
- -
{/* nth */}
-
+
+ + <> + + + + +