mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-05-05 16:20:14 +02:00
use StringBytes() instead of String()
This commit is contained in:
parent
74c646fe21
commit
75a07daf7b
@ -17,7 +17,8 @@ func main() {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||||
|
|
||||||
// connect to relay
|
// connect to relay
|
||||||
url := "wss://nostr.zebedee.cloud"
|
//url := "wss://nostr.zebedee.cloud"
|
||||||
|
url := "wss://nostr-relay.nokotaro.com"
|
||||||
relay, err := nostr.RelayConnect(ctx, url)
|
relay, err := nostr.RelayConnect(ctx, url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -116,7 +117,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
ev.Content = strings.TrimSpace(content)
|
ev.Content = strings.TrimSpace(content)
|
||||||
ev.Sign(sk)
|
ev.Sign(sk)
|
||||||
for _, url := range []string{"wss://nostr.zebedee.cloud"} {
|
for _, url := range []string{"wss://nostr-relay.nokotaro.com"} {
|
||||||
ctx := context.WithValue(context.Background(), "url", url)
|
ctx := context.WithValue(context.Background(), "url", url)
|
||||||
relay, e := nostr.RelayConnect(ctx, url)
|
relay, e := nostr.RelayConnect(ctx, url)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
@ -62,7 +62,11 @@ func (f *Filter) UnmarshalJSON(payload []byte) error {
|
|||||||
}
|
}
|
||||||
f.Limit = val
|
f.Limit = val
|
||||||
case "search":
|
case "search":
|
||||||
f.Search = v.String()
|
val, err := v.StringBytes()
|
||||||
|
if err != nil {
|
||||||
|
visiterr = fmt.Errorf("invalid 'search' field: %w", err)
|
||||||
|
}
|
||||||
|
f.Search = string(val)
|
||||||
default:
|
default:
|
||||||
if strings.HasPrefix(key, "#") {
|
if strings.HasPrefix(key, "#") {
|
||||||
f.Tags[key[1:]], err = fastjsonArrayToStringList(v)
|
f.Tags[key[1:]], err = fastjsonArrayToStringList(v)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user