cli-tunnel 1.2.0-beta.3 → 1.2.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +10 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -473,16 +473,18 @@ async function main() {
473
473
  console.log(`\n ${DIM}More info: https://aka.ms/devtunnels/doc${RESET}`);
474
474
  console.log(` ${DIM}Continuing without tunnel (local only)...${RESET}\n`);
475
475
  }
476
- // If just installed, check login
477
- if (devtunnelInstalled) {
476
+ }
477
+ if (devtunnelInstalled) {
478
+ try {
479
+ // Check if logged in before attempting tunnel creation
478
480
  try {
479
481
  const userInfo = execFileSync('devtunnel', ['user', 'show'], { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
480
- if (userInfo.includes('not logged in') || userInfo.includes('No user')) {
482
+ if (userInfo.includes('not logged in') || userInfo.includes('No user') || userInfo.includes('Anonymous')) {
481
483
  throw new Error('not logged in');
482
484
  }
483
485
  }
484
486
  catch {
485
- console.log(` ${YELLOW}⚠ devtunnel not authenticated.${RESET}\n`);
487
+ console.log(`\n ${YELLOW}⚠ devtunnel not authenticated.${RESET}\n`);
486
488
  const loginAnswer = await askUser(` Would you like to log in now? [Y/n] `);
487
489
  if (loginAnswer === '' || loginAnswer === 'y' || loginAnswer === 'yes') {
488
490
  try {
@@ -506,6 +508,10 @@ async function main() {
506
508
  }
507
509
  }
508
510
  }
511
+ catch (err) {
512
+ console.log(` ${YELLOW}⚠${RESET} Tunnel failed: ${err.message}\n`);
513
+ devtunnelInstalled = false;
514
+ }
509
515
  }
510
516
  if (devtunnelInstalled) {
511
517
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-tunnel",
3
- "version": "1.2.0-beta.3",
3
+ "version": "1.2.0-beta.4",
4
4
  "description": "Tunnel any CLI app to your phone — PTY + devtunnel + xterm.js",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",