@iobroker/socket-classes 0.4.9 → 0.4.12

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 CHANGED
@@ -69,6 +69,15 @@ io.close();
69
69
  -->
70
70
 
71
71
  ## Changelog
72
+ ### 0.4.12 (2022-07-08)
73
+ * (bluefox) Corrected getAdapterInstances method
74
+
75
+ ### 0.4.11 (2022-07-05)
76
+ * (bluefox) Corrected log transportation
77
+
78
+ ### 0.4.10 (2022-06-22)
79
+ * (bluefox) Corrected getAdapterInstances
80
+
72
81
  ### 0.4.9 (2022-06-20)
73
82
  * (bluefox) Do not show error with failed authentication
74
83
 
@@ -371,7 +371,10 @@ class SocketCommands {
371
371
  } else if (type === 'objectChange') {
372
372
  this.adapter.unsubscribeForeignObjects && this.adapter.unsubscribeForeignObjects(pattern);
373
373
  } else if (type === 'log') {
374
- this.adapter.requireLog && this.adapter.requireLog(false);
374
+ if (this.adapter.requireLog && this.logEnabled) {
375
+ this.logEnabled = false;
376
+ this.adapter.requireLog(false);
377
+ }
375
378
  } else if (type === 'fileChange') {
376
379
  this.adapter.unsubscribeForeignFiles && this.adapter.unsubscribeForeignFiles(pattern, patternFile);
377
380
  }
@@ -388,7 +391,10 @@ class SocketCommands {
388
391
  this.adapter.unsubscribeForeignObjects && this.adapter.unsubscribeForeignObjects(pattern);
389
392
  } else if (type === 'log') {
390
393
  //console.log((socket._name || socket.id) + ' requireLog false');
391
- this.adapter.requireLog && this.adapter.requireLog(false);
394
+ if (this.adapter.requireLog && this.logEnabled) {
395
+ this.logEnabled = false;
396
+ this.adapter.requireLog(false);
397
+ }
392
398
  } else if (type === 'fileChange') {
393
399
  const [id, fileName] = pattern.split('####');
394
400
  this.adapter.unsubscribeForeignFiles && this.adapter.unsubscribeForeignFiles(id, fileName);
@@ -422,7 +428,10 @@ class SocketCommands {
422
428
  } else if (type === 'objectChange') {
423
429
  this.adapter.subscribeForeignObjects && this.adapter.subscribeForeignObjects(pattern);
424
430
  } else if (type === 'log') {
425
- this.adapter.requireLog && this.adapter.requireLog(true);
431
+ if (this.adapter.requireLog && !this.logEnabled) {
432
+ this.logEnabled = true;
433
+ this.adapter.requireLog(true);
434
+ }
426
435
  }
427
436
  } else {
428
437
  this.subscribes[type][pattern]++;
@@ -454,7 +463,10 @@ class SocketCommands {
454
463
  } else if (type === 'objectChange') {
455
464
  this.adapter.unsubscribeForeignObjects && this.adapter.unsubscribeForeignObjects(pattern);
456
465
  } else if (type === 'log') {
457
- this.adapter.requireLog && this.adapter.requireLog(false);
466
+ if (this.adapter.requireLog && !this.logEnabled) {
467
+ this.logEnabled = true;
468
+ this.adapter.requireLog(true);
469
+ }
458
470
  }
459
471
  delete this.subscribes[type][pattern];
460
472
  }
@@ -538,6 +550,42 @@ class SocketCommands {
538
550
  return this.commands[command];
539
551
  }
540
552
 
