Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arlo

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arlo - npm Package Compare versions

Comparing version 0.0.4 to 1.0.0

81

lib/arlo.js
const data = require('./data');
const dateFormat = require('dateformat');
const session = require('./session');
const randomstring = require('randomstring');

@@ -11,22 +10,20 @@ // https://github.com/jeffreydwalter/arlo/blob/master/Arlo.py

const timeout = ms => new Promise(res => setTimeout(res, ms))
const timeout = ms => new Promise(res => setTimeout(res, ms));
const arlo = {
login: async(auth) => {
let d = await data.post({ path: 'login/v2', body: auth});
login: async auth => {
let d = await data.post({path: 'login/v2', body: auth});
userId = d.userId;
session.set(d);
},
logout: async() => {
await data.put({ path: 'logout'});
logout: async () => {
await data.put({path: 'logout'});
session.reset();
},
modes: {
set: async(mode) => {
let {
deviceId, xCloudId
} = await arlo.basestation.get();
set: async mode => {
let {deviceId, xCloudId} = await arlo.basestation.get();
let headers = {
xCloudId
xCloudId,
};

@@ -37,58 +34,64 @@

to: deviceId,
action: "set",
resource: "modes",
action: 'set',
resource: 'modes',
publishResponse: true,
properties: {
active: mode
}
}
active: mode,
},
};
let ret = await data.post({ path: `users/devices/notify/${deviceId}`, body, headers });
let ret = await data.post({
path: `users/devices/notify/${deviceId}`,
body,
headers,
});
var active = await arlo.modes.active();
while(active != mode) {
while (active != mode) {
await timeout(50);
active = await arlo.modes.active();
}
return ret;
},
active: async() => {
let automations = await data.get({ path: 'users/devices/automation/active'});
active: async () => {
let automations = await data.get({
path: 'users/devices/automation/active',
});
return automations[0].activeModes[0];
}
},
},
devices: {
get: async() => {
return await data.get({ path: 'users/devices'});
}
get: async () => {
return await data.get({path: 'users/devices'});
},
},
basestation: {
get: async() => {
get: async () => {
let devices = await arlo.devices.get();
return devices.filter(({deviceType}) => deviceType == 'basestation')[0];
}
},
},
cameras: {
get: async() => {
get: async () => {
let devices = await arlo.devices.get();
return devices.filter(({deviceType}) => deviceType == 'camera');
}
},
},
recordings: {
get: async({ from=new Date(), to=new Date()}={}) => {
get: async ({from = new Date(), to = new Date()} = {}) => {
const body = {
dateFrom: dateFormat(from, 'yyyymmdd'),
dateTo: dateFormat(to, 'yyyymmdd'),
}
return await data.post({ path: 'users/library', body });
};
return await data.post({path: 'users/library', body});
},
delete: async(recordings) => {
delete: async recordings => {
const body = {
data: [].concat(recordings || [])
data: [].concat(recordings || []),
};
return await r2.post({ path: 'users/library/recycle', body });
return await r2.post({path: 'users/library/recycle', body});
},
},
}
module.exports = arlo
};
module.exports = arlo;
//const r2 = require('r2');
const rp = require('request-promise');
const rp = require('request-promise-native');
const session = require('./session');
const request = async({
path, body, headers
}, method) => {
const request = async ({path, body, headers}, method) => {
let options = {
uri: `https://arlo.netgear.com/hmsweb/${path}`,
method,
headers: {...session.get(), ...headers
},
headers: {...session.get(), ...headers},
body,
json: true
json: true,
};

@@ -19,3 +16,3 @@

return resp.data;
}
};

@@ -31,5 +28,5 @@ const data = {

return await request(opts, 'PUT');
}
}
},
};
module.exports = data
module.exports = data;
var config;
const set = ({ token }) => {
const set = ({token}) => {
config = {
DNT: "1",
schemaVersion: "1",
Host: "arlo.netgear.com",
Referer: "https://arlo.netgear.com/",
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone)",
"Content-Type": "application/json;charset=utf-8",
Authorization: token
}
}
DNT: '1',
schemaVersion: '1',
Host: 'arlo.netgear.com',
Referer: 'https://arlo.netgear.com/',
'User-Agent':
'Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202 NETGEAR/v1 (iOS Vuezone)',
'Content-Type': 'application/json;charset=utf-8',
Authorization: token,
};
};
const get = () => {
return config;
}
};
const reset = () => {
set({});
}
};

@@ -26,4 +27,4 @@ const session = {

get,
reset
}
reset,
};

@@ -30,0 +31,0 @@ reset();

{
"name": "arlo",
"version": "0.0.4",
"version": "1.0.0",
"description": "modern, promise based library for interfacing with Arlo cameras",
"main": "index.js",
"scripts": {
"test": "mocha --timeout 60000"
"test": "jest"
},

@@ -13,10 +13,3 @@ "repository": {

},
"keywords": [
"arlo",
"iot",
"async",
"await",
"promise",
"camera"
],
"keywords": ["arlo", "iot", "async", "await", "promise", "camera"],
"author": "Roy Lines <roy@roylines.co.uk> (https://github.com/roylines)",

@@ -30,11 +23,8 @@ "license": "MIT",

"dateformat": "3.0.3",
"r2": "2.0.1",
"randomstring": "1.1.5",
"request": "2.88.0",
"request-promise": "4.2.4"
"request-promise-native": "1.0.8"
},
"devDependencies": {
"chai": "*",
"mocha": "*"
"jest": "25.1.0"
}
}
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