-
-
-
-
Cached / Forwarded
-- / --
+
+
+
+
+
Cached / Forwarded
-- / --
From adff418e144d056e2d3312352e431864f5f393f0 Mon Sep 17 00:00:00 2001
From: Suraj Verma <5441349+surajverma@users.noreply.github.com>
Date: Tue, 8 Sep 2026 17:26:19 +0530
Subject: [PATCH 07/45] Improve PWA cache freshness and avoid caching API
responses
---
sw.js | 57 +++++++++++++++++++++++++++++++++++----------------------
1 file changed, 35 insertions(+), 22 deletions(-)
diff --git a/sw.js b/sw.js
index de521ee..7111c7b 100644
--- a/sw.js
+++ b/sw.js
@@ -1,40 +1,53 @@
-const CACHE_NAME = 'pi-dashboard-cache-v0.6.0';
-const urlsToCache = [
+const CACHE_NAME = 'pi-dashboard-cache-v1';
+const APP_SHELL = [
'{{CACHE_URL}}',
'{{CACHE_URL}}css/style.css',
'{{CACHE_URL}}js/app.js',
];
self.addEventListener('install', event => {
- event.waitUntil(
- caches.open(CACHE_NAME)
- .then(cache => {
- return cache.addAll(urlsToCache);
- })
- );
+ event.waitUntil(caches.open(CACHE_NAME).then(cache => cache.addAll(APP_SHELL)));
+ self.skipWaiting();
});
self.addEventListener('activate', event => {
event.waitUntil(
- caches.keys().then(cacheNames =>
- Promise.all(
- cacheNames
- .filter(name => name !== CACHE_NAME)
- .map(name => caches.delete(name))
- )
- )
+ caches.keys().then(names => Promise.all(names.filter(name => name !== CACHE_NAME).map(name => caches.delete(name))))
);
+ self.clients.claim();
});
self.addEventListener('fetch', event => {
+ if (event.request.method !== 'GET') return;
+ const url = new URL(event.request.url);
+ const apiPaths = ['/init', '/data', '/queries', '/health'];
+ if (apiPaths.some(path => url.pathname.endsWith(path))) return;
+
+ if (event.request.mode === 'navigate') {
+ event.respondWith(
+ fetch(event.request)
+ .then(response => {
+ const copy = response.clone();
+ caches.open(CACHE_NAME).then(cache => cache.put(event.request, copy));
+ return response;
+ })
+ .catch(() => caches.match(event.request).then(response => response || caches.match('{{CACHE_URL}}')))
+ );
+ return;
+ }
+
event.respondWith(
- caches.open(CACHE_NAME).then(cache =>
- cache.match(event.request).then(response => {
- if (response) {
+ caches.match(event.request).then(cached => {
+ const network = fetch(event.request)
+ .then(response => {
+ if (response.ok && url.origin === self.location.origin) {
+ const copy = response.clone();
+ caches.open(CACHE_NAME).then(cache => cache.put(event.request, copy));
+ }
return response;
- }
- return fetch(event.request);
- })
- )
+ })
+ .catch(() => cached);
+ return cached || network;
+ })
);
});
From 3a2144a6ea4c80313bb7f7c97e4d84d73a965e4f Mon Sep 17 00:00:00 2001
From: Suraj Verma <5441349+surajverma@users.noreply.github.com>
Date: Tue, 8 Sep 2026 17:26:29 +0530
Subject: [PATCH 08/45] Document backward-compatible dashboard tuning options
---
config-example.json | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/config-example.json b/config-example.json
index 7673df5..7820d35 100644
--- a/config-example.json
+++ b/config-example.json
@@ -1,21 +1,27 @@
{
"base_path": "/",
- "refresh_interval": 1000,
+ "refresh_interval": 2000,
+ "queries_refresh_interval": 3000,
+ "cache_ttl": 1000,
"show_queries": false,
+ "show_network_summary": true,
+ "show_trends": true,
"piholes": [
{
"name": "Primary",
"address": "https://pi.hole/one",
- "password": "your_app_password_here",
+ "password": "${PIHOLE_PRIMARY_PASSWORD}",
"enabled": true,
- "link": true
+ "link": true,
+ "verify_ssl": false
},
{
"name": "Secondary",
"address": "https://pi.hole/two",
"password": "your_app_password_here",
"enabled": true,
- "link": false
+ "link": false,
+ "verify_ssl": false
}
]
-}
\ No newline at end of file
+}
From 0bf4c432e628cb0cba154f6941d35faae47c1fb1 Mon Sep 17 00:00:00 2001
From: Suraj Verma <5441349+surajverma@users.noreply.github.com>
Date: Tue, 8 Sep 2026 17:26:40 +0530
Subject: [PATCH 09/45] Clean Python dependencies and add production server
---
requirements.txt | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index f0e3d82..3d28282 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,17 +1,4 @@
-blinker==1.9.0
-certifi==2025.8.3
-charset-normalizer==3.4.2
-click==8.2.1
-colorama==0.4.6
Flask==3.1.3
-flask-cors==6.0.1
-idna==3.15
-itsdangerous==2.2.0
-Jinja2==3.1.6
MarkupSafe==3.0.2
requests==2.33.0
-urllib3==2.7.0
-Werkzeug==3.1.5
-requests==2.32.4
-urllib3==2.7.0
-Werkzeug==3.1.6
+gunicorn==23.0.0
From 8225a1ef01dbbf8a21004401b1e162e72365d018 Mon Sep 17 00:00:00 2001
From: Suraj Verma <5441349+surajverma@users.noreply.github.com>
Date: Tue, 8 Sep 2026 17:27:12 +0530
Subject: [PATCH 10/45] Make network summary visibility independent of
generated utilities
---
index.html | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/index.html b/index.html
index fa5764f..356088d 100644
--- a/index.html
+++ b/index.html
@@ -24,8 +24,7 @@
Pi-Dash
Last updated: Never
-
-
+
Network Summary
@@ -37,7 +36,6 @@
Network Summa
Cached / Forwarded
-- / --
-