553
+ _fixAdminUI(obj) {
554
+ if (obj && obj.common && !obj.common.adminUI) {
555
+ if (obj.common.noConfig) {
556
+ obj.common.adminUI = obj.common.adminUI || {};
557
+ obj.common.adminUI.config = 'none';
558
+ } else if (obj.common.jsonConfig) {
559
+ obj.common.adminUI = obj.common.adminUI || {};
560
+ obj.common.adminUI.config = 'json';
561
+ } else if (obj.common.materialize) {
562
+ obj.common.adminUI = obj.common.adminUI || {};
563
+ obj.common.adminUI.config = 'materialize';
564
+ } else {
565
+ obj.common.adminUI = obj.common.adminUI || {};
566
+ obj.common.adminUI.config = 'html';
567
+ }
568
+
569
+ if (obj.common.jsonCustom) {
570
+ obj.common.adminUI = obj.common.adminUI || {};
571
+ obj.common.adminUI.custom = 'json';
572
+ } else if (obj.common.supportCustoms) {
573
+ obj.common.adminUI = obj.common.adminUI || {};
574
+ obj.common.adminUI.custom = 'json';
575
+ }
576
+
577
+ if (obj.common.materializeTab && obj.common.adminTab) {
578
+ obj.common.adminUI = obj.common.adminUI || {};
579
+ obj.common.adminUI.tab = 'materialize';
580
+ } else if (obj.common.adminTab) {
581
+ obj.common.adminUI = obj.common.adminUI || {};
582
+ obj.common.adminUI.tab = 'html';
583
+ }
584
+
585
+ obj.common.adminUI && this.adapter.log.debug(`Please add to "${obj._id.replace(/\.\d+$/, '')}" common.adminUI=${JSON.stringify(obj.common.adminUI)}`);
586
+ }
587
+ }
588
+
541
589
  __initCommandsCommon() {
542
590
  this.commands['authenticate'] = (socket, user, pass, callback) => {
543
591
  if (socket && socket.___socket) {
@@ -885,9 +933,9 @@ class SocketCommands {
885
933
  this.commands['getAdapterInstances'] = (socket, adapterName, callback) => {
886
934
  if (typeof callback === 'function') {
887
935
  if (this._checkPermissions(socket, 'getObject', callback)) {
888
- let _adapterName = adapterName || this.adapterName || '';
936
+ let _adapterName = adapterName !== undefined && adapterName !== null ? adapterName : this.adapterName || '';
889
937
  if (_adapterName) {
890
- _adapterName += '.'
938
+ _adapterName += '.';
891
939
  }
892
940
  this.adapter.getObjectView('system', 'instance',
893
941
  {startkey: `system.adapter.${_adapterName}`, endkey: `system.adapter.${_adapterName}\u9999`},
@@ -63,42 +63,6 @@ class SocketCommandsAdmin extends SocketCommands {
63
63
  this.onThresholdChanged = onThresholdChanged;
64
64
  }
65
65
 
66
- _fixAdminUI(obj) {
67
- if (obj && obj.common && !obj.common.adminUI) {
68
- if (obj.common.noConfig) {
69
- obj.common.adminUI = obj.common.adminUI || {};
70
- obj.common.adminUI.config = 'none';
71
- } else if (obj.common.jsonConfig) {
72
- obj.common.adminUI = obj.common.adminUI || {};
73
- obj.common.adminUI.config = 'json';
74
- } else if (obj.common.materialize) {
75
- obj.common.adminUI = obj.common.adminUI || {};
76
- obj.common.adminUI.config = 'materialize';
77
- } else {
78
- obj.common.adminUI = obj.common.adminUI || {};
79
- obj.common.adminUI.config = 'html';
80
- }
81
-
82
- if (obj.common.jsonCustom) {
83
- obj.common.adminUI = obj.common.adminUI || {};
84
- obj.common.adminUI.custom = 'json';
85
- } else if (obj.common.supportCustoms) {
86
- obj.common.adminUI = obj.common.adminUI || {};
87
- obj.common.adminUI.custom = 'json';
88
- }
89
-
90
- if (obj.common.materializeTab && obj.common.adminTab) {
91
- obj.common.adminUI = obj.common.adminUI || {};
92
- obj.common.adminUI.tab = 'materialize';
93
- } else if (obj.common.adminTab) {
94
- obj.common.adminUI = obj.common.adminUI || {};
95
- obj.common.adminUI.tab = 'html';
96
- }
97
-
98
- obj.common.adminUI && this.adapter.log.debug(`Please add to "${obj._id.replace(/\.\d+$/, '')}" common.adminUI=${JSON.stringify(obj.common.adminUI)}`);
99
- }
100
- }
101
-
102
66
  async updateRatings(uuid) {
103
67
  if (!uuid) {
104
68
  const obj = await this.adapter.getForeignObjectAsync('system.meta.uuid');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/socket-classes",
3
- "version": "0.4.9",
3
+ "version": "0.4.12",
4
4
  "description": "ioBroker server-side web sockets",
5
5
  "author": {
6
6
  "name": "bluefox",