@5minds/node-red-dashboard-2-processcube-audio-capture 0.1.6 → 0.1.8-develop-c587ec-mazg58el
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/ui-audio-capture.js +22 -1
- package/package.json +3 -3
|
@@ -9,10 +9,30 @@ module.exports = function (RED) {
|
|
|
9
9
|
|
|
10
10
|
const group = RED.nodes.getNode(config.group);
|
|
11
11
|
|
|
12
|
+
function addConnectionCredentials(RED, msg, conn) {
|
|
13
|
+
if (!msg._client) {
|
|
14
|
+
msg._client = {};
|
|
15
|
+
}
|
|
16
|
+
RED.plugins.getByType('node-red-dashboard-2').forEach((plugin) => {
|
|
17
|
+
if (plugin.hooks?.onAddConnectionCredentials && msg) {
|
|
18
|
+
msg = plugin.hooks.onAddConnectionCredentials(conn, msg);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
msg._client = {
|
|
22
|
+
...msg._client,
|
|
23
|
+
...{
|
|
24
|
+
socketId: conn.id,
|
|
25
|
+
socketIp: conn.handshake?.address,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return msg;
|
|
30
|
+
}
|
|
31
|
+
|
|
12
32
|
const evts = {
|
|
13
33
|
onSocket: {
|
|
14
34
|
'handle-audio': async function (conn, id, audioData) {
|
|
15
|
-
|
|
35
|
+
let msg = {};
|
|
16
36
|
msg.payload = audioData;
|
|
17
37
|
|
|
18
38
|
const audioBlob = Buffer.from(audioData.fileBase64, 'base64');
|
|
@@ -26,6 +46,7 @@ module.exports = function (RED) {
|
|
|
26
46
|
} else {
|
|
27
47
|
node.log(`Audio file saved to: ${tempFile.name}`);
|
|
28
48
|
msg.payload.filePath = tempFile.name;
|
|
49
|
+
msg = addConnectionCredentials(RED, msg, conn);
|
|
29
50
|
node.send(msg);
|
|
30
51
|
}
|
|
31
52
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@5minds/node-red-dashboard-2-processcube-audio-capture",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8-develop-c587ec-mazg58el",
|
|
4
4
|
"description": "A node to capture audio and pass the audio data on in the flow",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node-red",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dev:prod": "vite build --watch"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@5minds/processcube_engine_client": "^
|
|
43
|
+
"@5minds/processcube_engine_client": "^6.0.0",
|
|
44
44
|
"tmp": "^0.2.3",
|
|
45
45
|
"vue": "^3.3.8",
|
|
46
46
|
"vuex": "^4.1.0"
|
|
@@ -69,4 +69,4 @@
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
}
|