@@ -161,7 +161,11 @@ cli.command(
161
161
console . log ( yellow ( '\n --remote is required for tunneling, localtunnel is not enabled.\n' ) )
162
162
}
163
163
164
- lastRemoteUrl = printInfo ( options , port , remote , tunnelUrl )
164
+ let publicIp : string | undefined
165
+ if ( remote )
166
+ publicIp = await import ( 'public-ip' ) . then ( r => r . publicIpv4 ( ) )
167
+
168
+ lastRemoteUrl = printInfo ( options , port , remote , tunnelUrl , publicIp )
165
169
}
166
170
167
171
async function openTunnel ( port : number ) {
@@ -214,10 +218,13 @@ cli.command(
214
218
if ( ! lastRemoteUrl )
215
219
return
216
220
await import ( 'uqr' )
217
- . then ( ( r ) => {
221
+ . then ( async ( r ) => {
218
222
const code = r . renderUnicodeCompact ( lastRemoteUrl ! )
219
223
console . log ( `\n${ dim ( ' QR Code for remote control: ' ) } \n ${ blue ( lastRemoteUrl ! ) } \n` )
220
224
console . log ( code . split ( '\n' ) . map ( i => ` ${ i } ` ) . join ( '\n' ) )
225
+ const publicIp = await import ( 'public-ip' ) . then ( r => r . publicIpv4 ( ) )
226
+ if ( publicIp )
227
+ console . log ( `\n${ dim ( ' Public IP: ' ) } ${ blue ( publicIp ) } \n` )
221
228
} )
222
229
} ,
223
230
} ,
@@ -524,7 +531,13 @@ function exportOptions<T>(args: Argv<T>) {
524
531
} )
525
532
}
526
533
527
- function printInfo ( options : ResolvedSlidevOptions , port ?: number , remote ?: string , tunnelUrl ?: string ) {
534
+ function printInfo (
535
+ options : ResolvedSlidevOptions ,
536
+ port ?: number ,
537
+ remote ?: string ,
538
+ tunnelUrl ?: string ,
539
+ publicIp ?: string ,
540
+ ) {
528
541
console . log ( )
529
542
console . log ( )
530
543
console . log ( ` ${ cyan ( '●' ) + blue ( '■' ) + yellow ( '▲' ) } ` )
@@ -560,6 +573,11 @@ function printInfo(options: ResolvedSlidevOptions, port?: number, remote?: strin
560
573
console . log ( `${ dim ( ' remote control ' ) } > ${ blue ( lastRemoteUrl ) } ` )
561
574
} ) )
562
575
576
+ if ( publicIp ) {
577
+ lastRemoteUrl = `http://${ publicIp } :${ port } ${ entryPath } `
578
+ console . log ( `${ dim ( ' remote control ' ) } > ${ blue ( lastRemoteUrl ) } ` )
579
+ }
580
+
563
581
if ( tunnelUrl ) {
564
582
lastRemoteUrl = `${ tunnelUrl } ${ entryPath } `
565
583
console . log ( `${ dim ( ' remote via tunnel' ) } > ${ yellow ( lastRemoteUrl ) } ` )
0 commit comments