File tree Expand file tree Collapse file tree 3 files changed +105
-100
lines changed Expand file tree Collapse file tree 3 files changed +105
-100
lines changed Original file line number Diff line number Diff line change 4646 "dependencies" : {
4747 "@animespace/core" : " workspace:*" ,
4848 "@breadc/color" : " ^0.9.7" ,
49- "@naria2/node" : " ^0.0.25 " ,
49+ "@naria2/node" : " ^0.1.0 " ,
5050 "@onekuma/map" : " ^0.1.10" ,
5151 "animegarden" : " ^0.3.0" ,
5252 "anitomy" : " ^0.0.35" ,
5959 "get-port-please" : " ^3.1.2" ,
6060 "libaria2" : " ^1.0.95" ,
6161 "memofunc" : " ^0.1.6" ,
62- "naria2" : " ^0.0.25 " ,
62+ "naria2" : " ^0.1.0 " ,
6363 "pathe" : " ^1.1.2" ,
6464 "string-width" : " ^7.2.0" ,
6565 "webtorrent" : " ^2.5.1" ,
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ export class Aria2Client extends DownloadClient {
6363
6464 private client ! : WebSocket . Client ;
6565
66- private webUI ! : HttpServer ;
66+ private webUI ! : Awaited < ReturnType < typeof launchWebUI > > ;
6767
6868 private version ! : string ;
6969
@@ -503,15 +503,14 @@ export class Aria2Client extends DownloadClient {
503503 const version = await this . client . getVersion ( ) ;
504504 this . version = version . version ;
505505
506- const webPort = await getPort ( { port : 6801 } ) ;
507- const webui = `http://127.0.0.1:${ webPort } ?port=${ rpcPort } &secret=${ this . options . secret } ` ;
508506 this . webUI = await launchWebUI ( {
509- port : webPort ,
510507 rpc : { port : rpcPort , secret : this . options . secret }
511508 } ) ;
512509
513510 this . consola . log (
514- dim ( `aria2 v${ this . version } is running on the port ${ link ( rpcPort + '' , webui ) } ` )
511+ dim (
512+ `aria2 v${ this . version } is running on the port ${ link ( rpcPort + '' , this . webUI . url ) } `
513+ )
515514 ) ;
516515 res ( ) ;
517516 } catch ( error ) {
@@ -539,7 +538,11 @@ export class Aria2Client extends DownloadClient {
539538 await Promise . all ( [
540539 this . client . close ( ) . catch ( ( ) => { } ) ,
541540 new Promise < void > ( ( res ) => {
542- this . webUI ?. close ( ( ) => res ( ) ) ;
541+ if ( this . webUI . server ) {
542+ this . webUI . server . close ( ( ) => res ( ) ) ;
543+ } else {
544+ res ( ) ;
545+ }
543546 } )
544547 ] ) ;
545548
You can’t perform that action at this time.
0 commit comments