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

iobroker

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iobroker - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

4

doc/SCHEMA.md

@@ -650,3 +650,3 @@

* common.logLevel - (optional) debug, info, warn or error
* common.supportStopInstance- (optional) [true/false] if adapter supports signal stopInstance (messagebox required). The signal will be snet before stop to the adapter. (used if the problems occured with SIGTERM)
* common.supportStopInstance- (optional) [true/false] if adapter supports signal stopInstance (messagebox required). The signal will be sent before stop to the adapter. (used if the problems occured with SIGTERM)
* common.allowInit - (optional) [true/false] allow for "scheduled" adapter to be called "not in the time schedule", if settings changed or adapter started.

@@ -679,2 +679,4 @@ * common.onlyWWW - (optional) [true/false] say to controller, that adapter has only html files and no main.js, like rickshaw

* common.unchanged - (system) please do not use this flag. It is a flag to inform the system, that configuration dialog must be shown in admin.
* common.serviceStates - (optional) [true/false or path] if adapter can deliver additional states. If yes, the path adapter/lib/states.js will be called and it give following parameters function (objects, states, instance, config, callback). The function must deliver the array of points with values like function (err, result) { result = [{id: 'id1', val: 1}, {id: 'id2', val: 2}]}
* common.nogit - (optional) if true, no install from github directly is possible

@@ -681,0 +683,0 @@ #### instance

