@iobroker/adapter-react-v5 7.2.4 → 7.2.6
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 +6 -6
- package/build/AdminConnection.d.ts +1 -0
- package/build/AdminConnection.js +2 -0
- package/build/AdminConnection.js.map +1 -0
- package/{src/Components/404.tsx → build/Components/404.js} +14 -39
- package/build/Components/404.js.map +1 -0
- package/{Components → build/Components}/ColorPicker.d.ts +2 -2
- package/{Components → build/Components}/ColorPicker.js +50 -65
- package/build/Components/ColorPicker.js.map +1 -0
- package/{Components → build/Components}/ComplexCron.d.ts +2 -2
- package/{Components → build/Components}/ComplexCron.js +43 -71
- package/build/Components/ComplexCron.js.map +1 -0
- package/{Components → build/Components}/CopyToClipboard.d.ts +1 -2
- package/{src/Components/CopyToClipboard.tsx → build/Components/CopyToClipboard.js} +20 -38
- package/build/Components/CopyToClipboard.js.map +1 -0
- package/{Components → build/Components}/CustomModal.d.ts +3 -3
- package/build/Components/CustomModal.js +60 -0
- package/build/Components/CustomModal.js.map +1 -0
- package/{Components → build/Components}/FileBrowser.d.ts +2 -2
- package/{Components → build/Components}/FileBrowser.js +229 -236
- package/build/Components/FileBrowser.js.map +1 -0
- package/build/Components/FileViewer.d.ts +48 -0
- package/build/Components/FileViewer.js +277 -0
- package/build/Components/FileViewer.js.map +1 -0
- package/{Components → build/Components}/Icon.d.ts +1 -1
- package/build/Components/Icon.js +140 -0
- package/build/Components/Icon.js.map +1 -0
- package/{Components → build/Components}/IconPicker.d.ts +2 -2
- package/build/Components/IconPicker.js +73 -0
- package/build/Components/IconPicker.js.map +1 -0
- package/{Components → build/Components}/IconSelector.d.ts +3 -3
- package/{Components → build/Components}/IconSelector.js +29 -57
- package/build/Components/IconSelector.js.map +1 -0
- package/{Components → build/Components}/Image.d.ts +2 -2
- package/{Components → build/Components}/Image.js +16 -22
- package/build/Components/Image.js.map +1 -0
- package/{Components → build/Components}/Loader.d.ts +2 -2
- package/{Components → build/Components}/Loader.js +15 -40
- package/build/Components/Loader.js.map +1 -0
- package/{Components → build/Components}/Loaders/MV.d.ts +2 -2
- package/build/Components/Loaders/MV.js +61 -0
- package/build/Components/Loaders/MV.js.map +1 -0
- package/{Components → build/Components}/Loaders/PT.d.ts +2 -2
- package/{Components → build/Components}/Loaders/PT.js +10 -35
- package/build/Components/Loaders/PT.js.map +1 -0
- package/{Components → build/Components}/Loaders/Vendor.d.ts +2 -2
- package/build/Components/Loaders/Vendor.js +52 -0
- package/build/Components/Loaders/Vendor.js.map +1 -0
- package/{Components → build/Components}/Logo.d.ts +2 -2
- package/build/Components/Logo.js +108 -0
- package/build/Components/Logo.js.map +1 -0
- package/{Components → build/Components}/MDUtils.d.ts +1 -2
- package/{Components → build/Components}/MDUtils.js +4 -9
- package/build/Components/MDUtils.js.map +1 -0
- package/{Components → build/Components}/ObjectBrowser.d.ts +4 -4
- package/{Components → build/Components}/ObjectBrowser.js +1152 -1116
- package/build/Components/ObjectBrowser.js.map +1 -0
- package/{Components → build/Components}/Router.d.ts +1 -2
- package/{Components → build/Components}/Router.js +6 -7
- package/build/Components/Router.js.map +1 -0
- package/{Components → build/Components}/SaveCloseButtons.d.ts +2 -2
- package/build/Components/SaveCloseButtons.js +65 -0
- package/build/Components/SaveCloseButtons.js.map +1 -0
- package/{Components → build/Components}/Schedule.d.ts +2 -2
- package/{Components → build/Components}/Schedule.js +242 -257
- package/build/Components/Schedule.js.map +1 -0
- package/{Components → build/Components}/SelectWithIcon.d.ts +2 -2
- package/build/Components/SelectWithIcon.js +135 -0
- package/build/Components/SelectWithIcon.js.map +1 -0
- package/build/Components/SimpleCron/cronText.js +15 -0
- package/build/Components/SimpleCron/cronText.js.map +1 -0
- package/{Components → build/Components}/SimpleCron/index.d.ts +2 -2
- package/{Components → build/Components}/SimpleCron/index.js +55 -58
- package/build/Components/SimpleCron/index.js.map +1 -0
- package/{Components → build/Components}/TabContainer.d.ts +2 -2
- package/build/Components/TabContainer.js +23 -0
- package/build/Components/TabContainer.js.map +1 -0
- package/{Components → build/Components}/TabContent.d.ts +3 -2
- package/build/Components/TabContent.js +20 -0
- package/build/Components/TabContent.js.map +1 -0
- package/build/Components/TabHeader.d.ts +6 -0
- package/build/Components/TabHeader.js +6 -0
- package/build/Components/TabHeader.js.map +1 -0
- package/{Components → build/Components}/TableResize.d.ts +2 -2
- package/{src/Components/TableResize.tsx → build/Components/TableResize.js} +64 -134
- package/build/Components/TableResize.js.map +1 -0
- package/{Components → build/Components}/TextWithIcon.d.ts +2 -2
- package/{src/Components/TextWithIcon.tsx → build/Components/TextWithIcon.js} +30 -75
- package/build/Components/TextWithIcon.js.map +1 -0
- package/{Components → build/Components}/ToggleThemeMenu.d.ts +1 -1
- package/build/Components/ToggleThemeMenu.js +13 -0
- package/build/Components/ToggleThemeMenu.js.map +1 -0
- package/{Components → build/Components}/TreeTable.d.ts +3 -3
- package/{Components → build/Components}/TreeTable.js +87 -99
- package/build/Components/TreeTable.js.map +1 -0
- package/{Components → build/Components}/UploadImage.d.ts +2 -2
- package/{Components → build/Components}/UploadImage.js +46 -69
- package/build/Components/UploadImage.js.map +1 -0
- package/{Components → build/Components}/Utils.d.ts +2 -2
- package/{Components → build/Components}/Utils.js +47 -60
- package/build/Components/Utils.js.map +1 -0
- package/build/Components/withWidth.d.ts +2 -0
- package/build/Components/withWidth.js +22 -0
- package/build/Components/withWidth.js.map +1 -0
- package/build/Connection.d.ts +1 -0
- package/build/Connection.js +2 -0
- package/build/Connection.js.map +1 -0
- package/{Dialogs → build/Dialogs}/ComplexCron.d.ts +2 -2
- package/build/Dialogs/ComplexCron.js +85 -0
- package/build/Dialogs/ComplexCron.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Confirm.d.ts +2 -2
- package/build/Dialogs/Confirm.js +83 -0
- package/build/Dialogs/Confirm.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Cron.d.ts +2 -2
- package/build/Dialogs/Cron.js +72 -0
- package/build/Dialogs/Cron.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Error.d.ts +2 -2
- package/build/Dialogs/Error.js +27 -0
- package/build/Dialogs/Error.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Message.d.ts +2 -2
- package/build/Dialogs/Message.js +29 -0
- package/build/Dialogs/Message.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SelectFile.d.ts +2 -2
- package/build/Dialogs/SelectFile.js +116 -0
- package/build/Dialogs/SelectFile.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SelectID.d.ts +3 -3
- package/{Dialogs → build/Dialogs}/SelectID.js +28 -53
- package/build/Dialogs/SelectID.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SimpleCron.d.ts +2 -2
- package/build/Dialogs/SimpleCron.js +46 -0
- package/build/Dialogs/SimpleCron.js.map +1 -0
- package/build/Dialogs/TextInput.d.ts +2 -0
- package/build/Dialogs/TextInput.js +31 -0
- package/build/Dialogs/TextInput.js.map +1 -0
- package/{GenericApp.d.ts → build/GenericApp.d.ts} +2 -3
- package/{GenericApp.js → build/GenericApp.js} +162 -176
- package/build/GenericApp.js.map +1 -0
- package/{LegacyConnection.d.ts → build/LegacyConnection.d.ts} +69 -4
- package/{LegacyConnection.js → build/LegacyConnection.js} +106 -99
- package/build/LegacyConnection.js.map +1 -0
- package/{Prompt.d.ts → build/Prompt.d.ts} +1 -1
- package/{Prompt.js → build/Prompt.js} +3 -4
- package/build/Prompt.js.map +1 -0
- package/build/Theme.d.ts +5 -0
- package/{Theme.js → build/Theme.js} +37 -32
- package/build/Theme.js.map +1 -0
- package/build/assets/devices/parseNames.d.ts +0 -0
- package/build/assets/devices/parseNames.js +35 -0
- package/build/assets/devices/parseNames.js.map +1 -0
- package/build/assets/rooms/parseNames.d.ts +0 -0
- package/build/assets/rooms/parseNames.js +35 -0
- package/build/assets/rooms/parseNames.js.map +1 -0
- package/build/dictionary.d.ts +1 -0
- package/build/dictionary.js +25 -0
- package/build/dictionary.js.map +1 -0
- package/build/i18n/de.json +449 -0
- package/build/i18n/en.json +449 -0
- package/build/i18n/es.json +449 -0
- package/build/i18n/fr.json +449 -0
- package/build/i18n/it.json +449 -0
- package/build/i18n/nl.json +449 -0
- package/build/i18n/pl.json +449 -0
- package/build/i18n/pt.json +449 -0
- package/build/i18n/ru.json +449 -0
- package/build/i18n/uk.json +449 -0
- package/build/i18n/zh-cn.json +449 -0
- package/{i18n.d.ts → build/i18n.d.ts} +2 -2
- package/{i18n.js → build/i18n.js} +9 -11
- package/build/i18n.js.map +1 -0
- package/build/icons/IconAdapter.d.ts +3 -0
- package/build/icons/IconAdapter.js +6 -0
- package/build/icons/IconAdapter.js.map +1 -0
- package/build/icons/IconAlias.d.ts +3 -0
- package/build/icons/IconAlias.js +6 -0
- package/build/icons/IconAlias.js.map +1 -0
- package/build/icons/IconChannel.d.ts +3 -0
- package/build/icons/IconChannel.js +9 -0
- package/build/icons/IconChannel.js.map +1 -0
- package/build/icons/IconClearFilter.d.ts +3 -0
- package/build/icons/IconClearFilter.js +7 -0
- package/build/icons/IconClearFilter.js.map +1 -0
- package/build/icons/IconClosed.d.ts +3 -0
- package/build/icons/IconClosed.js +6 -0
- package/build/icons/IconClosed.js.map +1 -0
- package/build/icons/IconCopy.d.ts +3 -0
- package/build/icons/IconCopy.js +5 -0
- package/build/icons/IconCopy.js.map +1 -0
- package/build/icons/IconDevice.d.ts +3 -0
- package/build/icons/IconDevice.js +15 -0
- package/build/icons/IconDevice.js.map +1 -0
- package/build/icons/IconDocument.d.ts +3 -0
- package/build/icons/IconDocument.js +6 -0
- package/build/icons/IconDocument.js.map +1 -0
- package/build/icons/IconDocumentReadOnly.d.ts +3 -0
- package/build/icons/IconDocumentReadOnly.js +7 -0
- package/build/icons/IconDocumentReadOnly.js.map +1 -0
- package/build/icons/IconExpert.d.ts +3 -0
- package/build/icons/IconExpert.js +6 -0
- package/build/icons/IconExpert.js.map +1 -0
- package/build/icons/IconFx.d.ts +3 -0
- package/build/icons/IconFx.js +5 -0
- package/build/icons/IconFx.js.map +1 -0
- package/build/icons/IconInstance.d.ts +3 -0
- package/build/icons/IconInstance.js +6 -0
- package/build/icons/IconInstance.js.map +1 -0
- package/build/icons/IconLogout.d.ts +3 -0
- package/build/icons/IconLogout.js +6 -0
- package/build/icons/IconLogout.js.map +1 -0
- package/build/icons/IconNoIcon.d.ts +3 -0
- package/build/icons/IconNoIcon.js +5 -0
- package/build/icons/IconNoIcon.js.map +1 -0
- package/build/icons/IconOpen.d.ts +3 -0
- package/build/icons/IconOpen.js +6 -0
- package/build/icons/IconOpen.js.map +1 -0
- package/{icons → build/icons}/IconProps.d.ts +1 -1
- package/build/icons/IconProps.js +2 -0
- package/build/icons/IconProps.js.map +1 -0
- package/build/icons/IconState.d.ts +3 -0
- package/build/icons/IconState.js +6 -0
- package/build/icons/IconState.js.map +1 -0
- package/build/index.d.ts +67 -0
- package/build/index.js +67 -0
- package/build/index.js.map +1 -0
- package/{types.d.ts → build/types.d.ts} +1 -1
- package/package.json +84 -48
- package/AdminConnection.d.ts +0 -2
- package/AdminConnection.js +0 -4
- package/Components/404.js +0 -101
- package/Components/CopyToClipboard.js +0 -163
- package/Components/CustomModal.js +0 -88
- package/Components/FileViewer.d.ts +0 -10
- package/Components/FileViewer.js +0 -305
- package/Components/Icon.js +0 -148
- package/Components/IconPicker.js +0 -98
- package/Components/Loaders/MV.js +0 -66
- package/Components/Loaders/Vendor.js +0 -77
- package/Components/Logo.js +0 -117
- package/Components/SaveCloseButtons.js +0 -69
- package/Components/SelectWithIcon.js +0 -168
- package/Components/SimpleCron/cronText.js +0 -19
- package/Components/TabContainer.js +0 -25
- package/Components/TabContent.js +0 -21
- package/Components/TabHeader.d.ts +0 -6
- package/Components/TabHeader.js +0 -11
- package/Components/TableResize.js +0 -226
- package/Components/TextWithIcon.js +0 -119
- package/Components/ToggleThemeMenu.js +0 -18
- package/Components/withWidth.d.ts +0 -3
- package/Components/withWidth.js +0 -27
- package/Connection.d.ts +0 -3
- package/Connection.js +0 -8
- package/Dialogs/ComplexCron.js +0 -90
- package/Dialogs/Confirm.js +0 -111
- package/Dialogs/Cron.js +0 -100
- package/Dialogs/Error.js +0 -55
- package/Dialogs/Message.js +0 -57
- package/Dialogs/SelectFile.js +0 -119
- package/Dialogs/SimpleCron.js +0 -51
- package/Dialogs/TextInput.d.ts +0 -3
- package/Dialogs/TextInput.js +0 -35
- package/Theme.d.ts +0 -6
- package/i18n/de.json +0 -449
- package/i18n/en.json +0 -449
- package/i18n/es.json +0 -449
- package/i18n/fr.json +0 -449
- package/i18n/it.json +0 -449
- package/i18n/nl.json +0 -449
- package/i18n/pl.json +0 -449
- package/i18n/pt.json +0 -449
- package/i18n/ru.json +0 -449
- package/i18n/uk.json +0 -449
- package/i18n/zh-cn.json +0 -449
- package/icons/IconAdapter.d.ts +0 -4
- package/icons/IconAdapter.js +0 -10
- package/icons/IconAlias.d.ts +0 -4
- package/icons/IconAlias.js +0 -10
- package/icons/IconChannel.d.ts +0 -4
- package/icons/IconChannel.js +0 -13
- package/icons/IconClearFilter.d.ts +0 -4
- package/icons/IconClearFilter.js +0 -11
- package/icons/IconClosed.d.ts +0 -4
- package/icons/IconClosed.js +0 -10
- package/icons/IconCopy.d.ts +0 -4
- package/icons/IconCopy.js +0 -9
- package/icons/IconDevice.d.ts +0 -4
- package/icons/IconDevice.js +0 -19
- package/icons/IconDocument.d.ts +0 -4
- package/icons/IconDocument.js +0 -10
- package/icons/IconDocumentReadOnly.d.ts +0 -4
- package/icons/IconDocumentReadOnly.js +0 -11
- package/icons/IconExpert.d.ts +0 -4
- package/icons/IconExpert.js +0 -10
- package/icons/IconFx.d.ts +0 -4
- package/icons/IconFx.js +0 -9
- package/icons/IconInstance.d.ts +0 -4
- package/icons/IconInstance.js +0 -10
- package/icons/IconLogout.d.ts +0 -4
- package/icons/IconLogout.js +0 -10
- package/icons/IconNoIcon.d.ts +0 -4
- package/icons/IconNoIcon.js +0 -9
- package/icons/IconOpen.d.ts +0 -4
- package/icons/IconOpen.js +0 -10
- package/icons/IconProps.js +0 -2
- package/icons/IconState.d.ts +0 -4
- package/icons/IconState.js +0 -10
- package/index.d.ts +0 -128
- package/index.js +0 -215
- package/src/AdminConnection.tsx +0 -3
- package/src/Components/ColorPicker.tsx +0 -343
- package/src/Components/ComplexCron.tsx +0 -561
- package/src/Components/CustomModal.tsx +0 -170
- package/src/Components/FileBrowser.tsx +0 -2560
- package/src/Components/FileViewer.tsx +0 -412
- package/src/Components/Icon.tsx +0 -238
- package/src/Components/IconPicker.tsx +0 -165
- package/src/Components/IconSelector.tsx +0 -2220
- package/src/Components/Image.tsx +0 -193
- package/src/Components/Loader.tsx +0 -328
- package/src/Components/Logo.tsx +0 -176
- package/src/Components/MDUtils.tsx +0 -104
- package/src/Components/ObjectBrowser.tsx +0 -8947
- package/src/Components/Router.tsx +0 -90
- package/src/Components/SaveCloseButtons.tsx +0 -117
- package/src/Components/Schedule.tsx +0 -1998
- package/src/Components/SelectWithIcon.tsx +0 -239
- package/src/Components/TabContainer.tsx +0 -57
- package/src/Components/TabContent.tsx +0 -38
- package/src/Components/TabHeader.tsx +0 -20
- package/src/Components/ToggleThemeMenu.tsx +0 -52
- package/src/Components/TreeTable.tsx +0 -1002
- package/src/Components/UploadImage.tsx +0 -643
- package/src/Components/Utils.tsx +0 -1802
- package/src/Components/loader.css +0 -231
- package/src/Components/withWidth.tsx +0 -32
- package/src/Connection.tsx +0 -5
- package/src/Dialogs/ComplexCron.tsx +0 -163
- package/src/Dialogs/Confirm.tsx +0 -185
- package/src/Dialogs/Cron.tsx +0 -192
- package/src/Dialogs/Error.tsx +0 -67
- package/src/Dialogs/Message.tsx +0 -73
- package/src/Dialogs/SelectFile.tsx +0 -280
- package/src/Dialogs/SelectID.tsx +0 -310
- package/src/Dialogs/SimpleCron.tsx +0 -101
- package/src/Dialogs/TextInput.tsx +0 -99
- package/src/GenericApp.tsx +0 -1076
- package/src/LegacyConnection.tsx +0 -3720
- package/src/Prompt.tsx +0 -22
- package/src/Theme.tsx +0 -472
- package/src/icons/IconAdapter.tsx +0 -22
- package/src/icons/IconAlias.tsx +0 -22
- package/src/icons/IconChannel.tsx +0 -60
- package/src/icons/IconClearFilter.tsx +0 -24
- package/src/icons/IconClosed.tsx +0 -22
- package/src/icons/IconCopy.tsx +0 -21
- package/src/icons/IconDevice.tsx +0 -126
- package/src/icons/IconDocument.tsx +0 -22
- package/src/icons/IconDocumentReadOnly.tsx +0 -27
- package/src/icons/IconExpert.tsx +0 -26
- package/src/icons/IconFx.tsx +0 -38
- package/src/icons/IconInstance.tsx +0 -22
- package/src/icons/IconLogout.tsx +0 -32
- package/src/icons/IconNoIcon.tsx +0 -21
- package/src/icons/IconOpen.tsx +0 -22
- package/src/icons/IconProps.tsx +0 -16
- package/src/icons/IconState.tsx +0 -38
- package/src/index.css +0 -56
- /package/{Components → build/Components}/404.d.ts +0 -0
- /package/{Components → build/Components}/SimpleCron/cronText.d.ts +0 -0
- /package/{assets → build/assets}/devices.json +0 -0
- /package/{assets → build/assets}/lamp_ceiling.svg +0 -0
- /package/{assets → build/assets}/lamp_table.svg +0 -0
- /package/{assets → build/assets}/no_icon.svg +0 -0
- /package/{assets → build/assets}/rooms.json +0 -0
- /package/{index.css → build/index.css} +0 -0
- /package/{tasks.js → tasksExample.js} +0 -0
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2020-2024, Denis Haev (bluefox) <dogafox@gmail.com>
|
|
4
|
-
*
|
|
5
|
-
* MIT License
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ERRORS = exports.PROGRESS = void 0;
|
|
10
|
-
exports.pattern2RegEx = pattern2RegEx;
|
|
11
1
|
/** Possible progress states. */
|
|
12
|
-
|
|
2
|
+
export const PROGRESS = {
|
|
13
3
|
/** The socket is connecting. */
|
|
14
4
|
CONNECTING: 0,
|
|
15
5
|
/** The socket is successfully connected. */
|
|
@@ -24,13 +14,13 @@ exports.PROGRESS = {
|
|
|
24
14
|
const PERMISSION_ERROR = 'permissionError';
|
|
25
15
|
const NOT_CONNECTED = 'notConnectedError';
|
|
26
16
|
const TIMEOUT_FOR_ADMIN4 = 1300;
|
|
27
|
-
|
|
17
|
+
export const ERRORS = {
|
|
28
18
|
PERMISSION_ERROR,
|
|
29
19
|
NOT_CONNECTED,
|
|
30
20
|
};
|
|
31
21
|
function fixAdminUI(obj) {
|
|
32
22
|
// @ts-expect-error it is deprecated, but still could appear
|
|
33
|
-
if (
|
|
23
|
+
if (obj?.common && !obj.common.adminUI) {
|
|
34
24
|
if (obj.common.noConfig) {
|
|
35
25
|
// @ts-expect-error it is deprecated, but still could appear
|
|
36
26
|
obj.common.adminUI = obj.common.adminUI || {};
|
|
@@ -91,35 +81,54 @@ function fixAdminUI(obj) {
|
|
|
91
81
|
return obj;
|
|
92
82
|
}
|
|
93
83
|
/** Converts ioB pattern into regex */
|
|
94
|
-
function pattern2RegEx(pattern) {
|
|
84
|
+
export function pattern2RegEx(pattern) {
|
|
95
85
|
pattern = (pattern || '').toString();
|
|
96
86
|
const startsWithWildcard = pattern[0] === '*';
|
|
97
87
|
const endsWithWildcard = pattern[pattern.length - 1] === '*';
|
|
98
88
|
pattern = pattern.replace(/[-/\\^$+?.()|[\]{}]/g, '\\$&').replace(/\*/g, '.*');
|
|
99
89
|
return (startsWithWildcard ? '' : '^') + pattern + (endsWithWildcard ? '' : '$');
|
|
100
90
|
}
|
|
101
|
-
class
|
|
91
|
+
export class LegacyConnection {
|
|
92
|
+
// Do not define it as null, else we must check for null everywhere
|
|
93
|
+
_socket;
|
|
94
|
+
_authTimer;
|
|
95
|
+
systemLang = 'en';
|
|
96
|
+
_waitForFirstConnection;
|
|
97
|
+
_waitForFirstConnectionResolve = null;
|
|
98
|
+
_promises = {};
|
|
99
|
+
_instanceSubscriptions;
|
|
100
|
+
props;
|
|
101
|
+
doNotLoadAllObjects;
|
|
102
|
+
doNotLoadACL;
|
|
103
|
+
states = {};
|
|
104
|
+
objects = null;
|
|
105
|
+
scriptLoadCounter;
|
|
106
|
+
acl = null;
|
|
107
|
+
firstConnect = true;
|
|
108
|
+
waitForRestart = false;
|
|
109
|
+
connected = false;
|
|
110
|
+
statesSubscribes = {};
|
|
111
|
+
objectsSubscribes = {};
|
|
112
|
+
filesSubscribes = {};
|
|
113
|
+
onConnectionHandlers = [];
|
|
114
|
+
onLogHandlers = [];
|
|
115
|
+
onProgress;
|
|
116
|
+
onError;
|
|
117
|
+
loaded = false;
|
|
118
|
+
loadTimer = null;
|
|
119
|
+
loadCounter = 0;
|
|
120
|
+
admin5only;
|
|
121
|
+
ignoreState = '';
|
|
122
|
+
simStates = {};
|
|
123
|
+
autoSubscribes;
|
|
124
|
+
autoSubscribeLog;
|
|
125
|
+
subscribed;
|
|
126
|
+
isSecure;
|
|
127
|
+
onCmdStdoutHandler;
|
|
128
|
+
onCmdStderrHandler;
|
|
129
|
+
onCmdExitHandler;
|
|
130
|
+
systemConfig = null;
|
|
102
131
|
constructor(props) {
|
|
103
|
-
this.systemLang = 'en';
|
|
104
|
-
this._waitForFirstConnectionResolve = null;
|
|
105
|
-
this._promises = {};
|
|
106
|
-
this.states = {};
|
|
107
|
-
this.objects = null;
|
|
108
|
-
this.acl = null;
|
|
109
|
-
this.firstConnect = true;
|
|
110
|
-
this.waitForRestart = false;
|
|
111
|
-
this.connected = false;
|
|
112
|
-
this.statesSubscribes = {};
|
|
113
|
-
this.objectsSubscribes = {};
|
|
114
|
-
this.filesSubscribes = {};
|
|
115
|
-
this.onConnectionHandlers = [];
|
|
116
|
-
this.onLogHandlers = [];
|
|
117
|
-
this.loaded = false;
|
|
118
|
-
this.loadTimer = null;
|
|
119
|
-
this.loadCounter = 0;
|
|
120
|
-
this.ignoreState = '';
|
|
121
|
-
this.simStates = {};
|
|
122
|
-
this.systemConfig = null;
|
|
123
132
|
props = props || { protocol: window.location.protocol, host: window.location.hostname };
|
|
124
133
|
this.props = props;
|
|
125
134
|
this.autoSubscribes = this.props.autoSubscribes || [];
|
|
@@ -128,7 +137,7 @@ class Connection {
|
|
|
128
137
|
this.props.host = this.props.host || window.location.hostname;
|
|
129
138
|
this.props.port =
|
|
130
139
|
this.props.port ||
|
|
131
|
-
(window.location.port === '3000' ? (
|
|
140
|
+
(window.location.port === '3000' ? (LegacyConnection.isWeb() ? 8082 : 8081) : window.location.port);
|
|
132
141
|
this.props.ioTimeout = Math.max(this.props.ioTimeout || 20000, 20000);
|
|
133
142
|
this.props.cmdTimeout = Math.max(this.props.cmdTimeout || 5000, 5000);
|
|
134
143
|
this._instanceSubscriptions = {};
|
|
@@ -155,7 +164,7 @@ class Connection {
|
|
|
155
164
|
const adapterName = window.adapterName;
|
|
156
165
|
return (adapterName === 'material' ||
|
|
157
166
|
adapterName === 'vis' ||
|
|
158
|
-
|
|
167
|
+
adapterName?.startsWith('vis-') ||
|
|
159
168
|
adapterName === 'echarts-show' ||
|
|
160
169
|
window.socketUrl !== undefined);
|
|
161
170
|
}
|
|
@@ -207,7 +216,7 @@ class Connection {
|
|
|
207
216
|
if (pos !== -1) {
|
|
208
217
|
path = path.substring(0, pos + 1);
|
|
209
218
|
}
|
|
210
|
-
if (
|
|
219
|
+
if (LegacyConnection.isWeb()) {
|
|
211
220
|
// remove one level, like echarts, vis, .... We have here: '/echarts/'
|
|
212
221
|
const parts = path.split('/');
|
|
213
222
|
if (parts.length > 2) {
|
|
@@ -254,7 +263,7 @@ class Connection {
|
|
|
254
263
|
}
|
|
255
264
|
});
|
|
256
265
|
this._socket.on('reconnect', () => {
|
|
257
|
-
this.onProgress(
|
|
266
|
+
this.onProgress(PROGRESS.READY);
|
|
258
267
|
this.connected = true;
|
|
259
268
|
if (this.waitForRestart) {
|
|
260
269
|
window.location.reload();
|
|
@@ -267,10 +276,10 @@ class Connection {
|
|
|
267
276
|
this._socket.on('disconnect', () => {
|
|
268
277
|
this.connected = false;
|
|
269
278
|
this.subscribed = false;
|
|
270
|
-
this.onProgress(
|
|
279
|
+
this.onProgress(PROGRESS.CONNECTING);
|
|
271
280
|
this.onConnectionHandlers.forEach(cb => cb(false));
|
|
272
281
|
});
|
|
273
|
-
this._socket.on('reauthenticate', () =>
|
|
282
|
+
this._socket.on('reauthenticate', () => LegacyConnection.authenticate());
|
|
274
283
|
this._socket.on('log', message => {
|
|
275
284
|
this.props.onLog && this.props.onLog(message);
|
|
276
285
|
this.onLogHandlers.forEach(cb => cb(message));
|
|
@@ -283,7 +292,7 @@ class Connection {
|
|
|
283
292
|
}
|
|
284
293
|
_err = _err.toString();
|
|
285
294
|
if (_err.includes('User not authorized')) {
|
|
286
|
-
|
|
295
|
+
LegacyConnection.authenticate();
|
|
287
296
|
}
|
|
288
297
|
else {
|
|
289
298
|
window.alert(`Socket Error: ${err}`);
|
|
@@ -332,7 +341,7 @@ class Connection {
|
|
|
332
341
|
}
|
|
333
342
|
}
|
|
334
343
|
else {
|
|
335
|
-
this.onProgress(
|
|
344
|
+
this.onProgress(PROGRESS.READY);
|
|
336
345
|
}
|
|
337
346
|
this._subscribe(true);
|
|
338
347
|
this.onConnectionHandlers.forEach(cb => cb(true));
|
|
@@ -398,7 +407,7 @@ class Connection {
|
|
|
398
407
|
this.loaded = true;
|
|
399
408
|
this.loadTimer && clearTimeout(this.loadTimer);
|
|
400
409
|
this.loadTimer = null;
|
|
401
|
-
this.onProgress(
|
|
410
|
+
this.onProgress(PROGRESS.CONNECTED);
|
|
402
411
|
this.firstConnect = false;
|
|
403
412
|
this.acl = acl;
|
|
404
413
|
}
|
|
@@ -418,7 +427,7 @@ class Connection {
|
|
|
418
427
|
this.loaded = true;
|
|
419
428
|
this.loadTimer && clearTimeout(this.loadTimer);
|
|
420
429
|
this.loadTimer = null;
|
|
421
|
-
this.onProgress(
|
|
430
|
+
this.onProgress(PROGRESS.CONNECTED);
|
|
422
431
|
this.firstConnect = false;
|
|
423
432
|
}
|
|
424
433
|
this.systemConfig = data;
|
|
@@ -438,12 +447,12 @@ class Connection {
|
|
|
438
447
|
this.props.onLanguage && this.props.onLanguage(this.systemLang);
|
|
439
448
|
if (!this.doNotLoadAllObjects) {
|
|
440
449
|
await this.getObjects();
|
|
441
|
-
this.onProgress(
|
|
450
|
+
this.onProgress(PROGRESS.READY);
|
|
442
451
|
this.props.onReady && this.objects && this.props.onReady(this.objects);
|
|
443
452
|
}
|
|
444
453
|
else {
|
|
445
454
|
this.objects = this.admin5only ? {} : { 'system.config': data };
|
|
446
|
-
this.onProgress(
|
|
455
|
+
this.onProgress(PROGRESS.READY);
|
|
447
456
|
this.props.onReady && this.props.onReady(this.objects);
|
|
448
457
|
}
|
|
449
458
|
}
|
|
@@ -523,7 +532,7 @@ class Connection {
|
|
|
523
532
|
}
|
|
524
533
|
}
|
|
525
534
|
else {
|
|
526
|
-
this._socket.emit(
|
|
535
|
+
this._socket.emit(LegacyConnection.isWeb() ? 'getStates' : 'getForeignStates', id, (err, states) => {
|
|
527
536
|
err && console.error(`Cannot getForeignStates "${id}": ${JSON.stringify(err)}`);
|
|
528
537
|
states && Object.keys(states).forEach(_id => cb(_id, states[_id]));
|
|
529
538
|
});
|
|
@@ -575,7 +584,7 @@ class Connection {
|
|
|
575
584
|
}
|
|
576
585
|
return new Promise((resolve, reject) => {
|
|
577
586
|
if (typeof cb === 'function' && this.connected) {
|
|
578
|
-
this._socket.emit(
|
|
587
|
+
this._socket.emit(LegacyConnection.isWeb() ? 'getStates' : 'getForeignStates', id, (err, states) => {
|
|
579
588
|
err && console.error(`Cannot getForeignStates "${id}": ${JSON.stringify(err)}`);
|
|
580
589
|
states && Object.keys(states).forEach(_id => cb(_id, states[_id]));
|
|
581
590
|
states
|
|
@@ -852,7 +861,7 @@ class Connection {
|
|
|
852
861
|
}
|
|
853
862
|
catch (e) {
|
|
854
863
|
const knownError = e;
|
|
855
|
-
console.error(`Error by callback of stateChange: ${knownError
|
|
864
|
+
console.error(`Error by callback of stateChange: ${knownError?.message}`);
|
|
856
865
|
}
|
|
857
866
|
});
|
|
858
867
|
}
|
|
@@ -891,7 +900,7 @@ class Connection {
|
|
|
891
900
|
return new Promise((resolve, reject) => {
|
|
892
901
|
this._socket.emit('getStates', pattern, (err, res) => {
|
|
893
902
|
this.states = res;
|
|
894
|
-
!disableProgressUpdate && this.onProgress(
|
|
903
|
+
!disableProgressUpdate && this.onProgress(PROGRESS.STATES_LOADED);
|
|
895
904
|
err ? reject(new Error(err)) : resolve(this.states);
|
|
896
905
|
});
|
|
897
906
|
});
|
|
@@ -1005,9 +1014,9 @@ class Connection {
|
|
|
1005
1014
|
resolve(this.objects);
|
|
1006
1015
|
}
|
|
1007
1016
|
else {
|
|
1008
|
-
this._socket.emit(
|
|
1017
|
+
this._socket.emit(LegacyConnection.isWeb() ? 'getObjects' : 'getAllObjects', (err, res) => {
|
|
1009
1018
|
this.objects = res;
|
|
1010
|
-
disableProgressUpdate && this.onProgress(
|
|
1019
|
+
disableProgressUpdate && this.onProgress(PROGRESS.OBJECTS_LOADED);
|
|
1011
1020
|
err ? reject(new Error(err)) : resolve(this.objects);
|
|
1012
1021
|
});
|
|
1013
1022
|
}
|
|
@@ -1041,7 +1050,7 @@ class Connection {
|
|
|
1041
1050
|
const ids = Object.keys(this.statesSubscribes);
|
|
1042
1051
|
ids.forEach(id => this._socket.emit('subscribe', id));
|
|
1043
1052
|
ids.length &&
|
|
1044
|
-
this._socket.emit(
|
|
1053
|
+
this._socket.emit(LegacyConnection.isWeb() ? 'getStates' : 'getForeignStates', ids, (err, states) => {
|
|
1045
1054
|
err && console.error(`Cannot getForeignStates: ${JSON.stringify(err)}`);
|
|
1046
1055
|
// inform about states
|
|
1047
1056
|
states && Object.keys(states).forEach(id => this.stateChange(id, states[id]));
|
|
@@ -1190,7 +1199,7 @@ class Connection {
|
|
|
1190
1199
|
* @param update Force update
|
|
1191
1200
|
*/
|
|
1192
1201
|
getAdapters(adapter, update) {
|
|
1193
|
-
if (
|
|
1202
|
+
if (LegacyConnection.isWeb()) {
|
|
1194
1203
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1195
1204
|
}
|
|
1196
1205
|
if (typeof adapter === 'boolean') {
|
|
@@ -1253,7 +1262,7 @@ class Connection {
|
|
|
1253
1262
|
* @param newName The new name.
|
|
1254
1263
|
*/
|
|
1255
1264
|
async renameGroup(id, newId, newName) {
|
|
1256
|
-
if (
|
|
1265
|
+
if (LegacyConnection.isWeb()) {
|
|
1257
1266
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1258
1267
|
}
|
|
1259
1268
|
const groups = await this.getGroups(true);
|
|
@@ -1486,7 +1495,7 @@ class Connection {
|
|
|
1486
1495
|
* @param update Force update.
|
|
1487
1496
|
*/
|
|
1488
1497
|
getCertificates(update) {
|
|
1489
|
-
if (
|
|
1498
|
+
if (LegacyConnection.isWeb()) {
|
|
1490
1499
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1491
1500
|
}
|
|
1492
1501
|
if (this._promises.cert && !update) {
|
|
@@ -1547,7 +1556,7 @@ class Connection {
|
|
|
1547
1556
|
* Get the logs from a host (only for admin connection).
|
|
1548
1557
|
*/
|
|
1549
1558
|
getLogs(host, linesNumber) {
|
|
1550
|
-
if (
|
|
1559
|
+
if (LegacyConnection.isWeb()) {
|
|
1551
1560
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1552
1561
|
}
|
|
1553
1562
|
if (!this.connected) {
|
|
@@ -1561,7 +1570,7 @@ class Connection {
|
|
|
1561
1570
|
* Get the log files (only for admin connection).
|
|
1562
1571
|
*/
|
|
1563
1572
|
getLogsFiles(host) {
|
|
1564
|
-
if (
|
|
1573
|
+
if (LegacyConnection.isWeb()) {
|
|
1565
1574
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1566
1575
|
}
|
|
1567
1576
|
if (!this.connected) {
|
|
@@ -1575,7 +1584,7 @@ class Connection {
|
|
|
1575
1584
|
* Delete the logs from a host (only for admin connection).
|
|
1576
1585
|
*/
|
|
1577
1586
|
delLogs(host) {
|
|
1578
|
-
if (
|
|
1587
|
+
if (LegacyConnection.isWeb()) {
|
|
1579
1588
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1580
1589
|
}
|
|
1581
1590
|
if (!this.connected) {
|
|
@@ -1691,7 +1700,7 @@ class Connection {
|
|
|
1691
1700
|
* @param update Force update.
|
|
1692
1701
|
*/
|
|
1693
1702
|
getHosts(update) {
|
|
1694
|
-
if (
|
|
1703
|
+
if (LegacyConnection.isWeb()) {
|
|
1695
1704
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1696
1705
|
}
|
|
1697
1706
|
if (!update && this._promises.hosts) {
|
|
@@ -1718,7 +1727,7 @@ class Connection {
|
|
|
1718
1727
|
* @param update Force update.
|
|
1719
1728
|
*/
|
|
1720
1729
|
getUsers(update) {
|
|
1721
|
-
if (
|
|
1730
|
+
if (LegacyConnection.isWeb()) {
|
|
1722
1731
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1723
1732
|
}
|
|
1724
1733
|
if (!update && this._promises.users) {
|
|
@@ -1771,7 +1780,7 @@ class Connection {
|
|
|
1771
1780
|
* @param timeoutMs Optional read timeout.
|
|
1772
1781
|
*/
|
|
1773
1782
|
getHostInfo(host, update, timeoutMs) {
|
|
1774
|
-
if (
|
|
1783
|
+
if (LegacyConnection.isWeb()) {
|
|
1775
1784
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1776
1785
|
}
|
|
1777
1786
|
if (!host.startsWith('system.host.')) {
|
|
@@ -1816,7 +1825,7 @@ class Connection {
|
|
|
1816
1825
|
* @param timeoutMs Optional read timeout.
|
|
1817
1826
|
*/
|
|
1818
1827
|
getHostInfoShort(host, update, timeoutMs) {
|
|
1819
|
-
if (
|
|
1828
|
+
if (LegacyConnection.isWeb()) {
|
|
1820
1829
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1821
1830
|
}
|
|
1822
1831
|
if (!host.startsWith('system.host.')) {
|
|
@@ -1862,7 +1871,7 @@ class Connection {
|
|
|
1862
1871
|
* @param timeoutMs Timeout in ms.
|
|
1863
1872
|
*/
|
|
1864
1873
|
getRepository(host, options, update, timeoutMs) {
|
|
1865
|
-
if (
|
|
1874
|
+
if (LegacyConnection.isWeb()) {
|
|
1866
1875
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1867
1876
|
}
|
|
1868
1877
|
if (!update && this._promises.repo) {
|
|
@@ -1907,7 +1916,7 @@ class Connection {
|
|
|
1907
1916
|
* @param cmdTimeout Timeout in ms.
|
|
1908
1917
|
*/
|
|
1909
1918
|
getInstalled(host, update, cmdTimeout) {
|
|
1910
|
-
if (
|
|
1919
|
+
if (LegacyConnection.isWeb()) {
|
|
1911
1920
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1912
1921
|
}
|
|
1913
1922
|
this._promises.installed = this._promises.installed || {};
|
|
@@ -1989,7 +1998,7 @@ class Connection {
|
|
|
1989
1998
|
cmdId,
|
|
1990
1999
|
/** Timeout of command in ms */
|
|
1991
2000
|
cmdTimeout) {
|
|
1992
|
-
if (
|
|
2001
|
+
if (LegacyConnection.isWeb()) {
|
|
1993
2002
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
1994
2003
|
}
|
|
1995
2004
|
if (!this.connected) {
|
|
@@ -2044,7 +2053,7 @@ class Connection {
|
|
|
2044
2053
|
* Read the base settings of a given host.
|
|
2045
2054
|
*/
|
|
2046
2055
|
async readBaseSettings(host) {
|
|
2047
|
-
if (
|
|
2056
|
+
if (LegacyConnection.isWeb()) {
|
|
2048
2057
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2049
2058
|
}
|
|
2050
2059
|
const result = await this.checkFeatureSupported('CONTROLLER_READWRITE_BASE_SETTINGS');
|
|
@@ -2088,7 +2097,7 @@ class Connection {
|
|
|
2088
2097
|
* @param config The new base settings.
|
|
2089
2098
|
*/
|
|
2090
2099
|
writeBaseSettings(host, config) {
|
|
2091
|
-
if (
|
|
2100
|
+
if (LegacyConnection.isWeb()) {
|
|
2092
2101
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2093
2102
|
}
|
|
2094
2103
|
return this.checkFeatureSupported('CONTROLLER_READWRITE_BASE_SETTINGS').then(result => {
|
|
@@ -2127,7 +2136,7 @@ class Connection {
|
|
|
2127
2136
|
* Send command to restart the iobroker on host
|
|
2128
2137
|
*/
|
|
2129
2138
|
restartController(host) {
|
|
2130
|
-
if (
|
|
2139
|
+
if (LegacyConnection.isWeb()) {
|
|
2131
2140
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2132
2141
|
}
|
|
2133
2142
|
return new Promise((resolve, reject) => {
|
|
@@ -2143,7 +2152,7 @@ class Connection {
|
|
|
2143
2152
|
* @param typeOfDiag one of none, normal, no-city, extended
|
|
2144
2153
|
*/
|
|
2145
2154
|
getDiagData(host, typeOfDiag) {
|
|
2146
|
-
if (
|
|
2155
|
+
if (LegacyConnection.isWeb()) {
|
|
2147
2156
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2148
2157
|
}
|
|
2149
2158
|
return new Promise(resolve => {
|
|
@@ -2157,7 +2166,7 @@ class Connection {
|
|
|
2157
2166
|
if (!this.connected) {
|
|
2158
2167
|
return Promise.reject(new Error(NOT_CONNECTED));
|
|
2159
2168
|
}
|
|
2160
|
-
if (
|
|
2169
|
+
if (LegacyConnection.isWeb()) {
|
|
2161
2170
|
return new Promise((resolve, reject) => {
|
|
2162
2171
|
this._socket.emit('getStates', pattern || '*', (err, states) => err ? reject(new Error(err)) : resolve(states));
|
|
2163
2172
|
});
|
|
@@ -2170,7 +2179,7 @@ class Connection {
|
|
|
2170
2179
|
* Get foreign objects by pattern, by specific type and resolve their enums. (Only admin)
|
|
2171
2180
|
*/
|
|
2172
2181
|
getForeignObjects(pattern, type) {
|
|
2173
|
-
if (
|
|
2182
|
+
if (LegacyConnection.isWeb()) {
|
|
2174
2183
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2175
2184
|
}
|
|
2176
2185
|
if (!this.connected) {
|
|
@@ -2238,7 +2247,7 @@ class Connection {
|
|
|
2238
2247
|
* Change the password of the given user.
|
|
2239
2248
|
*/
|
|
2240
2249
|
changePassword(user, password) {
|
|
2241
|
-
if (
|
|
2250
|
+
if (LegacyConnection.isWeb()) {
|
|
2242
2251
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2243
2252
|
}
|
|
2244
2253
|
return new Promise((resolve, reject) => {
|
|
@@ -2251,7 +2260,7 @@ class Connection {
|
|
|
2251
2260
|
getIpAddresses(host,
|
|
2252
2261
|
/** Force update. */
|
|
2253
2262
|
update) {
|
|
2254
|
-
if (
|
|
2263
|
+
if (LegacyConnection.isWeb()) {
|
|
2255
2264
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2256
2265
|
}
|
|
2257
2266
|
if (!host.startsWith('system.host.')) {
|
|
@@ -2260,7 +2269,7 @@ class Connection {
|
|
|
2260
2269
|
if (!update && this._promises[`IPs_${host}`]) {
|
|
2261
2270
|
return this._promises[`IPs_${host}`];
|
|
2262
2271
|
}
|
|
2263
|
-
this._promises[`IPs_${host}`] = this.getObject(host).then(obj => (
|
|
2272
|
+
this._promises[`IPs_${host}`] = this.getObject(host).then(obj => (obj?.common ? obj.common.address || [] : []));
|
|
2264
2273
|
return this._promises[`IPs_${host}`];
|
|
2265
2274
|
}
|
|
2266
2275
|
/**
|
|
@@ -2269,7 +2278,7 @@ class Connection {
|
|
|
2269
2278
|
getHostByIp(ipOrHostName,
|
|
2270
2279
|
/** Force update. */
|
|
2271
2280
|
update) {
|
|
2272
|
-
if (
|
|
2281
|
+
if (LegacyConnection.isWeb()) {
|
|
2273
2282
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2274
2283
|
}
|
|
2275
2284
|
if (ipOrHostName.startsWith('system.host.')) {
|
|
@@ -2280,10 +2289,9 @@ class Connection {
|
|
|
2280
2289
|
}
|
|
2281
2290
|
this._promises[`rIPs_${ipOrHostName}`] = new Promise(resolve => {
|
|
2282
2291
|
this._socket.emit('getHostByIp', ipOrHostName, (ip, host) => {
|
|
2283
|
-
var _a, _b;
|
|
2284
2292
|
const IPs4 = [{ name: '[IPv4] 0.0.0.0 - Listen on all IPs', address: '0.0.0.0', family: 'ipv4' }];
|
|
2285
2293
|
const IPs6 = [{ name: '[IPv6] :: - Listen on all IPs', address: '::', family: 'ipv6' }];
|
|
2286
|
-
if (
|
|
2294
|
+
if (host?.native?.hardware?.networkInterfaces) {
|
|
2287
2295
|
for (const eth in host.native.hardware.networkInterfaces) {
|
|
2288
2296
|
if (!Object.prototype.hasOwnProperty.call(host.native.hardware.networkInterfaces, eth)) {
|
|
2289
2297
|
continue;
|
|
@@ -2318,7 +2326,7 @@ class Connection {
|
|
|
2318
2326
|
* Encrypt a text
|
|
2319
2327
|
*/
|
|
2320
2328
|
encrypt(text) {
|
|
2321
|
-
if (
|
|
2329
|
+
if (LegacyConnection.isWeb()) {
|
|
2322
2330
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2323
2331
|
}
|
|
2324
2332
|
return new Promise((resolve, reject) => {
|
|
@@ -2329,7 +2337,7 @@ class Connection {
|
|
|
2329
2337
|
* Decrypt a text
|
|
2330
2338
|
*/
|
|
2331
2339
|
decrypt(encryptedText) {
|
|
2332
|
-
if (
|
|
2340
|
+
if (LegacyConnection.isWeb()) {
|
|
2333
2341
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2334
2342
|
}
|
|
2335
2343
|
return new Promise((resolve, reject) => {
|
|
@@ -2387,7 +2395,7 @@ class Connection {
|
|
|
2387
2395
|
* @param options.mode Access rights. Default is 0x644
|
|
2388
2396
|
*/
|
|
2389
2397
|
chmodFile(adapter, fileName, options) {
|
|
2390
|
-
if (
|
|
2398
|
+
if (LegacyConnection.isWeb()) {
|
|
2391
2399
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2392
2400
|
}
|
|
2393
2401
|
if (!this.connected) {
|
|
@@ -2407,7 +2415,7 @@ class Connection {
|
|
|
2407
2415
|
* @param options.ownerGroup Group name
|
|
2408
2416
|
*/
|
|
2409
2417
|
chownFile(adapter, fileName, options) {
|
|
2410
|
-
if (
|
|
2418
|
+
if (LegacyConnection.isWeb()) {
|
|
2411
2419
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2412
2420
|
}
|
|
2413
2421
|
if (!this.connected) {
|
|
@@ -2435,7 +2443,7 @@ class Connection {
|
|
|
2435
2443
|
* Get the alarm notifications from a host (only for admin connection).
|
|
2436
2444
|
*/
|
|
2437
2445
|
getNotifications(host, category) {
|
|
2438
|
-
if (
|
|
2446
|
+
if (LegacyConnection.isWeb()) {
|
|
2439
2447
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2440
2448
|
}
|
|
2441
2449
|
if (!this.connected) {
|
|
@@ -2452,7 +2460,7 @@ class Connection {
|
|
|
2452
2460
|
* @param category optional
|
|
2453
2461
|
*/
|
|
2454
2462
|
clearNotifications(host, category) {
|
|
2455
|
-
if (
|
|
2463
|
+
if (LegacyConnection.isWeb()) {
|
|
2456
2464
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2457
2465
|
}
|
|
2458
2466
|
if (!this.connected) {
|
|
@@ -2466,7 +2474,7 @@ class Connection {
|
|
|
2466
2474
|
* Read if only easy mode is allowed (only for admin connection).
|
|
2467
2475
|
*/
|
|
2468
2476
|
getIsEasyModeStrict() {
|
|
2469
|
-
if (
|
|
2477
|
+
if (LegacyConnection.isWeb()) {
|
|
2470
2478
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2471
2479
|
}
|
|
2472
2480
|
if (!this.connected) {
|
|
@@ -2480,7 +2488,7 @@ class Connection {
|
|
|
2480
2488
|
* Read easy mode configuration (only for admin connection).
|
|
2481
2489
|
*/
|
|
2482
2490
|
getEasyMode() {
|
|
2483
|
-
if (
|
|
2491
|
+
if (LegacyConnection.isWeb()) {
|
|
2484
2492
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2485
2493
|
}
|
|
2486
2494
|
if (!this.connected) {
|
|
@@ -2530,7 +2538,7 @@ class Connection {
|
|
|
2530
2538
|
* Read adapter ratings
|
|
2531
2539
|
*/
|
|
2532
2540
|
getRatings(update) {
|
|
2533
|
-
if (
|
|
2541
|
+
if (LegacyConnection.isWeb()) {
|
|
2534
2542
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2535
2543
|
}
|
|
2536
2544
|
if (!this.connected) {
|
|
@@ -2556,7 +2564,7 @@ class Connection {
|
|
|
2556
2564
|
}
|
|
2557
2565
|
// returns very optimized information for adapters to minimize a connection load
|
|
2558
2566
|
getCompactAdapters(update) {
|
|
2559
|
-
if (
|
|
2567
|
+
if (LegacyConnection.isWeb()) {
|
|
2560
2568
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2561
2569
|
}
|
|
2562
2570
|
if (!update && this._promises.compactAdapters) {
|
|
@@ -2577,7 +2585,7 @@ class Connection {
|
|
|
2577
2585
|
}
|
|
2578
2586
|
// returns very optimized information for adapters to minimize a connection load
|
|
2579
2587
|
getCompactInstances(update) {
|
|
2580
|
-
if (
|
|
2588
|
+
if (LegacyConnection.isWeb()) {
|
|
2581
2589
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2582
2590
|
}
|
|
2583
2591
|
if (!update && this._promises.compactInstances) {
|
|
@@ -2601,7 +2609,7 @@ class Connection {
|
|
|
2601
2609
|
* Reads only version of installed adapter
|
|
2602
2610
|
*/
|
|
2603
2611
|
getCompactInstalled(host, update, cmdTimeout) {
|
|
2604
|
-
if (
|
|
2612
|
+
if (LegacyConnection.isWeb()) {
|
|
2605
2613
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2606
2614
|
}
|
|
2607
2615
|
this._promises.installedCompact = this._promises.installedCompact || {};
|
|
@@ -2642,7 +2650,7 @@ class Connection {
|
|
|
2642
2650
|
// returns very optimized information for adapters to minimize a connection load.
|
|
2643
2651
|
// reads only version of installed adapter
|
|
2644
2652
|
getCompactSystemRepositories(update, cmdTimeout) {
|
|
2645
|
-
if (
|
|
2653
|
+
if (LegacyConnection.isWeb()) {
|
|
2646
2654
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2647
2655
|
}
|
|
2648
2656
|
if (!update && this._promises.getCompactSystemRepositories) {
|
|
@@ -2697,7 +2705,7 @@ class Connection {
|
|
|
2697
2705
|
* @param timeoutMs timeout in ms.
|
|
2698
2706
|
*/
|
|
2699
2707
|
getCompactRepository(host, update, timeoutMs) {
|
|
2700
|
-
if (
|
|
2708
|
+
if (LegacyConnection.isWeb()) {
|
|
2701
2709
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2702
2710
|
}
|
|
2703
2711
|
if (!update && this._promises.repoCompact) {
|
|
@@ -2742,7 +2750,7 @@ class Connection {
|
|
|
2742
2750
|
* Get the list of all hosts in compact form (only _id, common.name, common.icon, common.color, native.hardware.networkInterfaces)
|
|
2743
2751
|
*/
|
|
2744
2752
|
getCompactHosts(update) {
|
|
2745
|
-
if (
|
|
2753
|
+
if (LegacyConnection.isWeb()) {
|
|
2746
2754
|
return Promise.reject(new Error('Allowed only in admin'));
|
|
2747
2755
|
}
|
|
2748
2756
|
if (!update && this._promises.hostsCompact) {
|
|
@@ -2766,7 +2774,7 @@ class Connection {
|
|
|
2766
2774
|
if (!this.connected) {
|
|
2767
2775
|
return Promise.reject(new Error(NOT_CONNECTED));
|
|
2768
2776
|
}
|
|
2769
|
-
this._promises.uuid = this.getObject('system.meta.uuid').then(obj =>
|
|
2777
|
+
this._promises.uuid = this.getObject('system.meta.uuid').then(obj => obj?.native?.uuid);
|
|
2770
2778
|
return this._promises.uuid;
|
|
2771
2779
|
}
|
|
2772
2780
|
/**
|
|
@@ -2786,7 +2794,7 @@ class Connection {
|
|
|
2786
2794
|
if (err) {
|
|
2787
2795
|
reject(new Error(err));
|
|
2788
2796
|
}
|
|
2789
|
-
else if (result
|
|
2797
|
+
else if (result?.error) {
|
|
2790
2798
|
reject(new Error(result.error));
|
|
2791
2799
|
}
|
|
2792
2800
|
else {
|
|
@@ -2814,7 +2822,6 @@ class Connection {
|
|
|
2814
2822
|
* @param callback message handler. Could be null if all callbacks for this messageType should be unsubscribed
|
|
2815
2823
|
*/
|
|
2816
2824
|
unsubscribeFromInstance(targetInstance, messageType, callback) {
|
|
2817
|
-
var _a;
|
|
2818
2825
|
if (!targetInstance.startsWith('system.adapter.')) {
|
|
2819
2826
|
targetInstance = `system.adapter.${targetInstance}`;
|
|
2820
2827
|
}
|
|
@@ -2822,7 +2829,7 @@ class Connection {
|
|
|
2822
2829
|
const promiseResults = [];
|
|
2823
2830
|
do {
|
|
2824
2831
|
deleted = false;
|
|
2825
|
-
const index =
|
|
2832
|
+
const index = this._instanceSubscriptions[targetInstance]?.findIndex(sub => (!messageType || sub.messageType === messageType) && (!callback || sub.callback === callback));
|
|
2826
2833
|
if (index !== undefined && index !== null && index !== -1) {
|
|
2827
2834
|
deleted = true;
|
|
2828
2835
|
// remember messageType
|
|
@@ -2880,4 +2887,4 @@ class Connection {
|
|
|
2880
2887
|
this.ignoreState = id || '';
|
|
2881
2888
|
}
|
|
2882
2889
|
}
|
|
2883
|
-
|
|
2890
|
+
//# sourceMappingURL=LegacyConnection.js.map
|