use StringBytes() instead of String()

This commit is contained in:
Yasuhiro Matsumoto 2023-02-26 21:34:01 +09:00 committed by fiatjaf_
parent 74c646fe21
commit 75a07daf7b
2 changed files with 8 additions and 3 deletions

View File

@ -17,7 +17,8 @@ func main() {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
// 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)
if err != nil {
panic(err)
@ -116,7 +117,7 @@ func main() {
}
ev.Content = strings.TrimSpace(content)
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)
relay, e := nostr.RelayConnect(ctx, url)
if e != nil {

View File

@ -62,7 +62,11 @@ func (f *Filter) UnmarshalJSON(payload []byte) error {
}
f.Limit = val
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:
if strings.HasPrefix(key, "#") {
f.Tags[key[1:]], err = fastjsonArrayToStringList(v)