Add DASHBOARD_SKIP_LOGIN + live machine metrics widget#2
Merged
Conversation
skip-login: - New DASHBOARD_SKIP_LOGIN flag. When set, authenticated() returns true and ShellDeck trusts the network gate (network_allowed) instead of its own login password — for deployments fronted by Cloudflare Access / Zero Trust or a trusted proxy. The shell unlock (second) password is unaffected, so shells stay gated. Default off; documented in .env.example and README. machine metrics: - New src/metrics.rs reads CPU% (/proc/stat delta), core count, load average, RAM/swap (/proc/meminfo), uptime, and hardware temperatures (/sys/class/hwmon temp*_input + labels). Exposed at GET /api/metrics, login-gated but not behind the shell unlock. - Sidebar "Machine" widget (frontend/metrics.ts) polls every 5s and renders CPU/RAM meters, temperature chips, and load — styled like a system monitor. Frontend-only helpers stay global scripts; metrics.js loads before events.js. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a DASHBOARD_SKIP_LOGIN environment flag that lets ShellDeck trust an external auth layer (Cloudflare Access, reverse proxy) instead of prompting for its own login password, while leaving the shell-unlock (second) password untouched. Also introduces a live host-metrics widget (CPU, RAM, load, temps, uptime) served from a new /api/metrics endpoint and rendered in a sidebar panel.
Changes:
- New
DASHBOARD_SKIP_LOGINflag wired throughconfig.rsand short-circuitingauth::authenticated, gated still by the network checks inguard. - New
src/metrics.rsmodule reading/procand/sys/class/hwmon, exposed viaapi_metricsroute behind the standard login guard. - New
frontend/metrics.ts/ compiledpublic/metrics.jspolling/api/metricsevery 5s, plus matching CSS and dashboard HTML for the sidebar widget.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/auth.rs | Short-circuit authenticated() when skip_login is enabled. |
| src/config.rs | Parse DASHBOARD_SKIP_LOGIN env var into new skip_login field. |
| src/main.rs | Register the new metrics module. |
| src/metrics.rs | New module gathering CPU%, load, mem/swap, uptime, hwmon temps. |
| src/routes.rs | New /api/metrics handler guarded by the standard login guard. |
| src/pages.rs | Add metrics sidebar markup and load metrics.js. |
| frontend/metrics.ts | TypeScript source for the metrics widget poller/renderer. |
| public/metrics.js | Compiled JS for the metrics widget. |
| frontend/events.ts, public/events.js | Kick off initial fetch and 5s interval for loadMetrics. |
| public/app.css | Styles for metric meters and temperature chips. |
| README.md, .env.example | Document the new flag and the metrics widget. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Skip-login (trust the front door)
New
DASHBOARD_SKIP_LOGINflag. When set,authenticated()returnstrueand ShellDeck trusts the existing network gate (network_allowed— allowed IPs / Cloudflare headers / Access email) instead of prompting for its own login password. This is for deployments fronted by Cloudflare Access / Zero Trust (or a trusted reverse proxy) that already authenticate who can reach the dashboard.The shell unlock (second) password is unaffected — shell previews, input, and the live terminal still require it. Default is off; documented in
.env.exampleand the README security section.Live machine metrics widget
src/metrics.rsreads, with no extra dependencies:/proc/statdelta, plus core count/proc/loadavg)/proc/meminfo, used = total − available)/proc/uptime)/sys/class/hwmon/*/temp*_inputwithtemp*_label(covers AMDk10temp, Intelcoretemp, NVMeComposite, wifi, etc.), sorted hottest-first, capped at 8.GET /api/metrics, login-gated but not behind the shell unlock (not sensitive).frontend/metrics.ts) polls every 5s and renders CPU/RAM meters (green→amber→red), temperature chips, and the load line — styled like the CachyOS system-monitor widget.Scope & verification
.rschanges are minimal and in the repo's compact style (nocargo fmtchurn):auth.rs+6,config.rs+5,main.rs+1,routes.rs+16, newmetrics.rs.metrics.jsloads beforeevents.js.cargo build --releaseclean;bun run checkclean;bun run build:frontendreproducespublic/*.js.code.falkinator.org:/returns 200 without the app login (skip-login), and/api/metricsreturns real data for the host (logan-laptop: CPU/RAM/load + 6 temp sensors).🤖 Generated with Claude Code