termbeam 1.2.6 → 1.2.7
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/README.md +1 -1
- package/package.json +1 -1
- package/src/cli.js +19 -5
- package/src/server.js +6 -6
package/README.md
CHANGED
|
@@ -110,7 +110,7 @@ termbeam --host 127.0.0.1 # restrict to localhost (default: 0.0.0.0)
|
|
|
110
110
|
| Flag | Description | Default |
|
|
111
111
|
| --------------------- | ---------------------------------------------------- | -------------- |
|
|
112
112
|
| `--password <pw>` | Set access password (also accepts `--password=<pw>`) | Auto-generated |
|
|
113
|
-
| `--no-password` | Disable password
|
|
113
|
+
| `--no-password` | Disable password (cannot combine with `--public`) | — |
|
|
114
114
|
| `--generate-password` | Auto-generate a secure password | On |
|
|
115
115
|
| `--tunnel` | Create an ephemeral devtunnel URL (private) | On |
|
|
116
116
|
| `--no-tunnel` | Disable tunnel (LAN-only) | — |
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -230,7 +230,7 @@ function parseArgs() {
|
|
|
230
230
|
let useTunnel = true;
|
|
231
231
|
let noTunnel = false;
|
|
232
232
|
let persistedTunnel = false;
|
|
233
|
-
let
|
|
233
|
+
let publicTunnel = false;
|
|
234
234
|
let explicitPassword = !!password;
|
|
235
235
|
|
|
236
236
|
const args = process.argv.slice(2);
|
|
@@ -248,7 +248,7 @@ function parseArgs() {
|
|
|
248
248
|
useTunnel = true;
|
|
249
249
|
persistedTunnel = true;
|
|
250
250
|
} else if (args[i] === '--public') {
|
|
251
|
-
|
|
251
|
+
publicTunnel = true;
|
|
252
252
|
} else if (args[i].startsWith('--password=')) {
|
|
253
253
|
password = args[i].split('=')[1];
|
|
254
254
|
explicitPassword = true;
|
|
@@ -285,8 +285,22 @@ function parseArgs() {
|
|
|
285
285
|
if (noTunnel) useTunnel = false;
|
|
286
286
|
|
|
287
287
|
// --public requires a tunnel
|
|
288
|
-
if (
|
|
289
|
-
|
|
288
|
+
if (publicTunnel && !useTunnel) {
|
|
289
|
+
const rd = '\x1b[31m';
|
|
290
|
+
const rs = '\x1b[0m';
|
|
291
|
+
console.error(
|
|
292
|
+
`${rd}Error: --public requires a tunnel. Remove --no-tunnel or remove --public.${rs}`,
|
|
293
|
+
);
|
|
294
|
+
process.exit(1);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// --public requires password authentication
|
|
298
|
+
if (publicTunnel && !password) {
|
|
299
|
+
const rd = '\x1b[31m';
|
|
300
|
+
const rs = '\x1b[0m';
|
|
301
|
+
console.error(
|
|
302
|
+
`${rd}Error: Public tunnels require password authentication. Remove --no-password or remove --public.${rs}`,
|
|
303
|
+
);
|
|
290
304
|
process.exit(1);
|
|
291
305
|
}
|
|
292
306
|
|
|
@@ -302,7 +316,7 @@ function parseArgs() {
|
|
|
302
316
|
password,
|
|
303
317
|
useTunnel,
|
|
304
318
|
persistedTunnel,
|
|
305
|
-
|
|
319
|
+
publicTunnel,
|
|
306
320
|
shell,
|
|
307
321
|
shellArgs,
|
|
308
322
|
cwd,
|
package/src/server.js
CHANGED
|
@@ -27,10 +27,10 @@ function getLocalIP() {
|
|
|
27
27
|
return '127.0.0.1';
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
function
|
|
30
|
+
function confirmPublicTunnel() {
|
|
31
31
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
32
32
|
return new Promise((resolve) => {
|
|
33
|
-
rl.question(' Do you want to continue with
|
|
33
|
+
rl.question(' Do you want to continue with public access? (y/N): ', (answer) => {
|
|
34
34
|
rl.close();
|
|
35
35
|
resolve(answer.trim().toLowerCase() === 'y');
|
|
36
36
|
});
|
|
@@ -110,8 +110,8 @@ function createTermBeamServer(overrides = {}) {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
// Warn and require consent for
|
|
114
|
-
if (config.useTunnel && config.
|
|
113
|
+
// Warn and require consent for public tunnel access
|
|
114
|
+
if (config.useTunnel && config.publicTunnel) {
|
|
115
115
|
const rd = '\x1b[31m';
|
|
116
116
|
const yl = '\x1b[33m';
|
|
117
117
|
const rs = '\x1b[0m';
|
|
@@ -123,7 +123,7 @@ function createTermBeamServer(overrides = {}) {
|
|
|
123
123
|
console.log(` ${yl}No Microsoft login will be required to reach the tunnel.${rs}`);
|
|
124
124
|
console.log(` ${yl}Only the TermBeam password will protect your terminal.${rs}`);
|
|
125
125
|
console.log('');
|
|
126
|
-
const confirmed = await
|
|
126
|
+
const confirmed = await confirmPublicTunnel();
|
|
127
127
|
if (!confirmed) {
|
|
128
128
|
console.log('');
|
|
129
129
|
console.log(' Aborted. Restart without --public for private access.');
|
|
@@ -178,7 +178,7 @@ function createTermBeamServer(overrides = {}) {
|
|
|
178
178
|
if (config.useTunnel) {
|
|
179
179
|
const tunnel = await startTunnel(config.port, {
|
|
180
180
|
persisted: config.persistedTunnel,
|
|
181
|
-
anonymous: config.
|
|
181
|
+
anonymous: config.publicTunnel,
|
|
182
182
|
});
|
|
183
183
|
if (tunnel) {
|
|
184
184
|
publicUrl = tunnel.url;
|