peer-term 1.4.4 → 1.4.6
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 +31 -1
- package/package.json +1 -1
- package/src/index.js +7 -1
- package/src/ui.js +2 -2
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ npx peer-term
|
|
|
12
12
|
|
|
13
13
|
This will start a terminal sharing session and give you a 6-digit code.
|
|
14
14
|
|
|
15
|
-
Share this code with your peer. They can view your terminal by going to https://
|
|
15
|
+
Share this code with your peer. They can view your terminal by going to https://peerterm.dhananjaybalekar.in/ and entering the code.
|
|
16
16
|
|
|
17
17
|
## Global Installation
|
|
18
18
|
|
|
@@ -37,10 +37,38 @@ peer-term --path . # starts in current directory
|
|
|
37
37
|
peer-term --readonly # view-only session
|
|
38
38
|
peer-term --secure # require fingerprint verification
|
|
39
39
|
peer-term --expiry 10m # custom expiry time
|
|
40
|
+
peer-term --rejoin 5m # custom reconnection window
|
|
40
41
|
peer-term --relay wss://custom # use a custom relay server
|
|
41
42
|
peer-term --verbose # enable debug logging
|
|
42
43
|
```
|
|
43
44
|
|
|
45
|
+
### CLI Highlights
|
|
46
|
+
|
|
47
|
+
| Flag | Description | Default |
|
|
48
|
+
| :--- | :--- | :--- |
|
|
49
|
+
| `--expiry <time>` | Session expiry duration (e.g. `5m`, `30s`, `1h`) | `5m` |
|
|
50
|
+
| `--rejoin <time>` | Reconnection window if connection drops (e.g. `2m`, `10m`) | `2m` |
|
|
51
|
+
| `--readonly` | Disable client keystrokes (view-only terminal mode) | Off |
|
|
52
|
+
| `--secure` | Enable fingerprint verification for MITM protection | Off |
|
|
53
|
+
| `--path <dir>` | Starting directory for the terminal session | `~` (Home) |
|
|
54
|
+
| `--relay <url>` | Custom relay server WebSocket URL(s) | `wss://relay.dhananjaybalekar.in` |
|
|
55
|
+
| `-V, --verbose` | Enable verbose debug logging | Off |
|
|
56
|
+
| `-h, --help` | Display usage information and exit | — |
|
|
57
|
+
| `-v, --version` | Output version number and exit | — |
|
|
58
|
+
|
|
59
|
+
### Interactive Controls
|
|
60
|
+
|
|
61
|
+
While running, you can manage sessions directly from the host CLI:
|
|
62
|
+
|
|
63
|
+
| Command | Description |
|
|
64
|
+
| :--- | :--- |
|
|
65
|
+
| `n` | Create a new session |
|
|
66
|
+
| `l` | List all active sessions |
|
|
67
|
+
| `a <code>` | Authorize verified fingerprint (in `--secure` mode) |
|
|
68
|
+
| `k <code>` | Kill a specific session |
|
|
69
|
+
| `q` | Quit all sessions and exit |
|
|
70
|
+
|
|
71
|
+
|
|
44
72
|
## Features
|
|
45
73
|
|
|
46
74
|
- **No Config**: Works instantly. No port forwarding or firewall configuration needed.
|
|
@@ -51,6 +79,8 @@ peer-term --verbose # enable debug logging
|
|
|
51
79
|
- **Custom Start Path**: Set the starting directory with `--path`.
|
|
52
80
|
- **Resilient Connections**: Both host and client get a 2-minute rejoin window if their IP changes or connection drops. PTY state is fully preserved — no session restart needed.
|
|
53
81
|
- **Multi-Session**: Manage multiple simultaneous sessions with the interactive CLI menu.
|
|
82
|
+
- **QR Code Support**: Displays a terminal QR code for instant connection from mobile or tablet devices without manually entering the code.
|
|
83
|
+
- **Interactive Controls**: Manage sessions directly from the CLI (`n` for new session, `l` to list, `k` to kill, `a` to authorize fingerprint, `q` to quit).
|
|
54
84
|
|
|
55
85
|
## How It Works
|
|
56
86
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -338,6 +338,12 @@ class Session {
|
|
|
338
338
|
case 'code': {
|
|
339
339
|
this.code = msg.code;
|
|
340
340
|
this.hostToken = msg.hostToken || null;
|
|
341
|
+
const shareUrl = process.env.PEERTERM_CLIENT_URL || (
|
|
342
|
+
url.includes('relay.dhananjaybalekar.in')
|
|
343
|
+
? 'https://peerterm.dhananjaybalekar.in'
|
|
344
|
+
: url.replace(/^wss:\/\//i, 'https://').replace(/^ws:\/\//i, 'http://')
|
|
345
|
+
);
|
|
346
|
+
|
|
341
347
|
await printSessionBox({
|
|
342
348
|
code: this.code,
|
|
343
349
|
expiry: formatDuration(this.expiryMs),
|
|
@@ -345,7 +351,7 @@ class Session {
|
|
|
345
351
|
mode: (this.readOnly ? 'Read-Only' : 'Read-Write') + (this.secureMode ? ' (Secure)' : ''),
|
|
346
352
|
shell: this.shell,
|
|
347
353
|
startPath: this.startPath,
|
|
348
|
-
shareUrl
|
|
354
|
+
shareUrl
|
|
349
355
|
});
|
|
350
356
|
if (resolve) resolve(this.code);
|
|
351
357
|
break;
|
package/src/ui.js
CHANGED
|
@@ -46,11 +46,11 @@ export function printBanner() {
|
|
|
46
46
|
* @param {string} opts.mode - "Read-Write" or "Read-Only"
|
|
47
47
|
* @param {string} opts.shell - Shell path (e.g. "/bin/zsh")
|
|
48
48
|
* @param {string} [opts.startPath] - Starting directory for the session
|
|
49
|
-
* @param {string} [opts.shareUrl] - URL to share (e.g. "https://peerterm.
|
|
49
|
+
* @param {string} [opts.shareUrl] - URL to share (e.g. "https://peerterm.dhananjaybalekar.in")
|
|
50
50
|
*/
|
|
51
51
|
export async function printSessionBox({ code, expiry, rejoinWindow, mode, shell, startPath, shareUrl }) {
|
|
52
52
|
const spacedCode = code.split('').join(' ');
|
|
53
|
-
const url = shareUrl || 'https://peerterm.
|
|
53
|
+
const url = shareUrl || 'https://peerterm.dhananjaybalekar.in';
|
|
54
54
|
const joinUrl = `${url}?code=${code}`;
|
|
55
55
|
|
|
56
56
|
// Truncate long shell paths to keep box readable
|