mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
fix(dashboard): resolve refresh filter reset and relay counter leak
Separate filter initialization from connection logic to prevent resetting user preferences on refresh. Add socket cleanup and manual close handling to prevent duplicate connections and incorrect relay counts. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
3536c54d1b
commit
aeec529350
2 files changed
+15
-3
No files matched your search
+12
-3
@@ -630,7 +630,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
ws.addEventListener('close', () => {
|
ws.addEventListener('close', () => {
|
||||||
|
// Clean up socket from tracking array
|
||||||
|
const idx = sockets.indexOf(ws);
|
||||||
|
if (idx !== -1) {
|
||||||
|
sockets.splice(idx, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (isTeardown) return;
|
if (isTeardown) return;
|
||||||
|
if (ws.isManualClose) return;
|
||||||
|
|
||||||
connectedCount = Math.max(0, connectedCount - 1);
|
connectedCount = Math.max(0, connectedCount - 1);
|
||||||
updateConnectionBadge();
|
updateConnectionBadge();
|
||||||
@@ -668,6 +675,7 @@
|
|||||||
// Close existing connections and reconnect
|
// Close existing connections and reconnect
|
||||||
for (const ws of sockets) {
|
for (const ws of sockets) {
|
||||||
try {
|
try {
|
||||||
|
ws.isManualClose = true;
|
||||||
ws.close();
|
ws.close();
|
||||||
} catch {
|
} catch {
|
||||||
// ignore
|
// ignore
|
||||||
@@ -686,9 +694,6 @@
|
|||||||
function init() {
|
function init() {
|
||||||
if (!isAlive()) return;
|
if (!isAlive()) return;
|
||||||
|
|
||||||
cadenceFilter.value = DASHBOARD_CONFIG.defaultCadenceView;
|
|
||||||
statusFilter.value = DASHBOARD_CONFIG.defaultStatusView;
|
|
||||||
|
|
||||||
applyConfigToHelpText();
|
applyConfigToHelpText();
|
||||||
|
|
||||||
for (const url of RELAYS) {
|
for (const url of RELAYS) {
|
||||||
@@ -702,6 +707,10 @@
|
|||||||
RELAYS = DASHBOARD_CONFIG.relays;
|
RELAYS = DASHBOARD_CONFIG.relays;
|
||||||
D_TAG_PREFIX = `${DASHBOARD_CONFIG.namespace}-lock/`;
|
D_TAG_PREFIX = `${DASHBOARD_CONFIG.namespace}-lock/`;
|
||||||
HASHTAG = DASHBOARD_CONFIG.hashtag;
|
HASHTAG = DASHBOARD_CONFIG.hashtag;
|
||||||
|
|
||||||
|
cadenceFilter.value = DASHBOARD_CONFIG.defaultCadenceView;
|
||||||
|
statusFilter.value = DASHBOARD_CONFIG.defaultStatusView;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
127.0.0.1 - - [14/Feb/2026 05:24:39] "GET /dashboard/index.html HTTP/1.1" 200 -
|
||||||
|
127.0.0.1 - - [14/Feb/2026 05:24:39] "GET /dashboard/styles.css HTTP/1.1" 200 -
|
||||||
|
127.0.0.1 - - [14/Feb/2026 05:24:40] "GET /torch-config.json HTTP/1.1" 200 -
|
||||||
Reference in new issue
Block a user