@aaqu/fromcubes-portal-react 0.1.0-alpha.17 → 0.1.0-alpha.18
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/nodes/lib/helpers.js +0 -14
- package/nodes/portal-react.js +10 -9
- package/package.json +1 -1
package/nodes/lib/helpers.js
CHANGED
|
@@ -121,18 +121,6 @@ function removeRoute(router, path) {
|
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
function esc(s) {
|
|
125
|
-
return String(s)
|
|
126
|
-
.replace(/&/g, "&")
|
|
127
|
-
.replace(/</g, "<")
|
|
128
|
-
.replace(/>/g, ">")
|
|
129
|
-
.replace(/"/g, """);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function escScript(s) {
|
|
133
|
-
return String(s).replace(/<\/(script)/gi, "<\\/$1");
|
|
134
|
-
}
|
|
135
|
-
|
|
136
124
|
module.exports = function (RED) {
|
|
137
125
|
return createHelpers(RED);
|
|
138
126
|
};
|
|
@@ -307,8 +295,6 @@ function createHelpers(RED) {
|
|
|
307
295
|
removeRoute,
|
|
308
296
|
isSafeName,
|
|
309
297
|
validateSubPath,
|
|
310
|
-
esc,
|
|
311
|
-
escScript,
|
|
312
298
|
pkgRoot,
|
|
313
299
|
userDir,
|
|
314
300
|
cacheDir,
|
package/nodes/portal-react.js
CHANGED
|
@@ -243,7 +243,7 @@ module.exports = function (RED) {
|
|
|
243
243
|
}
|
|
244
244
|
pageState[endpoint] = { building: true, wsPath, pageTitle };
|
|
245
245
|
clients.forEach((ws) => {
|
|
246
|
-
try { if (ws.readyState === 1) ws.send(JSON.stringify({ type: "building" })); } catch (
|
|
246
|
+
try { if (ws.readyState === 1) ws.send(JSON.stringify({ type: "building" })); } catch (e) { RED.log.trace("[portal-react] ws send building: " + e.message); }
|
|
247
247
|
});
|
|
248
248
|
|
|
249
249
|
// Selective injection: only include components referenced in user code (+ transitive deps)
|
|
@@ -388,7 +388,7 @@ module.exports = function (RED) {
|
|
|
388
388
|
showWsStatus,
|
|
389
389
|
};
|
|
390
390
|
clients.forEach((ws) => {
|
|
391
|
-
try { if (ws.readyState === 1) ws.send(JSON.stringify({ type: "error", message: missingReturnError.error })); } catch (
|
|
391
|
+
try { if (ws.readyState === 1) ws.send(JSON.stringify({ type: "error", message: missingReturnError.error })); } catch (e) { RED.log.trace("[portal-react] ws send error frame: " + e.message); }
|
|
392
392
|
});
|
|
393
393
|
return;
|
|
394
394
|
}
|
|
@@ -413,7 +413,7 @@ module.exports = function (RED) {
|
|
|
413
413
|
);
|
|
414
414
|
node.status({ fill: "red", shape: "dot", text: "transpile error" });
|
|
415
415
|
clients.forEach((ws) => {
|
|
416
|
-
try { if (ws.readyState === 1) ws.send(JSON.stringify({ type: "error", message: compiled.error })); } catch (
|
|
416
|
+
try { if (ws.readyState === 1) ws.send(JSON.stringify({ type: "error", message: compiled.error })); } catch (e) { RED.log.trace("[portal-react] ws send transpile error: " + e.message); }
|
|
417
417
|
});
|
|
418
418
|
} else {
|
|
419
419
|
node.status({
|
|
@@ -482,7 +482,7 @@ module.exports = function (RED) {
|
|
|
482
482
|
if (!compiled.error && contentHash) {
|
|
483
483
|
const versionFrame = JSON.stringify({ type: "version", hash: contentHash });
|
|
484
484
|
clients.forEach((ws) => {
|
|
485
|
-
try { if (ws.readyState === 1) ws.send(versionFrame); } catch (
|
|
485
|
+
try { if (ws.readyState === 1) ws.send(versionFrame); } catch (e) { RED.log.trace("[portal-react] ws send version: " + e.message); }
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
488
|
|
|
@@ -607,7 +607,7 @@ module.exports = function (RED) {
|
|
|
607
607
|
// Plugin hook: plugins may reject the connection before upgrade.
|
|
608
608
|
// Default (no plugins) = allowed, matches dashboard behavior.
|
|
609
609
|
if (!hooks.allow("onIsValidConnection", request)) {
|
|
610
|
-
try { socket.destroy(); } catch (
|
|
610
|
+
try { socket.destroy(); } catch (e) { RED.log.trace("[portal-react] socket destroy: " + e.message); }
|
|
611
611
|
return;
|
|
612
612
|
}
|
|
613
613
|
wsServer.handleUpgrade(request, socket, head, (ws) => {
|
|
@@ -716,7 +716,8 @@ module.exports = function (RED) {
|
|
|
716
716
|
try {
|
|
717
717
|
ws.send(frame);
|
|
718
718
|
return true;
|
|
719
|
-
} catch (
|
|
719
|
+
} catch (e) {
|
|
720
|
+
RED.log.trace("[portal-react] ws send frame: " + e.message);
|
|
720
721
|
return false;
|
|
721
722
|
}
|
|
722
723
|
}
|
|
@@ -747,7 +748,7 @@ module.exports = function (RED) {
|
|
|
747
748
|
clients.forEach((ws) => {
|
|
748
749
|
try {
|
|
749
750
|
ws.close(1001, "node redeployed");
|
|
750
|
-
} catch (
|
|
751
|
+
} catch (e) { RED.log.trace("[portal-react] ws close client: " + e.message); }
|
|
751
752
|
});
|
|
752
753
|
clients.clear();
|
|
753
754
|
|
|
@@ -755,7 +756,7 @@ module.exports = function (RED) {
|
|
|
755
756
|
if (wsServer) {
|
|
756
757
|
try {
|
|
757
758
|
wsServer.close();
|
|
758
|
-
} catch (
|
|
759
|
+
} catch (e) { RED.log.trace("[portal-react] wsServer close: " + e.message); }
|
|
759
760
|
wsServer = null;
|
|
760
761
|
}
|
|
761
762
|
|
|
@@ -796,7 +797,7 @@ module.exports = function (RED) {
|
|
|
796
797
|
function wsSend(ws, obj) {
|
|
797
798
|
try {
|
|
798
799
|
if (ws.readyState === 1) ws.send(JSON.stringify(obj));
|
|
799
|
-
} catch (
|
|
800
|
+
} catch (e) { RED.log.trace("[portal-react] wsSend: " + e.message); }
|
|
800
801
|
}
|
|
801
802
|
|
|
802
803
|
function updateStatus() {
|