File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,10 +70,10 @@ impl SunoClient {
7070
7171 fn headers ( & self ) -> reqwest:: header:: HeaderMap {
7272 let mut headers = reqwest:: header:: HeaderMap :: new ( ) ;
73- if let Ok ( jwt) = self . auth . jwt ( ) {
74- if let Ok ( val) = format ! ( "Bearer {jwt}" ) . parse ( ) {
75- headers . insert ( "authorization" , val ) ;
76- }
73+ if let Ok ( jwt) = self . auth . jwt ( )
74+ && let Ok ( val) = format ! ( "Bearer {jwt}" ) . parse ( )
75+ {
76+ headers . insert ( "authorization" , val ) ;
7777 }
7878 if let Ok ( val) = self . auth . device_id ( ) . parse ( ) {
7979 headers. insert ( "device-id" , val) ;
Original file line number Diff line number Diff line change @@ -14,18 +14,17 @@ impl SunoClient {
1414 . await ?;
1515 let resp = self . check_response ( resp) . await ?;
1616
17- // The response may be the persona directly or wrapped in a paginated envelope.
18- // Try direct parse first, fall back to extracting from items array.
1917 let body: serde_json:: Value = resp. json ( ) . await ?;
2018
21- if let Some ( items) = body. get ( "items" ) . and_then ( |v| v. as_array ( ) ) {
22- if let Some ( first) = items. first ( ) {
23- let info: PersonaInfo = serde_json:: from_value ( first. clone ( ) ) ?;
24- return Ok ( info) ;
25- }
19+ if let Some ( first) = body
20+ . get ( "items" )
21+ . and_then ( |v| v. as_array ( ) )
22+ . and_then ( |items| items. first ( ) )
23+ {
24+ let info: PersonaInfo = serde_json:: from_value ( first. clone ( ) ) ?;
25+ return Ok ( info) ;
2626 }
2727
28- // Try parsing the entire response as PersonaInfo
2928 let info: PersonaInfo = serde_json:: from_value ( body) ?;
3029 Ok ( info)
3130 }
Original file line number Diff line number Diff line change @@ -103,8 +103,10 @@ pub struct ClipMetadata {
103103pub struct FeedResponse {
104104 #[ serde( default ) ]
105105 pub clips : Vec < Clip > ,
106+ #[ allow( dead_code) ]
106107 pub next_cursor : Option < String > ,
107108 #[ serde( default ) ]
109+ #[ allow( dead_code) ]
108110 pub has_more : bool ,
109111}
110112
@@ -196,6 +198,7 @@ pub struct ControlSliders {
196198pub struct GenerateResponse {
197199 #[ serde( default ) ]
198200 pub clips : Vec < Clip > ,
201+ #[ allow( dead_code) ]
199202 pub status : Option < String > ,
200203}
201204
@@ -232,6 +235,7 @@ pub struct AlignedWord {
232235
233236// --- Captcha Check ---
234237
238+ #[ allow( dead_code) ]
235239#[ derive( Debug , Deserialize ) ]
236240pub struct CaptchaCheckResponse {
237241 #[ serde( default ) ]
@@ -272,6 +276,7 @@ pub struct ConcatRequest {
272276
273277// --- Persona ---
274278
279+ #[ allow( dead_code) ]
275280#[ derive( Debug , Deserialize , Serialize ) ]
276281pub struct PersonaResponse {
277282 #[ serde( default ) ]
Original file line number Diff line number Diff line change @@ -107,7 +107,8 @@ pub fn extract_clerk_cookie() -> Result<String, CliError> {
107107 let domains = Some ( vec ! [ "auth.suno.com" . to_string( ) , ".suno.com" . to_string( ) ] ) ;
108108
109109 // Each closure calls a different browser extractor
110- let browsers: & [ ( & str , & dyn Fn ( ) -> eyre:: Result < Vec < rookie:: enums:: Cookie > > ) ] = & [
110+ type BrowserFn = dyn Fn ( ) -> eyre:: Result < Vec < rookie:: enums:: Cookie > > ;
111+ let browsers: & [ ( & str , & BrowserFn ) ] = & [
111112 ( "Chrome" , & || {
112113 rookie:: chrome ( Some ( vec ! [ "auth.suno.com" . into( ) , ".suno.com" . into( ) ] ) )
113114 } ) ,
Original file line number Diff line number Diff line change @@ -485,6 +485,7 @@ pub enum VariationCategory {
485485}
486486
487487impl VariationCategory {
488+ #[ allow( dead_code) ]
488489 pub fn to_api_value ( & self ) -> & ' static str {
489490 match self {
490491 Self :: High => "high" ,
Original file line number Diff line number Diff line change @@ -228,15 +228,14 @@ async fn run() -> Result<(), CliError> {
228228 let c = client ( ) . await ?;
229229
230230 // Check captcha before generating
231- if let Ok ( captcha_needed) = c. check_captcha ( ) . await {
232- if captcha_needed && args. token . is_none ( ) {
233- eprintln ! (
234- "Warning: captcha required. Use --token <hcaptcha_token> or solve captcha in browser."
235- ) ;
236- eprintln ! (
237- "Tip: Premier accounts with 200+ credits consumed usually skip captcha."
238- ) ;
239- }
231+ if let Ok ( captcha_needed) = c. check_captcha ( ) . await
232+ && captcha_needed
233+ && args. token . is_none ( )
234+ {
235+ eprintln ! (
236+ "Warning: captcha required. Use --token <hcaptcha_token> or solve captcha in browser."
237+ ) ;
238+ eprintln ! ( "Tip: Premier accounts with 200+ credits consumed usually skip captcha." ) ;
240239 }
241240
242241 // If persona specified, use task="vox"
@@ -408,7 +407,10 @@ async fn run() -> Result<(), CliError> {
408407 }
409408
410409 Commands :: Info ( args) => {
411- let clips = client ( ) . await ?. get_clips ( & [ args. id . clone ( ) ] ) . await ?;
410+ let clips = client ( )
411+ . await ?
412+ . get_clips ( std:: slice:: from_ref ( & args. id ) )
413+ . await ?;
412414 if clips. is_empty ( ) {
413415 return Err ( CliError :: NotFound ( format ! ( "clip: {}" , args. id) ) ) ;
414416 }
You can’t perform that action at this time.
0 commit comments