node-red-contrib-remote 2.0.4 → 2.0.5
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/README.md +5 -2
- package/nodes/remote-access.js +24 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,11 +36,14 @@ You will find more information on [www.remote-red-com](https://www.remote-red.co
|
|
|
36
36
|
|
|
37
37
|
## Version History
|
|
38
38
|
|
|
39
|
+
Version 2.0.5
|
|
40
|
+
- Improved reconnect for Starlink users
|
|
41
|
+
|
|
39
42
|
Version 2.0.4
|
|
40
|
-
-
|
|
43
|
+
- Fix for 'No endpoint detected' message
|
|
41
44
|
|
|
42
45
|
Version 2.0.3
|
|
43
|
-
-
|
|
46
|
+
- More stable handling of connection losses
|
|
44
47
|
|
|
45
48
|
Version 2.0.2
|
|
46
49
|
- Crash on Node-RED startup fixed, extended error reporting
|
package/nodes/remote-access.js
CHANGED
|
@@ -15,8 +15,7 @@ module.exports = function(RED) {
|
|
|
15
15
|
await killSSHProcess(node);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
// Reset heartbeat status
|
|
19
|
-
node.initialHeartbeatStatus = ''
|
|
18
|
+
// Reset heartbeat status for current tunnel
|
|
20
19
|
node.lastHeartbeatStatus = ''
|
|
21
20
|
|
|
22
21
|
// Create ssh command
|
|
@@ -218,30 +217,39 @@ module.exports = function(RED) {
|
|
|
218
217
|
})
|
|
219
218
|
.then(response => {
|
|
220
219
|
// Remember the status
|
|
221
|
-
if ( node.initialHeartbeatStatus === '' ) {
|
|
222
|
-
node.initialHeartbeatStatus = response.data.status
|
|
223
|
-
}
|
|
224
220
|
node.lastHeartbeatStatus = response.data.status
|
|
225
221
|
|
|
226
222
|
// Based on the status...
|
|
227
223
|
if ( node.lastHeartbeatStatus === 'OK' ) {
|
|
228
|
-
|
|
224
|
+
// Successful heartbeat
|
|
225
|
+
node.configurationValidated = true; // Configuration is definitely OK
|
|
226
|
+
node.initialRetryCount = 0; // Reset retry counter on success
|
|
229
227
|
setStatus(node, {fill:"green",shape:"dot",text:"remote-access.status.serving"});
|
|
230
228
|
} else if ( node.lastHeartbeatStatus === 'NOTFOUND' ) {
|
|
231
|
-
// The local endpoint
|
|
229
|
+
// The local endpoint responded with a 404...
|
|
232
230
|
setStatus(node, {fill:"yellow",shape:"dot",text:"remote-access.status.heartbeaterrornotfound"});
|
|
233
231
|
node.log(`Heartbeat detected no valid endpoint, got a 404 response. Please check the base URL in the connection settings.`);
|
|
234
|
-
} else
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
} else {
|
|
233
|
+
// Heartbeat error - decide whether to reconnect
|
|
234
|
+
if ( node.configurationValidated === true ) {
|
|
235
|
+
// Configuration was validated before → Reconnect
|
|
237
236
|
setStatus(node, {fill:"red",shape:"dot",text:"remote-access.status.heartbeaterror"});
|
|
238
237
|
node.log(`Heartbeat error. Reconnecting soon.`);
|
|
239
238
|
// Set serving to false, checkServing will trigger reconnect and startSSH will kill old process
|
|
240
239
|
node.serving = false;
|
|
241
240
|
} else {
|
|
242
|
-
//
|
|
243
|
-
|
|
244
|
-
|
|
241
|
+
// Never worked yet - check if still in startup phase
|
|
242
|
+
if ( node.initialRetryCount < 3 ) {
|
|
243
|
+
// Still in startup phase - give it more chances (after reboot with slow network, Starlink reconnect, etc.)
|
|
244
|
+
node.initialRetryCount++;
|
|
245
|
+
setStatus(node, {fill:"yellow",shape:"dot",text:"remote-access.status.heartbeaterror"});
|
|
246
|
+
node.log(`Heartbeat error during startup (attempt ${node.initialRetryCount}/3). Reconnecting soon.`);
|
|
247
|
+
node.serving = false; // Trigger reconnect
|
|
248
|
+
} else {
|
|
249
|
+
// Too many failed attempts > Misconfiguration > NO reconnect
|
|
250
|
+
setStatus(node, {fill:"yellow",shape:"dot",text:"remote-access.status.heartbeaterroractive"});
|
|
251
|
+
node.log(`Heartbeat detected no valid endpoint. Please check your connection settings (Base URL, Serving Port and Protocol).`);
|
|
252
|
+
}
|
|
245
253
|
}
|
|
246
254
|
}
|
|
247
255
|
})
|
|
@@ -359,8 +367,9 @@ module.exports = function(RED) {
|
|
|
359
367
|
}
|
|
360
368
|
|
|
361
369
|
// Init heartbeat
|
|
362
|
-
node.
|
|
363
|
-
node.lastHeartbeatStatus = ''
|
|
370
|
+
node.configurationValidated = false; // Was the configuration EVER successfully validated?
|
|
371
|
+
node.lastHeartbeatStatus = '';
|
|
372
|
+
node.initialRetryCount = 0; // Counts retry attempts during startup phase
|
|
364
373
|
node.heartbeatinterval = setInterval(heartbeat, 5*60*1000, node);
|
|
365
374
|
|
|
366
375
|
// Call API for announce the instacehash and authentication, retrive server and port.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-remote",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Remote-RED is an ecosystem to bring remote access, push notification and geofencing to Node-RED. There are also additional functions like directly answer on a notification and homescreen widgets.",
|
|
5
5
|
"author": "Thorsten Heilmann",
|
|
6
6
|
"license": "GPL-3.0",
|