Commit Graph

178 Commits

Author SHA1 Message Date
stswangzhiping
d66558c9de fix: read dashboard token from ~/.openclaw/openclaw.json instead of running openclaw dashboard command
Made-with: Cursor
2026-03-18 14:00:57 +08:00
stswangzhiping
5f5b976f5b fix: split su command into separate args for ttyd
Made-with: Cursor
2026-03-16 16:21:11 +08:00
stswangzhiping
9dc559a43a fix: run ttyd shell as normal user (sts) instead of root
Made-with: Cursor
2026-03-16 16:15:13 +08:00
stswangzhiping
17d0711f67 ui: redesign WiFi list with signal bars and cleaner layout
- Replace <select> with scrollable list of clickable items
- Show signal strength as 4-bar icon instead of percentage text
- Remove security info from parentheses, show lock icon only
- Smaller font size for compact mobile display

Made-with: Cursor
2026-03-16 13:11:23 +08:00
stswangzhiping
c6f55c8c15 fix: pre-scan WiFi before entering AP mode
wlan0 cannot scan while in AP mode (hardware limitation).
Now scan nearby networks before starting hotspot and cache
the results for the captive portal page.

Made-with: Cursor
2026-03-16 13:04:00 +08:00
stswangzhiping
64f4050014 fix: EROFS dns config, double WS connection, and watchdog timeout
1. EROFS: install.sh pre-writes DNS hijack config to dnsmasq-shared.d
   since /etc may be read-only at runtime. dns-hijack.js gracefully
   falls back to checking if config already exists.

2. Double WS: add _connectionStarted guard to prevent _proceedWithConnection
   from being called twice (via event + hasInternet check).

3. Watchdog: move _startSdNotify() to start() beginning so READY=1
   is sent immediately, not delayed until network is ready.

Made-with: Cursor
2026-03-16 12:54:46 +08:00
stswangzhiping
9392f0f3d4 docs: add WiFi provisioning user manual to README
Made-with: Cursor
2026-03-16 12:45:10 +08:00
stswangzhiping
9d8af52bf4 fix: stop killing NM's dnsmasq - use dnsmasq-shared.d instead
Killing all dnsmasq processes caused NetworkManager to detect its
hotspot dnsmasq died and tear down the hotspot (AP appears briefly
then disappears).

Now leverage NM's built-in dnsmasq-shared.d config directory:
write DNS hijack config before starting AP so NM's own dnsmasq
picks it up. No separate dnsmasq process needed.

Made-with: Cursor
2026-03-16 12:40:19 +08:00
stswangzhiping
f58db93b64 fix: wait for NM auto-reconnect before starting AP on reboot
After WiFi is configured and device reboots, NetworkManager needs
a few seconds to auto-connect to saved WiFi. Without waiting,
AP starts immediately and occupies wlan0, preventing NM reconnect.

- Add hasSavedWifiConnection() to check for saved WiFi profiles
- Wait up to 20s for NM auto-connect before falling back to AP
- First boot (no saved WiFi) still starts AP immediately

Made-with: Cursor
2026-03-16 12:27:25 +08:00
stswangzhiping
b42e59fab8 feat: AP always-on mode - hotspot stays until WiFi STA connects
Redesign provisioning from one-shot blocking to persistent background manager:
- AP hotspot starts at boot regardless of eth0 status
- Captive portal runs alongside AP for WiFi configuration
- AP automatically shuts down only when WiFi STA connects
- WiFi drops at runtime -> AP auto-restarts
- WiFi connect fails -> AP auto-restarts for retry
- client.js no longer blocks on network; connects WS when ready

Made-with: Cursor
2026-03-16 12:18:35 +08:00
stswangzhiping
dac68f78b4 fix: clawd-rfkill.service failed due to systemd $ expansion
systemd expands $rf as env var (empty), breaking the inline script.
Move rfkill logic to standalone script to avoid escaping issues.
Also use quoted heredoc to prevent bash expansion in install.sh.

Made-with: Cursor
2026-03-16 11:49:07 +08:00
stswangzhiping
7a80c03028 fix: kill NetworkManager's dnsmasq before starting our own
NetworkManager auto-starts its own dnsmasq when creating a hotspot,
which conflicts with our DNS-hijacking dnsmasq on the same interface.
Now kill ALL dnsmasq instances before starting ours.

Made-with: Cursor
2026-03-16 11:19:04 +08:00
stswangzhiping
92906bcd4b fix: set AP hotspot password to fixed WPA2 PSK "12345678"
Open network was not viable as nmcli generates random password by default.
Use a simple fixed password since the AP is only for short-lived provisioning.

Made-with: Cursor
2026-03-16 10:44:26 +08:00
stswangzhiping
8a6e5b3666 fix: dnsmasq path detection and WiFi rfkill persistence
- dns-hijack.js: replace `which` with multi-path search (/usr/sbin etc.)
  since dnsmasq is often not in normal user PATH
- install.sh: auto-enable NetworkManager for WiFi provisioning
- install.sh: unblock WiFi rfkill at install time
- install.sh: create clawd-rfkill.service for persistent boot-time unlock

Made-with: Cursor
2026-03-16 10:06:30 +08:00
stswangzhiping
eb9f4ab1c3 feat: add WiFi provisioning for headless devices (AP + Captive Portal)
- Add lib/network.js: WiFi scan, connect, AP hotspot via nmcli
- Add lib/dns-hijack.js: dnsmasq management for DNS hijack + DHCP
- Add lib/captive-server.js: embedded HTTP captive portal with WiFi setup page
- Add lib/provisioning.js: orchestrator (detect network -> AP mode -> wait -> exit)
- Update client.js: call ensureNetwork() before WS connection
- Update install.sh: auto-install dnsmasq dependency

Made-with: Cursor
2026-03-16 08:58:51 +08:00
stswangzhiping
b3770d21d4 feat: add structured logging, process watchdog, and systemd hardening
- Add lib/logger.js: timestamped structured logging with 5MB x 5 file rotation
- Add lib/watchdog.js: generic child process supervisor with rate-limited restarts
- Enhance client.js: WS ping/pong liveness detection, uncaughtException/unhandledRejection handlers, systemd sd-notify integration
- Refactor frpc.js: FrpcManager now delegates to Watchdog instead of manual spawn/exit
- Enhance install.sh: environment file, log directory, systemd resource limits, security hardening, WatchdogSec=60
- Replace all console.log/warn/error with structured logger across modules

Made-with: Cursor
2026-03-16 07:31:19 +08:00
stswangzhiping
42d1d361dc style(ttyd): enable cursor blink via client option
Made-with: Cursor
2026-03-15 23:25:36 +08:00
stswangzhiping
1ff9fd90e5 fix(ttyd): add -W writable and -i 127.0.0.1 flags
Made-with: Cursor
2026-03-15 23:22:05 +08:00
stswangzhiping
54476c82b6 fix(frpc): ttyd switch to tcp proxy to fix ws bidirectional issue
Made-with: Cursor
2026-03-15 22:55:27 +08:00
stswangzhiping
c0c445b61d feat: add ttyd terminal support, parallel startup in frpc.js
Made-with: Cursor
2026-03-15 21:39:05 +08:00
stswangzhiping
abf2cacac7 fix: use total-available for mem_used, aggregate real filesystems for disk
Made-with: Cursor
2026-03-15 21:29:51 +08:00
stswangzhiping
f5ae8b0710 fix: use shell background + polling to get dashboard info reliably
Made-with: Cursor
2026-03-15 14:29:03 +08:00
stswangzhiping
64cd7432e1 fix: getDashboardInfo uses spawn+Promise to handle long-running process
Made-with: Cursor
2026-03-15 14:09:41 +08:00
stswangzhiping
516d0d26ee feat: integrate frpc manager and send dashboard info via WebSocket
Made-with: Cursor
2026-03-15 11:10:33 +08:00
stswangzhiping
a9a7816e16 fix: show claw_id in activation box, remove noisy startup logs
Made-with: Cursor
2026-03-14 22:46:49 +08:00
stswangzhiping
3b7fc0c0d4 fix: combine machine-id+cpu+disk serial for box_id to prevent ghost clone collision
Made-with: Cursor
2026-03-14 22:21:13 +08:00
stswangzhiping
aba21bf8b7 fix: replace MAC address with CPU serial / disk serial / DMI UUID for box_id
Made-with: Cursor
2026-03-14 21:18:57 +08:00
stswangzhiping
222c38a707 feat: initial clawd implementation - WebSocket daemon for claw box
Made-with: Cursor
2026-03-14 20:41:26 +08:00