Socket
Socket
Sign inDemoInstall

@semilimes/node-red-semilimes

Package Overview
Dependencies
Maintainers
0
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@semilimes/node-red-semilimes - npm Package Compare versions

Comparing version 1.1.5 to 1.1.6

2

package.json
{
"name": "@semilimes/node-red-semilimes",
"version": "1.1.5",
"version": "1.1.6",
"description": "The new semilimes connector which integrates with the public API",

@@ -5,0 +5,0 @@ "scripts": {

@@ -49,2 +49,4 @@ "use strict";

this.cameraList = config.cameraList;
var smeConnector = config.connector && RED.nodes.getNode(config.connector);

@@ -327,2 +329,5 @@ if (!smeConnector)

}
case 'camera_call': {
smeConnector.remoteAppInitiateCall(this.recipientId, this.groupChatId, this.cameraList);
}
default:

@@ -329,0 +334,0 @@ break;

@@ -44,2 +44,3 @@ "use strict";

var webSocket = new core.SmeWebSocket(serverWsURL, apiKey, xAccount);
var apiRemoteClient = new core.SmeRemoteClient();

@@ -92,2 +93,10 @@ var pjson = require('../package.json');

function remoteAppCallApi(endpoint, method, data, logEnabled = false) {
return apiRemoteClient.callApi(endpoint, method, data, logEnabled);
}
function remoteAppInitiateCall(recipientId, groupChatId, cameraIds) {
return apiRemoteClient.cameraInitiateCall(recipientId, groupChatId, cameraIds);
}
function addMessageListener(listener) {

@@ -112,2 +121,3 @@ webSocket.addMessageListener(listener);

this.addStatusListener = addStatusListener;
this.remoteAppInitiateCall = remoteAppInitiateCall;

@@ -185,2 +195,48 @@ //Get my P2P Chats (Contacts)

//Get cameras list
RED.httpAdmin.get(`/${connectorId}/sme-remote/cameras`, function (req, res, next) {
var endpoint = "/api/cameras";
var httpMethod = "GET";
remoteAppCallApi(endpoint, httpMethod, null)
.then(
value => {
res.json(value);
},
error => {
console.log(error);
res.status(500).send(error);
}
)
.catch(error => {
res.status(500).send(error);
})
});
//Initiate camera call
RED.httpAdmin.post(`/${connectorId}/sme-remote/cameras/initiatecall`, function (req, res, next) {
var body = req.body;
var endpoint = `/api/cameras/${body.cameraId}/initiatecall`;
var httpMethod = "POST";
var data = {
"groupChatId": body.groupChatId,
"cameraIds": body.cameraIds
};
remoteAppCallApi(endpoint, httpMethod, null)
.then(
value => {
res.json(value);
},
error => {
console.log(error);
res.status(500).send(error);
}
)
.catch(error => {
res.status(500).send(error);
})
});
};

@@ -187,0 +243,0 @@

@@ -15,3 +15,3 @@ "use strict";

const EventEmitter = require('events');
const ws = require('ws');
const WebSocket = require('ws');

@@ -293,3 +293,3 @@ function getTimestamp() {

webSocket = new ws.WebSocket(serverWsURL, options);
webSocket = new WebSocket(serverWsURL, options);
webSocket.setMaxListeners(0);

@@ -577,7 +577,49 @@ messageDeliver.emit('status', 'connecting...');

function SmeRemoteClient() {
function callApi(endpoint, method, data, logEnabled = false) {
return new Promise((resolve, reject) => {
let reqConfig = {
method,
url: `${process.env.SME_REMOTE_URL}${endpoint}`,
headers: {
'Authorization': `Bearer ${process.env.SME_REMOTE_API_KEY}`,
},
data
}
console.log("Trying to make sme remote request: ", reqConfig)
axios.request(reqConfig)
.then((response) => {
resolve(response.data);
})
.catch((error) => {
reject(error)
});
})
}
function cameraInitiateCall(recipientId, groupChatId, cameraIds) {
var endpoint = `/api/cameras/initiatecall`;
var httpMethod = "POST";
var data = {
"recipientId": recipientId,
"groupChatId": groupChatId,
"cameraIds": cameraIds
};
this.callApi(endpoint, httpMethod, data);
}
this.callApi = callApi;
this.cameraInitiateCall = cameraInitiateCall;
}
return {
SmeHelper: SmeHelper,
SmeApiClient: SmeApiClient,
SmeWebSocket: SmeWebSocket
SmeWebSocket: SmeWebSocket,
SmeRemoteClient: SmeRemoteClient
};
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc