From e9274acb11aa4718d89dadc106ed92bd908bd6ba Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Tue, 17 Feb 2026 22:11:52 -0800 Subject: [PATCH 1/2] Add repost of repost --- api/swagger/swagger-v1.yaml | 24 +++++++++++++++++++++++- api/v1_playlist_reposts.go | 14 +++++++++++++- api/v1_track_favorites.go | 6 +++--- api/v1_track_reposts.go | 16 +++++++++++++--- 4 files changed, 52 insertions(+), 8 deletions(-) diff --git a/api/swagger/swagger-v1.yaml b/api/swagger/swagger-v1.yaml index 4548a35c..335377b4 100644 --- a/api/swagger/swagger-v1.yaml +++ b/api/swagger/swagger-v1.yaml @@ -1556,6 +1556,12 @@ paths: required: true schema: type: string + requestBody: + required: false + content: + application/json: + schema: + $ref: "#/components/schemas/repost_request_body" responses: "200": description: Playlist reposted successfully @@ -3147,6 +3153,12 @@ paths: required: true schema: type: string + requestBody: + required: false + content: + application/json: + schema: + $ref: "#/components/schemas/repost_request_body" responses: "200": description: Track reposted successfully @@ -10555,7 +10567,17 @@ components: properties: is_save_of_repost: type: boolean - description: Set to true when favoriting a reposted item (used for notifications) + description: Set to true when favoriting a reposted playlist (used for notifications) + is_favorite_of_repost: + type: boolean + description: Set to true when favoriting a reposted track (used for notifications) + repost_request_body: + type: object + description: Optional metadata for repost operations + properties: + is_repost_of_repost: + type: boolean + description: Set to true when reposting an item that was reposted (used for notifications) pin_comment_request_body: type: object required: diff --git a/api/v1_playlist_reposts.go b/api/v1_playlist_reposts.go index 58eb8fcc..33880fed 100644 --- a/api/v1_playlist_reposts.go +++ b/api/v1_playlist_reposts.go @@ -1,6 +1,7 @@ package api import ( + "encoding/json" "strconv" "time" @@ -50,6 +51,17 @@ func (app *ApiServer) postV1PlaylistRepost(c *fiber.Ctx) error { return err } + metadata := "" + if body := c.Body(); len(body) > 0 { + var reqBody struct { + IsRepostOfRepost *bool `json:"is_repost_of_repost"` + } + if err := json.Unmarshal(body, &reqBody); err == nil && reqBody.IsRepostOfRepost != nil { + metadataBytes, _ := json.Marshal(map[string]bool{"is_repost_of_repost": *reqBody.IsRepostOfRepost}) + metadata = string(metadataBytes) + } + } + nonce := time.Now().UnixNano() manageEntityTx := &corev1.ManageEntityLegacy{ @@ -59,7 +71,7 @@ func (app *ApiServer) postV1PlaylistRepost(c *fiber.Ctx) error { Action: indexer.Action_Repost, EntityType: indexer.Entity_Playlist, Nonce: strconv.FormatInt(nonce, 10), - Metadata: "", + Metadata: metadata, } response, err := app.sendTransactionWithSigner(manageEntityTx, signer.PrivateKey) diff --git a/api/v1_track_favorites.go b/api/v1_track_favorites.go index ed73df0b..bc7de9ec 100644 --- a/api/v1_track_favorites.go +++ b/api/v1_track_favorites.go @@ -54,10 +54,10 @@ func (app *ApiServer) postV1TrackFavorite(c *fiber.Ctx) error { metadata := "" if body := c.Body(); len(body) > 0 { var reqBody struct { - IsSaveOfRepost *bool `json:"is_save_of_repost"` + IsFavoriteOfRepost *bool `json:"is_favorite_of_repost"` } - if err := json.Unmarshal(body, &reqBody); err == nil && reqBody.IsSaveOfRepost != nil { - metadataBytes, _ := json.Marshal(map[string]bool{"is_save_of_repost": *reqBody.IsSaveOfRepost}) + if err := json.Unmarshal(body, &reqBody); err == nil && reqBody.IsFavoriteOfRepost != nil { + metadataBytes, _ := json.Marshal(map[string]bool{"is_favorite_of_repost": *reqBody.IsFavoriteOfRepost}) metadata = string(metadataBytes) } } diff --git a/api/v1_track_reposts.go b/api/v1_track_reposts.go index e9e0bc14..ae147d37 100644 --- a/api/v1_track_reposts.go +++ b/api/v1_track_reposts.go @@ -1,6 +1,7 @@ package api import ( + "encoding/json" "strconv" "time" @@ -50,9 +51,18 @@ func (app *ApiServer) postV1TrackRepost(c *fiber.Ctx) error { return err } + metadata := "" + if body := c.Body(); len(body) > 0 { + var reqBody struct { + IsRepostOfRepost *bool `json:"is_repost_of_repost"` + } + if err := json.Unmarshal(body, &reqBody); err == nil && reqBody.IsRepostOfRepost != nil { + metadataBytes, _ := json.Marshal(map[string]bool{"is_repost_of_repost": *reqBody.IsRepostOfRepost}) + metadata = string(metadataBytes) + } + } + nonce := time.Now().UnixNano() - nonceBytes := make([]byte, 32) - copy(nonceBytes, []byte(strconv.FormatInt(nonce, 10))) manageEntityTx := &corev1.ManageEntityLegacy{ Signer: common.HexToAddress(signer.Address).String(), @@ -61,7 +71,7 @@ func (app *ApiServer) postV1TrackRepost(c *fiber.Ctx) error { Action: indexer.Action_Repost, EntityType: indexer.Entity_Track, Nonce: strconv.FormatInt(nonce, 10), - Metadata: "", + Metadata: metadata, } response, err := app.sendTransactionWithSigner(manageEntityTx, signer.PrivateKey) From c67f81af7cd224511ff6e695f80a9402d79553da Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Tue, 17 Feb 2026 22:14:34 -0800 Subject: [PATCH 2/2] Fix inconsistency --- api/swagger/swagger-v1.yaml | 5 +---- api/v1_track_favorites.go | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/api/swagger/swagger-v1.yaml b/api/swagger/swagger-v1.yaml index 335377b4..0500b210 100644 --- a/api/swagger/swagger-v1.yaml +++ b/api/swagger/swagger-v1.yaml @@ -10567,10 +10567,7 @@ components: properties: is_save_of_repost: type: boolean - description: Set to true when favoriting a reposted playlist (used for notifications) - is_favorite_of_repost: - type: boolean - description: Set to true when favoriting a reposted track (used for notifications) + description: Set to true when favoriting a reposted item (used for notifications) repost_request_body: type: object description: Optional metadata for repost operations diff --git a/api/v1_track_favorites.go b/api/v1_track_favorites.go index bc7de9ec..ed73df0b 100644 --- a/api/v1_track_favorites.go +++ b/api/v1_track_favorites.go @@ -54,10 +54,10 @@ func (app *ApiServer) postV1TrackFavorite(c *fiber.Ctx) error { metadata := "" if body := c.Body(); len(body) > 0 { var reqBody struct { - IsFavoriteOfRepost *bool `json:"is_favorite_of_repost"` + IsSaveOfRepost *bool `json:"is_save_of_repost"` } - if err := json.Unmarshal(body, &reqBody); err == nil && reqBody.IsFavoriteOfRepost != nil { - metadataBytes, _ := json.Marshal(map[string]bool{"is_favorite_of_repost": *reqBody.IsFavoriteOfRepost}) + if err := json.Unmarshal(body, &reqBody); err == nil && reqBody.IsSaveOfRepost != nil { + metadataBytes, _ := json.Marshal(map[string]bool{"is_save_of_repost": *reqBody.IsSaveOfRepost}) metadata = string(metadataBytes) } }