Skip to content

Commit

Permalink
feat(ws): white/black list pubkey.
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy committed Jan 10, 2025
1 parent 7e098d3 commit fbae6fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions delivery/websocket/event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *Server) handleEvent(conn *websocket.Conn, m message.Message) {

bloomCheckCmd := pipe.BFExists(qCtx, s.redis.BloomFilterName, eID[:])

var whiteListCheckCmd *gredis.BoolCmd = nil
var whiteListCheckCmd *gredis.BoolCmd

if s.config.Limitation.RestrictedWrites {
whiteListCheckCmd = pipe.CFExists(qCtx, s.redis.WhiteListFilterName, msg.Event.PublicKey)
Expand Down Expand Up @@ -208,7 +208,7 @@ func (s *Server) handleEvent(conn *websocket.Conn, m message.Message) {
}
}

func checkLimitations(c clientState, redis *redis.Redis,
func checkLimitations(c clientState, r *redis.Redis,

Check failure on line 211 in delivery/websocket/event_handler.go

View workflow job for this annotation

GitHub Actions / lint

named return "accepted" with type "bool" found (nonamedreturns)
limits Limitation, msg message.Event) (accepted bool, isAuthFail bool,
failType string, resp string,
) {
Expand All @@ -233,7 +233,7 @@ func checkLimitations(c clientState, redis *redis.Redis,
time.Unix(expiration, 0).String())
}

if err := redis.AddDelayedTask(expirationTaskListName,
if err := r.AddDelayedTask(expirationTaskListName,
fmt.Sprintf("%s:%d", msg.Event.ID, msg.Event.Kind), time.Until(time.Unix(expiration, 0))); err != nil {
return false, false, serverFail, "error: can't add event to expiration queue."
}
Expand Down

0 comments on commit fbae6fa

Please sign in to comment.