Skip to content

[API-84] Add track /stream /download /inspect#57

Merged
raymondjacobson merged 4 commits intomainfrom
rj-api-84
May 1, 2025
Merged

[API-84] Add track /stream /download /inspect#57
raymondjacobson merged 4 commits intomainfrom
rj-api-84

Conversation

@raymondjacobson
Copy link
Copy Markdown
Member

A bit more of a pain than I wanted
Tried to keep flow linear but with same behavior as python

Tested=

make test

api diff not super useful for these.

here's the response from inspect

image

@gitguardian
Copy link
Copy Markdown

gitguardian Bot commented Apr 30, 2025

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
16874868 Triggered Generic High Entropy Secret dcc3500 config/config.go View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Comment thread api/stream_util.go
// tryFindWorkingUrl attempts to validate a media link by checking if it can serve content.
// It tries the primary URL first, then falls back to mirrors if needed.
// Returns the first valid URL found or the main URL if nothing works.
func tryFindWorkingUrl(mediaLink *dbv1.MediaLink) *url.URL {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to keep doing this or just send it to the first one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do. I went back & forth for a while, but for people streaming from the public API until we have proportional rewards, etc., to promise a really high QoS - i think about lots of scenarios where the stream endpoint "just doesn't work"

e.g. node de-registers & content is still shuffling around

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have the mirrors now though, so this code is much nicer than python

Comment thread config/nodes.go
DevNodes = []Node{
{
DelegateOwnerWallet: "0x0000000000000000000000000000000000000001",
Endpoint: "https://dummynode.com",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not match these to the audius-compose DN / CNs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't sure what our plan there was for local stack and this is all i needed for this PR... down to change it if we want though

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not blocking, think we will want eventually though

Copy link
Copy Markdown
Contributor

@stereosteve stereosteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread api/v1_track_inspect.go Outdated

infos := make([]*inspectResponse, len(tracks))
var wg sync.WaitGroup
errChan := make(chan error, len(tracks))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we're not actually using errChan.

I think the intention is to ignore errors silently, which is fine... but in that case you can remove the errChan

You could also use an errgroup here... if you want.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh woops yea thx. great catch

@raymondjacobson raymondjacobson merged commit ff9bc90 into main May 1, 2025
2 checks passed
@raymondjacobson raymondjacobson deleted the rj-api-84 branch May 1, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants