@iobroker/adapter-react-v5 7.4.2 → 7.4.4
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 +2 -2
- package/build/Components/FileBrowser.js +1 -1
- package/build/Components/FileBrowser.js.map +1 -1
- package/build/Components/IconDeviceType.d.ts +1 -1
- package/build/Components/IconDeviceType.js +5 -1
- package/build/Components/IconDeviceType.js.map +1 -1
- package/build/Components/IconPicker.js +0 -1
- package/build/Components/IconPicker.js.map +1 -1
- package/build/Components/Image.js.map +1 -1
- package/build/Components/Logo.js +4 -4
- package/build/Components/Logo.js.map +1 -1
- package/build/Components/ObjectBrowser.d.ts +8 -6
- package/build/Components/ObjectBrowser.js +2 -2
- package/build/Components/ObjectBrowser.js.map +1 -1
- package/build/Components/TextWithIcon.js +0 -1
- package/build/Components/TextWithIcon.js.map +1 -1
- package/build/Components/Utils.js +1 -3
- package/build/Components/Utils.js.map +1 -1
- package/build/Dialogs/SelectID.d.ts +2 -2
- package/build/Dialogs/SelectID.js +1 -1
- package/build/Dialogs/SelectID.js.map +1 -1
- package/build/GenericApp.js +1 -1
- package/build/GenericApp.js.map +1 -1
- package/build/LegacyConnection.d.ts +4 -7
- package/build/LegacyConnection.js +84 -160
- package/build/LegacyConnection.js.map +1 -1
- package/build/i18n/de.json +1 -1
- package/build/i18n/en.json +1 -0
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/types.d.ts +80 -0
- package/i18n/de.json +2 -2
- package/i18n/en.json +2 -1
- package/package.json +15 -15
|
@@ -13,73 +13,10 @@ export const PROGRESS = {
|
|
|
13
13
|
};
|
|
14
14
|
const PERMISSION_ERROR = 'permissionError';
|
|
15
15
|
const NOT_CONNECTED = 'notConnectedError';
|
|
16
|
-
const TIMEOUT_FOR_ADMIN4 = 1300;
|
|
17
16
|
export const ERRORS = {
|
|
18
17
|
PERMISSION_ERROR,
|
|
19
18
|
NOT_CONNECTED,
|
|
20
19
|
};
|
|
21
|
-
function fixAdminUI(obj) {
|
|
22
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
23
|
-
if (obj?.common && !obj.common.adminUI) {
|
|
24
|
-
if (obj.common.noConfig) {
|
|
25
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
26
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
27
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
28
|
-
obj.common.adminUI.config = 'none';
|
|
29
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
30
|
-
}
|
|
31
|
-
else if (obj.common.jsonConfig) {
|
|
32
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
33
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
34
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
35
|
-
obj.common.adminUI.config = 'json';
|
|
36
|
-
}
|
|
37
|
-
else if (obj.common.materialize) {
|
|
38
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
39
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
40
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
41
|
-
obj.common.adminUI.config = 'materialize';
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
45
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
46
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
47
|
-
obj.common.adminUI.config = 'html';
|
|
48
|
-
}
|
|
49
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
50
|
-
if (obj.common.jsonCustom) {
|
|
51
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
52
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
53
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
54
|
-
obj.common.adminUI.custom = 'json';
|
|
55
|
-
}
|
|
56
|
-
else if (obj.common.supportCustoms) {
|
|
57
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
58
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
59
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
60
|
-
obj.common.adminUI.custom = 'json';
|
|
61
|
-
}
|
|
62
|
-
if (obj.common.materializeTab && obj.common.adminTab) {
|
|
63
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
64
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
65
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
66
|
-
obj.common.adminUI.tab = 'materialize';
|
|
67
|
-
}
|
|
68
|
-
else if (obj.common.adminTab) {
|
|
69
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
70
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
71
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
72
|
-
obj.common.adminUI.tab = 'html';
|
|
73
|
-
}
|
|
74
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
75
|
-
if (obj.common.adminUI) {
|
|
76
|
-
console.debug(
|
|
77
|
-
// @ts-expect-error it is deprecated, but still could appear
|
|
78
|
-
`Please add to "${obj._id.replace(/\.\d+$/, '')}" common.adminUI=${JSON.stringify(obj.common.adminUI)}`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return obj;
|
|
82
|
-
}
|
|
83
20
|
/** Converts ioB pattern into regex */
|
|
84
21
|
export function pattern2RegEx(pattern) {
|
|
85
22
|
pattern = (pattern || '').toString();
|
|
@@ -117,7 +54,6 @@ export class LegacyConnection {
|
|
|
117
54
|
loaded = false;
|
|
118
55
|
loadTimer = null;
|
|
119
56
|
loadCounter = 0;
|
|
120
|
-
admin5only;
|
|
121
57
|
ignoreState = '';
|
|
122
58
|
simStates = {};
|
|
123
59
|
autoSubscribes;
|
|
@@ -152,7 +88,6 @@ export class LegacyConnection {
|
|
|
152
88
|
this.onError =
|
|
153
89
|
this.props.onError ||
|
|
154
90
|
((err) => console.error(err));
|
|
155
|
-
this.admin5only = this.props.admin5only || false;
|
|
156
91
|
this.startSocket();
|
|
157
92
|
}
|
|
158
93
|
/**
|
|
@@ -412,14 +347,9 @@ export class LegacyConnection {
|
|
|
412
347
|
this.acl = acl;
|
|
413
348
|
}
|
|
414
349
|
// Read system configuration
|
|
415
|
-
let
|
|
350
|
+
let systemConfig;
|
|
416
351
|
try {
|
|
417
|
-
|
|
418
|
-
data = await this.getCompactSystemConfig();
|
|
419
|
-
}
|
|
420
|
-
else {
|
|
421
|
-
data = await this.getSystemConfig();
|
|
422
|
-
}
|
|
352
|
+
systemConfig = await this.getSystemConfig();
|
|
423
353
|
if (this.doNotLoadACL) {
|
|
424
354
|
if (this.loaded) {
|
|
425
355
|
return;
|
|
@@ -430,7 +360,7 @@ export class LegacyConnection {
|
|
|
430
360
|
this.onProgress(PROGRESS.CONNECTED);
|
|
431
361
|
this.firstConnect = false;
|
|
432
362
|
}
|
|
433
|
-
this.systemConfig =
|
|
363
|
+
this.systemConfig = systemConfig;
|
|
434
364
|
if (this.systemConfig && this.systemConfig.common) {
|
|
435
365
|
this.systemLang = this.systemConfig.common.language;
|
|
436
366
|
}
|
|
@@ -451,7 +381,7 @@ export class LegacyConnection {
|
|
|
451
381
|
this.props.onReady && this.objects && this.props.onReady(this.objects);
|
|
452
382
|
}
|
|
453
383
|
else {
|
|
454
|
-
this.objects =
|
|
384
|
+
this.objects = { 'system.config': systemConfig };
|
|
455
385
|
this.onProgress(PROGRESS.READY);
|
|
456
386
|
this.props.onReady && this.props.onReady(this.objects);
|
|
457
387
|
}
|
|
@@ -478,7 +408,7 @@ export class LegacyConnection {
|
|
|
478
408
|
* @param binary Set to true if the given state is binary and requires Base64 decoding
|
|
479
409
|
* @param cb The callback
|
|
480
410
|
*/
|
|
481
|
-
subscribeState(id, binary, cb) {
|
|
411
|
+
async subscribeState(id, binary, cb) {
|
|
482
412
|
if (typeof binary === 'function') {
|
|
483
413
|
cb = binary;
|
|
484
414
|
binary = false;
|
|
@@ -492,7 +422,7 @@ export class LegacyConnection {
|
|
|
492
422
|
}
|
|
493
423
|
if (!cb) {
|
|
494
424
|
console.error('No callback found for subscribeState');
|
|
495
|
-
return;
|
|
425
|
+
return Promise.reject(new Error('No callback found for subscribeState'));
|
|
496
426
|
}
|
|
497
427
|
const toSubscribe = [];
|
|
498
428
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -525,16 +455,35 @@ export class LegacyConnection {
|
|
|
525
455
|
this._socket.emit('subscribe', toSubscribe);
|
|
526
456
|
}
|
|
527
457
|
if (binary) {
|
|
458
|
+
let base64;
|
|
528
459
|
for (let i = 0; i < ids.length; i++) {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
460
|
+
try {
|
|
461
|
+
// deprecated, but we still support it
|
|
462
|
+
base64 = await this.getBinaryState(ids[i]);
|
|
463
|
+
}
|
|
464
|
+
catch (e) {
|
|
465
|
+
console.error(`Cannot getBinaryState "${ids[i]}": ${JSON.stringify(e)}`);
|
|
466
|
+
base64 = undefined;
|
|
467
|
+
}
|
|
468
|
+
if (base64 !== undefined && cb) {
|
|
469
|
+
cb(ids[i], base64);
|
|
470
|
+
}
|
|
532
471
|
}
|
|
533
472
|
}
|
|
534
473
|
else {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
474
|
+
return new Promise((resolve, reject) => {
|
|
475
|
+
this._socket.emit(LegacyConnection.isWeb() ? 'getStates' : 'getForeignStates', ids, (err, states) => {
|
|
476
|
+
if (err) {
|
|
477
|
+
console.error(`Cannot getForeignStates "${id}": ${JSON.stringify(err)}`);
|
|
478
|
+
reject(new Error(err));
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
if (states) {
|
|
482
|
+
Object.keys(states).forEach(_id => cb(_id, states[_id]));
|
|
483
|
+
}
|
|
484
|
+
resolve();
|
|
485
|
+
}
|
|
486
|
+
});
|
|
538
487
|
});
|
|
539
488
|
}
|
|
540
489
|
}
|
|
@@ -1169,26 +1118,14 @@ export class LegacyConnection {
|
|
|
1169
1118
|
adapter = '';
|
|
1170
1119
|
}
|
|
1171
1120
|
adapter = adapter || '';
|
|
1172
|
-
if (!update && this._promises[`instances_${adapter}`]) {
|
|
1121
|
+
if (!update && this._promises[`instances_${adapter}`] instanceof Promise) {
|
|
1173
1122
|
return this._promises[`instances_${adapter}`];
|
|
1174
1123
|
}
|
|
1175
1124
|
if (!this.connected) {
|
|
1176
1125
|
return Promise.reject(new Error(NOT_CONNECTED));
|
|
1177
1126
|
}
|
|
1178
1127
|
this._promises[`instances_${adapter}`] = new Promise((resolve, reject) => {
|
|
1179
|
-
|
|
1180
|
-
timeout = null;
|
|
1181
|
-
this.getObjectView(`system.adapter.${adapter ? `${adapter}.` : ''}`, `system.adapter.${adapter ? `${adapter}.` : ''}\u9999`, 'instance')
|
|
1182
|
-
.then(items => resolve(Object.keys(items).map(id => fixAdminUI(items[id]))))
|
|
1183
|
-
.catch(e => reject(new Error(e)));
|
|
1184
|
-
}, TIMEOUT_FOR_ADMIN4);
|
|
1185
|
-
this._socket.emit('getAdapterInstances', adapter, (err, instances) => {
|
|
1186
|
-
if (timeout) {
|
|
1187
|
-
clearTimeout(timeout);
|
|
1188
|
-
timeout = null;
|
|
1189
|
-
err ? reject(new Error(err)) : resolve(instances);
|
|
1190
|
-
}
|
|
1191
|
-
});
|
|
1128
|
+
this._socket.emit('getAdapterInstances', adapter, (err, instances) => err ? reject(new Error(err)) : resolve(instances));
|
|
1192
1129
|
});
|
|
1193
1130
|
return this._promises[`instances_${adapter}`];
|
|
1194
1131
|
}
|
|
@@ -1207,27 +1144,15 @@ export class LegacyConnection {
|
|
|
1207
1144
|
adapter = '';
|
|
1208
1145
|
}
|
|
1209
1146
|
adapter = adapter || '';
|
|
1210
|
-
if (!update && this._promises[`adapter_${adapter}`]) {
|
|
1147
|
+
if (!update && this._promises[`adapter_${adapter}`] instanceof Promise) {
|
|
1211
1148
|
return this._promises[`adapter_${adapter}`];
|
|
1212
1149
|
}
|
|
1213
1150
|
if (!this.connected) {
|
|
1214
1151
|
return Promise.reject(new Error(NOT_CONNECTED));
|
|
1215
1152
|
}
|
|
1216
1153
|
this._promises[`adapter_${adapter}`] = new Promise((resolve, reject) => {
|
|
1217
|
-
let timeout = setTimeout(() => {
|
|
1218
|
-
timeout = null;
|
|
1219
|
-
this.getObjectView(`system.adapter.${adapter}.`, `system.adapter.${adapter}.\u9999`, 'adapter')
|
|
1220
|
-
.then(items => {
|
|
1221
|
-
resolve(Object.keys(items).map(id => fixAdminUI(items[id])));
|
|
1222
|
-
})
|
|
1223
|
-
.catch(e => reject(new Error(e)));
|
|
1224
|
-
}, TIMEOUT_FOR_ADMIN4);
|
|
1225
1154
|
this._socket.emit('getAdapters', adapter, (err, adapters) => {
|
|
1226
|
-
|
|
1227
|
-
clearTimeout(timeout);
|
|
1228
|
-
timeout = null;
|
|
1229
|
-
err ? reject(new Error(err)) : resolve(adapters);
|
|
1230
|
-
}
|
|
1155
|
+
err ? reject(new Error(err)) : resolve(adapters);
|
|
1231
1156
|
});
|
|
1232
1157
|
});
|
|
1233
1158
|
return this._promises[`adapter_${adapter}`];
|
|
@@ -1280,7 +1205,6 @@ export class LegacyConnection {
|
|
|
1280
1205
|
obj._id = newId;
|
|
1281
1206
|
if (newName !== undefined) {
|
|
1282
1207
|
obj.common = obj.common || {};
|
|
1283
|
-
// @ts-expect-error will be corrected in the next js-controller release
|
|
1284
1208
|
obj.common.name = newName;
|
|
1285
1209
|
}
|
|
1286
1210
|
return this.setObject(obj._id, obj).then(() => this.delObject(id));
|
|
@@ -1401,7 +1325,7 @@ export class LegacyConnection {
|
|
|
1401
1325
|
_enum,
|
|
1402
1326
|
/** Force update. */
|
|
1403
1327
|
update) {
|
|
1404
|
-
if (!update && this._promises[`enums_${_enum || 'all'}`]) {
|
|
1328
|
+
if (!update && this._promises[`enums_${_enum || 'all'}`] instanceof Promise) {
|
|
1405
1329
|
return this._promises[`enums_${_enum || 'all'}`];
|
|
1406
1330
|
}
|
|
1407
1331
|
if (!this.connected) {
|
|
@@ -1498,7 +1422,7 @@ export class LegacyConnection {
|
|
|
1498
1422
|
if (LegacyConnection.isWeb()) {
|
|
1499
1423
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1500
1424
|
}
|
|
1501
|
-
if (this._promises.cert && !update) {
|
|
1425
|
+
if (this._promises.cert instanceof Promise && !update) {
|
|
1502
1426
|
return this._promises.cert;
|
|
1503
1427
|
}
|
|
1504
1428
|
if (!this.connected) {
|
|
@@ -1703,7 +1627,7 @@ export class LegacyConnection {
|
|
|
1703
1627
|
if (LegacyConnection.isWeb()) {
|
|
1704
1628
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1705
1629
|
}
|
|
1706
|
-
if (!update && this._promises.hosts) {
|
|
1630
|
+
if (!update && this._promises.hosts instanceof Promise) {
|
|
1707
1631
|
return this._promises.hosts;
|
|
1708
1632
|
}
|
|
1709
1633
|
if (!this.connected) {
|
|
@@ -1730,7 +1654,7 @@ export class LegacyConnection {
|
|
|
1730
1654
|
if (LegacyConnection.isWeb()) {
|
|
1731
1655
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1732
1656
|
}
|
|
1733
|
-
if (!update && this._promises.users) {
|
|
1657
|
+
if (!update && this._promises.users instanceof Promise) {
|
|
1734
1658
|
return this._promises.users;
|
|
1735
1659
|
}
|
|
1736
1660
|
if (!this.connected) {
|
|
@@ -1754,7 +1678,7 @@ export class LegacyConnection {
|
|
|
1754
1678
|
* @param update Force update.
|
|
1755
1679
|
*/
|
|
1756
1680
|
getGroups(update) {
|
|
1757
|
-
if (!update && this._promises.groups) {
|
|
1681
|
+
if (!update && this._promises.groups instanceof Promise) {
|
|
1758
1682
|
return this._promises.groups;
|
|
1759
1683
|
}
|
|
1760
1684
|
if (!this.connected) {
|
|
@@ -1786,7 +1710,7 @@ export class LegacyConnection {
|
|
|
1786
1710
|
if (!host.startsWith('system.host.')) {
|
|
1787
1711
|
host += `system.host.${host}`;
|
|
1788
1712
|
}
|
|
1789
|
-
if (!update && this._promises[`hostInfo_${host}`]) {
|
|
1713
|
+
if (!update && this._promises[`hostInfo_${host}`] instanceof Promise) {
|
|
1790
1714
|
return this._promises[`hostInfo_${host}`];
|
|
1791
1715
|
}
|
|
1792
1716
|
if (!this.connected) {
|
|
@@ -1831,7 +1755,7 @@ export class LegacyConnection {
|
|
|
1831
1755
|
if (!host.startsWith('system.host.')) {
|
|
1832
1756
|
host += `system.host.${host}`;
|
|
1833
1757
|
}
|
|
1834
|
-
if (!update && this._promises[`hostInfoShort_${host}`]) {
|
|
1758
|
+
if (!update && this._promises[`hostInfoShort_${host}`] instanceof Promise) {
|
|
1835
1759
|
return this._promises[`hostInfoShort_${host}`];
|
|
1836
1760
|
}
|
|
1837
1761
|
if (!this.connected) {
|
|
@@ -1874,7 +1798,7 @@ export class LegacyConnection {
|
|
|
1874
1798
|
if (LegacyConnection.isWeb()) {
|
|
1875
1799
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1876
1800
|
}
|
|
1877
|
-
if (!update && this._promises.repo) {
|
|
1801
|
+
if (!update && this._promises.repo instanceof Promise) {
|
|
1878
1802
|
return this._promises.repo;
|
|
1879
1803
|
}
|
|
1880
1804
|
if (!this.connected) {
|
|
@@ -1920,7 +1844,7 @@ export class LegacyConnection {
|
|
|
1920
1844
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1921
1845
|
}
|
|
1922
1846
|
this._promises.installed = this._promises.installed || {};
|
|
1923
|
-
if (!update && this._promises.installed[host]) {
|
|
1847
|
+
if (!update && this._promises.installed[host] instanceof Promise) {
|
|
1924
1848
|
return this._promises.installed[host];
|
|
1925
1849
|
}
|
|
1926
1850
|
if (!this.connected) {
|
|
@@ -2038,7 +1962,7 @@ export class LegacyConnection {
|
|
|
2038
1962
|
feature,
|
|
2039
1963
|
/** Force update. */
|
|
2040
1964
|
update) {
|
|
2041
|
-
if (!update && this._promises[`supportedFeatures_${feature}`]) {
|
|
1965
|
+
if (!update && this._promises[`supportedFeatures_${feature}`] instanceof Promise) {
|
|
2042
1966
|
return this._promises[`supportedFeatures_${feature}`];
|
|
2043
1967
|
}
|
|
2044
1968
|
if (!this.connected) {
|
|
@@ -2195,7 +2119,7 @@ export class LegacyConnection {
|
|
|
2195
2119
|
* @param update Force update.
|
|
2196
2120
|
*/
|
|
2197
2121
|
getSystemConfig(update) {
|
|
2198
|
-
if (!update && this._promises.systemConfig) {
|
|
2122
|
+
if (!update && this._promises.systemConfig instanceof Promise) {
|
|
2199
2123
|
return this._promises.systemConfig;
|
|
2200
2124
|
}
|
|
2201
2125
|
if (!this.connected) {
|
|
@@ -2266,7 +2190,7 @@ export class LegacyConnection {
|
|
|
2266
2190
|
if (!host.startsWith('system.host.')) {
|
|
2267
2191
|
host = `system.host.${host}`;
|
|
2268
2192
|
}
|
|
2269
|
-
if (!update && this._promises[`IPs_${host}`]) {
|
|
2193
|
+
if (!update && this._promises[`IPs_${host}`] instanceof Promise) {
|
|
2270
2194
|
return this._promises[`IPs_${host}`];
|
|
2271
2195
|
}
|
|
2272
2196
|
this._promises[`IPs_${host}`] = this.getObject(host).then(obj => (obj?.common ? obj.common.address || [] : []));
|
|
@@ -2284,11 +2208,11 @@ export class LegacyConnection {
|
|
|
2284
2208
|
if (ipOrHostName.startsWith('system.host.')) {
|
|
2285
2209
|
ipOrHostName = ipOrHostName.replace(/^system\.host\./, '');
|
|
2286
2210
|
}
|
|
2287
|
-
if (!update && this._promises[`rIPs_${ipOrHostName}`]) {
|
|
2211
|
+
if (!update && this._promises[`rIPs_${ipOrHostName}`] instanceof Promise) {
|
|
2288
2212
|
return this._promises[`rIPs_${ipOrHostName}`];
|
|
2289
2213
|
}
|
|
2290
2214
|
this._promises[`rIPs_${ipOrHostName}`] = new Promise(resolve => {
|
|
2291
|
-
this._socket.emit('getHostByIp', ipOrHostName, (
|
|
2215
|
+
this._socket.emit('getHostByIp', ipOrHostName, (_ip, host) => {
|
|
2292
2216
|
const IPs4 = [{ name: '[IPv4] 0.0.0.0 - Listen on all IPs', address: '0.0.0.0', family: 'ipv4' }];
|
|
2293
2217
|
const IPs6 = [{ name: '[IPv6] :: - Listen on all IPs', address: '::', family: 'ipv6' }];
|
|
2294
2218
|
if (host?.native?.hardware?.networkInterfaces) {
|
|
@@ -2348,33 +2272,32 @@ export class LegacyConnection {
|
|
|
2348
2272
|
* Gets the version.
|
|
2349
2273
|
*/
|
|
2350
2274
|
getVersion(update) {
|
|
2351
|
-
if (update && this._promises.version) {
|
|
2352
|
-
|
|
2353
|
-
}
|
|
2354
|
-
this._promises.version =
|
|
2355
|
-
this.
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
});
|
|
2366
|
-
});
|
|
2275
|
+
if (!update && this._promises.version instanceof Promise) {
|
|
2276
|
+
return this._promises.version;
|
|
2277
|
+
}
|
|
2278
|
+
this._promises.version = new Promise((resolve, reject) => {
|
|
2279
|
+
this._socket.emit('getVersion', (err, version, serverName) => {
|
|
2280
|
+
// support of old socket.io
|
|
2281
|
+
if (err && !version && typeof err === 'string' && err.match(/\d+\.\d+\.\d+/)) {
|
|
2282
|
+
resolve({ version: err, serverName: 'socketio' });
|
|
2283
|
+
}
|
|
2284
|
+
else {
|
|
2285
|
+
err ? reject(new Error(err)) : resolve({ version, serverName });
|
|
2286
|
+
}
|
|
2287
|
+
});
|
|
2288
|
+
});
|
|
2367
2289
|
return this._promises.version;
|
|
2368
2290
|
}
|
|
2369
2291
|
/**
|
|
2370
2292
|
* Gets the web server name.
|
|
2371
2293
|
*/
|
|
2372
2294
|
getWebServerName() {
|
|
2373
|
-
this._promises.webName
|
|
2374
|
-
this._promises.webName
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2295
|
+
if (this._promises.webName instanceof Promise) {
|
|
2296
|
+
return this._promises.webName;
|
|
2297
|
+
}
|
|
2298
|
+
this._promises.webName = new Promise((resolve, reject) => {
|
|
2299
|
+
this._socket.emit('getAdapterName', (err, name) => err ? reject(new Error(err)) : resolve(name));
|
|
2300
|
+
});
|
|
2378
2301
|
return this._promises.webName;
|
|
2379
2302
|
}
|
|
2380
2303
|
/**
|
|
@@ -2506,7 +2429,7 @@ export class LegacyConnection {
|
|
|
2506
2429
|
return Promise.reject(new Error(NOT_CONNECTED));
|
|
2507
2430
|
}
|
|
2508
2431
|
return new Promise(resolve => {
|
|
2509
|
-
this._socket.emit('authEnabled', (
|
|
2432
|
+
this._socket.emit('authEnabled', (_isSecure, user) => resolve(user));
|
|
2510
2433
|
});
|
|
2511
2434
|
}
|
|
2512
2435
|
getCurrentSession(cmdTimeout) {
|
|
@@ -2555,11 +2478,12 @@ export class LegacyConnection {
|
|
|
2555
2478
|
if (!this.connected) {
|
|
2556
2479
|
return Promise.reject(new Error(NOT_CONNECTED));
|
|
2557
2480
|
}
|
|
2558
|
-
this._promises.currentInstance
|
|
2559
|
-
this._promises.currentInstance
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2481
|
+
if (this._promises.currentInstance instanceof Promise) {
|
|
2482
|
+
return this._promises.currentInstance;
|
|
2483
|
+
}
|
|
2484
|
+
this._promises.currentInstance = new Promise((resolve, reject) => {
|
|
2485
|
+
this._socket.emit('getCurrentInstance', (err, namespace) => err ? reject(new Error(err)) : resolve(namespace));
|
|
2486
|
+
});
|
|
2563
2487
|
return this._promises.currentInstance;
|
|
2564
2488
|
}
|
|
2565
2489
|
// returns very optimized information for adapters to minimize a connection load
|
|
@@ -2567,7 +2491,7 @@ export class LegacyConnection {
|
|
|
2567
2491
|
if (LegacyConnection.isWeb()) {
|
|
2568
2492
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2569
2493
|
}
|
|
2570
|
-
if (!update && this._promises.compactAdapters) {
|
|
2494
|
+
if (!update && this._promises.compactAdapters instanceof Promise) {
|
|
2571
2495
|
return this._promises.compactAdapters;
|
|
2572
2496
|
}
|
|
2573
2497
|
if (!this.connected) {
|
|
@@ -2588,7 +2512,7 @@ export class LegacyConnection {
|
|
|
2588
2512
|
if (LegacyConnection.isWeb()) {
|
|
2589
2513
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2590
2514
|
}
|
|
2591
|
-
if (!update && this._promises.compactInstances) {
|
|
2515
|
+
if (!update && this._promises.compactInstances instanceof Promise) {
|
|
2592
2516
|
return this._promises.compactInstances;
|
|
2593
2517
|
}
|
|
2594
2518
|
if (!this.connected) {
|
|
@@ -2613,7 +2537,7 @@ export class LegacyConnection {
|
|
|
2613
2537
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2614
2538
|
}
|
|
2615
2539
|
this._promises.installedCompact = this._promises.installedCompact || {};
|
|
2616
|
-
if (!update && this._promises.installedCompact[host]) {
|
|
2540
|
+
if (!update && this._promises.installedCompact[host] instanceof Promise) {
|
|
2617
2541
|
return this._promises.installedCompact[host];
|
|
2618
2542
|
}
|
|
2619
2543
|
if (!this.connected) {
|
|
@@ -2653,7 +2577,7 @@ export class LegacyConnection {
|
|
|
2653
2577
|
if (LegacyConnection.isWeb()) {
|
|
2654
2578
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2655
2579
|
}
|
|
2656
|
-
if (!update && this._promises.getCompactSystemRepositories) {
|
|
2580
|
+
if (!update && this._promises.getCompactSystemRepositories instanceof Promise) {
|
|
2657
2581
|
return this._promises.getCompactSystemRepositories;
|
|
2658
2582
|
}
|
|
2659
2583
|
if (!this.connected) {
|
|
@@ -2686,7 +2610,7 @@ export class LegacyConnection {
|
|
|
2686
2610
|
}
|
|
2687
2611
|
// returns very optimized information for adapters to minimize a connection load
|
|
2688
2612
|
getCompactSystemConfig(update) {
|
|
2689
|
-
if (!update && this._promises.systemConfigPromise) {
|
|
2613
|
+
if (!update && this._promises.systemConfigPromise instanceof Promise) {
|
|
2690
2614
|
return this._promises.systemConfigPromise;
|
|
2691
2615
|
}
|
|
2692
2616
|
if (!this.connected) {
|
|
@@ -2708,7 +2632,7 @@ export class LegacyConnection {
|
|
|
2708
2632
|
if (LegacyConnection.isWeb()) {
|
|
2709
2633
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2710
2634
|
}
|
|
2711
|
-
if (!update && this._promises.repoCompact) {
|
|
2635
|
+
if (!update && this._promises.repoCompact instanceof Promise) {
|
|
2712
2636
|
return this._promises.repoCompact;
|
|
2713
2637
|
}
|
|
2714
2638
|
if (!this.connected) {
|
|
@@ -2753,7 +2677,7 @@ export class LegacyConnection {
|
|
|
2753
2677
|
if (LegacyConnection.isWeb()) {
|
|
2754
2678
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2755
2679
|
}
|
|
2756
|
-
if (!update && this._promises.hostsCompact) {
|
|
2680
|
+
if (!update && this._promises.hostsCompact instanceof Promise) {
|
|
2757
2681
|
return this._promises.hostsCompact;
|
|
2758
2682
|
}
|
|
2759
2683
|
if (!this.connected) {
|
|
@@ -2768,7 +2692,7 @@ export class LegacyConnection {
|
|
|
2768
2692
|
* Get uuid
|
|
2769
2693
|
*/
|
|
2770
2694
|
getUuid() {
|
|
2771
|
-
if (this._promises.uuid) {
|
|
2695
|
+
if (this._promises.uuid instanceof Promise) {
|
|
2772
2696
|
return this._promises.uuid;
|
|
2773
2697
|
}
|
|
2774
2698
|
if (!this.connected) {
|