Skip to content

Commit

Permalink
# 1.5.0 (2018-05-xx)
Browse files Browse the repository at this point in the history
* (bluefox) Breaking changes: "*?\" are no more allowed in IDs
* (bluefox) the read file function was protected
* (bluefox) possible access rights problem was closed
* (bluefox) the user by changing of states and objects is logged
* (apollon77) the node10 testing was added
  • Loading branch information
GermanBluefox committed May 3, 2018
1 parent 48ecdc3 commit 45cc32b
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 17 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 1.5.0 (2018-05-xx)
* (bluefox) Breaking changes: "*?\" are no more allowed in IDs
* (bluefox) the read file function was protected
* (bluefox) possible access rights problem was closed
* (bluefox) the user by changing of states and objects is logged
* (apollon77) the node10 testing was added

# 1.4.2 (2018-04-12)
Main changes: add instance with desired number, Force using of socket.io 2.1.0, Bugfixes

Expand Down
11 changes: 5 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
'use strict';

function getAppName() {
var parts = __dirname.replace(/\\/g, '/').split('/');
const parts = __dirname.replace(/\\/g, '/').split('/');
return parts[parts.length - 1].split('.')[0].toLowerCase();
}

module.exports = function (grunt) {

var srcDir = __dirname + '/';
var pkg = grunt.file.readJSON('package.json');
var iopackage = grunt.file.readJSON('io-package.json');
var appName = getAppName();

const srcDir = __dirname + '/';
const pkg = grunt.file.readJSON('package.json');
const iopackage = grunt.file.readJSON('io-package.json');
const appName = getAppName();

// Project configuration.
grunt.initConfig({
Expand Down
13 changes: 12 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"common": {
"name": "js-controller",
"version": "1.4.2",
"version": "1.5.0",
"platform": "Javascript/Node.js",
"controller": true,
"title": "JS controller",
Expand All @@ -17,6 +17,17 @@
"pl": "Kontroler JS"
},
"news": {
"1.5.0": {
"en": "see CHANGELOG.md",
"de": "Sehe CHANGELOG.md",
"ru": "см. CHANGELOG.md",
"pt": "veja CHANGELOG.md",
"nl": "zie CHANGELOG.md",
"fr": "voir CHANGELOG.md",
"it": "vedi CHANGELOG.md",
"es": "ver CHANGELOG.md",
"pl": "zobacz CHANGELOG.md"
},
"1.4.2": {
"en": "see CHANGELOG.md",
"de": "Sehe CHANGELOG.md",
Expand Down
23 changes: 22 additions & 1 deletion lib/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ function Adapter(options) {
if (options.instance !== undefined) {
initAdapter(options);
} else
if (!config.isInstall && res && res.val === true) {
if (!config.isInstall && res && res.val === true && !config.forceIfDisabled) {
logger.error(options.name + '.' + instance + ' already running');
process.exit(7);
} else {
Expand Down Expand Up @@ -1011,6 +1011,7 @@ function Adapter(options) {
logger.warn(that.namespace + ' Do not use parent or children for ' + id);
}
if (!obj.from) obj.from = 'system.adapter.' + that.namespace;
if (!obj.user) obj.user = (options ? options.user : '') || 'system.user.admin';
if (!obj.ts) obj.ts = new Date().getTime();
that.objects.setObject(id, obj, options, callback);
} else {
Expand Down Expand Up @@ -1175,12 +1176,14 @@ function Adapter(options) {
obj = extend(true, oldObj, obj);

if (!obj.from) obj.from = 'system.adapter.' + that.namespace;
if (!obj.user) obj.user = (options ? options.user : '') || 'system.user.admin';
if (!obj.ts) obj.ts = new Date().getTime();

that.objects.setObject(id, obj, options, callback);
});
} else {
if (!obj.from) obj.from = 'system.adapter.' + that.namespace;
if (!obj.user) obj.user = (options ? options.user : '') || 'system.user.admin';
if (!obj.ts) obj.ts = new Date().getTime();
that.objects.extendObject(id, obj, options, callback);
}
Expand Down Expand Up @@ -1214,6 +1217,7 @@ function Adapter(options) {
options = null;
}
if (!obj.from) obj.from = 'system.adapter.' + that.namespace;
if (!obj.user) obj.user = (options ? options.user : '') || 'system.user.admin';
if (!obj.ts) obj.ts = new Date().getTime();

that.objects.setObject(id, obj, options, callback);
Expand Down Expand Up @@ -1274,12 +1278,14 @@ function Adapter(options) {
obj = extend(true, oldObj, obj);

if (!obj.from) obj.from = 'system.adapter.' + that.namespace;
if (!obj.user) obj.user = (options ? options.user : '') || 'system.user.admin';
if (!obj.ts) obj.ts = new Date().getTime();

that.objects.setObject(id, obj, callback);
});
} else {
if (!obj.from) obj.from = 'system.adapter.' + that.namespace;
if (!obj.user) obj.user = (options ? options.user : '') || 'system.user.admin';
if (!obj.ts) obj.ts = new Date().getTime();

that.objects.extendObject(id, obj, options, callback);
Expand Down Expand Up @@ -1777,6 +1783,7 @@ function Adapter(options) {
that.objects.getObject(id, options, function (err, obj) {
if (!obj) {
if (!object.from) object.from = 'system.adapter.' + that.namespace;
if (!object.user) object.user = (options ? options.user : '') || 'system.user.admin';
if (!object.ts) object.ts = new Date().getTime();

that.objects.setObject(id, object, callback);
Expand All @@ -1798,6 +1805,7 @@ function Adapter(options) {
that.objects.getObject(id, options, function (err, _obj) {
if (!_obj) {
if (!obj.from) obj.from = 'system.adapter.' + that.namespace;
if (!obj.user) obj.user = (options ? options.user : '') || 'system.user.admin';
if (!obj.ts) obj.ts = new Date().getTime();

that.objects.setObject(id, obj, callback);
Expand Down Expand Up @@ -2112,6 +2120,7 @@ function Adapter(options) {
if (pos === -1) {
obj.common.members.push(objId);
obj.from = 'system.adapter.' + that.namespace;
obj.user = (options ? options.user : '') || 'system.user.admin';
obj.ts = new Date().getTime();

that.objects.setObject(obj._id, obj, options, function (err) {
Expand All @@ -2135,6 +2144,7 @@ function Adapter(options) {
obj.common.members.push(objId);

obj.from = 'system.adapter.' + that.namespace;
obj.user = (options ? options.user : '') || 'system.user.admin';
obj.ts = new Date().getTime();

that.objects.setObject(obj._id, obj, options, callback);
Expand Down Expand Up @@ -2211,6 +2221,7 @@ function Adapter(options) {
obj.common.members.splice(pos, 1);
count++;
obj.from = 'system.adapter.' + that.namespace;
obj.user = (options ? options.user : '') || 'system.user.admin';
obj.ts = new Date().getTime();

that.objects.setObject(obj._id, obj, options, function (err) {
Expand Down Expand Up @@ -2586,6 +2597,7 @@ function Adapter(options) {
if (pos === -1) {
obj.common.members.push(objId);
obj.from = 'system.adapter.' + that.namespace;
obj.user = (options ? options.user : '') || 'system.user.admin';
obj.ts = new Date().getTime();
that.objects.setObject(obj._id, obj, options, callback);
} else if (callback) {
Expand All @@ -2604,6 +2616,7 @@ function Adapter(options) {
if (pos === -1) {
obj.common.members.push(objId);
obj.from = 'system.adapter.' + that.namespace;
obj.user = (options ? options.user : '') || 'system.user.admin';
obj.ts = new Date().getTime();
that.objects.setObject(obj._id, obj, callback);
} else if (callback) {
Expand Down Expand Up @@ -2697,6 +2710,7 @@ function Adapter(options) {
obj.common.members.splice(pos, 1);
count++;
obj.from = 'system.adapter.' + that.namespace;
obj.user = (options ? options.user : '') || 'system.user.admin';
obj.ts = new Date().getTime();
that.objects.setObject(obj._id, obj, function (err) {
if (!--count && callback) {
Expand Down Expand Up @@ -3271,6 +3285,9 @@ function Adapter(options) {
} else
if (state.from !== undefined && state.from !== oldState.from) {
differ = true;
} else
if (state.user !== undefined && state.user !== oldState.user) {
differ = true;
}
if (differ) {
that.outputCount++;
Expand Down Expand Up @@ -3658,6 +3675,8 @@ function Adapter(options) {
}

state.from = 'system.adapter.' + that.namespace;
state.user = (options ? options.user : '') || 'system.user.admin';

if (options && options.user && options.user !== 'system.user.admin') {
checkStates(id, options, 'setState', function (err) {
if (err) {
Expand Down Expand Up @@ -3795,6 +3814,7 @@ function Adapter(options) {
}

state.from = 'system.adapter.' + that.namespace;
state.user = (options ? options.user : '') || 'system.user.admin';

if (options && options.user && options.user !== 'system.user.admin') {
checkStates(id, options, 'setState', function (err) {
Expand Down Expand Up @@ -3870,6 +3890,7 @@ function Adapter(options) {
}

state.from = 'system.adapter.' + that.namespace;
state.user = (options ? options.user : '') || 'system.user.admin';

if (options && options.user && options.user !== 'system.user.admin') {
checkStates(id, options, 'setState', function (err) {
Expand Down
4 changes: 1 addition & 3 deletions lib/objects/objectsInMemServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2694,9 +2694,7 @@ function ObjectsInMemServer(settings) {
if (objects[id]) {
if (objects[id].common && objects[id].common.dontDelete) {
if (typeof callback === 'function') {
setImmediate(function () {
callback('Object is marked as non deletable');
});
setImmediate(callback, 'Object is marked as non deletable');
}
return;
}
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "iobroker.js-controller",
"version": "1.4.2",
"version": "1.5.0",
"engines": {
"node": ">=4"
},
"optionalDependencies": {
"redis": "^2.8.0",
"greenlock": "^2.1.19",
"greenlock": "^2.2.7",
"le-challenge-fs": "^2.0.8",
"le-sni-auto": "^2.1.1",
"le-sni-auto": "^2.1.5",
"winston-syslog": "^1.2.6"
},
"bin": {
Expand All @@ -32,8 +32,8 @@
"semver": "^5.5.0",
"socket.io": "~2.1.0",
"socket.io-client": "~2.1.0",
"tar": "^4.4.1",
"winston": "^2.4.1",
"tar": "^4.4.2",
"winston": "^2.4.2",
"winston-daily-rotate-file": "^1.7.2",
"yargs": "^11.0.0"
},
Expand All @@ -48,7 +48,7 @@
"grunt-jsdoc": "^2.1.0",
"grunt-replace": "^1.0.1",
"istanbul": "^0.4.5",
"mocha": "^5.0.1"
"mocha": "^5.1.1"
},
"homepage": "http://www.iobroker.com",
"description": "...domesticate the Internet of Things",
Expand Down

0 comments on commit 45cc32b

Please sign in to comment.