mirror of
https://github.com/fiatjaf/nak.git
synced 2024-11-22 08:19:06 -05:00
-until now
This commit is contained in:
parent
f0d90b567c
commit
242b028656
15
req.go
15
req.go
|
@ -68,7 +68,7 @@ example:
|
||||||
Usage: "only accept events newer than this (unix timestamp)",
|
Usage: "only accept events newer than this (unix timestamp)",
|
||||||
Category: CATEGORY_FILTER_ATTRIBUTES,
|
Category: CATEGORY_FILTER_ATTRIBUTES,
|
||||||
},
|
},
|
||||||
&cli.IntFlag{
|
&cli.StringFlag{
|
||||||
Name: "until",
|
Name: "until",
|
||||||
Aliases: []string{"u"},
|
Aliases: []string{"u"},
|
||||||
Usage: "only accept events older than this (unix timestamp)",
|
Usage: "only accept events older than this (unix timestamp)",
|
||||||
|
@ -196,9 +196,16 @@ example:
|
||||||
return fmt.Errorf("parse error: Invalid numeric literal %q", since)
|
return fmt.Errorf("parse error: Invalid numeric literal %q", since)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if until := c.Int("until"); until != 0 {
|
if until := c.String("until"); until != "" {
|
||||||
ts := nostr.Timestamp(until)
|
if until == "now" {
|
||||||
filter.Until = &ts
|
ts := nostr.Now()
|
||||||
|
filter.Until = &ts
|
||||||
|
} else if i, err := strconv.Atoi(until); err == nil {
|
||||||
|
ts := nostr.Timestamp(i)
|
||||||
|
filter.Until = &ts
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("parse error: Invalid numeric literal %q", until)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if limit := c.Int("limit"); limit != 0 {
|
if limit := c.Int("limit"); limit != 0 {
|
||||||
filter.Limit = limit
|
filter.Limit = limit
|
||||||
|
|
Loading…
Reference in New Issue
Block a user