fix(persistence): save service tunnel error state; fix legacy migration; add server label
CI / Build & Test (push) Successful in 2m44s

This commit is contained in:
Raven Scott
2026-02-28 22:00:38 -05:00
parent 6c1428c6f1
commit 4a7399dab8
+4 -1
View File
@@ -157,13 +157,15 @@ function loadState() {
servers: Array.isArray(data.servers) ? data.servers : [], servers: Array.isArray(data.servers) ? data.servers : [],
virtualHosts: Array.isArray(data.virtualHosts) ? data.virtualHosts : [], virtualHosts: Array.isArray(data.virtualHosts) ? data.virtualHosts : [],
serviceTunnels: Array.isArray(data.serviceTunnels) ? data.serviceTunnels : [], serviceTunnels: Array.isArray(data.serviceTunnels) ? data.serviceTunnels : [],
sshConnections: [], sshConnections: Array.isArray(data.sshConnections) ? data.sshConnections : [],
rdpConnections: Array.isArray(data.rdpConnections) ? data.rdpConnections : [],
nextServerId: typeof data.nextServerId === 'number' ? data.nextServerId : 0, nextServerId: typeof data.nextServerId === 'number' ? data.nextServerId : 0,
nextServiceTunnelId: typeof data.nextServiceTunnelId === 'number' ? data.nextServiceTunnelId : 0 nextServiceTunnelId: typeof data.nextServiceTunnelId === 'number' ? data.nextServiceTunnelId : 0
}; };
// Write the new state.json immediately // Write the new state.json immediately
currentSettings = out.settings; currentSettings = out.settings;
sshConnectionsList = out.sshConnections; sshConnectionsList = out.sshConnections;
rdpConnectionsList = out.rdpConnections;
nextServerId = out.nextServerId; nextServerId = out.nextServerId;
nextServiceTunnelId = out.nextServiceTunnelId; nextServiceTunnelId = out.nextServiceTunnelId;
saveStateSync(); saveStateSync();
@@ -639,6 +641,7 @@ async function startServiceTunnel(payload) {
} catch (e) { } catch (e) {
debugLog('startServiceTunnel: error', e.message); debugLog('startServiceTunnel: error', e.message);
serviceTunnels.set(tunnelId, { label, hsUrl, localPort, state: 'error', error: e.message, createdAt: Date.now() }); serviceTunnels.set(tunnelId, { label, hsUrl, localPort, state: 'error', error: e.message, createdAt: Date.now() });
saveStateSync();
emit('serviceTunnelError', { tunnelId, label, error: e.message }); emit('serviceTunnelError', { tunnelId, label, error: e.message });
return { ok: false, error: e.message }; return { ok: false, error: e.message };
} }