Repository navigation
Enhance Pi-hole API proxy, caching, and mobile UI features - #28
Merged
Merged
Conversation
… configuration defaults
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The proxy endpoints currently 500 on non-integer length query params and the browser test fixture server binds to 0.0.0.0, unnecessarily exposing it beyond localhost.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR modernizes Pi-Dash’s backend proxy and frontend dashboard to support richer Pi-hole status reporting, safer/easier configuration, and improved responsiveness—backed by a new automated regression test suite and updated deployment guidance.
Changes:
- Refactors the Flask proxy to add per-instance health/blocking metadata, a network summary, and a shared backend cache with configurable TTL.
- Reworks the dashboard UI for mobile/desktop behavior (expandable cards, query panel), and introduces a shared “core” module to support Node/jsdom tests.
- Adds CI workflow coverage (Python + Node + Playwright rendered checks), updates Docker runtime (non-root + gunicorn), and expands documentation/config examples.
File summaries
| File | Description |
|---|---|
| tests/test_proxy.py | Adds Python regression tests for config compatibility, caching, summary behavior, and routes. |
| tests/lifecycle.test.cjs | Adds jsdom lifecycle tests for abort/recovery behavior and timer correctness. |
| tests/dashboard.test.cjs | Adds jsdom behavior tests for query grouping/tracking, mobile UI, and XSS safety for names. |
| tests/browser/server.cjs | Adds a local fixture server to render production assets with synthetic API responses. |
| tests/browser/run.cjs | Automates Playwright runs for rendered layout + offline/online lifecycle checks and screenshots. |
| tests/browser/mock.js | Injects synthetic fixture data and hooks fetch/timers for rendered regression checks. |
| tests/browser/index.html | Adds a small harness page to drive fixture iframes and rendered checks. |
| tests/browser/checks.js | Implements browser-only geometry/layout and lifecycle assertions across viewports/scenarios. |
| tailwind.config.js | Enables Tailwind darkMode: 'class' for explicit theme class behavior. |
| sw.js | Updates PWA caching strategy and app-shell assets; avoids caching API responses. |
| src/tailwind.css | Removes inline custom CSS (moved to dedicated dashboard stylesheet). |
| requirements.txt | Simplifies Python deps and adds gunicorn for production serving. |
| README.md | Major rewrite: new configuration options, install guidance, and development/testing instructions. |
| proxy.py | Refactors proxy to add caching, health endpoint, richer data model, and config helpers. |
| package.json | Adds jsdom/playwright and introduces test/dev scripts alongside Tailwind build. |
| js/dashboard-core.js | New shared pure helpers for formatting, health/status, and query tracking/grouping. |
| js/app.js | Rewrites dashboard runtime: polling lifecycle controls, mobile card toggles, query feed panel, trends. |
| index.html | Updates markup for network summary + query panel + loads new dashboard CSS and core JS. |
| Dockerfile | Improves container security (non-root), adds healthcheck, switches to gunicorn. |
| css/style.css | Updates generated Tailwind output to match new markup/classes. |
| css/dashboard.css | Adds custom responsive styling for desktop/mobile cards, query panel, and status indicators. |
| config-example.json | Expands example config with new options and env-var password reference. |
| .gitignore | Adds ignores for Python cache and rendered test artifacts. |
| .github/workflows/test.yml | Adds CI workflow for Python tests, Node tests, Tailwind build, and Playwright rendered checks. |
| .dockerignore | Excludes tests, artifacts, and .git from Docker build context. |
Review details
Files not reviewed (1)
- css/style.css: Generated file
Suppressed comments (1)
proxy.py:419
/queriesparseslengthwithint(...)directly; a non-integer query param will raiseValueErrorand return a 500. Use the existing_inthelper so invalid input falls back to the default and remains clamped.
length = max(1, min(int(request.args.get('length', 50)), 200))
return jsonify(fetch_queries(length))
- Files reviewed: 21/25 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
This pull request introduces several improvements to Pi-Dash, focusing on enhanced configuration flexibility, improved Docker and CI/CD support, expanded documentation, and a new custom CSS file for better dashboard appearance and responsiveness. The most significant changes are grouped below.
Configuration and Documentation Enhancements:
config-example.json,README.md: Expanded configuration options for Pi-hole instances, including new settings likequeries_refresh_interval,cache_ttl,show_network_summary,show_trends, andverify_ssl. The example now uses environment variable references for sensitive values, with detailed explanations and usage instructions added to the documentation. [1] [2]README.md: The documentation has been extensively rewritten for clarity, with improved feature descriptions, configuration tables, installation instructions (including Docker Compose, Docker Run, and native), and a new section on health checks and development/testing. [1] [2]Docker and CI/CD Improvements:
Dockerfile: The build now creates a non-root user for better security, usesgunicornfor production serving, and adds a health check endpoint..dockerignore: Excludes test directories, test results, and.gitfrom Docker builds to reduce image size and improve build performance..github/workflows/test.yml: Adds a new GitHub Actions workflow to run backend and frontend tests, perform syntax checks, verify builds, and upload test artifacts.README.md: Adds a badge for the new test workflow.Frontend Styling:
css/dashboard.css: Introduces a new custom CSS file, providing improved layout, responsive design, status indicators, and better mobile support for the dashboard.These changes collectively make Pi-Dash more robust, secure, configurable, and user-friendly, with clearer documentation and improved development workflows.