Skip to content

Commit

Permalink
chore:ci: pull tags/v0.22.0 from usememos/memos
Browse files Browse the repository at this point in the history
  • Loading branch information
lincolnthalles committed May 18, 2024
2 parents 18b4ac1 + 8f1fc7a commit 7e082d0
Show file tree
Hide file tree
Showing 106 changed files with 2,131 additions and 2,091 deletions.
2 changes: 1 addition & 1 deletion memos/.github/workflows/backend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
go mod tidy -go=1.22
git diff --exit-code
- name: golangci-lint
uses: golangci/golangci-lint-action@v5
uses: golangci/golangci-lint-action@v6
with:
version: v1.54.1
args: --verbose --timeout=3m
Expand Down
4 changes: 2 additions & 2 deletions memos/.github/workflows/frontend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3.0.0
- uses: pnpm/action-setup@v4.0.0
with:
version: 9
- uses: actions/setup-node@v4
Expand All @@ -36,7 +36,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3.0.0
- uses: pnpm/action-setup@v4.0.0
with:
version: 9
- uses: actions/setup-node@v4
Expand Down
118 changes: 64 additions & 54 deletions memos/docs/apidocs.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -691,21 +691,6 @@ paths:
$ref: '#/definitions/googlerpcStatus'
tags:
- WorkspaceService
/api/v1/workspace/settings:
get:
summary: ListWorkspaceSetting returns the list of settings.
operationId: WorkspaceSettingService_ListWorkspaceSettings
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1ListWorkspaceSettingsResponse'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
tags:
- WorkspaceSettingService
/api/v1/workspace/{name}:
get:
summary: GetWorkspaceSetting returns the setting by name.
Expand Down Expand Up @@ -1477,6 +1462,36 @@ paths:
pattern: users/[^/]+
tags:
- UserService
/api/v1/{name}:rebuild:
post:
summary: RebuildMemoProperty rebuilds a memo property.
operationId: MemoService_RebuildMemoProperty
responses:
"200":
description: A successful response.
schema:
type: object
properties: {}
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: name
description: |-
The name of the memo.
Format: memos/{id}. Use "memos/-" to rebuild all memos.
in: path
required: true
type: string
pattern: memos/[^/]+
- name: body
in: body
required: true
schema:
$ref: '#/definitions/MemoServiceRebuildMemoPropertyBody'
tags:
- MemoService
/api/v1/{parent}/tags:
get:
summary: ListMemoTags lists tags for a memo.
Expand All @@ -1499,11 +1514,13 @@ paths:
required: true
type: string
pattern: memos/[^/]+
- name: rebuild
description: Rebuild the tags.
- name: filter
description: |-
Filter is used to filter memos.
Format: "creator == users/{uid} && visibilities == ['PUBLIC', 'PROTECTED']"
in: query
required: false
type: boolean
type: string
tags:
- MemoService
/api/v1/{parent}/tags/{tag}:
Expand Down Expand Up @@ -1780,6 +1797,8 @@ paths:
tags:
- UserService
definitions:
MemoServiceRebuildMemoPropertyBody:
type: object
MemoServiceRenameMemoTagBody:
type: object
properties:
Expand Down Expand Up @@ -1831,6 +1850,20 @@ definitions:
expiresAt:
type: string
format: date-time
WorkspaceStorageSettingS3Config:
type: object
properties:
accessKeyId:
type: string
accessKeySecret:
type: string
endpoint:
type: string
region:
type: string
bucket:
type: string
title: 'Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/'
apiHttpBody:
type: object
properties:
Expand Down Expand Up @@ -2067,34 +2100,20 @@ definitions:
format: int64
description: The max upload size in megabytes.
s3Config:
$ref: '#/definitions/apiv1WorkspaceStorageSettingS3Config'
$ref: '#/definitions/WorkspaceStorageSettingS3Config'
description: The S3 config.
apiv1WorkspaceStorageSettingS3Config:
type: object
properties:
accessKeyId:
type: string
accessKeySecret:
type: string
endpoint:
type: string
region:
type: string
bucket:
type: string
title: 'Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/'
apiv1WorkspaceStorageSettingStorageType:
type: string
enum:
- STORAGE_TYPE_UNSPECIFIED
- STORAGE_TYPE_DATABASE
- STORAGE_TYPE_LOCAL
- STORAGE_TYPE_S3
- DATABASE
- LOCAL
- S3
default: STORAGE_TYPE_UNSPECIFIED
description: |2-
- STORAGE_TYPE_DATABASE: STORAGE_TYPE_DATABASE is the database storage type.
- STORAGE_TYPE_LOCAL: STORAGE_TYPE_LOCAL is the local storage type.
- STORAGE_TYPE_S3: STORAGE_TYPE_S3 is the S3 storage type.
- DATABASE: DATABASE is the database storage type.
- LOCAL: LOCAL is the local storage type.
- S3: S3 is the S3 storage type.
googlerpcStatus:
type: object
properties:
Expand Down Expand Up @@ -2137,8 +2156,7 @@ definitions:
Note: this functionality is not currently available in the official
protobuf release, and it is not used for type URLs beginning with
type.googleapis.com. As of May 2023, there are no widely used type server
implementations and no plans to implement one.
type.googleapis.com.
Schemes other than `http`, `https` (or the empty scheme) might be
used with implementation specific semantics.
Expand Down Expand Up @@ -2173,7 +2191,7 @@ definitions:
foo = any.unpack(Foo.getDefaultInstance());
}
Example 3: Pack and unpack a message in Python.
Example 3: Pack and unpack a message in Python.
foo = Foo(...)
any = Any()
Expand All @@ -2183,7 +2201,7 @@ definitions:
any.Unpack(foo)
...
Example 4: Pack and unpack a message in Go
Example 4: Pack and unpack a message in Go
foo := &pb.Foo{...}
any, err := anypb.New(foo)
Expand All @@ -2203,7 +2221,7 @@ definitions:
name "y.z".
JSON
====
The JSON representation of an `Any` value uses the regular
representation of the deserialized, embedded message, with an
additional field `@type` which contains the type URL. Example:
Expand Down Expand Up @@ -2410,8 +2428,8 @@ definitions:
type: string
enum:
- TYPE_UNSPECIFIED
- TYPE_MEMO_COMMENT
- TYPE_VERSION_UPDATE
- MEMO_COMMENT
- VERSION_UPDATE
default: TYPE_UNSPECIFIED
v1ItalicNode:
type: object
Expand Down Expand Up @@ -2543,14 +2561,6 @@ definitions:
items:
type: object
$ref: '#/definitions/v1Webhook'
v1ListWorkspaceSettingsResponse:
type: object
properties:
settings:
type: array
items:
type: object
$ref: '#/definitions/apiv1WorkspaceSetting'
v1MathBlockNode:
type: object
properties:
Expand Down
16 changes: 8 additions & 8 deletions memos/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ toolchain go1.22.2

