termbeam 0.0.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/LICENSE +21 -0
- package/README.md +123 -0
- package/bin/termbeam.js +2 -0
- package/package.json +69 -0
- package/public/index.html +779 -0
- package/public/terminal.html +490 -0
- package/src/auth.js +124 -0
- package/src/cli.js +81 -0
- package/src/routes.js +87 -0
- package/src/server.js +122 -0
- package/src/sessions.js +90 -0
- package/src/tunnel.js +69 -0
- package/src/version.js +34 -0
- package/src/websocket.js +72 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 TermBeam Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 📡 TermBeam
|
|
4
|
+
|
|
5
|
+
**Beam your terminal to any device**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/termbeam)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://nodejs.org)
|
|
10
|
+
|
|
11
|
+
Access your terminal from your phone, tablet, or any browser.
|
|
12
|
+
Multi-session, mobile-optimized, with touch controls.
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## ✨ Features
|
|
19
|
+
|
|
20
|
+
- 📱 **Mobile-optimized** — Touch-friendly UI designed for phones and tablets
|
|
21
|
+
- 🖥️ **Multi-session** — Run multiple terminal sessions simultaneously
|
|
22
|
+
- 🔐 **Password auth** — Token-based authentication with rate limiting
|
|
23
|
+
- 📂 **Folder browser** — Visual directory picker for setting the working directory
|
|
24
|
+
- 👆 **Touch controls** — Arrow keys, Ctrl shortcuts, Tab, Esc via on-screen touch bar
|
|
25
|
+
- 🔤 **Nerd Font support** — Full glyph rendering with JetBrains Mono Nerd Font
|
|
26
|
+
- 📲 **QR code** — Scan to connect instantly from your phone
|
|
27
|
+
- 🌐 **DevTunnel** — Optional public URL for remote access from anywhere
|
|
28
|
+
- 🔍 **Zoom** — Adjustable font size for any screen
|
|
29
|
+
- ↔️ **Swipe to delete** — iOS-style session management
|
|
30
|
+
|
|
31
|
+
## 🚀 Quick Start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx termbeam
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or install globally:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g termbeam
|
|
41
|
+
termbeam
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Scan the QR code printed in your terminal, or open the URL on any device.
|
|
45
|
+
|
|
46
|
+
## 📖 Usage
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Start with your default shell
|
|
50
|
+
termbeam
|
|
51
|
+
|
|
52
|
+
# With password protection (recommended)
|
|
53
|
+
termbeam --password mysecret
|
|
54
|
+
|
|
55
|
+
# Auto-generate a secure password
|
|
56
|
+
termbeam --generate-password
|
|
57
|
+
|
|
58
|
+
# Use a specific shell
|
|
59
|
+
termbeam /bin/bash
|
|
60
|
+
|
|
61
|
+
# Custom port and listen on all interfaces
|
|
62
|
+
termbeam --port 8080 --host 0.0.0.0
|
|
63
|
+
|
|
64
|
+
# Public tunnel + password (access from anywhere)
|
|
65
|
+
termbeam --tunnel --generate-password
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### All Options
|
|
69
|
+
|
|
70
|
+
| Flag | Description | Default |
|
|
71
|
+
| --------------------- | ------------------------------- | ----------- |
|
|
72
|
+
| `--password <pw>` | Set access password | None |
|
|
73
|
+
| `--generate-password` | Auto-generate a secure password | — |
|
|
74
|
+
| `--tunnel` | Create a public devtunnel URL | Off |
|
|
75
|
+
| `--port <port>` | Server port | `3456` |
|
|
76
|
+
| `--host <addr>` | Bind address | `127.0.0.1` |
|
|
77
|
+
| `-h, --help` | Show help | — |
|
|
78
|
+
| `-v, --version` | Show version | — |
|
|
79
|
+
|
|
80
|
+
### Environment Variables
|
|
81
|
+
|
|
82
|
+
| Variable | Description |
|
|
83
|
+
| ------------------- | ------------------------------- |
|
|
84
|
+
| `PORT` | Server port (overrides default) |
|
|
85
|
+
| `TERMBEAM_PASSWORD` | Access password |
|
|
86
|
+
| `TERMBEAM_CWD` | Default working directory |
|
|
87
|
+
|
|
88
|
+
## 🔒 Security
|
|
89
|
+
|
|
90
|
+
TermBeam is designed for **local network use**. When exposing to the internet:
|
|
91
|
+
|
|
92
|
+
- **Always use a password** (`--password` or `--generate-password`)
|
|
93
|
+
- Authentication uses secure, httpOnly tokens with 24-hour expiry
|
|
94
|
+
- Login endpoint is rate-limited (5 attempts per minute)
|
|
95
|
+
- Security headers enabled (X-Frame-Options, X-Content-Type-Options, etc.)
|
|
96
|
+
- By default, binds to `127.0.0.1` (localhost only)
|
|
97
|
+
- Use `--host 0.0.0.0` explicitly to expose on your LAN
|
|
98
|
+
|
|
99
|
+
> ⚠️ **Never run without a password on a public network.**
|
|
100
|
+
|
|
101
|
+
## 🏗️ Project Structure
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
termbeam/
|
|
105
|
+
├── bin/
|
|
106
|
+
│ └── termbeam.js # CLI entry point
|
|
107
|
+
├── src/
|
|
108
|
+
│ └── server.js # Express + WebSocket server
|
|
109
|
+
├── public/
|
|
110
|
+
│ ├── index.html # Session manager UI
|
|
111
|
+
│ └── terminal.html # Terminal UI (xterm.js)
|
|
112
|
+
├── package.json
|
|
113
|
+
├── LICENSE
|
|
114
|
+
└── README.md
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## 🤝 Contributing
|
|
118
|
+
|
|
119
|
+
Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
120
|
+
|
|
121
|
+
## 📄 License
|
|
122
|
+
|
|
123
|
+
[MIT](LICENSE) — made with ❤️
|
package/bin/termbeam.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "termbeam",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Beam your terminal to any device — mobile-optimized web terminal with multi-session support",
|
|
5
|
+
"main": "src/server.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"termbeam": "./bin/termbeam.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node bin/termbeam.js",
|
|
11
|
+
"dev": "node bin/termbeam.js --generate-password",
|
|
12
|
+
"test": "node --test test/*.test.js",
|
|
13
|
+
"prepare": "husky",
|
|
14
|
+
"format": "prettier --write .",
|
|
15
|
+
"lint": "node --check src/*.js bin/*.js",
|
|
16
|
+
"prepublishOnly": "npm test"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"terminal",
|
|
20
|
+
"pty",
|
|
21
|
+
"mobile",
|
|
22
|
+
"web-terminal",
|
|
23
|
+
"remote-terminal",
|
|
24
|
+
"xterm",
|
|
25
|
+
"websocket",
|
|
26
|
+
"ssh-alternative"
|
|
27
|
+
],
|
|
28
|
+
"author": "",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"homepage": "https://github.com/dorlugasigal/TermBeam",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/dorlugasigal/TermBeam.git"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/dorlugasigal/TermBeam/issues"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18.0.0"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"bin/",
|
|
43
|
+
"src/",
|
|
44
|
+
"public/",
|
|
45
|
+
"LICENSE",
|
|
46
|
+
"README.md"
|
|
47
|
+
],
|
|
48
|
+
"lint-staged": {
|
|
49
|
+
"*.js": [
|
|
50
|
+
"prettier --write",
|
|
51
|
+
"node --check"
|
|
52
|
+
],
|
|
53
|
+
"*.{json,md,yml,yaml,html,css}": [
|
|
54
|
+
"prettier --write"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"cookie-parser": "^1.4.7",
|
|
59
|
+
"express": "^5.2.1",
|
|
60
|
+
"node-pty": "^1.0.0",
|
|
61
|
+
"qrcode": "^1.5.4",
|
|
62
|
+
"ws": "^8.19.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"husky": "^9.1.7",
|
|
66
|
+
"lint-staged": "^16.2.7",
|
|
67
|
+
"prettier": "^3.8.1"
|
|
68
|
+
}
|
|
69
|
+
}
|