Skip to content

Commit

Permalink
feat: update proto to v0.4.16
Browse files Browse the repository at this point in the history
  • Loading branch information
MuZhou233 committed Jul 19, 2024
1 parent 74736ec commit 58f431c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func WithToken(ctx context.Context, token string) context.Context {
func (c *LibrarianClient) RunBackgroundRefresh() {
for {
c.muToken.RLock()
resp, err := c.RefreshToken(
resp, err := c.RefreshToken( // nolint:typecheck // false positive
WithToken(context.Background(), c.refreshToken),
new(pb.RefreshTokenRequest),
)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240627104009-3198e0b83bf2
github.com/go-kratos/kratos/v2 v2.7.3
github.com/hashicorp/consul/api v1.29.1
github.com/tuihub/protos v0.4.14
google.golang.org/grpc v1.64.0
github.com/tuihub/protos v0.4.16
google.golang.org/grpc v1.64.1
google.golang.org/protobuf v1.34.2
)

Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ github.com/tuihub/protos v0.4.4 h1:C+iZHYVjyXVZvqVF9DqUNudsheLAEyhHRdA5gt43hJw=
github.com/tuihub/protos v0.4.4/go.mod h1:FvaMeevw4RUzHy5kNgbCHWk3fH25ApXEaNmPvDhXozc=
github.com/tuihub/protos v0.4.14 h1:QQDr/lw4r88iSzAVh9TwdKm4uFpMmCSsRYIPXtg13gg=
github.com/tuihub/protos v0.4.14/go.mod h1:DuhbgkLYDaZxitUjLYHrc5ArgM25V1Vcl68mpTgC/co=
github.com/tuihub/protos v0.4.16 h1:zNawX1TpkCMTDKzYikGgeSJmwdJk0PLW75N3RBEiToc=
github.com/tuihub/protos v0.4.16/go.mod h1:h0nKrfphmLMsiDHrG07DHKFNSmqi2JoePTx60ER7wQI=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down Expand Up @@ -316,6 +318,7 @@ google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0=
google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
Expand Down
4 changes: 2 additions & 2 deletions porter.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ func (p *Porter) AsUser(ctx context.Context, userID int64) (*LibrarianClient, er
if err != nil {
return nil, err
}
resp, err := client.GainUserPrivilege(
resp, err := client.AcquireUserToken(
WithToken(ctx, p.wrapper.Token.AccessToken),
&sephirah.GainUserPrivilegeRequest{
&sephirah.AcquireUserTokenRequest{
UserId: &librarian.InternalID{Id: userID},
},
)
Expand Down
11 changes: 2 additions & 9 deletions wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,8 @@ func (s *service) PullFeed(ctx context.Context, req *pb.PullFeedRequest) (*pb.Pu
if !s.p.Enabled() {
return nil, errors.Forbidden("Unauthorized caller", "")
}
if req.GetSource() == "" ||
req.GetChannelId() == "" {
return nil, errors.BadRequest("Invalid feed id", "")
}
for _, source := range s.p.Config.FeatureSummary.GetFeedSources() {
if source.GetId() == req.GetSource() {
if source.GetId() == req.GetSource().GetId() {
return s.p.Handler.PullFeed(ctx, req)
}
}
Expand All @@ -197,11 +193,8 @@ func (s *service) PushFeedItems(ctx context.Context, req *pb.PushFeedItemsReques
if !s.p.Enabled() {
return nil, errors.Forbidden("Unauthorized caller", "")
}
if req.GetDestination() == "" || req.GetChannelId() == "" || len(req.GetItems()) == 0 {
return nil, errors.BadRequest("Invalid feed id", "")
}
for _, destination := range s.p.Config.FeatureSummary.GetNotifyDestinations() {
if destination.GetId() == req.GetDestination() {
if destination.GetId() == req.GetDestination().GetId() {
return s.p.Handler.PushFeedItems(ctx, req)
}
}
Expand Down

0 comments on commit 58f431c

Please sign in to comment.