require (
github.com/aws/aws-sdk-go-v2 v1.26.1
github.com/aws/aws-sdk-go-v2/config v1.27.11
github.com/aws/aws-sdk-go-v2/credentials v1.17.11
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.15
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1
github.com/aws/aws-sdk-go-v2/config v1.27.13
github.com/aws/aws-sdk-go-v2/credentials v1.17.13
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.17
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.2
github.com/go-sql-driver/mysql v1.8.1
github.com/google/cel-go v0.20.1
github.com/google/uuid v1.6.0
Expand All @@ -27,7 +27,7 @@ require (
github.com/yourselfhosted/gomark v0.0.0-20240228170507-6a73bfad2eb6
golang.org/x/crypto v0.23.0
golang.org/x/mod v0.17.0
golang.org/x/net v0.24.0
golang.org/x/net v0.25.0
golang.org/x/oauth2 v0.20.0
google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be
google.golang.org/grpc v1.63.2
Expand Down Expand Up @@ -72,9 +72,9 @@ require (
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.7 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
Expand Down
32 changes: 16 additions & 16 deletions memos/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+
github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2/go.mod h1:lPprDr1e6cJdyYeGXnRaJoP4Md+cDBvi2eOj00BlGmg=
github.com/aws/aws-sdk-go-v2/config v1.27.11 h1:f47rANd2LQEYHda2ddSCKYId18/8BhSRM4BULGmfgNA=
github.com/aws/aws-sdk-go-v2/config v1.27.11/go.mod h1:SMsV78RIOYdve1vf36z8LmnszlRWkwMQtomCAI0/mIE=
github.com/aws/aws-sdk-go-v2/credentials v1.17.11 h1:YuIB1dJNf1Re822rriUOTxopaHHvIq0l/pX3fwO+Tzs=
github.com/aws/aws-sdk-go-v2/credentials v1.17.11/go.mod h1:AQtFPsDH9bI2O+71anW6EKL+NcD7LG3dpKGMV4SShgo=
github.com/aws/aws-sdk-go-v2/config v1.27.13 h1:WbKW8hOzrWoOA/+35S5okqO/2Ap8hkkFUzoW8Hzq24A=
github.com/aws/aws-sdk-go-v2/config v1.27.13/go.mod h1:XLiyiTMnguytjRER7u5RIkhIqS8Nyz41SwAWb4xEjxs=
github.com/aws/aws-sdk-go-v2/credentials v1.17.13 h1:XDCJDzk/u5cN7Aple7D/MiAhx1Rjo/0nueJ0La8mRuE=
github.com/aws/aws-sdk-go-v2/credentials v1.17.13/go.mod h1:FMNcjQrmuBYvOTZDtOLCIu0esmxjF7RuA/89iSXWzQI=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 h1:FVJ0r5XTHSmIHJV6KuDmdYhEpvlHpiSd38RQWhut5J4=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1/go.mod h1:zusuAeqezXzAB24LGuzuekqMAEgWkVYukBec3kr3jUg=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.15 h1:7Zwtt/lP3KNRkeZre7soMELMGNoBrutx8nobg1jKWmo=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.15/go.mod h1:436h2adoHb57yd+8W+gYPrrA9U/R/SuAuOO42Ushzhw=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.17 h1:9b1Os1s11mF5qTIKLgSsyPG810di2+ySSLIIt9bwe9I=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.17/go.mod h1:9Wp7tDOMhv0+sb/FTRAkbHNQ7abYDnoJRzm5AAtCnTc=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 h1:aw39xVGeRWlWx9EzGVnhOR4yOjQDHPQ6o6NmBlscyQg=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5/go.mod h1:FSaRudD0dXiMPK2UjknVwwTYyZMRsHv3TtkabsZih5I=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 h1:PG1F3OD1szkuQPzDw3CIQsRIrtTlUC3lP84taWzHlq0=
Expand All @@ -54,14 +54,14 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 h1:ogRAwT1/g
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7/go.mod h1:YCsIZhXfRPLFFCl5xxY+1T9RKzOKjCut+28JSX2DnAk=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.5 h1:f9RyWNtS8oH7cZlbn+/JNPpjUk5+5fLd5lM9M0i49Ys=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.5/go.mod h1:h5CoMZV2VF297/VLhRhO1WF+XYWOzXo+4HsObA4HjBQ=
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 h1:6cnno47Me9bRykw9AEv9zkXE+5or7jz8TsskTTccbgc=
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1/go.mod h1:qmdkIIAC+GCLASF7R2whgNrJADz0QZPX+Seiw/i4S3o=
github.com/aws/aws-sdk-go-v2/service/sso v1.20.5 h1:vN8hEbpRnL7+Hopy9dzmRle1xmDc7o8tmY0klsr175w=
github.com/aws/aws-sdk-go-v2/service/sso v1.20.5/go.mod h1:qGzynb/msuZIE8I75DVRCUXw3o3ZyBmUvMwQ2t/BrGM=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4 h1:Jux+gDDyi1Lruk+KHF91tK2KCuY61kzoCpvtvJJBtOE=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4/go.mod h1:mUYPBhaF2lGiukDEjJX2BLRRKTmoUSitGDUgM4tRxak=
github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 h1:cwIxeBttqPN3qkaAjcEcsh8NYr8n2HZPkcKgPAi1phU=
github.com/aws/aws-sdk-go-v2/service/sts v1.28.6/go.mod h1:FZf1/nKNEkHdGGJP/cI2MoIMquumuRK6ol3QQJNDxmw=
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.2 h1:rq2hglTQM3yHZvOPVMtNvLS5x6hijx7JvRDgKiTNDGQ=
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.2/go.mod h1:qmdkIIAC+GCLASF7R2whgNrJADz0QZPX+Seiw/i4S3o=
github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 h1:o5cTaeunSpfXiLTIBx5xo2enQmiChtu1IBbzXnfU9Hs=
github.com/aws/aws-sdk-go-v2/service/sso v1.20.6/go.mod h1:qGzynb/msuZIE8I75DVRCUXw3o3ZyBmUvMwQ2t/BrGM=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.0 h1:Qe0r0lVURDDeBQJ4yP+BOrJkvkiCo/3FH/t+wY11dmw=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.0/go.mod h1:mUYPBhaF2lGiukDEjJX2BLRRKTmoUSitGDUgM4tRxak=
github.com/aws/aws-sdk-go-v2/service/sts v1.28.7 h1:et3Ta53gotFR4ERLXXHIHl/Uuk1qYpP5uU7cvNql8ns=
github.com/aws/aws-sdk-go-v2/service/sts v1.28.7/go.mod h1:FZf1/nKNEkHdGGJP/cI2MoIMquumuRK6ol3QQJNDxmw=
github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q=
github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down Expand Up @@ -504,8 +504,8 @@ golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
Expand Down
6 changes: 4 additions & 2 deletions memos/plugin/storage/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Client struct {
Bucket *string
}

func NewClient(ctx context.Context, s3Config *storepb.WorkspaceStorageSetting_S3Config) (*Client, error) {
func NewClient(ctx context.Context, s3Config *storepb.StorageS3Config) (*Client, error) {
resolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...any) (aws.Endpoint, error) {
return aws.Endpoint{
URL: s3Config.Endpoint,
Expand Down Expand Up @@ -70,7 +70,9 @@ func (c *Client) PresignGetObject(ctx context.Context, key string) (string, erro
Bucket: aws.String(*c.Bucket),
Key: aws.String(key),
}, func(opts *s3.PresignOptions) {
opts.Expires = time.Duration(7 * 24 * time.Hour)
// Set the expiration time of the presigned URL to 5 days.
// Reference: https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
opts.Expires = time.Duration(5 * 24 * time.Hour)
})
if err != nil {
return "", errors.Wrap(err, "failed to presign put object")
Expand Down
4 changes: 2 additions & 2 deletions memos/proto/api/v1/inbox_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ message Inbox {

enum Type {
TYPE_UNSPECIFIED = 0;
TYPE_MEMO_COMMENT = 1;
TYPE_VERSION_UPDATE = 2;
MEMO_COMMENT = 1;
VERSION_UPDATE = 2;
}
Type type = 6;

Expand Down
18 changes: 16 additions & 2 deletions memos/proto/api/v1/memo_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ service MemoService {
body: "*"
};
}
// RebuildMemoProperty rebuilds a memo property.
rpc RebuildMemoProperty(RebuildMemoPropertyRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/{name=memos/*}:rebuild"
body: "*"
};
}
// ListMemoTags lists tags for a memo.
rpc ListMemoTags(ListMemoTagsRequest) returns (ListMemoTagsResponse) {
option (google.api.http) = {get: "/api/v1/{parent=memos/*}/tags"};
Expand Down Expand Up @@ -247,13 +254,20 @@ message ExportMemosResponse {
bytes content = 1;
}

message RebuildMemoPropertyRequest {
// The name of the memo.
// Format: memos/{id}. Use "memos/-" to rebuild all memos.
string name = 1;
}

message ListMemoTagsRequest {
// The parent, who owns the tags.
// Format: memos/{id}. Use "memos/-" to list all tags.
string parent = 1;

// Rebuild the tags.
bool rebuild = 2;
// Filter is used to filter memos.
// Format: "creator == users/{uid} && visibilities == ['PUBLIC', 'PROTECTED']"
string filter = 2;
}

message ListMemoTagsResponse {
Expand Down
Loading

0 comments on commit 7e082d0

Please sign in to comment.