termbeam 1.1.0 → 1.1.1
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.
- package/package.json +1 -1
- package/src/server.js +24 -1
- package/src/tunnel.js +20 -14
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -12,7 +12,7 @@ const { createAuth } = require('./auth');
|
|
|
12
12
|
const { SessionManager } = require('./sessions');
|
|
13
13
|
const { setupRoutes, cleanupUploadedFiles } = require('./routes');
|
|
14
14
|
const { setupWebSocket } = require('./websocket');
|
|
15
|
-
const { startTunnel, cleanupTunnel } = require('./tunnel');
|
|
15
|
+
const { startTunnel, cleanupTunnel, findDevtunnel } = require('./tunnel');
|
|
16
16
|
|
|
17
17
|
// --- Helpers ---
|
|
18
18
|
function getLocalIP() {
|
|
@@ -75,6 +75,29 @@ function createTermBeamServer(overrides = {}) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
function start() {
|
|
78
|
+
// Fail early if tunnel mode is on but devtunnel CLI is not installed
|
|
79
|
+
if (config.useTunnel && !findDevtunnel()) {
|
|
80
|
+
log.error('❌ devtunnel CLI is not installed.');
|
|
81
|
+
log.error('');
|
|
82
|
+
log.error(' TermBeam uses tunnels by default for remote access.');
|
|
83
|
+
log.error(' Install the Azure Dev Tunnels CLI, or use --no-tunnel for LAN-only mode.');
|
|
84
|
+
log.error('');
|
|
85
|
+
log.error(' Install it:');
|
|
86
|
+
log.error(' Windows: winget install Microsoft.devtunnel');
|
|
87
|
+
log.error(
|
|
88
|
+
' or: Invoke-WebRequest -Uri https://aka.ms/TunnelsCliDownload/win-x64 -OutFile devtunnel.exe',
|
|
89
|
+
);
|
|
90
|
+
log.error(' macOS: brew install --cask devtunnel');
|
|
91
|
+
log.error(' Linux: curl -sL https://aka.ms/DevTunnelCliInstall | bash');
|
|
92
|
+
log.error('');
|
|
93
|
+
log.error(' Then restart your terminal and try again.');
|
|
94
|
+
log.error(
|
|
95
|
+
' Docs: https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started',
|
|
96
|
+
);
|
|
97
|
+
log.error('');
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
|
|
78
101
|
return new Promise((resolve) => {
|
|
79
102
|
server.listen(config.port, config.host, async () => {
|
|
80
103
|
const ip = getLocalIP();
|
package/src/tunnel.js
CHANGED
|
@@ -89,7 +89,8 @@ async function startTunnel(port, options = {}) {
|
|
|
89
89
|
if (!found) {
|
|
90
90
|
log.error('❌ devtunnel CLI is not installed.');
|
|
91
91
|
log.error('');
|
|
92
|
-
log.error('
|
|
92
|
+
log.error(' TermBeam uses tunnels by default for remote access.');
|
|
93
|
+
log.error(' Install the Azure Dev Tunnels CLI, or use --no-tunnel for LAN-only mode.');
|
|
93
94
|
log.error('');
|
|
94
95
|
log.error(' Install it:');
|
|
95
96
|
log.error(' Windows: winget install Microsoft.devtunnel');
|
|
@@ -120,19 +121,24 @@ async function startTunnel(port, options = {}) {
|
|
|
120
121
|
} catch {}
|
|
121
122
|
|
|
122
123
|
if (!loggedIn) {
|
|
123
|
-
log.info('devtunnel not logged in, launching login...');
|
|
124
|
-
log.info('A browser window will open for authentication.');
|
|
124
|
+
log.info('devtunnel not logged in, launching browser login (30s timeout)...');
|
|
125
125
|
try {
|
|
126
|
-
execFileSync(devtunnelCmd, ['user', 'login'], { stdio: 'inherit' });
|
|
127
|
-
} catch
|
|
128
|
-
log.
|
|
129
|
-
log.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
126
|
+
execFileSync(devtunnelCmd, ['user', 'login'], { stdio: 'inherit', timeout: 30000 });
|
|
127
|
+
} catch {
|
|
128
|
+
log.info('Browser login failed or unavailable, falling back to device code flow...');
|
|
129
|
+
log.info('A code will be displayed — open the URL on any device to authenticate.');
|
|
130
|
+
try {
|
|
131
|
+
execFileSync(devtunnelCmd, ['user', 'login', '-d'], { stdio: 'inherit' });
|
|
132
|
+
} catch (loginErr) {
|
|
133
|
+
log.error('');
|
|
134
|
+
log.error(' DevTunnel login failed. To use tunnels, run:');
|
|
135
|
+
log.error(' devtunnel user login');
|
|
136
|
+
log.error('');
|
|
137
|
+
log.error(' Or start without a tunnel:');
|
|
138
|
+
log.error(' termbeam --no-tunnel');
|
|
139
|
+
log.error('');
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
136
142
|
}
|
|
137
143
|
}
|
|
138
144
|
|
|
@@ -257,4 +263,4 @@ function cleanupTunnel() {
|
|
|
257
263
|
}
|
|
258
264
|
}
|
|
259
265
|
|
|
260
|
-
module.exports = { startTunnel, cleanupTunnel };
|
|
266
|
+
module.exports = { startTunnel, cleanupTunnel, findDevtunnel };
|