tmux-weblink 2.2.24 → 2.2.26
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 +189 -30
- package/README.zh-CN.md +169 -47
- package/dist/assets/shell-client.js +12 -12
- package/dist/browser/shell-client.js +11 -11
- package/dist/lib/build-app.js +4 -4
- package/dist/lib/fs-access.js +1 -1
- package/dist/lib/shared-layout.js +9 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,24 +2,172 @@
|
|
|
2
2
|
|
|
3
3
|
**English** | [中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
Access your tmux sessions from the browser. A lightweight web server that lists running tmux sessions and lets you attach through a full terminal in your browser — with built-in notes and a
|
|
5
|
+
Access your tmux sessions from the browser. A lightweight web server that lists running tmux sessions and lets you attach through a full terminal in your browser — with built-in notes, a file browser, and a touch-friendly UI for both mobile and desktop.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Full terminal**: xterm.js rendering, 256 colors, copy/paste, paste images straight into CLI tools
|
|
10
|
+
- **Touch optimized**: inertial scrollback, tap-to-page left half, drag-select auto-copy, virtual-key toolbar
|
|
11
|
+
- **PWA**: "Add to Home Screen" on phones, "Install" in desktop browsers → standalone window app
|
|
12
|
+
- **Sidebar grouping**: sessions auto-clustered by working directory (folder-name headers, collapsible)
|
|
13
|
+
- **New Session directory-tree picker**: expand down to any directory, including hidden ones
|
|
14
|
+
- **Notes**: per-session Markdown scratchpad with auto-save
|
|
15
|
+
- **Files**: browse/edit local files and view git status
|
|
16
|
+
- **Machines federation**: join NAT'd machines to a public hub (no open ports needed), multi-machine terminal matrix
|
|
17
|
+
- **Security**: scrypt-hashed password auth, login rate limiting, audit log
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Usage Guide (step by step)
|
|
22
|
+
|
|
23
|
+
## 1. Install and start
|
|
8
24
|
|
|
9
25
|
```bash
|
|
10
26
|
npm install -g tmux-weblink
|
|
27
|
+
|
|
28
|
+
# Start (default port 21000)
|
|
29
|
+
tmux-weblink
|
|
11
30
|
```
|
|
12
31
|
|
|
13
|
-
|
|
32
|
+
Open **http://localhost:21000** in your browser.
|
|
14
33
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
34
|
+
## 2. First run: set a password and log in
|
|
35
|
+
|
|
36
|
+
The first visit shows a **"Set your password"** page (min 8 characters). The password is stored as a scrypt hash on the machine; from then on you just type it to log in.
|
|
37
|
+
|
|
38
|
+
> Alternative: run `tmux-weblink setup` from the command line to initialize.
|
|
39
|
+
|
|
40
|
+
## 3. Layout tour
|
|
41
|
+
|
|
42
|
+
- **Sidebar (Sessions mode, default)**:
|
|
43
|
+
- **`+ New Session`** button on top — create a new tmux session
|
|
44
|
+
- Session list **grouped by working directory** (folder-name headers, click to collapse). Sessions from the same project stack together.
|
|
45
|
+
- Each session has a colored dot: **green = idle, amber = working** (automatic activity probing, no config)
|
|
46
|
+
- Sessions killed inside tmux move to a greyed-out **"失效会话 / dead sessions"** group (see §8)
|
|
47
|
+
- **Three mode buttons at the bottom**: `Sessions` / `Files` / `Settings`
|
|
48
|
+
- **Main area**: placeholder until you open a session, then the full terminal
|
|
49
|
+
|
|
50
|
+
## 4. Opening a session & day-to-day operations
|
|
51
|
+
|
|
52
|
+
### Open a session
|
|
53
|
+
|
|
54
|
+
**Click any session** in the sidebar to attach (a real `tmux attach`, not an emulation). The sidebar collapses to give the terminal the full width.
|
|
55
|
+
|
|
56
|
+
- To switch sessions, click the **tmux-weblink** logo in the top-left to re-open the sidebar, then click another session
|
|
57
|
+
- Attachments are real: windows/panes you open and what other terminals (e.g. a native tmux client) see stay fully in sync
|
|
58
|
+
|
|
59
|
+
### Copy & paste
|
|
60
|
+
|
|
61
|
+
| Action | How |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| Copy terminal text | **Drag-select** and release — auto-copies (desktop & mobile); or hold `Shift` while dragging |
|
|
64
|
+
| Paste into terminal | With the terminal focused, just press `Ctrl+V` (`Cmd+V` on Mac) — the page handles it: text is typed in, images are uploaded (grant clipboard permission the first time) |
|
|
65
|
+
| Paste an **image** (≥2.2.24) | Copy an image (screenshot / clipboard image), press `Ctrl+V` in the terminal → the image uploads to `~/.tmux-web/uploads/` and its **file path is typed into the terminal**. The terminal is text-only, so pasting an image = pasting its path — then `cat` or `vim` it |
|
|
66
|
+
|
|
67
|
+
> In an agent session (Machines), pasted images land on the **agent's machine**, so the path is valid there.
|
|
68
|
+
|
|
69
|
+
### Touch screens (phones / tablets)
|
|
70
|
+
|
|
71
|
+
The terminal is split in two zones — the **left 40% is a paging zone** (split top/bottom by where your finger lands):
|
|
72
|
+
|
|
73
|
+
- **Left 40%** (split top/bottom by where your finger lands):
|
|
74
|
+
- tap/swipe **top half** = page up (PgUp, vim-friendly)
|
|
75
|
+
- tap/swipe **bottom half** = page down (PgDn)
|
|
76
|
+
- A translucent ↑/↓ hint appears; no soft keyboard pops up — tap the terminal body when you want to type
|
|
77
|
+
- **Right 60%**: drag up/down to **scroll terminal history** with inertia, like a normal mobile page
|
|
78
|
+
|
|
79
|
+
### Virtual-key toolbar (mobile)
|
|
80
|
+
|
|
81
|
+
Tap the input bar at the bottom for a toolbar with `ESC` / `Tab` / `Shift+Tab` / arrow keys — the keys soft keyboards lack.
|
|
82
|
+
|
|
83
|
+
### Switch tmux windows from the header
|
|
84
|
+
|
|
85
|
+
Multi-window sessions show a **window drawer** at the terminal header (a mobile-friendly tab picker). Tap to switch tmux windows — no need to remember `Ctrl+B n` keybindings.
|
|
86
|
+
|
|
87
|
+
### Quick Commands
|
|
88
|
+
|
|
89
|
+
Open **`/quick-commands`**: save frequent commands as cards (title + command + optional target session) and run them with one click. Great for "restart the service" or "run the tests".
|
|
90
|
+
|
|
91
|
+
## 5. Creating a session (New Session)
|
|
18
92
|
|
|
19
|
-
|
|
93
|
+
Click **`+ New Session`** in the sidebar:
|
|
94
|
+
|
|
95
|
+
1. **Session name**: e.g. `myproject`
|
|
96
|
+
2. **Start directory** — either:
|
|
97
|
+
- type a path and pick from the live **autocomplete** (typing `~/.cl` suggests `~/.claude`), or
|
|
98
|
+
- click the folder button (📁) to open a **directory tree**; expand down to your target — it auto-expands to the current session's directory, and **hidden directories (`.claude`, `.config`, …) are visible** (≥2.2.25, sorted after regular ones)
|
|
99
|
+
3. Click **Create** — the session starts and you're attached
|
|
100
|
+
|
|
101
|
+
> Leave the directory empty to start in `$HOME` and `cd` later — the tree is a convenience, not a requirement.
|
|
102
|
+
|
|
103
|
+
## 6. Notes & Files
|
|
104
|
+
|
|
105
|
+
### Notes (per-session scratchpad)
|
|
106
|
+
|
|
107
|
+
Click the **notepad icon** in the session header to open that session's Markdown pad; it **auto-saves as you type** into `~/.tmux-web/db.json`. Re-open the session later and the note is still there. For a bigger surface / export use `/notes/<session>` or the global note at `/notes/__global__`.
|
|
108
|
+
|
|
109
|
+
### Files (browse/edit + git)
|
|
110
|
+
|
|
111
|
+
Switch to **Files** mode at the bottom:
|
|
112
|
+
|
|
113
|
+
- **Default** (no config): with a session open, Files browses that session's **working directory**
|
|
114
|
+
- **Configured** (`TMUX_WEB_FS_ROOTS=/path1:/path2`): shows multiple root entries
|
|
115
|
+
- Click folders to descend, click a file to open it in the editor, **Save** to write; `..` goes up
|
|
116
|
+
- Git repos show the **branch name** and per-file change markers; git diffs are viewable from the header/sidebar
|
|
117
|
+
- New file: type a name in the bottom field and hit **New File**
|
|
118
|
+
|
|
119
|
+
Security: paths must resolve inside a configured root (single file ≤1 MiB by default); traversal like `../../../etc/passwd` is rejected.
|
|
120
|
+
|
|
121
|
+
## 7. Machines (bring NAT'd machines in)
|
|
122
|
+
|
|
123
|
+
One **hub** (publicly reachable) + any number of machines stuck behind NAT. Every machine runs the same package and the same command — only the role differs:
|
|
124
|
+
|
|
125
|
+
1. **On the hub**: open `http://<hub>:21000/settings/machines`, create an agent token and copy it (one-shot; it disappears once you leave the page)
|
|
126
|
+
2. **On the remote machine** (e.g. your home/office LAN box): start the server, then open *its own* `http://localhost:21000/settings/machines`, paste hub URL + token, hit **Save & Connect**
|
|
127
|
+
3. **Back on the hub's browser page**: a group named after the machine appears in the sidebar — click into its sessions exactly like local ones. Input, touch, and image paste all travel through an encrypted tunnel
|
|
128
|
+
|
|
129
|
+
Notes:
|
|
130
|
+
|
|
131
|
+
- The agent client runs **in-process** next to the normal server; the remote machine opens no ports
|
|
132
|
+
- **When the hub is upgraded, upgrade the remote agents too** (agent-side logic evolves with releases)
|
|
133
|
+
- Hard-refresh the browser after front-end changes (see §9)
|
|
134
|
+
|
|
135
|
+
## 8. Sessions killed in tmux (dead sessions / tombstones)
|
|
136
|
+
|
|
137
|
+
When you `kill-session` a session in tmux, the list doesn't throw it away — it moves to the greyed-out **dead sessions** group, keeping its place and path.
|
|
138
|
+
|
|
139
|
+
Click it to open an action panel:
|
|
140
|
+
|
|
141
|
+
- **Rebuild (same name & path)** — relaunch the session in its original working directory (the common case)
|
|
142
|
+
- **Rename (record only)** — change the record, not tmux
|
|
143
|
+
- **Delete the dead record** — forget it entirely
|
|
144
|
+
|
|
145
|
+
## 9. Installing as an app
|
|
146
|
+
|
|
147
|
+
- **iOS**: Safari share → **Add to Home Screen** (fullscreen standalone)
|
|
148
|
+
- **Android / Chrome**: menu → **Add to Home Screen** / **Install app**
|
|
149
|
+
- **Desktop browsers** (Linux/Windows/macOS): click the **Install** icon in the Chrome/Edge/Chromium address bar for a standalone window
|
|
150
|
+
- Note: plain-HTTP LAN IPs won't show the install prompt (browsers require a secure context); `localhost` or HTTPS both work
|
|
151
|
+
|
|
152
|
+
## 10. Troubleshooting
|
|
153
|
+
|
|
154
|
+
| Symptom | Fix |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| Page doesn't show new features after an upgrade | **Hard-refresh**: `Ctrl+Shift+R` (Mac `Cmd+Shift+R`). Front-end JS is served at page load; already-open pages don't update themselves |
|
|
157
|
+
| Agent sessions still behave old after hub upgrade | Upgrade the **remote agent** package to the new version too |
|
|
158
|
+
| Pasting an image does nothing | Need ≥2.2.24; make sure `Ctrl+V` in the terminal and grant clipboard permission once |
|
|
159
|
+
| Hidden dirs like `.claude` missing in the tree | Need ≥2.2.25 (hidden entries sort at the end of listings) |
|
|
160
|
+
| Port taken | `PORT=8080 tmux-weblink` |
|
|
161
|
+
| Forgot your password | Re-run `tmux-weblink setup` on the machine |
|
|
162
|
+
| Running under systemd | The unit **must** set `KillMode=process` (the default control-group mode would kill the tmux server on restart — see [docs/index.md](docs/index.md)) |
|
|
163
|
+
| Server won't run natively on Windows | Run the server inside **WSL2**; the Windows browser works fine as a client (point it at WSL2 or a remote hub) |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
# Command reference
|
|
20
168
|
|
|
21
169
|
```bash
|
|
22
|
-
# Interactive setup (
|
|
170
|
+
# Interactive setup (set password, etc.)
|
|
23
171
|
tmux-weblink setup
|
|
24
172
|
|
|
25
173
|
# Start on default port 21000
|
|
@@ -28,9 +176,6 @@ tmux-weblink
|
|
|
28
176
|
# Custom port
|
|
29
177
|
PORT=8080 tmux-weblink
|
|
30
178
|
|
|
31
|
-
# Use the default xterm.js renderer
|
|
32
|
-
tmux-weblink
|
|
33
|
-
|
|
34
179
|
# Optional: tail-first buffer loading (see docs/architecture.md)
|
|
35
180
|
TMUX_WEB_INITIAL_LINES=1000 TMUX_WEB_HISTORY_CHUNK=500 tmux-weblink
|
|
36
181
|
|
|
@@ -38,37 +183,51 @@ TMUX_WEB_INITIAL_LINES=1000 TMUX_WEB_HISTORY_CHUNK=500 tmux-weblink
|
|
|
38
183
|
tmux-weblink agent --hub wss://hub.example.com --token <agent-token> --name laptop
|
|
39
184
|
```
|
|
40
185
|
|
|
41
|
-
> **Every machine
|
|
42
|
-
> `http://localhost:21000/settings/machines
|
|
43
|
-
>
|
|
44
|
-
>
|
|
45
|
-
> `/settings/machines` page creates/revokes tokens.
|
|
186
|
+
> **Every machine runs the same command.** To join a hub without the CLI, start the
|
|
187
|
+
> server and open its own `http://localhost:21000/settings/machines`, paste the hub
|
|
188
|
+
> URL + token, and press **Save & Connect**. The hub's `/settings/machines` page
|
|
189
|
+
> creates/revokes tokens.
|
|
46
190
|
|
|
47
|
-
|
|
191
|
+
# Environment variables
|
|
48
192
|
|
|
49
|
-
|
|
193
|
+
| Variable | Default | Description |
|
|
194
|
+
| --- | --- | --- |
|
|
195
|
+
| `PORT` | `21000` | HTTP port |
|
|
196
|
+
| `TMUX_WEB_MODE` | `production` | `development` uses a dev data directory |
|
|
197
|
+
| `TMUX_WEB_INITIAL_LINES` | — | Read the last N lines first when opening a session |
|
|
198
|
+
| `TMUX_WEB_HISTORY_CHUNK` | — | History chunk size for batched loading |
|
|
199
|
+
| `TMUX_WEB_AGENT_HUB` / `TMUX_WEB_AGENT_TOKEN` / `TMUX_WEB_AGENT_NAME` | — | Agent connection parameters |
|
|
200
|
+
| `TMUX_WEB_FS_ROOTS` | — | File-browsing roots (colon-separated). Unset = Files browses the open session's working directory |
|
|
201
|
+
| `TMUX_WEB_MAX_IMAGE_UPLOAD_BYTES` | 10 MiB | Image-paste upload size cap |
|
|
50
202
|
|
|
51
|
-
|
|
52
|
-
- [Notes](docs/notes.md) — per-session Markdown scratchpad
|
|
53
|
-
- **Windows drawer** — switch tmux windows from the terminal header (mobile-friendly tab picker)
|
|
54
|
-
- [Machines / Agents](docs/agents.md) — join NAT'd machines to a public hub
|
|
55
|
-
- [Architecture](docs/architecture.md) — how the server, terminal, and sidebar connect
|
|
203
|
+
# More documentation
|
|
56
204
|
|
|
57
|
-
|
|
205
|
+
- [Documentation hub](docs/index.md) (incl. systemd service setup)
|
|
206
|
+
- [Notes](docs/notes.md)
|
|
207
|
+
- [Files API / security](docs/files.md)
|
|
208
|
+
- [Machines / Agents](docs/agents.md)
|
|
209
|
+
- [Architecture](docs/architecture.md)
|
|
210
|
+
|
|
211
|
+
# Prerequisites
|
|
58
212
|
|
|
59
213
|
- **Node.js** >= 22
|
|
60
|
-
- **tmux** installed and
|
|
61
|
-
- Writable `~/.tmux-web/` and `~/.config/tmux-web/` (see [docs](docs/index.md)
|
|
214
|
+
- **tmux** installed and in your PATH
|
|
215
|
+
- Writable `~/.tmux-web/` and `~/.config/tmux-web/` (dev-mode paths: see [docs](docs/index.md))
|
|
216
|
+
|
|
217
|
+
# Windows notes
|
|
218
|
+
|
|
219
|
+
- The server doesn't run natively well on Windows (node-pty lacks a linux-x64-style prebuild there; requires source compilation — **WSL2** is recommended)
|
|
220
|
+
- The browser client (PWA / web) works fine on Windows, against WSL2 locally or a remote hub
|
|
62
221
|
|
|
63
|
-
|
|
222
|
+
# Credits
|
|
64
223
|
|
|
65
|
-
|
|
224
|
+
Built on ideas and code from:
|
|
66
225
|
|
|
67
226
|
- [tmux-web](https://github.com/ashutoshpw/tmux-web) by [@ashutoshpw](https://github.com/ashutoshpw)
|
|
68
227
|
- [persalink](https://github.com/brobata/persalink) by [@brobata](https://github.com/brobata)
|
|
69
228
|
|
|
70
|
-
|
|
229
|
+
A continuation and re-packaging of those experiments, focused on a single-user, browser-first tmux companion that's easy to install and run.
|
|
71
230
|
|
|
72
|
-
|
|
231
|
+
# License
|
|
73
232
|
|
|
74
233
|
MIT
|
package/README.zh-CN.md
CHANGED
|
@@ -2,37 +2,174 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | **中文**
|
|
4
4
|
|
|
5
|
-
在浏览器里访问你的 tmux 会话。一个轻量级 Web 服务器:列出正在运行的 tmux
|
|
5
|
+
在浏览器里访问你的 tmux 会话。一个轻量级 Web 服务器:列出正在运行的 tmux 会话,并让你通过浏览器里的完整终端接入——内置笔记与文件浏览,移动端与桌面端都能用。
|
|
6
6
|
|
|
7
7
|
## 特性
|
|
8
8
|
|
|
9
9
|
- **完整终端**:xterm.js 渲染,支持 256 色、复制粘贴、粘贴图片到 CLI 工具
|
|
10
|
-
-
|
|
10
|
+
- **触摸优化**:移动端惯性回看历史、左半屏点按翻页、拖选自动复制、虚拟键盘工具栏
|
|
11
11
|
- **PWA**:手机"添加到主屏幕"、桌面浏览器"安装应用"即为独立窗口应用
|
|
12
12
|
- **侧边栏会话分组**:按工作目录自动聚类(显示文件夹名),可折叠
|
|
13
|
-
- **New Session
|
|
14
|
-
- **笔记(Notes)**:每个会话独立的 Markdown
|
|
15
|
-
- **文件浏览/编辑(Files
|
|
13
|
+
- **New Session 目录树选择器**:层层展开目录树,直接定位到当前会话所在路径(含隐藏目录)
|
|
14
|
+
- **笔记(Notes)**:每个会话独立的 Markdown 便签,自动保存
|
|
15
|
+
- **文件浏览/编辑(Files)**:浏览、编辑本地文件与 git 状态
|
|
16
16
|
- **Machines 联邦**:把 NAT 后的机器加入公共 hub(hub 无需开放端口),多机终端矩阵
|
|
17
|
-
-
|
|
18
|
-
- **安全**:scrypt 哈希 token 认证、登录限流、审计日志
|
|
17
|
+
- **安全**:scrypt 哈希密码认证、登录限流、审计日志
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# 使用教程(手把手)
|
|
22
|
+
|
|
23
|
+
## 1. 安装与启动
|
|
21
24
|
|
|
22
25
|
```bash
|
|
23
26
|
npm install -g tmux-weblink
|
|
27
|
+
|
|
28
|
+
# 启动(默认端口 21000)
|
|
29
|
+
tmux-weblink
|
|
24
30
|
```
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
打开浏览器访问 **http://localhost:21000**。
|
|
27
33
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
## 2. 第一次使用:设置密码并登录
|
|
35
|
+
|
|
36
|
+
第一次访问会看到 **"Set your password"(设置密码)** 页面(要求至少 8 位)。设置后密码以 scrypt 哈希保存在本机,以后每次打开都输入同一个密码即可。
|
|
37
|
+
|
|
38
|
+
> 也可以用命令行初始化:`tmux-weblink setup`
|
|
39
|
+
|
|
40
|
+
## 3. 界面一览
|
|
41
|
+
|
|
42
|
+
登录后主界面分三块:
|
|
43
|
+
|
|
44
|
+
- **左侧边栏(Sessions 模式,默认)**:
|
|
45
|
+
- 顶部 **`+ New Session`** 按钮——创建新 tmux 会话
|
|
46
|
+
- 下方会话列表,**按工作目录自动分组**(每组一个文件夹标题,可点击折叠)。同目录的多个会话堆在一起,一眼看到"我在哪个项目里开了什么"
|
|
47
|
+
- 每个会话前面的小圆点显示活动状态:**绿色 = 空闲(idle),橘黄 = 正在干活(working)**(后台自动探测,无需配置)
|
|
48
|
+
- 若 session 在 tmux 里被杀掉,会出现在 **"失效会话"** 分组(灰显,见 §9)
|
|
49
|
+
- **底部三个模式按钮**:`Sessions`(会话)/ `Files`(文件)/ `Settings`(设置)
|
|
50
|
+
- **右侧主区**:点击会话前的占位提示;接入终端后显示完整终端
|
|
51
|
+
|
|
52
|
+
## 4. 接入终端 & 每天的操作
|
|
53
|
+
|
|
54
|
+
### 打开一个会话
|
|
55
|
+
|
|
56
|
+
直接**点击侧边栏里的会话**即可接入(通过 `tmux attach` 接入真实会话,不是模拟)。接入后侧边栏自动收起,终端占满屏幕。
|
|
57
|
+
|
|
58
|
+
- 需要切换会话时,点左上角 **tmux-weblink** 标志展开侧边栏,再点另一个会话
|
|
59
|
+
- 会话是真实 attach:你在 tmux 里开的窗口/面板,以及**别的终端**(如 tmux 原始终端)看到的内容完全同步
|
|
60
|
+
|
|
61
|
+
### 复制与粘贴
|
|
62
|
+
|
|
63
|
+
| 操作 | 方法 |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| 复制终端里的文本 | 用鼠标**拖选**,松手即自动复制(桌面 & 移动端通用);或先 `Shift` 再拖选 |
|
|
66
|
+
| 粘贴到终端 | 焦点在终端里直接 `Ctrl+V`(Mac 为 `Cmd+V`)——页面接管:文本 = 直接输入,图片 = 自动上传(首次需放行剪贴板权限) |
|
|
67
|
+
| 粘贴**图片**(≥2.2.24) | 复制一张图片(截图/剪贴板图片),在终端里 `Ctrl+V` 粘贴 → 图片自动上传到本机 `~/.tmux-web/uploads/`,并把**文件路径输入到终端**。终端是文本协议,粘贴图片 = 得到路径,可在 shell 里 `cat` / `vim` 查看 |
|
|
68
|
+
|
|
69
|
+
> 在 agent 会话(Machines)里粘贴图片,文件会传到 **agent 那台机器**上,路径对那台机器有效。
|
|
70
|
+
|
|
71
|
+
### 触摸屏(手机 / 平板)
|
|
72
|
+
|
|
73
|
+
终端区域分左右两区,**左手拇指方便操作的左 40% 是翻页区**:
|
|
74
|
+
|
|
75
|
+
- **左 40%**(按手指落点分上下两半)是翻页区:
|
|
76
|
+
- 点/滑 **上半区** = 上翻一页(PgUp,vim 友好)
|
|
77
|
+
- 点/滑 **下半区** = 下翻一页(PgDn)
|
|
78
|
+
- 会弹出半透明提示(↑/↓),不弹软键盘;要输入时点击终端主体即可
|
|
79
|
+
- **右 60%**:上下拖动**回看终端历史**(带惯性),像普通手机页面一样往回翻
|
|
80
|
+
|
|
81
|
+
### 虚拟键盘工具栏(移动端)
|
|
82
|
+
|
|
83
|
+
点击屏幕下方输入条弹出工具栏:`ESC` / `Tab` / `Shift+Tab` / 方向键等软键盘没有的键。
|
|
84
|
+
|
|
85
|
+
### 在终端头部切换 tmux 窗口
|
|
86
|
+
|
|
87
|
+
多窗口会话顶部有 **窗口抽屉**(移动端友好的标签选择器),点击即切换到对应 tmux 窗口,不用记 `Ctrl+B n` 之类的快捷键。
|
|
88
|
+
|
|
89
|
+
### 快速命令 Quick Commands
|
|
90
|
+
|
|
91
|
+
打开 **`/quick-commands`** 页面:把常用命令存成卡片(标题 + 命令 + 可指定在哪个 session 执行),点一下即执行。适合"重启服务"、"跑测试"这类天天要敲的命令。
|
|
92
|
+
|
|
93
|
+
## 5. 创建新会话(New Session)
|
|
94
|
+
|
|
95
|
+
侧边栏点 **`+ New Session`**,弹窗里:
|
|
96
|
+
|
|
97
|
+
1. **Session name**:会话名(字母数字,如 `myproject`)
|
|
98
|
+
2. **Start directory**:起始目录,两种填法:
|
|
99
|
+
- 直接输入路径,下面会**实时补全匹配**(输入 `~/.cl` 会补全出 `~/.claude`)
|
|
100
|
+
- 点目录树按钮(📁)弹出**目录树**,层层展开选择;树会自动展开到当前会话所在目录,**隐藏目录(`.claude`、`.config` 等)也可见**(≥2.2.25,排在普通目录后面)
|
|
101
|
+
3. 点 **Create**:创建并自动接入
|
|
102
|
+
|
|
103
|
+
> 不会用目录树也没关系:留空 = 在 home 目录创建,之后在会话里 `cd` 即可。
|
|
31
104
|
|
|
32
|
-
##
|
|
105
|
+
## 6. 笔记 Notes & 文件 Files
|
|
106
|
+
|
|
107
|
+
### Notes(每个会话一块便签)
|
|
108
|
+
|
|
109
|
+
会话头部点**记事本图标**,打开该会话的 Markdown 便签,**边写边自动保存**到 `~/.tmux-web/db.json`。下次再打开这个会话,便签还在。想用大编辑区/导出,打开 `/notes/<session名>` 或全局便签 `/notes/__global__`。
|
|
110
|
+
|
|
111
|
+
### Files(文件浏览/编辑 + git)
|
|
112
|
+
|
|
113
|
+
点底部 **Files** 模式:
|
|
114
|
+
|
|
115
|
+
- **默认**(未配置时):打开会话后切到 Files,直接浏览**当前会话的工作目录**
|
|
116
|
+
- **配置后**(`TMUX_WEB_FS_ROOTS=/path1:/path2`):显示多个根目录入口
|
|
117
|
+
- 点文件夹逐层进入,点文件在右侧打开编辑器直接改,**Save** 保存;`..` 回上级
|
|
118
|
+
- 目录里有 git 仓库时显示**分支名**,文件旁标注改动状态;顶部/侧栏可看 **git diff**
|
|
119
|
+
- 新建文件:底部输入文件名 + **New File**
|
|
120
|
+
|
|
121
|
+
安全限制:路径必须落在配置的根目录内(默认单文件 ≤1 MiB),`../../../etc/passwd` 这类越界会被拒绝。
|
|
122
|
+
|
|
123
|
+
## 7. 多机使用 Machines(把 NAT 后的机器接进来)
|
|
124
|
+
|
|
125
|
+
一台 **hub**(有公网 IP 或至少你能访问它)+ 任意台**被 NAT 挡住的机器**。所有机器装的是同一个包、跑的是同一条命令,只是角色不同:
|
|
126
|
+
|
|
127
|
+
1. **hub 上**:打开 `http://<hub>:21000/settings/machines`,点创建 agent token,复制(一次性的,关页就看不到)
|
|
128
|
+
2. **远端机器**(如家里/公司内网的电脑):安装好并启动后,打开**它本机**的 `http://localhost:21000/settings/machines`,粘贴 hub 地址 + token,点 **Save & Connect**
|
|
129
|
+
3. 回到 **hub 的浏览器页面**:侧边栏出现该机器的分组(显示机器名),点里面的会话就像操作本机会话一样——输入、触摸、图片粘贴全部走加密隧道
|
|
130
|
+
|
|
131
|
+
要点:
|
|
132
|
+
|
|
133
|
+
- agent 客户端与普通服务器**同进程**运行,远端机器不需要开放任何端口
|
|
134
|
+
- **hub 升级新版后,远端 agent 也要升级到对应版本**(agent 端逻辑随版本变化)
|
|
135
|
+
- 浏览器端改版后记得**硬刷新**(见 §10)
|
|
136
|
+
|
|
137
|
+
## 8. 在 tmux 里关掉的会话(失效会话/墓碑)
|
|
138
|
+
|
|
139
|
+
在 tmux 里 `kill-session` 或关闭了某个会话后,列表不会立刻把它扔掉,而是移到 **"失效会话"** 分组灰显(保留你记得住的位置)。
|
|
140
|
+
|
|
141
|
+
点它弹出操作面板:
|
|
142
|
+
|
|
143
|
+
- **重建同名同路径 session**:在原工作目录把会话原样拉起来(最常用)
|
|
144
|
+
- **重命名(仅记录)**:只改记录不改 tmux
|
|
145
|
+
- **删除失效记录(墓碑消失)**:彻底忘掉它
|
|
146
|
+
|
|
147
|
+
## 9. 手机 / 桌面安装成独立应用
|
|
148
|
+
|
|
149
|
+
- **iOS**:Safari 分享 → **添加到主屏幕**,全屏独立运行
|
|
150
|
+
- **Android / Chrome**:菜单 → **添加到主屏幕** / **安装应用**
|
|
151
|
+
- **桌面**(Linux/Windows/macOS 浏览器):Chrome/Edge/Chromium 地址栏右侧点**安装**图标,变成独立窗口应用
|
|
152
|
+
- 注意:内网 HTTP IP 不会出现安装提示(浏览器要求 secure context);本机 `localhost` 或 HTTPS 都可以
|
|
153
|
+
|
|
154
|
+
## 10. 常见问题 Troubleshooting
|
|
155
|
+
|
|
156
|
+
| 现象 | 解决办法 |
|
|
157
|
+
| --- | --- |
|
|
158
|
+
| 页面功能没更新(缺新按钮/触摸手势不对) | **硬刷新**:`Ctrl+Shift+R`(Mac `Cmd+Shift+R`)。前端 JS 是服务端启动时下发的,服务端升级后**已打开的页面不会自动更新** |
|
|
159
|
+
| 升级后 agent 会话仍旧行为 | 升级 **hub** 后记得升级远端机器上的 agent 到新版本 |
|
|
160
|
+
| 粘贴图片没反应 | 需要 ≥2.2.24;确认终端里 `Ctrl+V`(浏览器剪贴板权限要放行一次) |
|
|
161
|
+
| 目录树里看不到 `.claude` 等隐藏目录 | 需要 ≥2.2.25(隐藏目录排在列表末尾) |
|
|
162
|
+
| 端口被占 | `PORT=8080 tmux-weblink` 换端口 |
|
|
163
|
+
| 忘了密码 | 本机重跑 `tmux-weblink setup` 重置 |
|
|
164
|
+
| 用 systemd 托管 | 配置文件必须带 `KillMode=process`(否则重启服务会连坐杀掉 tmux server,见 [docs/index.md](docs/index.md)) |
|
|
165
|
+
| Windows 上服务端起不来 | 服务端推荐在 **WSL2** 里运行;Windows 浏览器作为客户端完全正常(接 WSL2 或远程 hub) |
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
# 命令速查
|
|
33
170
|
|
|
34
171
|
```bash
|
|
35
|
-
#
|
|
172
|
+
# 交互式初始化(设置密码等)
|
|
36
173
|
tmux-weblink setup
|
|
37
174
|
|
|
38
175
|
# 默认端口 21000 启动
|
|
@@ -48,35 +185,11 @@ TMUX_WEB_INITIAL_LINES=1000 TMUX_WEB_HISTORY_CHUNK=500 tmux-weblink
|
|
|
48
185
|
tmux-weblink agent --hub wss://hub.example.com --token <agent-token> --name laptop
|
|
49
186
|
```
|
|
50
187
|
|
|
51
|
-
> **每台机器都用同一条启动命令。** 加入 hub
|
|
52
|
-
> `http://localhost:21000/settings/machines
|
|
53
|
-
>
|
|
54
|
-
> `/settings/machines` 页面负责创建/吊销 token。
|
|
55
|
-
|
|
56
|
-
然后浏览器打开 `http://localhost:21000`,你会看到活跃的 tmux 会话列表——点击即可接入。
|
|
57
|
-
|
|
58
|
-
## 手机端 / PWA
|
|
59
|
-
|
|
60
|
-
- **iOS**:Safari 分享 → "添加到主屏幕",全屏独立运行
|
|
61
|
-
- **Android / Chrome**:菜单 → "添加到主屏幕" / "安装应用"
|
|
62
|
-
- 支持软键盘自动适配、触摸惯性滚动、拖选复制
|
|
188
|
+
> **每台机器都用同一条启动命令。** 加入 hub 也可不开命令行:机器启动后到本机
|
|
189
|
+
> `http://localhost:21000/settings/machines` 粘贴 hub 地址 + token,点 **Save & Connect**。
|
|
190
|
+
> hub 自己的 `/settings/machines` 负责创建/吊销 token。
|
|
63
191
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
桌面浏览器(Chrome / Edge / Chromium)地址栏右侧点"安装"图标即可生成**独立窗口应用**:
|
|
67
|
-
|
|
68
|
-
- 本机 `http://localhost:端口` 或 HTTPS 均可;内网 HTTP IP 不会出现安装提示(非 secure context)
|
|
69
|
-
- Windows 上服务端原生运行受限(node-pty 需 WSL2),可用 WSL2 或接入远程 hub 使用
|
|
70
|
-
|
|
71
|
-
## 文档
|
|
72
|
-
|
|
73
|
-
- [文档中心](docs/index.md)
|
|
74
|
-
- [笔记](docs/notes.md) — 每个会话独立的 Markdown 便签
|
|
75
|
-
- [文件](docs/files.md) — 浏览/编辑本地文件
|
|
76
|
-
- [Machines / Agents](docs/agents.md) — 把 NAT 机器接入公共 hub
|
|
77
|
-
- [架构](docs/architecture.md) — 服务器、终端、侧边栏如何协作
|
|
78
|
-
|
|
79
|
-
## 环境变量(常用)
|
|
192
|
+
# 环境变量(常用)
|
|
80
193
|
|
|
81
194
|
| 变量 | 默认 | 说明 |
|
|
82
195
|
| --- | --- | --- |
|
|
@@ -85,20 +198,29 @@ tmux-weblink agent --hub wss://hub.example.com --token <agent-token> --name lapt
|
|
|
85
198
|
| `TMUX_WEB_INITIAL_LINES` | — | 打开会话时先读尾部 N 行 |
|
|
86
199
|
| `TMUX_WEB_HISTORY_CHUNK` | — | 历史分批加载的块大小 |
|
|
87
200
|
| `TMUX_WEB_AGENT_HUB` / `TMUX_WEB_AGENT_TOKEN` / `TMUX_WEB_AGENT_NAME` | — | agent 连接参数 |
|
|
88
|
-
| `
|
|
201
|
+
| `TMUX_WEB_FS_ROOTS` | — | 文件浏览根目录(冒号分隔)。不设时 Files 模式浏览当前会话的工作目录 |
|
|
202
|
+
| `TMUX_WEB_MAX_IMAGE_UPLOAD_BYTES` | 10 MiB | 图片粘贴上传大小上限 |
|
|
203
|
+
|
|
204
|
+
# 更多文档
|
|
205
|
+
|
|
206
|
+
- [文档中心](docs/index.md)(含 systemd 服务配置)
|
|
207
|
+
- [笔记](docs/notes.md)
|
|
208
|
+
- [文件 API / 安全](docs/files.md)
|
|
209
|
+
- [Machines / Agents](docs/agents.md)
|
|
210
|
+
- [架构](docs/architecture.md)
|
|
89
211
|
|
|
90
|
-
|
|
212
|
+
# 前提条件
|
|
91
213
|
|
|
92
214
|
- **Node.js** >= 22
|
|
93
215
|
- **tmux** 已安装且在 PATH 中
|
|
94
216
|
- 可写的 `~/.tmux-web/` 和 `~/.config/tmux-web/`(dev 模式路径见 [docs](docs/index.md))
|
|
95
217
|
|
|
96
|
-
|
|
218
|
+
# Windows 说明
|
|
97
219
|
|
|
98
220
|
- 服务端在 Windows 上原生运行受限(node-pty 在 Windows 无 linux-x64 类 prebuild,需源码编译;推荐 **WSL2** 内运行服务)
|
|
99
221
|
- 浏览器客户端(PWA / 网页)在 Windows 上完全正常,可接入本机 WSL2 或远程 hub 的会话
|
|
100
222
|
|
|
101
|
-
|
|
223
|
+
# 致谢
|
|
102
224
|
|
|
103
225
|
本项目建立在以下项目的想法和代码之上:
|
|
104
226
|
|
|
@@ -107,6 +229,6 @@ tmux-weblink agent --hub wss://hub.example.com --token <agent-token> --name lapt
|
|
|
107
229
|
|
|
108
230
|
它是这些实验的延续与重新打包,目标是做一个单用户、浏览器优先、易于安装运行的 tmux 伴侣。
|
|
109
231
|
|
|
110
|
-
|
|
232
|
+
# 许可证
|
|
111
233
|
|
|
112
234
|
MIT
|