@@ -22,4 +22,6 @@ /**

var fs = require('fs');
var path = require('path');
var fs = require('fs');
var path = require('path');
var rootDir = path.normalize(__dirname + '/../../../');
var jsDir = rootDir + 'node_modules/iobroker.js-controller/';

@@ -74,3 +76,3 @@ // Save objects before exit

function setupWindows(callback) {
fs.writeFileSync(__dirname + '/../../../iobroker.bat', 'node node_modules/iobroker.js-controller/iobroker.js %1 %2 %3 %4 %5');
fs.writeFileSync(rootDir + 'iobroker.bat', 'node node_modules/iobroker.js-controller/iobroker.js %1 %2 %3 %4 %5');
console.log('Write "iobroker start" to start the ioBroker');

@@ -86,3 +88,3 @@

cnt++;
copyFile(__dirname + '/../install/windows/' + files[f], __dirname + '/../../../' + files[f], function () {
copyFile(__dirname + '/../install/windows/' + files[f], rootDir + files[f], function () {
if (!--cnt) {

@@ -92,4 +94,4 @@ // Call npm install node-windows

// js-controller installed as npm
console.log('npm install https://github.com/arthurblake/node-windows/tarball/f1fd60e93e2469663b99a9cf3a64086ecedfe1e4 --production --prefix "' + __dirname + '/../../../"');
var child = exec('npm install https://github.com/arthurblake/node-windows/tarball/f1fd60e93e2469663b99a9cf3a64086ecedfe1e4 --production --prefix "' + __dirname + '/../../../"');
console.log('npm install https://github.com/arthurblake/node-windows/tarball/f1fd60e93e2469663b99a9cf3a64086ecedfe1e4 --production --prefix "' + rootDir + '"');
var child = exec('npm install https://github.com/arthurblake/node-windows/tarball/f1fd60e93e2469663b99a9cf3a64086ecedfe1e4 --production --prefix "' + rootDir + '"');
child.stderr.pipe(process.stdout);

@@ -99,3 +101,3 @@ child.on('exit', function () {

// install node as service
var child1 = exec('node "' + __dirname + '/../../../install.js"');
var child1 = exec('node "' + rootDir + 'install.js"');
child1.stderr.pipe(process.stdout);

@@ -114,12 +116,12 @@ child1.on('exit', function () {

function setupFreeBSD(callback) {
fs.writeFileSync(__dirname + '/../../../iobroker', "node node_modules/iobroker.js-controller/iobroker.js $1 $2 $3 $4 $5", {mode: '755'});
fs.writeFileSync(rootDir + 'iobroker', "node node_modules/iobroker.js-controller/iobroker.js $1 $2 $3 $4 $5", {mode: '755'});
console.log('Write "service iobroker start" to start the ioBroker');
try {
if (!fs.existsSync(__dirname + '/../../iobroker.js-controller/iobroker')) {
fs.writeFileSync(__dirname + '/../../iobroker.js-controller/iobroker', "#!/usr/bin/env node\nrequire(__dirname + '/lib/setup.js');");
if (!fs.existsSync(jsDir + 'iobroker')) {
fs.writeFileSync(jsDir + 'iobroker', "#!/usr/bin/env node\nrequire(__dirname + '/lib/setup.js');");
}
fs.chmodSync(__dirname + '/../../../iobroker', '755');
fs.chmodSync(__dirname + '/../../iobroker.js-controller/iobroker', '755');
fs.chmodSync(rootDir + 'iobroker', '755');
fs.chmodSync(jsDir + 'iobroker', '755');
} catch (e) {
console.error('Cannot set permissions of ' + path.normalize(__dirname + '/../../iobroker.js-controller/iobroker'));
console.error('Cannot set permissions of ' + path.normalize(jsDir + 'iobroker'));
console.log('You can still manually copy ')

@@ -147,3 +149,3 @@ }

try {
fs.writeFileSync(__dirname + '/../../../install.sh', text, {mode: 511});
fs.writeFileSync(rootDir + 'install.sh', text, {mode: 511});
} catch (e) {

@@ -218,12 +220,12 @@

function setupLinux(callback) {
fs.writeFileSync(__dirname + '/../../../iobroker', "node node_modules/iobroker.js-controller/iobroker.js $1 $2 $3 $4 $5", {mode: '777'});
fs.writeFileSync(rootDir + 'iobroker', "node node_modules/iobroker.js-controller/iobroker.js $1 $2 $3 $4 $5", {mode: '777'});
console.log('Write "./iobroker start" to start the ioBroker');
try {
if (!fs.existsSync(__dirname + '/../../iobroker.js-controller/iobroker')) {
fs.writeFileSync(__dirname + '/../../iobroker.js-controller/iobroker', "#!/usr/bin/env node\nrequire(__dirname + '/lib/setup.js');");
if (!fs.existsSync(jsDir + 'iobroker')) {
fs.writeFileSync(jsDir + 'iobroker', "#!/usr/bin/env node\nrequire(__dirname + '/lib/setup.js');");
}
fs.chmodSync(__dirname + '/../../../iobroker', '777');
fs.chmodSync(__dirname + '/../../iobroker.js-controller/iobroker', '777');
fs.chmodSync(rootDir + 'iobroker', '777');
fs.chmodSync(jsDir + 'iobroker', '777');
} catch (e) {
console.error('Cannot set permissions of ' + path.normalize(__dirname + '/../../iobroker.js-controller/iobroker'));
console.error('Cannot set permissions of ' + path.normalize(jsDir + 'iobroker'));
console.log('You can still manually copy ')

@@ -251,3 +253,3 @@ }

try {
fs.writeFileSync(__dirname + '/../../../install.sh', text, {mode: 511});
fs.writeFileSync(rootDir + 'install.sh', text, {mode: 511});
} catch (e) {

@@ -307,3 +309,3 @@

console.log('-----------------------------------------------------');
console.log(' or just start "sh ' + path.normalize(__dirname + '/../../../install.sh') + '"');
console.log(' or just start "sh ' + path.normalize(rootDir + 'install.sh') + '"');
console.log('-----------------------------------------------------');

@@ -355,3 +357,3 @@ if (callback) callback();

console.log('-----------------------------------------------------');
console.log(' or just start "sudo bash ' + path.normalize(__dirname + '/../../../install.sh') + '"');
console.log(' or just start "sudo bash ' + path.normalize(rootDir + 'install.sh') + '"');
console.log('-----------------------------------------------------');

@@ -400,6 +402,6 @@ if (callback) callback();

if (platform === 'linux' || platform === 'darwin') {
cmd = 'npm install ' + packet + ' --production --prefix ' + _path;
cmd = 'npm install ' + packet + ' --production --save --prefix ' + _path;
if (isSudo) cmd = 'sudo ' + cmd;
} else {
cmd = 'npm install ' + packet + ' --production --prefix "' + _path + '"';
cmd = 'npm install ' + packet + ' --production --save --prefix "' + _path + '"';
}

@@ -426,9 +428,26 @@ console.log(cmd);

// install io-brocker.js-controller
// Create package.json in root directory, because required by npm
if (!fs.existsSync(rootDir + 'package.json')) {
var ownVersion = require(__dirname + '/../package.json').version;
fs.writeFileSync(rootDir + 'package.json', JSON.stringify({
name: 'iobroker.inst',
version: ownVersion,
private: true,
description: 'Automation platfrom in node.js',
dependencies: {
"iobroker": '~' + ownVersion,
"iobroker.discovery": "*",
"iobroker.admin": "*",
"iobroker.js-controller": "*"
}
}, null, 2));
}
// install io-brocker.js-controller
npmInstall('iobroker.discovery', false, function () {
npmInstall('iobroker.admin', false, function () {
npmInstall('iobroker.js-controller', false, function () {
if (!fs.existsSync(__dirname + '/../../../iobroker-data/iobroker.json')) {
if (fs.existsSync(__dirname + '/../../iobroker.js-controller/conf/iobroker-dist.json')) {
config = require(__dirname + '/../../iobroker.js-controller/conf/iobroker-dist.json');
if (!fs.existsSync(rootDir + 'iobroker-data/iobroker.json')) {
if (fs.existsSync(jsDir + 'conf/iobroker-dist.json')) {
config = require(jsDir + 'conf/iobroker-dist.json');
console.log('creating conf/iobroker.json');

@@ -442,19 +461,31 @@ config.objects.host = yargs.argv.objects || '127.0.0.1';

} else {
console.log('Could not find "' + __dirname + '/../../iobroker.js-controller/conf/iobroker-dist.json". Possible iobroker.js-controller was not installed');
console.log('Could not find "' + jsDir + 'conf/iobroker-dist.json". Possible iobroker.js-controller was not installed');
}
}
try {
// Create iobroker.sh and bat
if (!fs.existsSync(__dirname + '/../../../log')) fs.mkdirSync(__dirname + '/../../../log');
if (fs.existsSync(rootDir + 'package.json')) {
var pack = JSON.parse(fs.readFileSync(rootDir + 'package.json').toString());
if (fs.existsSync(rootDir + 'node_modules/iobroker.js-controller/package.json')) {
pack.dependencies['iobroker.js-controller'] = '~' + JSON.parse(fs.readFileSync(rootDir + 'node_modules/iobroker.js-controller/package.json').toString()).version;
}
if (fs.existsSync(rootDir + 'node_modules/iobroker.admin/package.json')) {
pack.dependencies['iobroker.admin'] = '~' + JSON.parse(fs.readFileSync(rootDir + 'node_modules/iobroker.admin/package.json').toString()).version;
}
if (fs.existsSync(rootDir + 'node_modules/iobroker.discovery/package.json')) {
pack.dependencies['iobroker.discovery'] = '~' + JSON.parse(fs.readFileSync(rootDir + 'node_modules/iobroker.discovery/package.json').toString()).version;
}
// Create package.json in root directory, because required by npm
if (!fs.existsSync(__dirname + '/../../../package.json')) {
fs.writeFileSync(__dirname + '/../../../package.json', JSON.stringify({
name: 'iobroker',
version: '1.0.0',
private: true,
description: 'Automation platfrom in node.js'
}, null, 2));
fs.writeFileSync(rootDir + 'package.json', JSON.stringify(pack, null, 2));
}
} catch (e) {
console.error('Cannot update ' + rootDir + 'package.json: ' + e);
}
try {
// Create iobroker.sh and bat
if (!fs.existsSync(rootDir + 'log')) fs.mkdirSync(rootDir + 'log');
// update package.json
if (platform === 'linux' || platform === 'darwin') {

@@ -461,0 +492,0 @@ setupLinux(callback);

@@ -30,6 +30,8 @@ var fs = require('fs');

for (var dev in ifaces) {
/*jshint loopfunc:true */
ifaces[dev].forEach(function (details) {
if (!details.internal) ipArr.push(details.address);
});
if (ifaces.hasOwnProperty(dev)) {
/*jshint loopfunc:true */
ifaces[dev].forEach(function (details) {
if (!details.internal) ipArr.push(details.address);
});
}
}

