feat(web): add Cloudflare Quick Tunnel support for remote access (#85)

* feat(web): add Cloudflare Quick Tunnel support for remote access

Implement --try-cf-tunnel flag that creates a temporary public URL
routing to the locally running server via cloudflared.

Features:
- Auto-detect and spawn cloudflared subprocess
- Extract and display *.trycloudflare.com URL
- Proper cleanup on server shutdown
- Dynamic port handling (tunnel routes to actual listening port)
- Isolated HOME dir to avoid config conflicts
- Installation help and limitations warning

* docs: add Cloudflare tunnel feature to README

- Document --try-cf-tunnel flag in CLI examples
- Add Cloudflare Quick Tunnel to Web/PWA features

* docs: add cloudflared as prerequisite for --try-cf-tunnel

* feat(web): auto-generate password for Cloudflare tunnel

When using --try-cf-tunnel without --ui-password, automatically generate
a secure random password to protect the publicly exposed service.

Features:
- 16-character random password (easy to read, no ambiguous characters)
- Password is displayed after tunnel is established
- Warning to save the password (not shown again)
- Works in both foreground and daemon modes
- Uses same password for subsequent restarts (stored in instance file)

* fix(web): improve Cloudflare tunnel UX and fix spawn ENAMETOOLONG

- Generate and display password before tunnel starts (green colored)
- Display tunnel URL in cyan via onTunnelReady callback
- Fix ENAMETOOLONG by using env:undefined instead of copying process.env
- Pass tryCfTunnel flag from CLI to main function
- Remove duplicate tunnel URL output
- Update warning message to reflect password protection
- Change start script to use CLI wrapper for proper initialization

---------

Co-authored-by: aptdnfapt <197602950+aptdnfapt@users.noreply.github.com>
This commit is contained in:
Alexis Okuwa
2025-12-31 15:43:18 +02:00
committed by GitHub
co-authored by aptdnfapt
parent fa2223a0e7
commit 6c30245134
5 changed files with 301 additions and 24 deletions
+3
View File
@@ -59,6 +59,7 @@ The whole project was built entirely with AI coding agents under my supervision.
- Mobile-first UI with gestures and optimized terminal controls
- Self-serve web updates (no CLI required)
- Update and restart keeps previous server settings (port/password)
- Cloudflare Quick Tunnel support for easy remote access (`--try-cf-tunnel`)
### Desktop (macOS)
@@ -91,6 +92,7 @@ openchamber # Start on port 3000
openchamber --port 8080 # Custom port
openchamber --daemon # Background mode
openchamber --ui-password secret # Password-protect UI
openchamber --try-cf-tunnel # Create a Cloudflare Quick Tunnel for remote access
openchamber stop # Stop server
openchamber update # Update to latest version
```
@@ -103,6 +105,7 @@ Download from [Releases](https://github.com/btriapitsyn/openchamber/releases).
- [OpenCode CLI](https://opencode.ai) installed
- Node.js 20+ (for web version)
- [cloudflared](https://github.com/cloudflare/cloudflared/releases) (required for `--try-cf-tunnel`)
See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.