@ystemsrx/cfshare 0.1.3 → 0.1.5
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 +339 -336
- package/README.zh.md +339 -336
- package/dist/src/cli.js +12 -7
- package/package.json +1 -1
- package/src/cli.ts +14 -7
package/README.md
CHANGED
|
@@ -1,168 +1,168 @@
|
|
|
1
|
-
<h1 align="center">☁️ CFShare</h1>
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
Securely share local files and services to the public internet via Cloudflare Tunnel
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
<p align="center">
|
|
8
|
-
<img src="https://img.shields.io/badge/Platform-macOS_|_Linux_|_Windows_(WSL2)-9cf?style=flat-square" alt="Platform">
|
|
9
|
-
<img src="https://img.shields.io/badge/Node-≥22-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node">
|
|
10
|
-
<img src="https://img.shields.io/badge/OpenClaw-≥2026.1.29-E86D37?style=flat-square" alt="OpenClaw">
|
|
11
|
-
<img src="https://img.shields.io/badge/License-MIT-97CA00?style=flat-square" alt="MIT">
|
|
12
|
-
</p>
|
|
13
|
-
|
|
14
|
-
<p align="center">
|
|
15
|
-
<a href="./README.zh.md">简体中文</a>
|
|
16
|
-
|
|
|
17
|
-
<strong>English</strong>
|
|
18
|
-
</p>
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## 📖 What Is This?
|
|
23
|
-
|
|
24
|
-
**CFShare** is a community plugin for [OpenClaw](https://github.com/openclaw/openclaw) that enables your AI assistant to:
|
|
25
|
-
|
|
26
|
-
- 🔗 **Expose a local port** as a temporary public HTTPS link (`https://*.trycloudflare.com`) with one command
|
|
27
|
-
- 📁 **Share files/directories** — automatically spins up a local static server + tunnel so recipients can browse/download/preview via a link (encryption supported)
|
|
28
|
-
- 🔒 **Built-in security** — Token/Basic auth, rate limiting, port blacklist, exclusion rules
|
|
29
|
-
- ⏱️ **Auto-expiry cleanup** — tunnels are automatically closed and temp files deleted when the TTL expires
|
|
30
|
-
|
|
31
|
-
> [!NOTE]
|
|
32
|
-
> **No Cloudflare account required.** CFShare uses [Cloudflare Quick Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/) (`trycloudflare.com`), which is completely free and works out of the box.
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## 🏗️ How It Works
|
|
37
|
-
|
|
38
|
-
```mermaid
|
|
39
|
-
flowchart LR
|
|
40
|
-
subgraph LOCAL["Your Machine"]
|
|
41
|
-
A["Local Service / Files"]
|
|
42
|
-
B["[Optional] Reverse Proxy<br/>(Auth + Rate Limit)"]
|
|
43
|
-
C["cloudflared tunnel"]
|
|
44
|
-
|
|
45
|
-
A --> B
|
|
46
|
-
B --> C
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
C ==>|Cloudflare Quick Tunnel| D["https://xxx.trycloudflare.com"]
|
|
50
|
-
E["Recipient's Browser"] --> D
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Internally, CFShare handles: path validation → copy files to a temp directory → start a read-only static server → mount auth/rate-limit reverse proxy → launch `cloudflared` tunnel → schedule expiry cleanup. All you need to do is tell the AI "what you want to share" and it takes care of the rest.
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## 🚀 Installation
|
|
58
|
-
|
|
59
|
-
### Step 1: Make Sure OpenClaw Is Installed
|
|
60
|
-
|
|
61
|
-
If you haven't installed OpenClaw yet, do so first:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
# Install OpenClaw (requires Node.js ≥ 22)
|
|
65
|
-
npm install -g openclaw@latest
|
|
66
|
-
|
|
67
|
-
# Run the onboarding wizard
|
|
68
|
-
openclaw onboard --install-daemon
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
> [!TIP]
|
|
72
|
-
> Not sure about your Node.js version? Run `node -v` to check. [nvm](https://github.com/nvm-sh/nvm) is recommended for managing versions.
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
### Step 2: Install `cloudflared`
|
|
77
|
-
|
|
78
|
-
CFShare relies on Cloudflare's `cloudflared` CLI to create tunnels.
|
|
79
|
-
|
|
80
|
-
<details>
|
|
81
|
-
<summary><b>🍎 macOS</b></summary>
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
brew install cloudflare/cloudflare/cloudflared
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
</details>
|
|
88
|
-
|
|
89
|
-
<details>
|
|
90
|
-
<summary><b>🐧 Linux (Debian / Ubuntu)</b></summary>
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null
|
|
94
|
-
echo "deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflared.list
|
|
95
|
-
sudo apt-get update && sudo apt-get install cloudflared
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
</details>
|
|
99
|
-
|
|
100
|
-
<details>
|
|
101
|
-
<summary><b>🪟 Windows (inside WSL2)</b></summary>
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
# Inside WSL2:
|
|
105
|
-
curl -fsSL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o /usr/local/bin/cloudflared
|
|
106
|
-
chmod +x /usr/local/bin/cloudflared
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Or install natively via PowerShell / CMD with winget:
|
|
110
|
-
|
|
111
|
-
```powershell
|
|
112
|
-
winget install --id Cloudflare.cloudflared
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
</details>
|
|
116
|
-
|
|
117
|
-
**Or simply ask the Agent to install it for you.**
|
|
118
|
-
|
|
119
|
-
Verify the installation:
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
cloudflared --version
|
|
123
|
-
# Output should be similar to: cloudflared version 2025.x.x
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
> [!IMPORTANT]
|
|
127
|
-
> You only need to install `cloudflared` — there is **no need** to run `cloudflared tunnel login`. Quick Tunnel requires no account authentication.
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
### Step 3: Install the CFShare Plugin
|
|
132
|
-
|
|
133
|
-
**Option A — Install from npm (recommended):**
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
openclaw plugins install @ystemsrx/cfshare
|
|
137
|
-
# After installation, restart the Gateway:
|
|
138
|
-
openclaw gateway restart
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Option B — Install from a local directory (for development):**
|
|
142
|
-
|
|
143
|
-
If you've already cloned the repository:
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
# Install dependencies first
|
|
147
|
-
cd /path/to/cfshare
|
|
148
|
-
npm install
|
|
149
|
-
|
|
150
|
-
# Link to OpenClaw (dev mode, no file copying)
|
|
151
|
-
openclaw plugins install -l .
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
---
|
|
155
|
-
|
|
156
|
-
### Step 4: Enable the Plugin and Restart the Gateway
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
# Enable the plugin
|
|
160
|
-
openclaw plugins enable cfshare
|
|
161
|
-
|
|
162
|
-
# Restart the Gateway to load the plugin
|
|
163
|
-
openclaw gateway restart
|
|
164
|
-
```
|
|
165
|
-
|
|
1
|
+
<h1 align="center">☁️ CFShare</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
Securely share local files and services to the public internet via Cloudflare Tunnel
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="https://img.shields.io/badge/Platform-macOS_|_Linux_|_Windows_(WSL2)-9cf?style=flat-square" alt="Platform">
|
|
9
|
+
<img src="https://img.shields.io/badge/Node-≥22-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node">
|
|
10
|
+
<img src="https://img.shields.io/badge/OpenClaw-≥2026.1.29-E86D37?style=flat-square" alt="OpenClaw">
|
|
11
|
+
<img src="https://img.shields.io/badge/License-MIT-97CA00?style=flat-square" alt="MIT">
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="./README.zh.md">简体中文</a>
|
|
16
|
+
|
|
|
17
|
+
<strong>English</strong>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 📖 What Is This?
|
|
23
|
+
|
|
24
|
+
**CFShare** is a community plugin for [OpenClaw](https://github.com/openclaw/openclaw) that enables your AI assistant to:
|
|
25
|
+
|
|
26
|
+
- 🔗 **Expose a local port** as a temporary public HTTPS link (`https://*.trycloudflare.com`) with one command
|
|
27
|
+
- 📁 **Share files/directories** — automatically spins up a local static server + tunnel so recipients can browse/download/preview via a link (encryption supported)
|
|
28
|
+
- 🔒 **Built-in security** — Token/Basic auth, rate limiting, port blacklist, exclusion rules
|
|
29
|
+
- ⏱️ **Auto-expiry cleanup** — tunnels are automatically closed and temp files deleted when the TTL expires
|
|
30
|
+
|
|
31
|
+
> [!NOTE]
|
|
32
|
+
> **No Cloudflare account required.** CFShare uses [Cloudflare Quick Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/) (`trycloudflare.com`), which is completely free and works out of the box.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 🏗️ How It Works
|
|
37
|
+
|
|
38
|
+
```mermaid
|
|
39
|
+
flowchart LR
|
|
40
|
+
subgraph LOCAL["Your Machine"]
|
|
41
|
+
A["Local Service / Files"]
|
|
42
|
+
B["[Optional] Reverse Proxy<br/>(Auth + Rate Limit)"]
|
|
43
|
+
C["cloudflared tunnel"]
|
|
44
|
+
|
|
45
|
+
A --> B
|
|
46
|
+
B --> C
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
C ==>|Cloudflare Quick Tunnel| D["https://xxx.trycloudflare.com"]
|
|
50
|
+
E["Recipient's Browser"] --> D
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Internally, CFShare handles: path validation → copy files to a temp directory → start a read-only static server → mount auth/rate-limit reverse proxy → launch `cloudflared` tunnel → schedule expiry cleanup. All you need to do is tell the AI "what you want to share" and it takes care of the rest.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 🚀 Installation
|
|
58
|
+
|
|
59
|
+
### Step 1: Make Sure OpenClaw Is Installed
|
|
60
|
+
|
|
61
|
+
If you haven't installed OpenClaw yet, do so first:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Install OpenClaw (requires Node.js ≥ 22)
|
|
65
|
+
npm install -g openclaw@latest
|
|
66
|
+
|
|
67
|
+
# Run the onboarding wizard
|
|
68
|
+
openclaw onboard --install-daemon
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
> [!TIP]
|
|
72
|
+
> Not sure about your Node.js version? Run `node -v` to check. [nvm](https://github.com/nvm-sh/nvm) is recommended for managing versions.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### Step 2: Install `cloudflared`
|
|
77
|
+
|
|
78
|
+
CFShare relies on Cloudflare's `cloudflared` CLI to create tunnels.
|
|
79
|
+
|
|
80
|
+
<details>
|
|
81
|
+
<summary><b>🍎 macOS</b></summary>
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
brew install cloudflare/cloudflare/cloudflared
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
</details>
|
|
88
|
+
|
|
89
|
+
<details>
|
|
90
|
+
<summary><b>🐧 Linux (Debian / Ubuntu)</b></summary>
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null
|
|
94
|
+
echo "deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflared.list
|
|
95
|
+
sudo apt-get update && sudo apt-get install cloudflared
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
</details>
|
|
99
|
+
|
|
100
|
+
<details>
|
|
101
|
+
<summary><b>🪟 Windows (inside WSL2)</b></summary>
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Inside WSL2:
|
|
105
|
+
curl -fsSL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o /usr/local/bin/cloudflared
|
|
106
|
+
chmod +x /usr/local/bin/cloudflared
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Or install natively via PowerShell / CMD with winget:
|
|
110
|
+
|
|
111
|
+
```powershell
|
|
112
|
+
winget install --id Cloudflare.cloudflared
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
</details>
|
|
116
|
+
|
|
117
|
+
**Or simply ask the Agent to install it for you.**
|
|
118
|
+
|
|
119
|
+
Verify the installation:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
cloudflared --version
|
|
123
|
+
# Output should be similar to: cloudflared version 2025.x.x
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
> [!IMPORTANT]
|
|
127
|
+
> You only need to install `cloudflared` — there is **no need** to run `cloudflared tunnel login`. Quick Tunnel requires no account authentication.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### Step 3: Install the CFShare Plugin
|
|
132
|
+
|
|
133
|
+
**Option A — Install from npm (recommended):**
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
openclaw plugins install @ystemsrx/cfshare
|
|
137
|
+
# After installation, restart the Gateway:
|
|
138
|
+
openclaw gateway restart
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Option B — Install from a local directory (for development):**
|
|
142
|
+
|
|
143
|
+
If you've already cloned the repository:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Install dependencies first
|
|
147
|
+
cd /path/to/cfshare
|
|
148
|
+
npm install
|
|
149
|
+
|
|
150
|
+
# Link to OpenClaw (dev mode, no file copying)
|
|
151
|
+
openclaw plugins install -l .
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### Step 4: Enable the Plugin and Restart the Gateway
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Enable the plugin
|
|
160
|
+
openclaw plugins enable cfshare
|
|
161
|
+
|
|
162
|
+
# Restart the Gateway to load the plugin
|
|
163
|
+
openclaw gateway restart
|
|
164
|
+
```
|
|
165
|
+
|
|
166
166
|
> [!NOTE]
|
|
167
167
|
> If you're running in daemon mode (`--install-daemon`), you can also restart via `openclaw restart`.
|
|
168
168
|
|
|
@@ -180,7 +180,7 @@ cfshare env_check
|
|
|
180
180
|
Common examples:
|
|
181
181
|
|
|
182
182
|
```bash
|
|
183
|
-
# Expose an existing local service
|
|
183
|
+
# Expose an existing local service
|
|
184
184
|
cfshare expose_port '{"port":3000,"opts":{"access":"token"}}'
|
|
185
185
|
|
|
186
186
|
# Share files/directories
|
|
@@ -190,177 +190,180 @@ cfshare expose_files '{"paths":["./dist"],"opts":{"access":"none"}}'
|
|
|
190
190
|
cfshare exposure_stop '{"id":"all"}'
|
|
191
191
|
```
|
|
192
192
|
|
|
193
|
-
`expose_port` and `expose_files`
|
|
194
|
-
Use `--
|
|
193
|
+
`expose_port` and `expose_files` print the result and exit by default.
|
|
194
|
+
Use `--keep-alive` if you want foreground lifecycle control (`Ctrl+C` to stop).
|
|
195
|
+
|
|
196
|
+
When running as CLI, CFShare uses `~/.cfshare` by default for state, workspaces, policy, and audit files.
|
|
197
|
+
This is isolated from plugin mode (`~/.openclaw/cfshare`) so both can coexist safely.
|
|
195
198
|
|
|
196
199
|
---
|
|
197
200
|
|
|
198
201
|
## ⚙️ Configuration (Optional)
|
|
199
|
-
|
|
200
|
-
CFShare works out of the box. The defaults below suit most use cases. To customize, edit `~/.openclaw/openclaw.json`:
|
|
201
|
-
|
|
202
|
-
```json5
|
|
203
|
-
{
|
|
204
|
-
plugins: {
|
|
205
|
-
entries: {
|
|
206
|
-
cfshare: {
|
|
207
|
-
enabled: true,
|
|
208
|
-
config: {
|
|
209
|
-
// Custom configuration (all fields are optional)
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
}
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Configuration Reference
|
|
218
|
-
|
|
219
|
-
| Option | Default | Description |
|
|
220
|
-
| :------------------------- | :-------------------- | :--------------------------------------- |
|
|
221
|
-
| `cloudflaredPath` | `"cloudflared"` | Path or command name for `cloudflared` |
|
|
222
|
-
| `stateDir` | `~/.openclaw/cfshare` | Directory for state file storage |
|
|
223
|
-
| `defaultTtlSeconds` | `3600` (1 hour) | Default tunnel time-to-live |
|
|
224
|
-
| `maxTtlSeconds` | `86400` (24 hours) | Maximum TTL cap |
|
|
225
|
-
| `defaultExposePortAccess` | `"token"` | Default auth mode for port exposure |
|
|
226
|
-
| `defaultExposeFilesAccess` | `"none"` | Default auth mode for file sharing |
|
|
227
|
-
| `blockedPorts` | `[22, 2375, 2376]` | Ports blocked from exposure (SSH/Docker) |
|
|
228
|
-
| `rateLimit.enabled` | `true` | Whether rate limiting is enabled |
|
|
229
|
-
| `rateLimit.maxRequests` | `240` | Max requests per window |
|
|
230
|
-
| `rateLimit.windowMs` | `60000` (1 minute) | Rate limit window in milliseconds |
|
|
231
|
-
|
|
232
|
-
> [!TIP]
|
|
233
|
-
> **Auth mode reference:**
|
|
234
|
-
>
|
|
235
|
-
> - `"token"` — A token is required to access the link (suitable for port exposure)
|
|
236
|
-
> - `"basic"` — HTTP Basic authentication (username/password)
|
|
237
|
-
> - `"none"` — No authentication, anyone can access (suitable for temporary file sharing)
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
|
|
241
|
-
## 💬 Usage Examples
|
|
242
|
-
|
|
243
|
-
Once installed, just speak naturally to your AI assistant — it will automatically invoke the appropriate CFShare tools:
|
|
244
|
-
|
|
245
|
-
### Get AI-Processed Files
|
|
246
|
-
|
|
247
|
-
> _"Rename all files under `/mnt/data/students/` to `{index}_{name}.{ext}` format, then bundle them up and give me a download link."_
|
|
248
|
-
|
|
249
|
-
The Agent will automatically call `expose_files` and return a public link along with its expiration time.
|
|
250
|
-
|
|
251
|
-
### Share Your Creations
|
|
252
|
-
|
|
253
|
-
> _"Build a 3D interactive solar system model with Vue 3 + Vite, then share it with my friend via a link."_
|
|
254
|
-
|
|
255
|
-
> _"Run this project for me and send me the link to access it."_
|
|
256
|
-
|
|
257
|
-
The Agent will create and run the project, then use `expose_port` to create a tunnel so anyone can access it through a link.
|
|
258
|
-
|
|
259
|
-
### Share a Directory (with File Browser) — preview images/videos/text in-browser, or download (encryption supported)
|
|
260
|
-
|
|
261
|
-
> _"Share the directory `~/Pictures/vacation` with encryption."_
|
|
262
|
-
|
|
263
|
-
The Agent will use `expose_files` in `preview` mode to create a share page with a file browser. A valid token is required to access it.
|
|
264
|
-
|
|
265
|
-
### View Active Shares
|
|
266
|
-
|
|
267
|
-
> _"What links do I have active right now?"_
|
|
268
|
-
|
|
269
|
-
### Stop Sharing
|
|
270
|
-
|
|
271
|
-
> _"Shut down all active share links."_
|
|
272
|
-
|
|
273
|
-
---
|
|
274
|
-
|
|
275
|
-
## 🧰 Tool Overview
|
|
276
|
-
|
|
277
|
-
CFShare registers the following tools for the AI:
|
|
278
|
-
|
|
279
|
-
| Tool | Purpose |
|
|
280
|
-
| :-------------- | :------------------------------------------------ |
|
|
281
|
-
| `env_check` | Check if `cloudflared` is available & view policy |
|
|
282
|
-
| `expose_port` | Expose a local port to the public internet |
|
|
283
|
-
| `expose_files` | Share files/directories (auto static server) |
|
|
284
|
-
| `exposure_list` | List all active sessions |
|
|
285
|
-
| `exposure_get` | Get details for a specific session |
|
|
286
|
-
| `exposure_stop` | Stop and clean up specific or all sessions |
|
|
287
|
-
| `exposure_logs` | View session logs |
|
|
288
|
-
| `maintenance` | TTL guardian / garbage collection / policy refresh |
|
|
289
|
-
| `audit_query` | Query audit logs |
|
|
290
|
-
| `audit_export` | Export audit logs to a file |
|
|
291
|
-
|
|
292
|
-
---
|
|
293
|
-
|
|
294
|
-
## 🔐 Security Design
|
|
295
|
-
|
|
296
|
-
<table>
|
|
297
|
-
<tr><td>🛡️</td><td><b>Secure by Default</b></td><td>Port exposure defaults to token auth + reverse proxy protection</td></tr>
|
|
298
|
-
<tr><td>🚫</td><td><b>Port Blacklist</b></td><td>SSH (22) and Docker Daemon (2375/2376) are blocked by default</td></tr>
|
|
299
|
-
<tr><td>⏳</td><td><b>Auto Expiry</b></td><td>Sessions automatically close tunnels and delete temp files upon expiration</td></tr>
|
|
300
|
-
<tr><td>📊</td><td><b>Rate Limiting</b></td><td>Per-IP sliding window rate limiting (default: 240 req/min)</td></tr>
|
|
301
|
-
<tr><td>📝</td><td><b>Audit Logging</b></td><td>All operations are logged to a local JSONL file</td></tr>
|
|
302
|
-
<tr><td>🙈</td><td><b>File Exclusion</b></td><td>Automatically excludes <code>.git/</code>, <code>.openclaw/</code>, and respects <code>.gitignore</code> rules</td></tr>
|
|
303
|
-
</table>
|
|
304
|
-
|
|
305
|
-
---
|
|
306
|
-
|
|
307
|
-
## ❓ FAQ
|
|
308
|
-
|
|
309
|
-
<details>
|
|
310
|
-
<summary><b>Q: Do I need a paid Cloudflare account?</b></summary>
|
|
311
|
-
|
|
312
|
-
No. CFShare uses Cloudflare Quick Tunnel (`trycloudflare.com`), which is completely free and requires no account registration.
|
|
313
|
-
|
|
314
|
-
</details>
|
|
315
|
-
|
|
316
|
-
<details>
|
|
317
|
-
<summary><b>Q: How long do links last?</b></summary>
|
|
318
|
-
|
|
319
|
-
By default, 1 hour. This can be adjusted via configuration or specified per share (up to 7 days). Links are automatically destroyed upon expiry.
|
|
320
|
-
|
|
321
|
-
</details>
|
|
322
|
-
|
|
323
|
-
<details>
|
|
324
|
-
<summary><b>Q: What if cloudflared is not found?</b></summary>
|
|
325
|
-
|
|
326
|
-
1. Confirm `cloudflared` is installed: `cloudflared --version`
|
|
327
|
-
2. If it's installed in a location not in your `PATH`, specify the full path in the config:
|
|
328
|
-
|
|
329
|
-
```json5
|
|
330
|
-
{
|
|
331
|
-
plugins: {
|
|
332
|
-
entries: {
|
|
333
|
-
cfshare: {
|
|
334
|
-
config: { cloudflaredPath: "/usr/local/bin/cloudflared" },
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
}
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
</details>
|
|
342
|
-
|
|
343
|
-
<details>
|
|
344
|
-
<summary><b>Q: Can I use it directly on Windows?</b></summary>
|
|
345
|
-
|
|
346
|
-
OpenClaw officially strongly recommends using WSL2 on Windows. CFShare follows the same guidance — please use it within a WSL2 environment.
|
|
347
|
-
|
|
348
|
-
</details>
|
|
349
|
-
|
|
350
|
-
<details>
|
|
351
|
-
<summary><b>Q: How do I verify the plugin installed correctly?</b></summary>
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
openclaw plugins list
|
|
355
|
-
# You should see cfshare listed as enabled
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
Then tell the AI _"Run the cfshare environment check"_ — it will call `env_check` and return detailed status information.
|
|
359
|
-
|
|
360
|
-
</details>
|
|
361
|
-
|
|
362
|
-
---
|
|
363
|
-
|
|
364
|
-
## 📄 License
|
|
365
|
-
|
|
366
|
-
MIT © [ystemsrx](https://github.com/ystemsrx)
|
|
202
|
+
|
|
203
|
+
CFShare works out of the box. The defaults below suit most use cases. To customize, edit `~/.openclaw/openclaw.json`:
|
|
204
|
+
|
|
205
|
+
```json5
|
|
206
|
+
{
|
|
207
|
+
plugins: {
|
|
208
|
+
entries: {
|
|
209
|
+
cfshare: {
|
|
210
|
+
enabled: true,
|
|
211
|
+
config: {
|
|
212
|
+
// Custom configuration (all fields are optional)
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Configuration Reference
|
|
221
|
+
|
|
222
|
+
| Option | Default | Description |
|
|
223
|
+
| :------------------------- | :-------------------- | :--------------------------------------- |
|
|
224
|
+
| `cloudflaredPath` | `"cloudflared"` | Path or command name for `cloudflared` |
|
|
225
|
+
| `stateDir` | `~/.openclaw/cfshare` | Directory for state file storage |
|
|
226
|
+
| `defaultTtlSeconds` | `3600` (1 hour) | Default tunnel time-to-live |
|
|
227
|
+
| `maxTtlSeconds` | `86400` (24 hours) | Maximum TTL cap |
|
|
228
|
+
| `defaultExposePortAccess` | `"token"` | Default auth mode for port exposure |
|
|
229
|
+
| `defaultExposeFilesAccess` | `"none"` | Default auth mode for file sharing |
|
|
230
|
+
| `blockedPorts` | `[22, 2375, 2376]` | Ports blocked from exposure (SSH/Docker) |
|
|
231
|
+
| `rateLimit.enabled` | `true` | Whether rate limiting is enabled |
|
|
232
|
+
| `rateLimit.maxRequests` | `240` | Max requests per window |
|
|
233
|
+
| `rateLimit.windowMs` | `60000` (1 minute) | Rate limit window in milliseconds |
|
|
234
|
+
|
|
235
|
+
> [!TIP]
|
|
236
|
+
> **Auth mode reference:**
|
|
237
|
+
>
|
|
238
|
+
> - `"token"` — A token is required to access the link (suitable for port exposure)
|
|
239
|
+
> - `"basic"` — HTTP Basic authentication (username/password)
|
|
240
|
+
> - `"none"` — No authentication, anyone can access (suitable for temporary file sharing)
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## 💬 Usage Examples
|
|
245
|
+
|
|
246
|
+
Once installed, just speak naturally to your AI assistant — it will automatically invoke the appropriate CFShare tools:
|
|
247
|
+
|
|
248
|
+
### Get AI-Processed Files
|
|
249
|
+
|
|
250
|
+
> _"Rename all files under `/mnt/data/students/` to `{index}_{name}.{ext}` format, then bundle them up and give me a download link."_
|
|
251
|
+
|
|
252
|
+
The Agent will automatically call `expose_files` and return a public link along with its expiration time.
|
|
253
|
+
|
|
254
|
+
### Share Your Creations
|
|
255
|
+
|
|
256
|
+
> _"Build a 3D interactive solar system model with Vue 3 + Vite, then share it with my friend via a link."_
|
|
257
|
+
|
|
258
|
+
> _"Run this project for me and send me the link to access it."_
|
|
259
|
+
|
|
260
|
+
The Agent will create and run the project, then use `expose_port` to create a tunnel so anyone can access it through a link.
|
|
261
|
+
|
|
262
|
+
### Share a Directory (with File Browser) — preview images/videos/text in-browser, or download (encryption supported)
|
|
263
|
+
|
|
264
|
+
> _"Share the directory `~/Pictures/vacation` with encryption."_
|
|
265
|
+
|
|
266
|
+
The Agent will use `expose_files` in `preview` mode to create a share page with a file browser. A valid token is required to access it.
|
|
267
|
+
|
|
268
|
+
### View Active Shares
|
|
269
|
+
|
|
270
|
+
> _"What links do I have active right now?"_
|
|
271
|
+
|
|
272
|
+
### Stop Sharing
|
|
273
|
+
|
|
274
|
+
> _"Shut down all active share links."_
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## 🧰 Tool Overview
|
|
279
|
+
|
|
280
|
+
CFShare registers the following tools for the AI:
|
|
281
|
+
|
|
282
|
+
| Tool | Purpose |
|
|
283
|
+
| :-------------- | :------------------------------------------------ |
|
|
284
|
+
| `env_check` | Check if `cloudflared` is available & view policy |
|
|
285
|
+
| `expose_port` | Expose a local port to the public internet |
|
|
286
|
+
| `expose_files` | Share files/directories (auto static server) |
|
|
287
|
+
| `exposure_list` | List all active sessions |
|
|
288
|
+
| `exposure_get` | Get details for a specific session |
|
|
289
|
+
| `exposure_stop` | Stop and clean up specific or all sessions |
|
|
290
|
+
| `exposure_logs` | View session logs |
|
|
291
|
+
| `maintenance` | TTL guardian / garbage collection / policy refresh |
|
|
292
|
+
| `audit_query` | Query audit logs |
|
|
293
|
+
| `audit_export` | Export audit logs to a file |
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## 🔐 Security Design
|
|
298
|
+
|
|
299
|
+
<table>
|
|
300
|
+
<tr><td>🛡️</td><td><b>Secure by Default</b></td><td>Port exposure defaults to token auth + reverse proxy protection</td></tr>
|
|
301
|
+
<tr><td>🚫</td><td><b>Port Blacklist</b></td><td>SSH (22) and Docker Daemon (2375/2376) are blocked by default</td></tr>
|
|
302
|
+
<tr><td>⏳</td><td><b>Auto Expiry</b></td><td>Sessions automatically close tunnels and delete temp files upon expiration</td></tr>
|
|
303
|
+
<tr><td>📊</td><td><b>Rate Limiting</b></td><td>Per-IP sliding window rate limiting (default: 240 req/min)</td></tr>
|
|
304
|
+
<tr><td>📝</td><td><b>Audit Logging</b></td><td>All operations are logged to a local JSONL file</td></tr>
|
|
305
|
+
<tr><td>🙈</td><td><b>File Exclusion</b></td><td>Automatically excludes <code>.git/</code>, <code>.openclaw/</code>, and respects <code>.gitignore</code> rules</td></tr>
|
|
306
|
+
</table>
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## ❓ FAQ
|
|
311
|
+
|
|
312
|
+
<details>
|
|
313
|
+
<summary><b>Q: Do I need a paid Cloudflare account?</b></summary>
|
|
314
|
+
|
|
315
|
+
No. CFShare uses Cloudflare Quick Tunnel (`trycloudflare.com`), which is completely free and requires no account registration.
|
|
316
|
+
|
|
317
|
+
</details>
|
|
318
|
+
|
|
319
|
+
<details>
|
|
320
|
+
<summary><b>Q: How long do links last?</b></summary>
|
|
321
|
+
|
|
322
|
+
By default, 1 hour. This can be adjusted via configuration or specified per share (up to 7 days). Links are automatically destroyed upon expiry.
|
|
323
|
+
|
|
324
|
+
</details>
|
|
325
|
+
|
|
326
|
+
<details>
|
|
327
|
+
<summary><b>Q: What if cloudflared is not found?</b></summary>
|
|
328
|
+
|
|
329
|
+
1. Confirm `cloudflared` is installed: `cloudflared --version`
|
|
330
|
+
2. If it's installed in a location not in your `PATH`, specify the full path in the config:
|
|
331
|
+
|
|
332
|
+
```json5
|
|
333
|
+
{
|
|
334
|
+
plugins: {
|
|
335
|
+
entries: {
|
|
336
|
+
cfshare: {
|
|
337
|
+
config: { cloudflaredPath: "/usr/local/bin/cloudflared" },
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
</details>
|
|
345
|
+
|
|
346
|
+
<details>
|
|
347
|
+
<summary><b>Q: Can I use it directly on Windows?</b></summary>
|
|
348
|
+
|
|
349
|
+
OpenClaw officially strongly recommends using WSL2 on Windows. CFShare follows the same guidance — please use it within a WSL2 environment.
|
|
350
|
+
|
|
351
|
+
</details>
|
|
352
|
+
|
|
353
|
+
<details>
|
|
354
|
+
<summary><b>Q: How do I verify the plugin installed correctly?</b></summary>
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
openclaw plugins list
|
|
358
|
+
# You should see cfshare listed as enabled
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Then tell the AI _"Run the cfshare environment check"_ — it will call `env_check` and return detailed status information.
|
|
362
|
+
|
|
363
|
+
</details>
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## 📄 License
|
|
368
|
+
|
|
369
|
+
MIT © [ystemsrx](https://github.com/ystemsrx)
|