@@ -39,3 +41,3 @@ return ipArr;

function findPath(path, url, isImage) {
function findPath(path, url) {
if (!url) return '';

@@ -67,3 +69,3 @@ if (url.substring(0, 'http://'.length) === 'http://' ||

var tmpFile = __dirname + '/../tmp/' + (fileName || Math.floor(Math.random() * 0xFFFFFFE) + '.zip');
request(urlOrPath).on('error', function (error) {
request(urlOrPath).on('error', function (/* error */) {
console.log('Cannot download ' + tmpFile);

@@ -166,3 +168,2 @@ if (callback) callback(tmpFile);

if (callback) callback(null, urlOrPath);
return;
}

@@ -179,3 +180,3 @@ }

var ioPackage = JSON.parse(fs.readFileSync(path + 'io-package.json'));
var package = fs.existsSync(path + 'package.json') ? JSON.parse(fs.readFileSync(path + 'package.json')) : {};
var pack = fs.existsSync(path + 'package.json') ? JSON.parse(fs.readFileSync(path + 'package.json')) : {};
result[ioPackage.common.name] = {

@@ -191,4 +192,4 @@ controller: true,

runningVersion: hostRunningVersion,
license: ioPackage.common.license ? ioPackage.common.license : ((package.licenses && package.licenses.length) ? package.licenses[0].type : ''),
licenseUrl: (package.licenses && package.licenses.length) ? package.licenses[0].url : ''
license: ioPackage.common.license ? ioPackage.common.license : ((pack.licenses && pack.licenses.length) ? pack.licenses[0].type : ''),
licenseUrl: (pack.licenses && pack.licenses.length) ? pack.licenses[0].url : ''
};

@@ -201,3 +202,3 @@ var dirs = fs.readdirSync(__dirname + '/../adapter');

ioPackage = JSON.parse(fs.readFileSync(path + 'io-package.json'));
package = fs.existsSync(path + 'package.json') ? JSON.parse(fs.readFileSync(path + 'package.json')) : {};
pack = fs.existsSync(path + 'package.json') ? JSON.parse(fs.readFileSync(path + 'package.json')) : {};
result[ioPackage.common.name] = {

@@ -213,4 +214,4 @@ controller: false,

type: ioPackage.common.type,
license: ioPackage.common.license ? ioPackage.common.license : ((package.licenses && package.licenses.length) ? package.licenses[0].type : ''),
licenseUrl: (package.licenses && package.licenses.length) ? package.licenses[0].url : ''
license: ioPackage.common.license ? ioPackage.common.license : ((pack.licenses && pack.licenses.length) ? pack.licenses[0].type : ''),
licenseUrl: (pack.licenses && pack.licenses.length) ? pack.licenses[0].url : ''
};

@@ -228,3 +229,3 @@ }

ioPackage = JSON.parse(fs.readFileSync(path + 'io-package.json'));
package = fs.existsSync(path + 'package.json') ? JSON.parse(fs.readFileSync(path + 'package.json')) : {};
pack = fs.existsSync(path + 'package.json') ? JSON.parse(fs.readFileSync(path + 'package.json')) : {};
result[ioPackage.common.name] = {

@@ -240,4 +241,4 @@ controller: false,

type: ioPackage.common.type,
license: ioPackage.common.license ? ioPackage.common.license : ((package.licenses && package.licenses.length) ? package.licenses[0].type : ''),
licenseUrl: (package.licenses && package.licenses.length) ? package.licenses[0].url : ''
license: ioPackage.common.license ? ioPackage.common.license : ((pack.licenses && pack.licenses.length) ? pack.licenses[0].type : ''),
licenseUrl: (pack.licenses && pack.licenses.length) ? pack.licenses[0].url : ''
};

@@ -258,3 +259,3 @@ }

ioPackage = JSON.parse(fs.readFileSync(path + 'io-package.json'));
package = fs.existsSync(path + 'package.json') ? JSON.parse(fs.readFileSync(path + 'package.json')) : {};
pack = fs.existsSync(path + 'package.json') ? JSON.parse(fs.readFileSync(path + 'package.json')) : {};
result[ioPackage.common.name] = {

@@ -269,4 +270,4 @@ controller: false,

readme: ioPackage.common.readme,
license: ioPackage.common.license ? ioPackage.common.license : ((package.licenses && package.licenses.length) ? package.licenses[0].type : ''),
licenseUrl: (package.licenses && package.licenses.length) ? package.licenses[0].url : ''
license: ioPackage.common.license ? ioPackage.common.license : ((pack.licenses && pack.licenses.length) ? pack.licenses[0].type : ''),
licenseUrl: (pack.licenses && pack.licenses.length) ? pack.licenses[0].url : ''
};

@@ -312,36 +313,18 @@ }

adapter = adapter ? 'iobroker.' + adapter : 'iobroker';
var config = require(getConfigFileName());
if (0 && config.network.useSystemNpm) {
var cmd = 'npm view ' + adapter + ' dist-tags.latest';
//console.log(cmd + ' (System call)');
// Install node modules as system call
try {
initNpm(function (er, npm) {
npm.commands.view([adapter, 'dist-tags.latest'], true, function (error, response) {
if (error) return callback ? callback(error) : 0;
// System call used for update of js-controller itself,
// because during installation npm packet will be deleted too, but some files must be loaded even during the install process.
var exec = require('child_process').exec;
var child = exec(cmd, function (error, stdout, stderr) {
if (stdout) {
var lines = stdout.split('\n');
stdout = lines[0].replace('\r', '').trim();
}
if (callback) callback(error, stdout);
if (response) {
if (callback) callback(error, Object.keys(response)[0]);
} else {
if (callback) callback(error);
}
});
});
} else {
try {
initNpm(function (er, npm) {
npm.commands.view([adapter, 'dist-tags.latest'], true, function (error, response) {
if (error) return callback ? callback(error) : 0;
if (response) {
if (callback) callback(error, Object.keys(response)[0]);
} else {
if (callback) callback(error);
}
});
});
} catch (e) {
console.log('error by reading ' + adapter + ': ' + e);
if (callback) callback(e);
}
} catch (e) {
console.log('error by reading ' + adapter + ': ' + e);
if (callback) callback(e);
}

@@ -393,6 +376,6 @@ }

var sources = {};
var path = '';
var toRead = 0;
var path = '';
var toRead = 0;
var timeout = null;
var count = 0;
var count = 0;

@@ -460,2 +443,3 @@ if (!extend) extend = require('node.extend');

for (var name in sources) {
if (!sources.hasOwnProperty(name)) continue;
if (sources[name].url) sources[name].url = findPath(path, sources[name].url);

@@ -462,0 +446,0 @@ if (sources[name].meta) sources[name].meta = findPath(path, sources[name].meta);

{
"name": "iobroker",
"version": "1.0.2",
"version": "1.0.3",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=0.8"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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