backend for xcvr appview

boop

+9 -1
+9 -1
server/internal/oauth/oauthclient.go
··· 1 package oauth 2 3 import ( 4 "context" 5 "encoding/json" 6 "errors" 7 "fmt" 8 9 "github.com/bluesky-social/indigo/api/atproto" 10 "github.com/bluesky-social/indigo/atproto/auth/oauth" ··· 178 func UploadBLOB(cs *oauth.ClientSession, file multipart.File, ctx context.Context) (*lexutil.BlobSchema, error) { 179 client := cs.APIClient() 180 181 - req := atpclient.NewAPIRequest("POST", "com.atproto.repo.uploadBlob", file) 182 resp, err := client.Do(ctx, req) 183 if err != nil { 184 return nil, err
··· 1 package oauth 2 3 import ( 4 + "bytes" 5 "context" 6 "encoding/json" 7 "errors" 8 "fmt" 9 + "io" 10 11 "github.com/bluesky-social/indigo/api/atproto" 12 "github.com/bluesky-social/indigo/atproto/auth/oauth" ··· 180 func UploadBLOB(cs *oauth.ClientSession, file multipart.File, ctx context.Context) (*lexutil.BlobSchema, error) { 181 client := cs.APIClient() 182 183 + fileBytes, err := io.ReadAll(file) 184 + if err != nil { 185 + return nil, errors.New("failed to readall: " + err.Error()) 186 + } 187 + fileReader := bytes.NewReader(fileBytes) 188 + 189 + req := atpclient.NewAPIRequest("POST", "com.atproto.repo.uploadBlob", fileReader) 190 resp, err := client.Do(ctx, req) 191 if err != nil { 192 return nil, err