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

smartfritz-promise

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smartfritz-promise - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3

cheerio.js

3

example.js

@@ -7,5 +7,2 @@ /**

* @author Andreas Goetz <cpuidle@gmx.de>
*
* Examples. To use install xml2json:
* npm install xml2json
*/

@@ -12,0 +9,0 @@

{
"name": "smartfritz-promise",
"version": "0.5.2",
"version": "0.5.3",
"description": "SmartHome for Fritz!Box and Dect!200 Node to communicate with AVM FritzBox over the aha-http-interface",

@@ -29,3 +29,3 @@ "author": {

"type": "git",
"url": "https://github.com/andig/smartfritz"
"url": "git+https://github.com/andig/smartfritz.git"
},

@@ -37,5 +37,6 @@ "dependencies": {

"request": ">=2.45.*",
"xml2json": "^0.9.0"
"xml2json-light": "^1.0.4"
},
"keywords": [
"Fritz!Box",
"FritzBox",

@@ -42,0 +43,0 @@ "SmartHome",

@@ -19,3 +19,3 @@ /**

var cheerio = require('cheerio');
var parser = require('xml2json');
var parser = require('xml2json-light');

@@ -104,3 +104,3 @@ // #############################################################################

return module.exports.getDeviceListInfo(sid, options).then(function(devicelistinfo) {
var devices = parser.toJson(devicelistinfo, {object:true});
var devices = parser.xml2json(devicelistinfo);
// extract devices as array

@@ -351,31 +351,31 @@ devices = [].concat((devices.devicelist || {}).device || []);

return executeCommand(sid, null, null, options, '/wlan/guest_access.lua?0=0').then(function(body) {
var settings = {};
var settings = extend(parseHTML(body), {
activate_guest_access: enable
});
if (enable) {
settings = parseHTML(body);
// checkboxes
for (var property in settings) {
if (settings[property] === true)
settings[property] = 'on';
else if (settings[property] === false)
delete settings[property];
}
settings.activate_guest_access = 'on';
// convert boolean to checkbox
for (var property in settings) {
if (settings[property] === true)
settings[property] = 'on';
else if (settings[property] === false)
delete settings[property];
}
// add "save" hints for various FB versions
settings.validate = 'apply';
settings.btnSave = '';
settings.xhr = 1;
// additional settings to apply values
settings = extend(settings, {
'sid': sid,
xhr: 1,
apply: '',
no_sidrenew: '',
oldpage: '/wlan/guest_access.lua'
});
var req = extend({
url: 'http://fritz.box',
method: 'POST',
form: settings
}, options || {});
req.url += '/wlan/guest_access.lua?sid=' + sid;
return new Promise(function(resolve, reject) {
var req = extend({
url: 'http://fritz.box',
method: 'POST',
form: settings
}, options || {});
req.url += '/data.lua';
return new Promise(function(resolve, reject) {
request(req, function(error, response, body) {

@@ -394,3 +394,3 @@ if (error || !(/^2/.test('' + response.statusCode)) || /action=".?login.lua"/.test(body)) {

else {
resolve(body.trim());
resolve(parseHTML(body));
}

@@ -397,0 +397,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