Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
b13042d6
Unverified
Commit
b13042d6
authored
Sep 17, 2023
by
boojack
Committed by
GitHub
Sep 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: move buf generated code to gitignore (#2236)
parent
d09e3c36
Changes
27
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
35 additions
and
2821 deletions
+35
-2821
frontend-tests.yml
.github/workflows/frontend-tests.yml
+6
-0
Dockerfile
Dockerfile
+10
-4
buf.gen.yaml
proto/buf.gen.yaml
+1
-1
.gitignore
web/.gitignore
+1
-6
CreateResourceDialog.tsx
web/src/components/CreateResourceDialog.tsx
+1
-1
ResourceListView.tsx
web/src/components/MemoEditor/ResourceListView.tsx
+1
-1
index.tsx
web/src/components/MemoEditor/index.tsx
+1
-1
MemoResource.tsx
web/src/components/MemoResource.tsx
+1
-1
MemoResourceListView.tsx
web/src/components/MemoResourceListView.tsx
+1
-1
ResourceIcon.tsx
web/src/components/ResourceIcon.tsx
+1
-1
AccessTokenSection.tsx
web/src/components/Settings/AccessTokenSection.tsx
+1
-1
grpcweb.ts
web/src/grpcweb.ts
+1
-1
api.ts
web/src/helpers/api.ts
+2
-2
MemoDetail.tsx
web/src/pages/MemoDetail.tsx
+1
-1
Resources.tsx
web/src/pages/Resources.tsx
+1
-1
UserProfile.tsx
web/src/pages/UserProfile.tsx
+1
-1
resource.ts
web/src/store/module/resource.ts
+1
-1
resource.ts
web/src/store/reducer/resource.ts
+1
-1
user.ts
web/src/store/v1/user.ts
+1
-1
common.ts
web/src/types/proto-grpcweb/api/v2/common.ts
+0
-10
memo_service.ts
web/src/types/proto-grpcweb/api/v2/memo_service.ts
+0
-468
resource_service.ts
web/src/types/proto-grpcweb/api/v2/resource_service.ts
+0
-288
system_service.ts
web/src/types/proto-grpcweb/api/v2/system_service.ts
+0
-465
tag_service.ts
web/src/types/proto-grpcweb/api/v2/tag_service.ts
+0
-193
user_service.ts
web/src/types/proto-grpcweb/api/v2/user_service.ts
+0
-1162
timestamp.ts
web/src/types/proto-grpcweb/google/protobuf/timestamp.ts
+0
-207
resource.ts
web/src/utils/resource.ts
+1
-1
No files found.
.github/workflows/frontend-tests.yml
View file @
b13042d6
...
@@ -13,6 +13,9 @@ jobs:
...
@@ -13,6 +13,9 @@ jobs:
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
steps
:
steps
:
-
uses
:
actions/checkout@v3
-
uses
:
actions/checkout@v3
-
uses
:
bufbuild/buf-setup-action@v1
-
run
:
buf generate
working-directory
:
proto
-
uses
:
pnpm/action-setup@v2.2.4
-
uses
:
pnpm/action-setup@v2.2.4
with
:
with
:
version
:
8
version
:
8
...
@@ -31,6 +34,9 @@ jobs:
...
@@ -31,6 +34,9 @@ jobs:
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
steps
:
steps
:
-
uses
:
actions/checkout@v3
-
uses
:
actions/checkout@v3
-
uses
:
bufbuild/buf-setup-action@v1
-
run
:
buf generate
working-directory
:
proto
-
uses
:
pnpm/action-setup@v2.2.4
-
uses
:
pnpm/action-setup@v2.2.4
with
:
with
:
version
:
8
version
:
8
...
...
Dockerfile
View file @
b13042d6
...
@@ -2,11 +2,17 @@
...
@@ -2,11 +2,17 @@
FROM
node:18-alpine AS frontend
FROM
node:18-alpine AS frontend
WORKDIR
/frontend-build
WORKDIR
/frontend-build
COPY
.
/web/package.json ./web/pnpm-lock.yaml ./
COPY
.
.
RUN
corepack
enable
&&
pnpm i
--frozen-lockfile
WORKDIR
/frontend-build/proto
RUN
npm i
-g
@bufbuild/buf
COPY
./web/ .
RUN
buf generate
WORKDIR
/frontend-build/web
RUN
corepack
enable
&&
pnpm i
--frozen-lockfile
RUN
pnpm build
RUN
pnpm build
...
@@ -15,7 +21,7 @@ FROM golang:1.21-alpine AS backend
...
@@ -15,7 +21,7 @@ FROM golang:1.21-alpine AS backend
WORKDIR
/backend-build
WORKDIR
/backend-build
COPY
. .
COPY
. .
COPY
--from=frontend /frontend-build/dist ./server/dist
COPY
--from=frontend /frontend-build/
web/
dist ./server/dist
RUN
CGO_ENABLED
=
0 go build
-o
memos ./main.go
RUN
CGO_ENABLED
=
0 go build
-o
memos ./main.go
...
...
proto/buf.gen.yaml
View file @
b13042d6
...
@@ -20,7 +20,7 @@ plugins:
...
@@ -20,7 +20,7 @@ plugins:
-
paths=source_relative
-
paths=source_relative
# Build the TypeScript definitions for the web.
# Build the TypeScript definitions for the web.
-
plugin
:
buf.build/community/stephenh-ts-proto:v1.152.1
-
plugin
:
buf.build/community/stephenh-ts-proto:v1.152.1
out
:
../web/src/types/proto
-grpcweb
out
:
../web/src/types/proto
# reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md#using-ts-proto
# reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md#using-ts-proto
opt
:
opt
:
-
env=browser
-
env=browser
...
...
web/.gitignore
View file @
b13042d6
...
@@ -3,9 +3,4 @@ node_modules
...
@@ -3,9 +3,4 @@ node_modules
dist
dist
dist-ssr
dist-ssr
*.local
*.local
src/types/proto
/test-results/
/playwright-report/
/playwright/.cache/
/playwright-screenshot/
web/src/components/CreateResourceDialog.tsx
View file @
b13042d6
import
{
Autocomplete
,
Button
,
Input
,
List
,
ListItem
,
Option
,
Select
,
Typography
}
from
"@mui/joy"
;
import
{
Autocomplete
,
Button
,
Input
,
List
,
ListItem
,
Option
,
Select
,
Typography
}
from
"@mui/joy"
;
import
React
,
{
useRef
,
useState
}
from
"react"
;
import
React
,
{
useRef
,
useState
}
from
"react"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
Resource
}
from
"@/types/proto
-grpcweb
/api/v2/resource_service"
;
import
{
Resource
}
from
"@/types/proto/api/v2/resource_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useResourceStore
}
from
"../store/module"
;
import
{
useResourceStore
}
from
"../store/module"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
{
generateDialog
}
from
"./Dialog"
;
...
...
web/src/components/MemoEditor/ResourceListView.tsx
View file @
b13042d6
import
{
Resource
}
from
"@/types/proto
-grpcweb
/api/v2/resource_service"
;
import
{
Resource
}
from
"@/types/proto/api/v2/resource_service"
;
import
Icon
from
"../Icon"
;
import
Icon
from
"../Icon"
;
import
ResourceIcon
from
"../ResourceIcon"
;
import
ResourceIcon
from
"../ResourceIcon"
;
...
...
web/src/components/MemoEditor/index.tsx
View file @
b13042d6
...
@@ -8,7 +8,7 @@ import { TAB_SPACE_WIDTH, UNKNOWN_ID } from "@/helpers/consts";
...
@@ -8,7 +8,7 @@ import { TAB_SPACE_WIDTH, UNKNOWN_ID } from "@/helpers/consts";
import
{
clearContentQueryParam
}
from
"@/helpers/utils"
;
import
{
clearContentQueryParam
}
from
"@/helpers/utils"
;
import
{
getMatchedNodes
}
from
"@/labs/marked"
;
import
{
getMatchedNodes
}
from
"@/labs/marked"
;
import
{
useFilterStore
,
useGlobalStore
,
useMemoStore
,
useResourceStore
,
useTagStore
,
useUserStore
}
from
"@/store/module"
;
import
{
useFilterStore
,
useGlobalStore
,
useMemoStore
,
useResourceStore
,
useTagStore
,
useUserStore
}
from
"@/store/module"
;
import
{
Resource
}
from
"@/types/proto
-grpcweb
/api/v2/resource_service"
;
import
{
Resource
}
from
"@/types/proto/api/v2/resource_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
showCreateResourceDialog
from
"../CreateResourceDialog"
;
import
showCreateResourceDialog
from
"../CreateResourceDialog"
;
import
Icon
from
"../Icon"
;
import
Icon
from
"../Icon"
;
...
...
web/src/components/MemoResource.tsx
View file @
b13042d6
import
{
Resource
}
from
"@/types/proto
-grpcweb
/api/v2/resource_service"
;
import
{
Resource
}
from
"@/types/proto/api/v2/resource_service"
;
import
{
getResourceUrl
}
from
"@/utils/resource"
;
import
{
getResourceUrl
}
from
"@/utils/resource"
;
import
ResourceIcon
from
"./ResourceIcon"
;
import
ResourceIcon
from
"./ResourceIcon"
;
...
...
web/src/components/MemoResourceListView.tsx
View file @
b13042d6
import
classNames
from
"classnames"
;
import
classNames
from
"classnames"
;
import
{
absolutifyLink
}
from
"@/helpers/utils"
;
import
{
absolutifyLink
}
from
"@/helpers/utils"
;
import
{
Resource
}
from
"@/types/proto
-grpcweb
/api/v2/resource_service"
;
import
{
Resource
}
from
"@/types/proto/api/v2/resource_service"
;
import
{
getResourceType
,
getResourceUrl
}
from
"@/utils/resource"
;
import
{
getResourceType
,
getResourceUrl
}
from
"@/utils/resource"
;
import
MemoResource
from
"./MemoResource"
;
import
MemoResource
from
"./MemoResource"
;
import
showPreviewImageDialog
from
"./PreviewImageDialog"
;
import
showPreviewImageDialog
from
"./PreviewImageDialog"
;
...
...
web/src/components/ResourceIcon.tsx
View file @
b13042d6
import
classNames
from
"classnames"
;
import
classNames
from
"classnames"
;
import
React
from
"react"
;
import
React
from
"react"
;
import
{
Resource
}
from
"@/types/proto
-grpcweb
/api/v2/resource_service"
;
import
{
Resource
}
from
"@/types/proto/api/v2/resource_service"
;
import
{
getResourceType
,
getResourceUrl
}
from
"@/utils/resource"
;
import
{
getResourceType
,
getResourceUrl
}
from
"@/utils/resource"
;
import
Icon
from
"./Icon"
;
import
Icon
from
"./Icon"
;
import
showPreviewImageDialog
from
"./PreviewImageDialog"
;
import
showPreviewImageDialog
from
"./PreviewImageDialog"
;
...
...
web/src/components/Settings/AccessTokenSection.tsx
View file @
b13042d6
...
@@ -4,7 +4,7 @@ import copy from "copy-to-clipboard";
...
@@ -4,7 +4,7 @@ import copy from "copy-to-clipboard";
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
toast
}
from
"react-hot-toast"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
ListUserAccessTokensResponse
,
UserAccessToken
}
from
"@/types/proto
-grpcweb
/api/v2/user_service"
;
import
{
ListUserAccessTokensResponse
,
UserAccessToken
}
from
"@/types/proto/api/v2/user_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
showCreateAccessTokenDialog
from
"../CreateAccessTokenDialog"
;
import
showCreateAccessTokenDialog
from
"../CreateAccessTokenDialog"
;
import
{
showCommonDialog
}
from
"../Dialog/CommonDialog"
;
import
{
showCommonDialog
}
from
"../Dialog/CommonDialog"
;
...
...
web/src/grpcweb.ts
View file @
b13042d6
import
{
createChannel
,
createClientFactory
,
FetchTransport
}
from
"nice-grpc-web"
;
import
{
createChannel
,
createClientFactory
,
FetchTransport
}
from
"nice-grpc-web"
;
import
{
UserServiceDefinition
}
from
"./types/proto
-grpcweb
/api/v2/user_service"
;
import
{
UserServiceDefinition
}
from
"./types/proto/api/v2/user_service"
;
const
address
=
import
.
meta
.
env
.
MODE
===
"development"
?
"http://localhost:8081"
:
window
.
location
.
origin
;
const
address
=
import
.
meta
.
env
.
MODE
===
"development"
?
"http://localhost:8081"
:
window
.
location
.
origin
;
...
...
web/src/helpers/api.ts
View file @
b13042d6
import
axios
from
"axios"
;
import
axios
from
"axios"
;
import
{
Resource
}
from
"@/types/proto
-grpcweb
/api/v2/resource_service"
;
import
{
Resource
}
from
"@/types/proto/api/v2/resource_service"
;
import
{
GetUserResponse
}
from
"@/types/proto
-grpcweb
/api/v2/user_service"
;
import
{
GetUserResponse
}
from
"@/types/proto/api/v2/user_service"
;
export
function
getSystemStatus
()
{
export
function
getSystemStatus
()
{
return
axios
.
get
<
SystemStatus
>
(
"/api/v1/status"
);
return
axios
.
get
<
SystemStatus
>
(
"/api/v1/status"
);
...
...
web/src/pages/MemoDetail.tsx
View file @
b13042d6
...
@@ -7,7 +7,7 @@ import UserAvatar from "@/components/UserAvatar";
...
@@ -7,7 +7,7 @@ import UserAvatar from "@/components/UserAvatar";
import
useLoading
from
"@/hooks/useLoading"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
{
useMemoStore
}
from
"@/store/module"
;
import
{
useMemoStore
}
from
"@/store/module"
;
import
{
useUserV1Store
}
from
"@/store/v1"
;
import
{
useUserV1Store
}
from
"@/store/v1"
;
import
{
User
}
from
"@/types/proto
-grpcweb
/api/v2/user_service"
;
import
{
User
}
from
"@/types/proto/api/v2/user_service"
;
const
MemoDetail
=
()
=>
{
const
MemoDetail
=
()
=>
{
const
params
=
useParams
();
const
params
=
useParams
();
...
...
web/src/pages/Resources.tsx
View file @
b13042d6
...
@@ -6,7 +6,7 @@ import Icon from "@/components/Icon";
...
@@ -6,7 +6,7 @@ import Icon from "@/components/Icon";
import
MobileHeader
from
"@/components/MobileHeader"
;
import
MobileHeader
from
"@/components/MobileHeader"
;
import
ResourceIcon
from
"@/components/ResourceIcon"
;
import
ResourceIcon
from
"@/components/ResourceIcon"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
{
ListResourcesResponse
,
Resource
}
from
"@/types/proto
-grpcweb
/api/v2/resource_service"
;
import
{
ListResourcesResponse
,
Resource
}
from
"@/types/proto/api/v2/resource_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
const
fetchAllResources
=
async
()
=>
{
const
fetchAllResources
=
async
()
=>
{
...
...
web/src/pages/UserProfile.tsx
View file @
b13042d6
...
@@ -7,7 +7,7 @@ import UserAvatar from "@/components/UserAvatar";
...
@@ -7,7 +7,7 @@ import UserAvatar from "@/components/UserAvatar";
import
useLoading
from
"@/hooks/useLoading"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
{
useUserStore
}
from
"@/store/module"
;
import
{
useUserStore
}
from
"@/store/module"
;
import
{
useUserV1Store
}
from
"@/store/v1"
;
import
{
useUserV1Store
}
from
"@/store/v1"
;
import
{
User
}
from
"@/types/proto
-grpcweb
/api/v2/user_service"
;
import
{
User
}
from
"@/types/proto/api/v2/user_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
const
UserProfile
=
()
=>
{
const
UserProfile
=
()
=>
{
...
...
web/src/store/module/resource.ts
View file @
b13042d6
import
*
as
api
from
"@/helpers/api"
;
import
*
as
api
from
"@/helpers/api"
;
import
{
Resource
}
from
"@/types/proto
-grpcweb
/api/v2/resource_service"
;
import
{
Resource
}
from
"@/types/proto/api/v2/resource_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
store
,
{
useAppSelector
}
from
"../"
;
import
store
,
{
useAppSelector
}
from
"../"
;
import
{
deleteResource
,
patchResource
,
setResources
}
from
"../reducer/resource"
;
import
{
deleteResource
,
patchResource
,
setResources
}
from
"../reducer/resource"
;
...
...
web/src/store/reducer/resource.ts
View file @
b13042d6
import
{
createSlice
,
PayloadAction
}
from
"@reduxjs/toolkit"
;
import
{
createSlice
,
PayloadAction
}
from
"@reduxjs/toolkit"
;
import
{
uniqBy
}
from
"lodash-es"
;
import
{
uniqBy
}
from
"lodash-es"
;
import
{
Resource
}
from
"@/types/proto
-grpcweb
/api/v2/resource_service"
;
import
{
Resource
}
from
"@/types/proto/api/v2/resource_service"
;
interface
State
{
interface
State
{
resources
:
Resource
[];
resources
:
Resource
[];
...
...
web/src/store/v1/user.ts
View file @
b13042d6
import
{
create
}
from
"zustand"
;
import
{
create
}
from
"zustand"
;
import
{
userServiceClient
}
from
"@/grpcweb"
;
import
{
userServiceClient
}
from
"@/grpcweb"
;
import
{
User
}
from
"@/types/proto
-grpcweb
/api/v2/user_service"
;
import
{
User
}
from
"@/types/proto/api/v2/user_service"
;
interface
UserV1Store
{
interface
UserV1Store
{
userMapByUsername
:
Record
<
string
,
User
>
;
userMapByUsername
:
Record
<
string
,
User
>
;
...
...
web/src/types/proto-grpcweb/api/v2/common.ts
deleted
100644 → 0
View file @
d09e3c36
/* eslint-disable */
export
const
protobufPackage
=
"memos.api.v2"
;
export
enum
RowStatus
{
ROW_STATUS_UNSPECIFIED
=
0
,
ACTIVE
=
1
,
ARCHIVED
=
2
,
UNRECOGNIZED
=
-
1
,
}
web/src/types/proto-grpcweb/api/v2/memo_service.ts
deleted
100644 → 0
View file @
d09e3c36
This diff is collapsed.
Click to expand it.
web/src/types/proto-grpcweb/api/v2/resource_service.ts
deleted
100644 → 0
View file @
d09e3c36
/* eslint-disable */
import
Long
from
"long"
;
import
_m0
from
"protobufjs/minimal"
;
import
{
Timestamp
}
from
"../../google/protobuf/timestamp"
;
export
const
protobufPackage
=
"memos.api.v2"
;
export
interface
Resource
{
id
:
number
;
createdTs
?:
Date
|
undefined
;
filename
:
string
;
externalLink
:
string
;
type
:
string
;
size
:
number
;
relatedMemoId
?:
number
|
undefined
;
}
export
interface
ListResourcesRequest
{
}
export
interface
ListResourcesResponse
{
resources
:
Resource
[];
}
function
createBaseResource
():
Resource
{
return
{
id
:
0
,
createdTs
:
undefined
,
filename
:
""
,
externalLink
:
""
,
type
:
""
,
size
:
0
,
relatedMemoId
:
undefined
};
}
export
const
Resource
=
{
encode
(
message
:
Resource
,
writer
:
_m0
.
Writer
=
_m0
.
Writer
.
create
()):
_m0
.
Writer
{
if
(
message
.
id
!==
0
)
{
writer
.
uint32
(
8
).
int32
(
message
.
id
);
}
if
(
message
.
createdTs
!==
undefined
)
{
Timestamp
.
encode
(
toTimestamp
(
message
.
createdTs
),
writer
.
uint32
(
18
).
fork
()).
ldelim
();
}
if
(
message
.
filename
!==
""
)
{
writer
.
uint32
(
26
).
string
(
message
.
filename
);
}
if
(
message
.
externalLink
!==
""
)
{
writer
.
uint32
(
34
).
string
(
message
.
externalLink
);
}
if
(
message
.
type
!==
""
)
{
writer
.
uint32
(
42
).
string
(
message
.
type
);
}
if
(
message
.
size
!==
0
)
{
writer
.
uint32
(
48
).
int64
(
message
.
size
);
}
if
(
message
.
relatedMemoId
!==
undefined
)
{
writer
.
uint32
(
56
).
int32
(
message
.
relatedMemoId
);
}
return
writer
;
},
decode
(
input
:
_m0
.
Reader
|
Uint8Array
,
length
?:
number
):
Resource
{
const
reader
=
input
instanceof
_m0
.
Reader
?
input
:
_m0
.
Reader
.
create
(
input
);
let
end
=
length
===
undefined
?
reader
.
len
:
reader
.
pos
+
length
;
const
message
=
createBaseResource
();
while
(
reader
.
pos
<
end
)
{
const
tag
=
reader
.
uint32
();
switch
(
tag
>>>
3
)
{
case
1
:
if
(
tag
!==
8
)
{
break
;
}
message
.
id
=
reader
.
int32
();
continue
;
case
2
:
if
(
tag
!==
18
)
{
break
;
}
message
.
createdTs
=
fromTimestamp
(
Timestamp
.
decode
(
reader
,
reader
.
uint32
()));
continue
;
case
3
:
if
(
tag
!==
26
)
{
break
;
}
message
.
filename
=
reader
.
string
();
continue
;
case
4
:
if
(
tag
!==
34
)
{
break
;
}
message
.
externalLink
=
reader
.
string
();
continue
;
case
5
:
if
(
tag
!==
42
)
{
break
;
}
message
.
type
=
reader
.
string
();
continue
;
case
6
:
if
(
tag
!==
48
)
{
break
;
}
message
.
size
=
longToNumber
(
reader
.
int64
()
as
Long
);
continue
;
case
7
:
if
(
tag
!==
56
)
{
break
;
}
message
.
relatedMemoId
=
reader
.
int32
();
continue
;
}
if
((
tag
&
7
)
===
4
||
tag
===
0
)
{
break
;
}
reader
.
skipType
(
tag
&
7
);
}
return
message
;
},
create
(
base
?:
DeepPartial
<
Resource
>
):
Resource
{
return
Resource
.
fromPartial
(
base
??
{});
},
fromPartial
(
object
:
DeepPartial
<
Resource
>
):
Resource
{
const
message
=
createBaseResource
();
message
.
id
=
object
.
id
??
0
;
message
.
createdTs
=
object
.
createdTs
??
undefined
;
message
.
filename
=
object
.
filename
??
""
;
message
.
externalLink
=
object
.
externalLink
??
""
;
message
.
type
=
object
.
type
??
""
;
message
.
size
=
object
.
size
??
0
;
message
.
relatedMemoId
=
object
.
relatedMemoId
??
undefined
;
return
message
;
},
};
function
createBaseListResourcesRequest
():
ListResourcesRequest
{
return
{};
}
export
const
ListResourcesRequest
=
{
encode
(
_
:
ListResourcesRequest
,
writer
:
_m0
.
Writer
=
_m0
.
Writer
.
create
()):
_m0
.
Writer
{
return
writer
;
},
decode
(
input
:
_m0
.
Reader
|
Uint8Array
,
length
?:
number
):
ListResourcesRequest
{
const
reader
=
input
instanceof
_m0
.
Reader
?
input
:
_m0
.
Reader
.
create
(
input
);
let
end
=
length
===
undefined
?
reader
.
len
:
reader
.
pos
+
length
;
const
message
=
createBaseListResourcesRequest
();
while
(
reader
.
pos
<
end
)
{
const
tag
=
reader
.
uint32
();
switch
(
tag
>>>
3
)
{
}
if
((
tag
&
7
)
===
4
||
tag
===
0
)
{
break
;
}
reader
.
skipType
(
tag
&
7
);
}
return
message
;
},
create
(
base
?:
DeepPartial
<
ListResourcesRequest
>
):
ListResourcesRequest
{
return
ListResourcesRequest
.
fromPartial
(
base
??
{});
},
fromPartial
(
_
:
DeepPartial
<
ListResourcesRequest
>
):
ListResourcesRequest
{
const
message
=
createBaseListResourcesRequest
();
return
message
;
},
};
function
createBaseListResourcesResponse
():
ListResourcesResponse
{
return
{
resources
:
[]
};
}
export
const
ListResourcesResponse
=
{
encode
(
message
:
ListResourcesResponse
,
writer
:
_m0
.
Writer
=
_m0
.
Writer
.
create
()):
_m0
.
Writer
{
for
(
const
v
of
message
.
resources
)
{
Resource
.
encode
(
v
!
,
writer
.
uint32
(
10
).
fork
()).
ldelim
();
}
return
writer
;
},
decode
(
input
:
_m0
.
Reader
|
Uint8Array
,
length
?:
number
):
ListResourcesResponse
{
const
reader
=
input
instanceof
_m0
.
Reader
?
input
:
_m0
.
Reader
.
create
(
input
);
let
end
=
length
===
undefined
?
reader
.
len
:
reader
.
pos
+
length
;
const
message
=
createBaseListResourcesResponse
();
while
(
reader
.
pos
<
end
)
{
const
tag
=
reader
.
uint32
();
switch
(
tag
>>>
3
)
{
case
1
:
if
(
tag
!==
10
)
{
break
;
}
message
.
resources
.
push
(
Resource
.
decode
(
reader
,
reader
.
uint32
()));
continue
;
}
if
((
tag
&
7
)
===
4
||
tag
===
0
)
{
break
;
}
reader
.
skipType
(
tag
&
7
);
}
return
message
;
},
create
(
base
?:
DeepPartial
<
ListResourcesResponse
>
):
ListResourcesResponse
{
return
ListResourcesResponse
.
fromPartial
(
base
??
{});
},
fromPartial
(
object
:
DeepPartial
<
ListResourcesResponse
>
):
ListResourcesResponse
{
const
message
=
createBaseListResourcesResponse
();
message
.
resources
=
object
.
resources
?.
map
((
e
)
=>
Resource
.
fromPartial
(
e
))
||
[];
return
message
;
},
};
export
type
ResourceServiceDefinition
=
typeof
ResourceServiceDefinition
;
export
const
ResourceServiceDefinition
=
{
name
:
"ResourceService"
,
fullName
:
"memos.api.v2.ResourceService"
,
methods
:
{
listResources
:
{
name
:
"ListResources"
,
requestType
:
ListResourcesRequest
,
requestStream
:
false
,
responseType
:
ListResourcesResponse
,
responseStream
:
false
,
options
:
{
_unknownFields
:
{
578365826
:
[
new
Uint8Array
([
19
,
18
,
17
,
47
,
97
,
112
,
105
,
47
,
118
,
50
,
47
,
114
,
101
,
115
,
111
,
117
,
114
,
99
,
101
,
115
]),
],
},
},
},
},
}
as
const
;
declare
const
self
:
any
|
undefined
;
declare
const
window
:
any
|
undefined
;
declare
const
global
:
any
|
undefined
;
const
tsProtoGlobalThis
:
any
=
(()
=>
{
if
(
typeof
globalThis
!==
"undefined"
)
{
return
globalThis
;
}
if
(
typeof
self
!==
"undefined"
)
{
return
self
;
}
if
(
typeof
window
!==
"undefined"
)
{
return
window
;
}
if
(
typeof
global
!==
"undefined"
)
{
return
global
;
}
throw
"Unable to locate global object"
;
})();
type
Builtin
=
Date
|
Function
|
Uint8Array
|
string
|
number
|
boolean
|
undefined
;
export
type
DeepPartial
<
T
>
=
T
extends
Builtin
?
T
:
T
extends
Array
<
infer
U
>
?
Array
<
DeepPartial
<
U
>>
:
T
extends
ReadonlyArray
<
infer
U
>
?
ReadonlyArray
<
DeepPartial
<
U
>>
:
T
extends
{}
?
{
[
K
in
keyof
T
]?:
DeepPartial
<
T
[
K
]
>
}
:
Partial
<
T
>
;
function
toTimestamp
(
date
:
Date
):
Timestamp
{
const
seconds
=
date
.
getTime
()
/
1
_000
;
const
nanos
=
(
date
.
getTime
()
%
1
_000
)
*
1
_000_000
;
return
{
seconds
,
nanos
};
}
function
fromTimestamp
(
t
:
Timestamp
):
Date
{
let
millis
=
(
t
.
seconds
||
0
)
*
1
_000
;
millis
+=
(
t
.
nanos
||
0
)
/
1
_000_000
;
return
new
Date
(
millis
);
}
function
longToNumber
(
long
:
Long
):
number
{
if
(
long
.
gt
(
Number
.
MAX_SAFE_INTEGER
))
{
throw
new
tsProtoGlobalThis
.
Error
(
"Value is larger than Number.MAX_SAFE_INTEGER"
);
}
return
long
.
toNumber
();
}
if
(
_m0
.
util
.
Long
!==
Long
)
{
_m0
.
util
.
Long
=
Long
as
any
;
_m0
.
configure
();
}
web/src/types/proto-grpcweb/api/v2/system_service.ts
deleted
100644 → 0
View file @
d09e3c36
This diff is collapsed.
Click to expand it.
web/src/types/proto-grpcweb/api/v2/tag_service.ts
deleted
100644 → 0
View file @
d09e3c36
/* eslint-disable */
import
_m0
from
"protobufjs/minimal"
;
export
const
protobufPackage
=
"memos.api.v2"
;
export
interface
Tag
{
name
:
string
;
creatorId
:
number
;
}
export
interface
ListTagsRequest
{
creatorId
:
number
;
}
export
interface
ListTagsResponse
{
tags
:
Tag
[];
}
function
createBaseTag
():
Tag
{
return
{
name
:
""
,
creatorId
:
0
};
}
export
const
Tag
=
{
encode
(
message
:
Tag
,
writer
:
_m0
.
Writer
=
_m0
.
Writer
.
create
()):
_m0
.
Writer
{
if
(
message
.
name
!==
""
)
{
writer
.
uint32
(
10
).
string
(
message
.
name
);
}
if
(
message
.
creatorId
!==
0
)
{
writer
.
uint32
(
16
).
int32
(
message
.
creatorId
);
}
return
writer
;
},
decode
(
input
:
_m0
.
Reader
|
Uint8Array
,
length
?:
number
):
Tag
{
const
reader
=
input
instanceof
_m0
.
Reader
?
input
:
_m0
.
Reader
.
create
(
input
);
let
end
=
length
===
undefined
?
reader
.
len
:
reader
.
pos
+
length
;
const
message
=
createBaseTag
();
while
(
reader
.
pos
<
end
)
{
const
tag
=
reader
.
uint32
();
switch
(
tag
>>>
3
)
{
case
1
:
if
(
tag
!==
10
)
{
break
;
}
message
.
name
=
reader
.
string
();
continue
;
case
2
:
if
(
tag
!==
16
)
{
break
;
}
message
.
creatorId
=
reader
.
int32
();
continue
;
}
if
((
tag
&
7
)
===
4
||
tag
===
0
)
{
break
;
}
reader
.
skipType
(
tag
&
7
);
}
return
message
;
},
create
(
base
?:
DeepPartial
<
Tag
>
):
Tag
{
return
Tag
.
fromPartial
(
base
??
{});
},
fromPartial
(
object
:
DeepPartial
<
Tag
>
):
Tag
{
const
message
=
createBaseTag
();
message
.
name
=
object
.
name
??
""
;
message
.
creatorId
=
object
.
creatorId
??
0
;
return
message
;
},
};
function
createBaseListTagsRequest
():
ListTagsRequest
{
return
{
creatorId
:
0
};
}
export
const
ListTagsRequest
=
{
encode
(
message
:
ListTagsRequest
,
writer
:
_m0
.
Writer
=
_m0
.
Writer
.
create
()):
_m0
.
Writer
{
if
(
message
.
creatorId
!==
0
)
{
writer
.
uint32
(
8
).
int32
(
message
.
creatorId
);
}
return
writer
;
},
decode
(
input
:
_m0
.
Reader
|
Uint8Array
,
length
?:
number
):
ListTagsRequest
{
const
reader
=
input
instanceof
_m0
.
Reader
?
input
:
_m0
.
Reader
.
create
(
input
);
let
end
=
length
===
undefined
?
reader
.
len
:
reader
.
pos
+
length
;
const
message
=
createBaseListTagsRequest
();
while
(
reader
.
pos
<
end
)
{
const
tag
=
reader
.
uint32
();
switch
(
tag
>>>
3
)
{
case
1
:
if
(
tag
!==
8
)
{
break
;
}
message
.
creatorId
=
reader
.
int32
();
continue
;
}
if
((
tag
&
7
)
===
4
||
tag
===
0
)
{
break
;
}
reader
.
skipType
(
tag
&
7
);
}
return
message
;
},
create
(
base
?:
DeepPartial
<
ListTagsRequest
>
):
ListTagsRequest
{
return
ListTagsRequest
.
fromPartial
(
base
??
{});
},
fromPartial
(
object
:
DeepPartial
<
ListTagsRequest
>
):
ListTagsRequest
{
const
message
=
createBaseListTagsRequest
();
message
.
creatorId
=
object
.
creatorId
??
0
;
return
message
;
},
};
function
createBaseListTagsResponse
():
ListTagsResponse
{
return
{
tags
:
[]
};
}
export
const
ListTagsResponse
=
{
encode
(
message
:
ListTagsResponse
,
writer
:
_m0
.
Writer
=
_m0
.
Writer
.
create
()):
_m0
.
Writer
{
for
(
const
v
of
message
.
tags
)
{
Tag
.
encode
(
v
!
,
writer
.
uint32
(
10
).
fork
()).
ldelim
();
}
return
writer
;
},
decode
(
input
:
_m0
.
Reader
|
Uint8Array
,
length
?:
number
):
ListTagsResponse
{
const
reader
=
input
instanceof
_m0
.
Reader
?
input
:
_m0
.
Reader
.
create
(
input
);
let
end
=
length
===
undefined
?
reader
.
len
:
reader
.
pos
+
length
;
const
message
=
createBaseListTagsResponse
();
while
(
reader
.
pos
<
end
)
{
const
tag
=
reader
.
uint32
();
switch
(
tag
>>>
3
)
{
case
1
:
if
(
tag
!==
10
)
{
break
;
}
message
.
tags
.
push
(
Tag
.
decode
(
reader
,
reader
.
uint32
()));
continue
;
}
if
((
tag
&
7
)
===
4
||
tag
===
0
)
{
break
;
}
reader
.
skipType
(
tag
&
7
);
}
return
message
;
},
create
(
base
?:
DeepPartial
<
ListTagsResponse
>
):
ListTagsResponse
{
return
ListTagsResponse
.
fromPartial
(
base
??
{});
},
fromPartial
(
object
:
DeepPartial
<
ListTagsResponse
>
):
ListTagsResponse
{
const
message
=
createBaseListTagsResponse
();
message
.
tags
=
object
.
tags
?.
map
((
e
)
=>
Tag
.
fromPartial
(
e
))
||
[];
return
message
;
},
};
export
type
TagServiceDefinition
=
typeof
TagServiceDefinition
;
export
const
TagServiceDefinition
=
{
name
:
"TagService"
,
fullName
:
"memos.api.v2.TagService"
,
methods
:
{
listTags
:
{
name
:
"ListTags"
,
requestType
:
ListTagsRequest
,
requestStream
:
false
,
responseType
:
ListTagsResponse
,
responseStream
:
false
,
options
:
{
_unknownFields
:
{
578365826
:
[
new
Uint8Array
([
14
,
18
,
12
,
47
,
97
,
112
,
105
,
47
,
118
,
50
,
47
,
116
,
97
,
103
,
115
])],
},
},
},
},
}
as
const
;
type
Builtin
=
Date
|
Function
|
Uint8Array
|
string
|
number
|
boolean
|
undefined
;
export
type
DeepPartial
<
T
>
=
T
extends
Builtin
?
T
:
T
extends
Array
<
infer
U
>
?
Array
<
DeepPartial
<
U
>>
:
T
extends
ReadonlyArray
<
infer
U
>
?
ReadonlyArray
<
DeepPartial
<
U
>>
:
T
extends
{}
?
{
[
K
in
keyof
T
]?:
DeepPartial
<
T
[
K
]
>
}
:
Partial
<
T
>
;
web/src/types/proto-grpcweb/api/v2/user_service.ts
deleted
100644 → 0
View file @
d09e3c36
This diff is collapsed.
Click to expand it.
web/src/types/proto-grpcweb/google/protobuf/timestamp.ts
deleted
100644 → 0
View file @
d09e3c36
/* eslint-disable */
import
Long
from
"long"
;
import
_m0
from
"protobufjs/minimal"
;
export
const
protobufPackage
=
"google.protobuf"
;
/**
* A Timestamp represents a point in time independent of any time zone or local
* calendar, encoded as a count of seconds and fractions of seconds at
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
* January 1, 1970, in the proleptic Gregorian calendar which extends the
* Gregorian calendar backwards to year one.
*
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
* second table is needed for interpretation, using a [24-hour linear
* smear](https://developers.google.com/time/smear).
*
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
* restricting to that range, we ensure that we can convert to and from [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
*
* # Examples
*
* Example 1: Compute Timestamp from POSIX `time()`.
*
* Timestamp timestamp;
* timestamp.set_seconds(time(NULL));
* timestamp.set_nanos(0);
*
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
*
* struct timeval tv;
* gettimeofday(&tv, NULL);
*
* Timestamp timestamp;
* timestamp.set_seconds(tv.tv_sec);
* timestamp.set_nanos(tv.tv_usec * 1000);
*
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
*
* FILETIME ft;
* GetSystemTimeAsFileTime(&ft);
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
*
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
* Timestamp timestamp;
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
*
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
*
* long millis = System.currentTimeMillis();
*
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
* .setNanos((int) ((millis % 1000) * 1000000)).build();
*
* Example 5: Compute Timestamp from Java `Instant.now()`.
*
* Instant now = Instant.now();
*
* Timestamp timestamp =
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
* .setNanos(now.getNano()).build();
*
* Example 6: Compute Timestamp from current time in Python.
*
* timestamp = Timestamp()
* timestamp.GetCurrentTime()
*
* # JSON Mapping
*
* In JSON format, the Timestamp type is encoded as a string in the
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
* where {year} is always expressed using four digits while {month}, {day},
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
* is required. A proto3 JSON serializer should always use UTC (as indicated by
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
* able to accept both UTC and other timezones (as indicated by an offset).
*
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
* 01:30 UTC on January 15, 2017.
*
* In JavaScript, one can convert a Date object to this format using the
* standard
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
* method. In Python, a standard `datetime.datetime` object can be converted
* to this format using
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
* ) to obtain a formatter capable of generating timestamps in this format.
*/
export
interface
Timestamp
{
/**
* Represents seconds of UTC time since Unix epoch
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
* 9999-12-31T23:59:59Z inclusive.
*/
seconds
:
number
;
/**
* Non-negative fractions of a second at nanosecond resolution. Negative
* second values with fractions must still have non-negative nanos values
* that count forward in time. Must be from 0 to 999,999,999
* inclusive.
*/
nanos
:
number
;
}
function
createBaseTimestamp
():
Timestamp
{
return
{
seconds
:
0
,
nanos
:
0
};
}
export
const
Timestamp
=
{
encode
(
message
:
Timestamp
,
writer
:
_m0
.
Writer
=
_m0
.
Writer
.
create
()):
_m0
.
Writer
{
if
(
message
.
seconds
!==
0
)
{
writer
.
uint32
(
8
).
int64
(
message
.
seconds
);
}
if
(
message
.
nanos
!==
0
)
{
writer
.
uint32
(
16
).
int32
(
message
.
nanos
);
}
return
writer
;
},
decode
(
input
:
_m0
.
Reader
|
Uint8Array
,
length
?:
number
):
Timestamp
{
const
reader
=
input
instanceof
_m0
.
Reader
?
input
:
_m0
.
Reader
.
create
(
input
);
let
end
=
length
===
undefined
?
reader
.
len
:
reader
.
pos
+
length
;
const
message
=
createBaseTimestamp
();
while
(
reader
.
pos
<
end
)
{
const
tag
=
reader
.
uint32
();
switch
(
tag
>>>
3
)
{
case
1
:
if
(
tag
!==
8
)
{
break
;
}
message
.
seconds
=
longToNumber
(
reader
.
int64
()
as
Long
);
continue
;
case
2
:
if
(
tag
!==
16
)
{
break
;
}
message
.
nanos
=
reader
.
int32
();
continue
;
}
if
((
tag
&
7
)
===
4
||
tag
===
0
)
{
break
;
}
reader
.
skipType
(
tag
&
7
);
}
return
message
;
},
create
(
base
?:
DeepPartial
<
Timestamp
>
):
Timestamp
{
return
Timestamp
.
fromPartial
(
base
??
{});
},
fromPartial
(
object
:
DeepPartial
<
Timestamp
>
):
Timestamp
{
const
message
=
createBaseTimestamp
();
message
.
seconds
=
object
.
seconds
??
0
;
message
.
nanos
=
object
.
nanos
??
0
;
return
message
;
},
};
declare
const
self
:
any
|
undefined
;
declare
const
window
:
any
|
undefined
;
declare
const
global
:
any
|
undefined
;
const
tsProtoGlobalThis
:
any
=
(()
=>
{
if
(
typeof
globalThis
!==
"undefined"
)
{
return
globalThis
;
}
if
(
typeof
self
!==
"undefined"
)
{
return
self
;
}
if
(
typeof
window
!==
"undefined"
)
{
return
window
;
}
if
(
typeof
global
!==
"undefined"
)
{
return
global
;
}
throw
"Unable to locate global object"
;
})();
type
Builtin
=
Date
|
Function
|
Uint8Array
|
string
|
number
|
boolean
|
undefined
;
export
type
DeepPartial
<
T
>
=
T
extends
Builtin
?
T
:
T
extends
Array
<
infer
U
>
?
Array
<
DeepPartial
<
U
>>
:
T
extends
ReadonlyArray
<
infer
U
>
?
ReadonlyArray
<
DeepPartial
<
U
>>
:
T
extends
{}
?
{
[
K
in
keyof
T
]?:
DeepPartial
<
T
[
K
]
>
}
:
Partial
<
T
>
;
function
longToNumber
(
long
:
Long
):
number
{
if
(
long
.
gt
(
Number
.
MAX_SAFE_INTEGER
))
{
throw
new
tsProtoGlobalThis
.
Error
(
"Value is larger than Number.MAX_SAFE_INTEGER"
);
}
return
long
.
toNumber
();
}
if
(
_m0
.
util
.
Long
!==
Long
)
{
_m0
.
util
.
Long
=
Long
as
any
;
_m0
.
configure
();
}
web/src/utils/resource.ts
View file @
b13042d6
import
{
Resource
}
from
"@/types/proto
-grpcweb
/api/v2/resource_service"
;
import
{
Resource
}
from
"@/types/proto/api/v2/resource_service"
;
export
const
getResourceUrl
=
(
resource
:
Resource
,
withOrigin
=
true
)
=>
{
export
const
getResourceUrl
=
(
resource
:
Resource
,
withOrigin
=
true
)
=>
{
if
(
resource
.
externalLink
)
{
if
(
resource
.
externalLink
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment