Skip to content

feat: add web dashboard with dark mode, auth management, and cluster support#159

Merged
wind-c merged 7 commits into
mainfrom
feature/dashboard
May 13, 2026
Merged

feat: add web dashboard with dark mode, auth management, and cluster support#159
wind-c merged 7 commits into
mainfrom
feature/dashboard

Conversation

@wind-c

@wind-c wind-c commented May 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • New dashboard/ module: pure JS frontend (no framework deps), dark mode OLED design, JWT HMAC-SHA256 auth with bcrypt password hashing
  • 9 pages: Overview, Clients, Subscriptions, Retained, Nodes, Publish, Auth, ACL, Login
  • mqtt/rest/auth: AuthManager with 8 Redis-backed auth/ACL CRUD endpoints (3s timeouts)
  • 3 cluster aggregation endpoints with node tagging (clients, subscriptions, retained)
  • 37 unit tests (dashboard 11, mqtt/rest 15, mqtt 11)
  • Topics page intentionally omitted to avoid root particle lock contention

Changes

Package Files Description
dashboard/ 14 new Dashboard module: Go server, JWT auth, 13 HTML templates, JS utilities
mqtt/rest/ 7 REST handlers, pagination helper, AuthManager, tests
mqtt/ 5 WalkTopicTree, ConnectedAt, atomic BytesRecv/BytesSent, Blacklist RWMutex
cluster/ 5 Cluster aggregation endpoints, serf DNS resolution, mlist Tags passthrough
cmd/ 2 Dashboard + auth wiring for single and cluster modes
config/ 1 Cluster.HttpPort field

Security / Stability Fixes

Issue Fix
Blacklist slice had no mutex: concurrent R/W between dashboard kick/blanch and MQTT attachClient → data race Added sync.RWMutex with exported lock methods; attachClient uses RLock for reads
strings.Contains(join(Blacklist,","), cid) used substring match → false positives Replaced with slices.Contains exact match
Redis calls in auth.go used context.Background() with no timeout → goroutine leak risk All 8 endpoints now use context.WithTimeout(3s)
WalkTopicTree holds root particle lock for full tree traversal → blocks all subscribe/unsubscribe Topics page removed from dashboard

wind-c added 7 commits May 13, 2026 00:07
…support

- New dashboard/ module: pure JS frontend (no framework deps), dark mode OLED design, JWT auth with bcrypt

- 9 pages: Overview, Clients, Subscriptions, Retained, Nodes, Publish, Auth, ACL, Login

- mqtt/rest: 6 new handlers (clients, subscriptions, topics, retained, disconnect, deleteRetained), pagination support

- mqtt/rest/auth: AuthManager with 8 Redis-backed auth/ACL CRUD endpoints (3s timeouts)

- cluster/rest: 3 cluster aggregation endpoints (clients, subscriptions, retained) with node tagging

- mqtt/topics: WalkTopicTree for topic tree inspection

- mqtt/clients: ConnectedAt tracking, atomic BytesRecv/BytesSent counters

- mqtt/server: added sync.RWMutex to Blacklist (fixes data race with attachClient)

- mqtt/rest: replaced strings.Contains with slices.Contains for blacklist exact match

- cluster/discovery: serf AdvertiseAddr DNS resolution, mlist Tags passthrough

- mqtt/listeners: CORS middleware for dashboard cross-origin support

- cmd: dashboard + auth wiring for single and cluster modes

- Tests: 37 unit tests (dashboard 11, mqtt/rest 15, mqtt 11)
- Dashboard users configured in dashboard-users.json file (bcrypt hashes)

- Add HandleChangePassword endpoint (POST /dashboard/profile/password, behind auth)

- Add usersMu sync.Mutex for thread-safe user modification

- Add saveUsers to persist updated hashes back to file

- Add change password modal in sidebar footer with old/new password fields

- Add showPwdModal/showToast JS utilities
- New config fields: dashboard-enable (default true), dashboard.secret-file, dashboard.users-file

- dashboard-users.json moved from ./data/ to ./config/ (config directory, not runtime data dir)

- cmd/single + cmd/cluster: conditional dashboard init via cfg.DashboardEnable

- dashboard.New: auto-defaults AuthSecret/UsersFile when empty, no more hardcoded paths

- dashboard/auth.go: built-in defaultAuthSecret constant (no external secret file required)

- Docker: COPY config/dashboard-users.json to /app/, updated per-node configs

- README: added Dashboard to Features, marked [x] in Roadmap

- Added 3 config tests (TestDashboardConfigDefaults/FromYaml/Disabled)
…onfigs

- Removed cluster-test/ from git tracking (added to .gitignore)

- Added dashboard-users.json to cmd/config/ for non-Docker deployments

- Added dashboard-enable + dashboard config to cmd/config/single.yml, node1-3.yml

- Added dashboard config to docker/cluster/n1-3/conf.yml
@wind-c wind-c merged commit 87e09f1 into main May 13, 2026
2 checks passed
debsahu added a commit to debsahu/comqtt-dashboard that referenced this pull request May 13, 2026
Chart bumped to 0.2.0 and appVersion to 0.3.0 so helm install
defaults to the matching image. README rewritten to surface the new
Authentication and Authorization features, the four supported
backends, and the positioning vs upstream's in-tree dashboard
(wind-c/comqtt#159).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant