nipb0: fixes to blossom.

This commit is contained in:
fiatjaf
2025-03-04 19:20:11 -03:00
parent 2865cccc46
commit b3b8d5804d
6 changed files with 13 additions and 16 deletions
+3 -10
View File
@@ -8,21 +8,14 @@ import (
)
// List retrieves a list of blobs from a specific pubkey
func (c *Client) List(ctx context.Context, pubkey string) ([]BlobDescriptor, error) {
if pubkey == "" {
var err error
pubkey, err = c.signer.GetPublicKey(ctx)
if err != nil {
return nil, fmt.Errorf("could not get pubkey: %w", err)
}
}
func (c *Client) List(ctx context.Context) ([]BlobDescriptor, error) {
pubkey, err := c.signer.GetPublicKey(ctx)
if !nostr.IsValidPublicKey(pubkey) {
return nil, fmt.Errorf("pubkey %s is not valid", pubkey)
}
bds := make([]BlobDescriptor, 0, 100)
err := c.httpCall(ctx, "GET", c.mediaserver+"/list/"+pubkey, "", func() string {
err = c.httpCall(ctx, "GET", "list/"+pubkey, "", func() string {
return c.authorizationHeader(ctx, func(evt *nostr.Event) {
evt.Tags = append(evt.Tags, nostr.Tag{"t", "list"})
})