Skip to content

feat: local audio API — uploaded-audio covers, download/export routes, cookie sanitize - #2

Open
francialisomlimoeiro wants to merge 1 commit into
ShowSnowBlood:mainfrom
francialisomlimoeiro:cover-upload
Open

feat: local audio API — uploaded-audio covers, download/export routes, cookie sanitize#2
francialisomlimoeiro wants to merge 1 commit into
ShowSnowBlood:mainfrom
francialisomlimoeiro:cover-upload

Conversation

@francialisomlimoeiro

Copy link
Copy Markdown

Addresses #1 (local audio upload API).

What's included

Local audio upload + cover generation

  • POST /api/uploads/audio — multipart upload running Suno's native upload chain (S3 POST-policy -> presigned PUT -> initialize-clip -> upload-finish -> poll), returns a clip_id
  • POST /api/custom_generate now accepts task: 'cover' + cover_clip_id (+ optional cover_start_s / cover_end_s), so an uploaded local file can be used as a cover source
  • upload_id passthrough for generating from an existing upload

Download / export routes

  • GET /api/download?id=<clip_id> — quota-aware router: prefers Suno Studio per-clip download and sample-pack (stems) exports, which don't count against the monthly download quota on Premier plans; path= forces a specific path, job= polls a running sample-pack export

Cookie sanitization

  • toBrowserCookies() fixes SUNO_COOKIE dumps for Playwright addCookies: drops Set-Cookie attribute junk, percent-encodes illegal value chars (e.g. ; inside OneTrust OptanonConsent), defaults domain=.suno.com, keeps the live session token over a stale env value — fixes CDP "Invalid cookie fields" crashes in the browser captcha fallback
  • scripts/selftest_browser_cookies.mts: offline self-test for the sanitizer (no generation involved)

No breaking changes to existing routes.

…d/export routes, cookie sanitize

- SunoApi: native upload chain (createAudioUpload S3 POST-policy,
  postUploadFile multipart, finishAudioUpload, getAudioUpload poll,
  initializeUploadClip) and cover payload (task='cover', cover_clip_id,
  cover_start_s/end_s) in generateSongs/custom_generate
- api/uploads/audio: multipart proxy running the full native upload chain,
  returns clip_id usable as cover source
- api/custom_generate: accept upload_id/cover_clip_id/task
- api/download: quota-aware download/export router (normal download,
  Studio per-clip download, sample-pack stems export with polling)
- SunoApi: toBrowserCookies() sanitizes SUNO_COOKIE dumps for Playwright
  addCookies (drops Set-Cookie attribute junk, percent-encodes illegal
  value chars like ';' inside OneTrust OptanonConsent, defaults
  domain=.suno.com, keeps the live session token over the stale env one)
- scripts/selftest_browser_cookies.mts: offline self-test for the
  sanitizer (no generation involved)
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.

1 participant