@@ -330,18 +330,28 @@ impl MisskeyClient {
330330 host : & str ,
331331 token : & str ,
332332 ) -> Result < Vec < Channel > , NoteDeckError > {
333- let ( followed, favorites, owned, featured) = tokio:: join!(
334- self . request( host, token, "channels/followed" , json!( { "limit" : 100 } ) ) ,
335- self . request( host, token, "channels/my-favorites" , json!( { "limit" : 100 } ) ) ,
336- self . request( host, token, "channels/owned" , json!( { "limit" : 100 } ) ) ,
337- self . request( host, token, "channels/featured" , json!( { } ) ) ,
338- ) ;
333+ let search_fut = self . request ( host, token, "channels/search" , json ! ( { "query" : "" , "limit" : 100 } ) ) ;
334+ let featured_fut = self . request ( host, token, "channels/featured" , json ! ( { } ) ) ;
335+
336+ let ( followed, favorites, owned, featured, search) = if token. is_empty ( ) {
337+ let ( fe, s) = tokio:: join!( featured_fut, search_fut) ;
338+ ( None , None , None , Some ( fe) , Some ( s) )
339+ } else {
340+ let ( fo, fa, o, fe, s) = tokio:: join!(
341+ self . request( host, token, "channels/followed" , json!( { "limit" : 100 } ) ) ,
342+ self . request( host, token, "channels/my-favorites" , json!( { "limit" : 100 } ) ) ,
343+ self . request( host, token, "channels/owned" , json!( { "limit" : 100 } ) ) ,
344+ featured_fut,
345+ search_fut,
346+ ) ;
347+ ( Some ( fo) , Some ( fa) , Some ( o) , Some ( fe) , Some ( s) )
348+ } ;
339349
340350 let mut seen = std:: collections:: HashSet :: with_capacity ( 128 ) ;
341351 let mut channels = Vec :: with_capacity ( 128 ) ;
342352
343- // User's own channels first, then featured as fallback
344- for data in [ followed, favorites, owned, featured] . into_iter ( ) . flatten ( ) {
353+ // User's own channels first, then public channels
354+ for data in [ followed, favorites, owned, featured, search ] . into_iter ( ) . flatten ( ) . flatten ( ) {
345355 if let Ok ( list) = serde_json:: from_value :: < Vec < Channel > > ( data) {
346356 for ch in list {
347357 if seen. insert ( ch. id . clone ( ) ) {
0 commit comments