@yemi33/minions 0.1.65 → 0.1.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dashboard/js/refresh.js +3 -8
- package/dashboard.js +5 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dashboard/js/refresh.js
CHANGED
|
@@ -57,15 +57,16 @@ async function refresh() {
|
|
|
57
57
|
|
|
58
58
|
refresh();
|
|
59
59
|
|
|
60
|
-
// SSE status stream — real-time push
|
|
60
|
+
// SSE status stream — real-time push + hot-reload on one connection
|
|
61
|
+
// (avoids exhausting HTTP/1.1's 6-connection-per-origin limit)
|
|
61
62
|
let _statusStream = null;
|
|
62
63
|
try {
|
|
63
64
|
_statusStream = new EventSource('/api/status-stream');
|
|
64
65
|
_statusStream.onmessage = (e) => {
|
|
65
66
|
try { _processStatusUpdate(JSON.parse(e.data)); } catch (e2) { console.error('status-stream:', e2.message); }
|
|
66
67
|
};
|
|
68
|
+
_statusStream.addEventListener('reload', () => { location.reload(); });
|
|
67
69
|
_statusStream.onerror = () => {
|
|
68
|
-
// Fall back to polling
|
|
69
70
|
if (_statusStream) { _statusStream.close(); _statusStream = null; }
|
|
70
71
|
setInterval(refresh, 4000);
|
|
71
72
|
};
|
|
@@ -79,10 +80,4 @@ document.querySelectorAll('.sidebar-link').forEach(link => {
|
|
|
79
80
|
});
|
|
80
81
|
switchPage(currentPage);
|
|
81
82
|
|
|
82
|
-
// Hot-reload: auto-refresh browser when dashboard files change
|
|
83
|
-
try {
|
|
84
|
-
const _hotReload = new EventSource('/api/hot-reload');
|
|
85
|
-
_hotReload.onmessage = (e) => { if (e.data === 'reload') location.reload(); };
|
|
86
|
-
} catch { /* expected */ }
|
|
87
|
-
|
|
88
83
|
window.MinionsRefresh = { refresh };
|
package/dashboard.js
CHANGED
|
@@ -109,7 +109,11 @@ function rebuildDashboardHtml() {
|
|
|
109
109
|
HTML_GZ = zlib.gzipSync(HTML);
|
|
110
110
|
HTML_ETAG = '"' + require('crypto').createHash('md5').update(HTML).digest('hex') + '"';
|
|
111
111
|
console.log(' Dashboard hot-reloaded');
|
|
112
|
-
// Push reload to all connected browsers
|
|
112
|
+
// Push reload to all connected browsers via status-stream (saves a connection)
|
|
113
|
+
for (const res of _statusStreamClients) {
|
|
114
|
+
try { res.write('event: reload\ndata: reload\n\n'); } catch { _statusStreamClients.delete(res); }
|
|
115
|
+
}
|
|
116
|
+
// Legacy hot-reload clients
|
|
113
117
|
for (const res of _hotReloadClients) {
|
|
114
118
|
try { res.write('data: reload\n\n'); } catch { _hotReloadClients.delete(res); }
|
|
115
119
|
}
|
package/package.json
CHANGED