@iobroker/socket-classes 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/lib/socketCommands.js +16 -2
- package/lib/socketCommon.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/socketCommands.js
CHANGED
|
@@ -217,6 +217,10 @@ class SocketCommands {
|
|
|
217
217
|
if (socket && socket.subscribe && socket.subscribe[type] && this._updateSession(socket)) {
|
|
218
218
|
return !!socket.subscribe[type].find(sub => {
|
|
219
219
|
if (sub.regex.test(id)) {
|
|
220
|
+
// replace language
|
|
221
|
+
if (this.adapter._language && id === 'system.config' && obj.common) {
|
|
222
|
+
obj.common.language = this.adapter._language;
|
|
223
|
+
}
|
|
220
224
|
socket.emit(type, id, obj);
|
|
221
225
|
return true;
|
|
222
226
|
}
|
|
@@ -1028,8 +1032,13 @@ class SocketCommands {
|
|
|
1028
1032
|
__initCommandsObjects() {
|
|
1029
1033
|
this.commands['getObject'] = (socket, id, callback) => {
|
|
1030
1034
|
if (this._checkPermissions(socket, 'getObject', callback, id)) {
|
|
1031
|
-
this.adapter.getForeignObject(id, {user: socket._acl.user}, (err,
|
|
1032
|
-
|
|
1035
|
+
this.adapter.getForeignObject(id, {user: socket._acl.user}, (err, obj) => {
|
|
1036
|
+
// overload language from current instance
|
|
1037
|
+
if (this.adapter._language && id === 'system.config' && obj.common) {
|
|
1038
|
+
obj.common.language = this.adapter._language;
|
|
1039
|
+
}
|
|
1040
|
+
SocketCommands._fixCallback(callback, err, obj);
|
|
1041
|
+
});
|
|
1033
1042
|
}
|
|
1034
1043
|
};
|
|
1035
1044
|
|
|
@@ -1038,6 +1047,11 @@ class SocketCommands {
|
|
|
1038
1047
|
if (this._checkPermissions(socket, 'getObjects', callback)) {
|
|
1039
1048
|
this.adapter.getForeignObjects('*', 'state', 'rooms', {user: socket._acl.user}, (err, objs) => {
|
|
1040
1049
|
if (typeof callback === 'function') {
|
|
1050
|
+
// overload language
|
|
1051
|
+
if (this.adapter._language && objs['system.config'] && objs['system.config'].common) {
|
|
1052
|
+
objs['system.config'].common.language = this.adapter._language;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1041
1055
|
callback(err, objs);
|
|
1042
1056
|
} else {
|
|
1043
1057
|
this.adapter.log.warn('[getObjects] Invalid callback');
|
package/lib/socketCommon.js
CHANGED