iobroker.iot 3.6.0 → 4.0.2
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 +8 -4
- package/admin/assets/index-5zouxn2w.js +680 -0
- package/admin/index_m.html +1 -1
- package/admin/rules/assets/{index-BRdNnGcA.js → index-DwYdaT5M.js} +80 -81
- package/admin/rules/customRuleBlocks.js +2 -2
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/AlexaResponse.js +101 -95
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Capabilities/Base.js +22 -36
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js +19 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js +19 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js +16 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js +27 -28
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js +19 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js +25 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js +37 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js +32 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js +29 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Directives/ChangeReport.js +34 -27
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/ChangeReport.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js +39 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Directives/ReportState.js +19 -22
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/ReportState.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/index.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/index.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js +36 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js +57 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js +57 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js +12 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js +16 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js +127 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js +18 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js +38 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Properties/ColorTemperatureInKelvin.js +20 -29
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/ColorTemperatureInKelvin.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js +23 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Properties/LockState.js +9 -12
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/LockState.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js +34 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js +19 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js +18 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Properties/PowerState.js +9 -9
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/PowerState.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js +31 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js +22 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js +49 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js +21 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/index.js +38 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/index.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js +20 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js +26 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AirCondition.js +148 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AirCondition.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Blind.js +13 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Blind.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/ContactSensor.js +17 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/ContactSensor.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Controls/Control.js +73 -104
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Control.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Ct.js +182 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Ct.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Dimmer.js +127 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Dimmer.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Door.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Door.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Gate.js +38 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Gate.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Hue.js +208 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Hue.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Controls/Light.js +15 -22
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Light.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Lock.js +35 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Lock.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Motion.js +17 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Motion.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js +26 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Slider.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Slider.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Socket.js +21 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Socket.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Temperature.js +21 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Temperature.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Thermostat.js +85 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Thermostat.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js +27 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Volume.js +116 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Volume.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Window.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Window.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/index.js +121 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/index.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Device.js +29 -30
- package/build-backend/lib/AlexaSmartHomeV3/Device.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/DeviceManager.js +392 -0
- package/build-backend/lib/AlexaSmartHomeV3/DeviceManager.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Helpers/AdapterProvider.js +12 -21
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/AdapterProvider.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/FileHelper.js +53 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/FileHelper.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Helpers/IotProxy.js +9 -26
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/IotProxy.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/Logger.js +93 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/Logger.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js +112 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/Utils.js +625 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/Utils.js.map +1 -0
- package/build-backend/lib/Utils.js +96 -0
- package/build-backend/lib/Utils.js.map +1 -0
- package/build-backend/lib/adminCommonSocket.js +715 -0
- package/build-backend/lib/adminCommonSocket.js.map +1 -0
- package/build-backend/lib/alexaCustom.js +542 -0
- package/build-backend/lib/alexaCustom.js.map +1 -0
- package/{lib → build-backend/lib}/alexaSmartHomeV2.js +4 -8
- package/{lib → build-backend/lib}/alexaSmartHomeV3.js +25 -45
- package/build-backend/lib/alexaSmartHomeV3.js.map +1 -0
- package/{lib → build-backend/lib}/alisa.js +41 -44
- package/{lib → build-backend/lib}/devices.js +11 -8
- package/build-backend/lib/devices.js.map +1 -0
- package/{lib → build-backend/lib}/functions.js +11 -8
- package/build-backend/lib/functions.js.map +1 -0
- package/{lib → build-backend/lib}/googleHome.js +25 -26
- package/{lib → build-backend/lib}/notifications.js +15 -22
- package/build-backend/lib/notifications.js.map +1 -0
- package/{lib → build-backend/lib}/remote.js +615 -636
- package/build-backend/lib/remote.js.map +1 -0
- package/{lib → build-backend/lib}/rooms.js +11 -8
- package/build-backend/lib/rooms.js.map +1 -0
- package/{lib → build-backend/lib}/texts.js +6 -4
- package/build-backend/lib/texts.js.map +1 -0
- package/build-backend/lib/translate.js +21 -0
- package/build-backend/lib/translate.js.map +1 -0
- package/{lib → build-backend/lib}/visuApp.js +45 -65
- package/build-backend/lib/visuApp.js.map +1 -0
- package/build-backend/main.js +1361 -0
- package/build-backend/main.js.map +1 -0
- package/io-package.json +14 -14
- package/package.json +18 -15
- package/admin/assets/index-DCbOB3g_.js +0 -681
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js +0 -15
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js +0 -15
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js +0 -15
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js +0 -20
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js +0 -34
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js +0 -27
- package/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js +0 -39
- package/lib/AlexaSmartHomeV3/Alexa/Directives/index.js +0 -13
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js +0 -38
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js +0 -55
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js +0 -56
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js +0 -11
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js +0 -108
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js +0 -40
- package/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js +0 -22
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js +0 -32
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js +0 -17
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js +0 -28
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js +0 -20
- package/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js +0 -52
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js +0 -19
- package/lib/AlexaSmartHomeV3/Alexa/Properties/index.js +0 -14
- package/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js +0 -22
- package/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js +0 -28
- package/lib/AlexaSmartHomeV3/Controls/AirCondition.js +0 -144
- package/lib/AlexaSmartHomeV3/Controls/Blind.js +0 -12
- package/lib/AlexaSmartHomeV3/Controls/ContactSensor.js +0 -17
- package/lib/AlexaSmartHomeV3/Controls/Ct.js +0 -172
- package/lib/AlexaSmartHomeV3/Controls/Dimmer.js +0 -124
- package/lib/AlexaSmartHomeV3/Controls/Door.js +0 -9
- package/lib/AlexaSmartHomeV3/Controls/Gate.js +0 -42
- package/lib/AlexaSmartHomeV3/Controls/Hue.js +0 -207
- package/lib/AlexaSmartHomeV3/Controls/Lock.js +0 -36
- package/lib/AlexaSmartHomeV3/Controls/Motion.js +0 -17
- package/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js +0 -25
- package/lib/AlexaSmartHomeV3/Controls/Slider.js +0 -10
- package/lib/AlexaSmartHomeV3/Controls/Socket.js +0 -21
- package/lib/AlexaSmartHomeV3/Controls/Temperature.js +0 -22
- package/lib/AlexaSmartHomeV3/Controls/Thermostat.js +0 -86
- package/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js +0 -28
- package/lib/AlexaSmartHomeV3/Controls/Volume.js +0 -109
- package/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js +0 -9
- package/lib/AlexaSmartHomeV3/Controls/Window.js +0 -9
- package/lib/AlexaSmartHomeV3/Controls/index.js +0 -14
- package/lib/AlexaSmartHomeV3/DeviceManager.js +0 -415
- package/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js +0 -8
- package/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js +0 -5
- package/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js +0 -5
- package/lib/AlexaSmartHomeV3/Helpers/FileHelper.js +0 -70
- package/lib/AlexaSmartHomeV3/Helpers/Logger.js +0 -95
- package/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js +0 -82
- package/lib/AlexaSmartHomeV3/Helpers/Utils.js +0 -583
- package/lib/Utils.js +0 -608
- package/lib/adminCommonSocket.js +0 -781
- package/lib/alexaCustom.js +0 -622
- package/lib/translate.js +0 -19
- package/main.js +0 -1454
package/lib/adminCommonSocket.js
DELETED
|
@@ -1,781 +0,0 @@
|
|
|
1
|
-
const { normalize } = require('node:path');
|
|
2
|
-
const { existsSync, lstatSync, readdirSync } = require('node:fs');
|
|
3
|
-
|
|
4
|
-
const ALLOW_CACHE = [
|
|
5
|
-
'getRepository',
|
|
6
|
-
'getInstalled',
|
|
7
|
-
'getInstalledAdapter',
|
|
8
|
-
'getVersion',
|
|
9
|
-
'getDiagData',
|
|
10
|
-
'getLocationOnDisk',
|
|
11
|
-
'getDevList',
|
|
12
|
-
'getLogs',
|
|
13
|
-
'getHostInfo',
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
// const SUPPORTED_ADAPTERS = ['admin', 'vis-2'];
|
|
17
|
-
|
|
18
|
-
const commandsPermissions = {
|
|
19
|
-
getObject: { type: 'object', operation: 'read' },
|
|
20
|
-
getObjects: { type: 'object', operation: 'list' },
|
|
21
|
-
getObjectView: { type: 'object', operation: 'list' },
|
|
22
|
-
setObject: { type: 'object', operation: 'write' },
|
|
23
|
-
requireLog: { type: 'object', operation: 'write' }, // just mapping to some command
|
|
24
|
-
delObject: { type: 'object', operation: 'delete' },
|
|
25
|
-
extendObject: { type: 'object', operation: 'write' },
|
|
26
|
-
getHostByIp: { type: 'object', operation: 'list' },
|
|
27
|
-
subscribeObjects: { type: 'object', operation: 'read' },
|
|
28
|
-
unsubscribeObjects: { type: 'object', operation: 'read' },
|
|
29
|
-
|
|
30
|
-
getStates: { type: 'state', operation: 'list' },
|
|
31
|
-
getState: { type: 'state', operation: 'read' },
|
|
32
|
-
setState: { type: 'state', operation: 'write' },
|
|
33
|
-
delState: { type: 'state', operation: 'delete' },
|
|
34
|
-
createState: { type: 'state', operation: 'create' },
|
|
35
|
-
subscribe: { type: 'state', operation: 'read' },
|
|
36
|
-
unsubscribe: { type: 'state', operation: 'read' },
|
|
37
|
-
getStateHistory: { type: 'state', operation: 'read' },
|
|
38
|
-
getVersion: { type: '', operation: '' },
|
|
39
|
-
getAdapterName: { type: '', operation: '' },
|
|
40
|
-
|
|
41
|
-
addUser: { type: 'users', operation: 'create' },
|
|
42
|
-
delUser: { type: 'users', operation: 'delete' },
|
|
43
|
-
addGroup: { type: 'users', operation: 'create' },
|
|
44
|
-
delGroup: { type: 'users', operation: 'delete' },
|
|
45
|
-
changePassword: { type: 'users', operation: 'write' },
|
|
46
|
-
|
|
47
|
-
httpGet: { type: 'other', operation: 'http' },
|
|
48
|
-
cmdExec: { type: 'other', operation: 'execute' },
|
|
49
|
-
sendTo: { type: 'other', operation: 'sendto' },
|
|
50
|
-
sendToHost: { type: 'other', operation: 'sendto' },
|
|
51
|
-
readLogs: { type: 'other', operation: 'execute' },
|
|
52
|
-
|
|
53
|
-
readDir: { type: 'file', operation: 'list' },
|
|
54
|
-
createFile: { type: 'file', operation: 'create' },
|
|
55
|
-
writeFile: { type: 'file', operation: 'write' },
|
|
56
|
-
readFile: { type: 'file', operation: 'read' },
|
|
57
|
-
fileExists: { type: 'file', operation: 'read' },
|
|
58
|
-
deleteFile: { type: 'file', operation: 'delete' },
|
|
59
|
-
readFile64: { type: 'file', operation: 'read' },
|
|
60
|
-
writeFile64: { type: 'file', operation: 'write' },
|
|
61
|
-
unlink: { type: 'file', operation: 'delete' },
|
|
62
|
-
renameFile: { type: 'file', operation: 'write' },
|
|
63
|
-
mkdir: { type: 'file', operation: 'write' },
|
|
64
|
-
chmodFile: { type: 'file', operation: 'write' },
|
|
65
|
-
chownFile: { type: 'file', operation: 'write' },
|
|
66
|
-
|
|
67
|
-
authEnabled: { type: '', operation: '' },
|
|
68
|
-
disconnect: { type: '', operation: '' },
|
|
69
|
-
listPermissions: { type: '', operation: '' },
|
|
70
|
-
getUserPermissions: { type: 'object', operation: 'read' },
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const cache = {};
|
|
74
|
-
let cacheGB;
|
|
75
|
-
let axios;
|
|
76
|
-
|
|
77
|
-
function fixAdminUI(obj) {
|
|
78
|
-
if (obj && obj.common && !obj.common.adminUI) {
|
|
79
|
-
if (obj.common.noConfig) {
|
|
80
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
81
|
-
obj.common.adminUI.config = 'none';
|
|
82
|
-
} else if (obj.common.jsonConfig) {
|
|
83
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
84
|
-
obj.common.adminUI.config = 'json';
|
|
85
|
-
} else if (obj.common.materialize) {
|
|
86
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
87
|
-
obj.common.adminUI.config = 'materialize';
|
|
88
|
-
} else {
|
|
89
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
90
|
-
obj.common.adminUI.config = 'html';
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (obj.common.jsonCustom) {
|
|
94
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
95
|
-
obj.common.adminUI.custom = 'json';
|
|
96
|
-
} else if (obj.common.supportCustoms) {
|
|
97
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
98
|
-
obj.common.adminUI.custom = 'json';
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (obj.common.materializeTab && obj.common.adminTab) {
|
|
102
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
103
|
-
obj.common.adminUI.tab = 'materialize';
|
|
104
|
-
} else if (obj.common.adminTab) {
|
|
105
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
106
|
-
obj.common.adminUI.tab = 'html';
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
async function _readInstanceConfig(adapter, id, user, isTab, configs) {
|
|
112
|
-
const obj = await adapter.getForeignObjectAsync(`system.adapter.${id}`, { user });
|
|
113
|
-
if (obj && obj.common) {
|
|
114
|
-
const instance = id.split('.').pop();
|
|
115
|
-
const config = {
|
|
116
|
-
id,
|
|
117
|
-
title: obj.common.titleLang || obj.common.title,
|
|
118
|
-
desc: obj.common.desc,
|
|
119
|
-
color: obj.common.color,
|
|
120
|
-
url: `/adapter/${obj.common.name}/${isTab ? 'tab' : 'index'}${!isTab && obj.common.materialize ? '_m' : ''}.html${instance ? '?' + instance : ''}`,
|
|
121
|
-
icon: obj.common.icon,
|
|
122
|
-
materialize: obj.common.materialize,
|
|
123
|
-
jsonConfig: obj.common.jsonConfig,
|
|
124
|
-
};
|
|
125
|
-
if (isTab) {
|
|
126
|
-
config.tab = true;
|
|
127
|
-
} else {
|
|
128
|
-
config.config = true;
|
|
129
|
-
}
|
|
130
|
-
/*if (typeof config.title === 'object') {
|
|
131
|
-
config.title = config.title[adapter.systemConfig.language] || config.title.en;
|
|
132
|
-
}
|
|
133
|
-
if (typeof config.desc === 'object') {
|
|
134
|
-
config.desc = config.desc[adapter.systemConfig.language] || config.desc.en;
|
|
135
|
-
}*/
|
|
136
|
-
configs.push(config);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
async function getEasyMode(adapter, adminObj) {
|
|
141
|
-
const adapterConfig = adminObj;
|
|
142
|
-
|
|
143
|
-
if (adapterConfig.native.accessLimit) {
|
|
144
|
-
const configs = [];
|
|
145
|
-
adapterConfig.native.accessAllowedConfigs = adapterConfig.native.accessAllowedConfigs || [];
|
|
146
|
-
adapterConfig.native.accessAllowedTabs = adapterConfig.native.accessAllowedTabs || [];
|
|
147
|
-
|
|
148
|
-
for (let a = 0; a < adapterConfig.native.accessAllowedConfigs.length; a++) {
|
|
149
|
-
await _readInstanceConfig(
|
|
150
|
-
adapterConfig.native.accessAllowedConfigs[a],
|
|
151
|
-
'system.user.admin',
|
|
152
|
-
false,
|
|
153
|
-
configs,
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return { strict: true, configs };
|
|
158
|
-
} else {
|
|
159
|
-
const doc = await adapter.getObjectViewAsync(
|
|
160
|
-
'system',
|
|
161
|
-
'instance',
|
|
162
|
-
{
|
|
163
|
-
startkey: 'system.adapter.',
|
|
164
|
-
endkey: 'system.adapter.\u9999',
|
|
165
|
-
},
|
|
166
|
-
{ user: 'system.user.admin' },
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
const configs = [];
|
|
170
|
-
if (doc && doc.rows.length) {
|
|
171
|
-
for (let i = 0; i < doc.rows.length; i++) {
|
|
172
|
-
const obj = doc.rows[i].value;
|
|
173
|
-
if (obj.common.noConfig && !obj.common.adminTab) {
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
if (!obj.common.enabled) {
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
if (!obj.common.noConfig) {
|
|
180
|
-
await _readInstanceConfig(
|
|
181
|
-
obj._id.substring('system.adapter.'.length),
|
|
182
|
-
'system.user.admin',
|
|
183
|
-
false,
|
|
184
|
-
configs,
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return { strict: false, configs };
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function getAdapterInstances(adapter, adapterName) {
|
|
194
|
-
return adapter
|
|
195
|
-
.getObjectViewAsync('system', 'instance', {
|
|
196
|
-
startkey: `system.adapter.${adapterName ? `${adapterName}.` : ''}`,
|
|
197
|
-
endkey: `system.adapter.${adapterName ? `${adapterName}.` : ''}\u9999`,
|
|
198
|
-
})
|
|
199
|
-
.then(doc =>
|
|
200
|
-
doc.rows
|
|
201
|
-
.map(item => {
|
|
202
|
-
const obj = item.value;
|
|
203
|
-
if (obj.common) {
|
|
204
|
-
delete obj.common.news;
|
|
205
|
-
}
|
|
206
|
-
fixAdminUI(obj);
|
|
207
|
-
return obj;
|
|
208
|
-
})
|
|
209
|
-
.filter(obj => obj && (!adapterName || (obj.common && obj.common.name === adapterName))),
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function getAdapters(adapter, adapterName) {
|
|
214
|
-
return adapter
|
|
215
|
-
.getObjectViewAsync('system', 'adapter', {
|
|
216
|
-
startkey: `system.adapter.${adapterName || ''}`,
|
|
217
|
-
endkey: `system.adapter.${adapterName || '\u9999'}`,
|
|
218
|
-
})
|
|
219
|
-
.then(doc =>
|
|
220
|
-
doc.rows
|
|
221
|
-
.filter(obj => obj && (!adapterName || (obj.common && obj.common.name === adapterName)))
|
|
222
|
-
.map(item => {
|
|
223
|
-
const obj = item.value;
|
|
224
|
-
if (obj.common) {
|
|
225
|
-
delete obj.common.news;
|
|
226
|
-
delete obj.native;
|
|
227
|
-
}
|
|
228
|
-
fixAdminUI(obj);
|
|
229
|
-
return obj;
|
|
230
|
-
}),
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
function getCompactInstances(adapter) {
|
|
235
|
-
return adapter
|
|
236
|
-
.getObjectViewAsync('system', 'instance', { startkey: `system.adapter.`, endkey: `system.adapter.\u9999` })
|
|
237
|
-
.then(doc => {
|
|
238
|
-
// calculate
|
|
239
|
-
const result = {};
|
|
240
|
-
|
|
241
|
-
doc.rows.forEach(item => {
|
|
242
|
-
const obj = item.value;
|
|
243
|
-
result[item.id] = {
|
|
244
|
-
adminTab: obj.common.adminTab,
|
|
245
|
-
name: obj.common.name,
|
|
246
|
-
icon: obj.common.icon,
|
|
247
|
-
enabled: obj.common.enabled,
|
|
248
|
-
};
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
return result;
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function getCompactSystemRepositories(adapter) {
|
|
256
|
-
return adapter.getForeignObjectAsync('system.repositories').then(obj => {
|
|
257
|
-
obj?.native?.repositories &&
|
|
258
|
-
Object.keys(obj.native.repositories).forEach(name => {
|
|
259
|
-
if (obj.native.repositories[name].json) {
|
|
260
|
-
// limit information to _repoInfo
|
|
261
|
-
obj.native.repositories[name].json = {
|
|
262
|
-
_repoInfo: obj.native.repositories[name].json._repoInfo,
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
return obj;
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
function getCompactAdapters(adapter) {
|
|
271
|
-
return adapter
|
|
272
|
-
.getObjectViewAsync('system', 'adapter', { startkey: `system.adapter.`, endkey: `system.adapter.\u9999` })
|
|
273
|
-
.then(doc => {
|
|
274
|
-
// calculate
|
|
275
|
-
const result = {};
|
|
276
|
-
|
|
277
|
-
doc.rows.forEach(item => {
|
|
278
|
-
const obj = item.value;
|
|
279
|
-
if (obj && obj.common && obj.common.name) {
|
|
280
|
-
result[obj.common.name] = { icon: obj.common.icon, v: obj.common.version };
|
|
281
|
-
if (obj.common.ignoreVersion) {
|
|
282
|
-
result[obj.common.name].iv = obj.common.ignoreVersion;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
return result;
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function sendToHost(adapter, host, command, message) {
|
|
292
|
-
return new Promise(resolve => {
|
|
293
|
-
if (!message && ALLOW_CACHE.includes(command) && cache[`${host}_${command}`]) {
|
|
294
|
-
if (Date.now() - cache[`${host}_${command}`].ts < 500) {
|
|
295
|
-
resolve(JSON.parse(cache[host + '_' + command].res));
|
|
296
|
-
} else {
|
|
297
|
-
delete cache[`${host}_${command}`];
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
adapter.getForeignStateAsync(`${host}.alive`).then(state => {
|
|
302
|
-
if (state?.val) {
|
|
303
|
-
adapter.sendToHost(host, command, message, res => {
|
|
304
|
-
if (!message && ALLOW_CACHE.includes(command)) {
|
|
305
|
-
cache[`${host}_${command}`] = { ts: Date.now(), res: JSON.stringify(res) };
|
|
306
|
-
cacheGB =
|
|
307
|
-
cacheGB ||
|
|
308
|
-
setInterval(() => {
|
|
309
|
-
const commands = Object.keys(cache);
|
|
310
|
-
commands.forEach(cmd => {
|
|
311
|
-
if (Date.now() - cache[cmd].ts > 500) {
|
|
312
|
-
delete cache[cmd];
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
if (!commands.length) {
|
|
316
|
-
clearInterval(cacheGB);
|
|
317
|
-
cacheGB = null;
|
|
318
|
-
}
|
|
319
|
-
}, 2000);
|
|
320
|
-
}
|
|
321
|
-
resolve(res);
|
|
322
|
-
});
|
|
323
|
-
} else {
|
|
324
|
-
resolve({});
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function sendTo(adapter, adapterInstance, command, message) {
|
|
331
|
-
return adapter.sendToAsync(adapterInstance, command, message);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function stopGB() {
|
|
335
|
-
clearInterval(cacheGB);
|
|
336
|
-
cacheGB = null;
|
|
337
|
-
|
|
338
|
-
const commands = Object.keys(cache);
|
|
339
|
-
commands.forEach(cmd => delete cache[cmd]);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function updateLicenses(adapter, login, password, adminObj) {
|
|
343
|
-
if (adapter.supportsFeature('CONTROLLER_LICENSE_MANAGER')) {
|
|
344
|
-
return new Promise(async (resolve, reject) => {
|
|
345
|
-
let timeout = setTimeout(() => {
|
|
346
|
-
if (timeout) {
|
|
347
|
-
timeout = null;
|
|
348
|
-
reject('updateLicenses timeout');
|
|
349
|
-
}
|
|
350
|
-
}, 7000);
|
|
351
|
-
|
|
352
|
-
sendToHost(adapter, adminObj.common.host, 'updateLicenses', { login, password }).then(result => {
|
|
353
|
-
if (timeout) {
|
|
354
|
-
clearTimeout(timeout);
|
|
355
|
-
timeout = null;
|
|
356
|
-
result && result.error ? reject(result.error) : resolve(result && result.result);
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
});
|
|
360
|
-
} else {
|
|
361
|
-
// remove this branch when js-controller 4.x will be mainstream
|
|
362
|
-
return Promise.reject('Not supported');
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
function getIsEasyModeStrict(adapter, adminObj) {
|
|
367
|
-
return Promise.resolve(adminObj.native.accessLimit);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
function getCompactInstalled(adapter, host) {
|
|
371
|
-
return sendToHost(adapter, host, 'getInstalled', null).then(data => {
|
|
372
|
-
const result = {};
|
|
373
|
-
Object.keys(data).forEach(name => (result[name] = { version: data[name].version }));
|
|
374
|
-
return result;
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
function getCompactSystemConfig(adapter) {
|
|
379
|
-
return adapter.getForeignObjectAsync('system.config').then(obj => {
|
|
380
|
-
obj = obj || {};
|
|
381
|
-
const secret = obj.native && obj.native.secret;
|
|
382
|
-
delete obj.native;
|
|
383
|
-
if (secret) {
|
|
384
|
-
obj.native = { secret };
|
|
385
|
-
}
|
|
386
|
-
return obj;
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
function getCompactRepository(adapter, host) {
|
|
391
|
-
return sendToHost(adapter, host, 'getRepository', null).then(data => {
|
|
392
|
-
// Extract only version and icon
|
|
393
|
-
const result = {};
|
|
394
|
-
data &&
|
|
395
|
-
Object.keys(data).forEach(
|
|
396
|
-
name =>
|
|
397
|
-
(result[name] = {
|
|
398
|
-
version: data[name].version,
|
|
399
|
-
icon: data[name].extIcon,
|
|
400
|
-
}),
|
|
401
|
-
);
|
|
402
|
-
return result;
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
function getCompactHosts(adapter) {
|
|
407
|
-
return adapter
|
|
408
|
-
.getObjectViewAsync('system', 'host', { startkey: 'system.host.', endkey: 'system.host.\u9999' })
|
|
409
|
-
.then(doc => {
|
|
410
|
-
const result = [];
|
|
411
|
-
doc.rows.map(item => {
|
|
412
|
-
const host = item.value;
|
|
413
|
-
if (host) {
|
|
414
|
-
host.common = host.common || {};
|
|
415
|
-
result.push({
|
|
416
|
-
_id: host._id,
|
|
417
|
-
common: {
|
|
418
|
-
name: host.common.name,
|
|
419
|
-
icon: host.common.icon,
|
|
420
|
-
color: host.common.color,
|
|
421
|
-
installedVersion: host.common.installedVersion,
|
|
422
|
-
},
|
|
423
|
-
native: {
|
|
424
|
-
hardware: {
|
|
425
|
-
networkInterfaces:
|
|
426
|
-
(host.native && host.native.hardware && host.native.hardware.networkInterfaces) ||
|
|
427
|
-
undefined,
|
|
428
|
-
},
|
|
429
|
-
},
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
return result;
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
function readLogs(adapter, host) {
|
|
439
|
-
return new Promise((resolve, reject) => {
|
|
440
|
-
let timeout = setTimeout(() => {
|
|
441
|
-
if (timeout) {
|
|
442
|
-
let result = { list: [] };
|
|
443
|
-
|
|
444
|
-
// deliver a file list
|
|
445
|
-
try {
|
|
446
|
-
const config = adapter.systemConfig;
|
|
447
|
-
// detect file log
|
|
448
|
-
if (config && config.log && config.log.transport) {
|
|
449
|
-
for (const transport in config.log.transport) {
|
|
450
|
-
if (
|
|
451
|
-
config.log.transport.hasOwnProperty(transport) &&
|
|
452
|
-
config.log.transport[transport].type === 'file'
|
|
453
|
-
) {
|
|
454
|
-
let filename = config.log.transport[transport].filename || 'log/';
|
|
455
|
-
const parts = filename.replace(/\\/g, '/').split('/');
|
|
456
|
-
parts.pop();
|
|
457
|
-
filename = parts.join('/');
|
|
458
|
-
if (filename[0] !== '/' && !filename.match(/^\W:/)) {
|
|
459
|
-
const _filename = normalize(`${__dirname}/../../../`) + filename;
|
|
460
|
-
if (!existsSync(_filename)) {
|
|
461
|
-
filename = normalize(`${__dirname}/../../`) + filename;
|
|
462
|
-
} else {
|
|
463
|
-
filename = _filename;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
if (existsSync(filename)) {
|
|
467
|
-
const files = readdirSync(filename);
|
|
468
|
-
|
|
469
|
-
for (let f = 0; f < files.length; f++) {
|
|
470
|
-
try {
|
|
471
|
-
if (!files[f].endsWith('-audit.json')) {
|
|
472
|
-
const stat = lstatSync(`${filename}/${files[f]}`);
|
|
473
|
-
if (!stat.isDirectory()) {
|
|
474
|
-
result.list.push({
|
|
475
|
-
fileName: `log/${transport}/${files[f]}`,
|
|
476
|
-
size: stat.size,
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
} catch (e) {
|
|
481
|
-
// push unchecked
|
|
482
|
-
// result.list.push('log/' + transport + '/' + files[f]);
|
|
483
|
-
adapter.log.error(`Cannot check file: ${filename}/${files[f]}`);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
} else {
|
|
490
|
-
result = { error: 'no file loggers' };
|
|
491
|
-
}
|
|
492
|
-
} catch (e) {
|
|
493
|
-
adapter.log.error(e);
|
|
494
|
-
result = { error: e };
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
result.error ? reject(result.error) : resolve(result.list);
|
|
498
|
-
}
|
|
499
|
-
}, 500);
|
|
500
|
-
|
|
501
|
-
sendToHost(adapter, host, 'getLogFiles', null).then(result => {
|
|
502
|
-
clearTimeout(timeout);
|
|
503
|
-
timeout = null;
|
|
504
|
-
result.error ? reject(result.error) : resolve(result.list);
|
|
505
|
-
});
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
function getRatings(adapter, forceUpdate, autoUpdate) {
|
|
510
|
-
axios = axios || require('axios');
|
|
511
|
-
|
|
512
|
-
if (!forceUpdate && adapter._ratings) {
|
|
513
|
-
return Promise.resolve(adapter._ratings);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
return adapter.getForeignObjectAsync('system.meta.uuid').then(obj =>
|
|
517
|
-
axios('https://rating.iobroker.net/rating?uuid=' + obj.native.uuid).then(response => {
|
|
518
|
-
let body = response.body;
|
|
519
|
-
if (body) {
|
|
520
|
-
if (typeof body !== 'object') {
|
|
521
|
-
try {
|
|
522
|
-
body = JSON.parse(body);
|
|
523
|
-
adapter._ratings = body;
|
|
524
|
-
} catch (e) {
|
|
525
|
-
adapter.log.error('Cannot parse ratings: ' + e);
|
|
526
|
-
}
|
|
527
|
-
} else if (body) {
|
|
528
|
-
adapter._ratings = body;
|
|
529
|
-
}
|
|
530
|
-
if (!adapter._ratings || typeof adapter._ratings !== 'object' || Array.isArray(adapter._ratings)) {
|
|
531
|
-
adapter._ratings = {};
|
|
532
|
-
}
|
|
533
|
-
adapter._ratings.uuid = obj.native.uuid;
|
|
534
|
-
return adapter._ratings;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
adapter.ratingTimeout && clearTimeout(adapter.ratingTimeout);
|
|
538
|
-
|
|
539
|
-
if (autoUpdate) {
|
|
540
|
-
adapter.ratingTimeout = setTimeout(() => {
|
|
541
|
-
adapter.ratingTimeout = null;
|
|
542
|
-
getRatings(adapter, forceUpdate, true).then(() => adapter.log.info('Adapter rating updated'));
|
|
543
|
-
}, 24 * 3600000);
|
|
544
|
-
}
|
|
545
|
-
}),
|
|
546
|
-
);
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
function listPermissions(adapter) {
|
|
550
|
-
return Promise.resolve(commandsPermissions);
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
function getHostByIp(adapter, ip) {
|
|
554
|
-
return adapter.getObjectViewAsync('system', 'host', {}).then(data => {
|
|
555
|
-
if (data && data.rows && data.rows.length) {
|
|
556
|
-
for (let i = 0; i < data.rows.length; i++) {
|
|
557
|
-
const obj = data.rows[i].value;
|
|
558
|
-
// if we requested specific name
|
|
559
|
-
if (obj.common.hostname === ip) {
|
|
560
|
-
return { ip, obj };
|
|
561
|
-
}
|
|
562
|
-
// try to find this IP in the list
|
|
563
|
-
else if (obj.native.hardware && obj.native.hardware.networkInterfaces) {
|
|
564
|
-
const net = obj.native.hardware.networkInterfaces;
|
|
565
|
-
for (const eth in net) {
|
|
566
|
-
if (!net.hasOwnProperty(eth)) {
|
|
567
|
-
continue;
|
|
568
|
-
}
|
|
569
|
-
for (let j = 0; j < net[eth].length; j++) {
|
|
570
|
-
if (net[eth][j].address === ip) {
|
|
571
|
-
return { ip, obj };
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
return { ip, obj: null };
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
function processWelcome(welcomeScreen, isPro, adapterObj, foundInstanceIDs, list) {
|
|
583
|
-
if (welcomeScreen) {
|
|
584
|
-
welcomeScreen = JSON.parse(JSON.stringify(welcomeScreen));
|
|
585
|
-
if (Array.isArray(welcomeScreen)) {
|
|
586
|
-
for (let w = 0; w < welcomeScreen.length; w++) {
|
|
587
|
-
// temporarily disabled for non pro
|
|
588
|
-
if (!isPro && welcomeScreen[w].name === 'vis editor') {
|
|
589
|
-
continue;
|
|
590
|
-
}
|
|
591
|
-
if (welcomeScreen[w].link) {
|
|
592
|
-
welcomeScreen[w].localLink = welcomeScreen[w].link;
|
|
593
|
-
}
|
|
594
|
-
if (welcomeScreen[w].localLinks && typeof welcomeScreen[w].localLinks === 'string') {
|
|
595
|
-
welcomeScreen[w].localLink = adapterObj.common.localLinks[welcomeScreen[w].localLinks];
|
|
596
|
-
if (typeof welcomeScreen[w].localLink === 'object') {
|
|
597
|
-
welcomeScreen[w].localLink = welcomeScreen[w].localLink.link;
|
|
598
|
-
}
|
|
599
|
-
} else if (welcomeScreen[w].localLink && typeof welcomeScreen[w].localLink === 'boolean') {
|
|
600
|
-
welcomeScreen[w].localLink = adapterObj.common.localLink;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
welcomeScreen[w].pro = isPro;
|
|
604
|
-
if (welcomeScreen[w].localLink) {
|
|
605
|
-
if (foundInstanceIDs.length > 1) {
|
|
606
|
-
foundInstanceIDs.forEach(id => {
|
|
607
|
-
const _welcomeScreen = JSON.parse(JSON.stringify(welcomeScreen));
|
|
608
|
-
_welcomeScreen.id = id;
|
|
609
|
-
_welcomeScreen.instance = parseInt(id.split('.').pop(), 10);
|
|
610
|
-
_welcomeScreen.adapter = id.replace(/^system\.adapter\./, '').replace(/\.\d+$/, '');
|
|
611
|
-
list.push(_welcomeScreen);
|
|
612
|
-
});
|
|
613
|
-
} else {
|
|
614
|
-
welcomeScreen[w].id = foundInstanceIDs[0];
|
|
615
|
-
welcomeScreen[w].instance = adapterObj.common.instance || 0;
|
|
616
|
-
welcomeScreen[w].adapter = adapterObj.common.name;
|
|
617
|
-
list.push(welcomeScreen[w]);
|
|
618
|
-
}
|
|
619
|
-
} else {
|
|
620
|
-
welcomeScreen[w].instance = adapterObj.common.instance || 0;
|
|
621
|
-
welcomeScreen[w].adapter = adapterObj.common.name;
|
|
622
|
-
list.push(welcomeScreen[w]);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
} else {
|
|
626
|
-
if (welcomeScreen.localLinks && typeof welcomeScreen.localLinks === 'string') {
|
|
627
|
-
welcomeScreen.localLink = adapterObj.common.localLinks[welcomeScreen.localLinks];
|
|
628
|
-
if (typeof welcomeScreen.localLink === 'object') {
|
|
629
|
-
welcomeScreen.localLink = welcomeScreen.localLink.link;
|
|
630
|
-
}
|
|
631
|
-
} else if (welcomeScreen.localLink && typeof welcomeScreen.localLink === 'boolean') {
|
|
632
|
-
welcomeScreen.localLink = adapterObj.common.localLink;
|
|
633
|
-
}
|
|
634
|
-
welcomeScreen.pro = isPro;
|
|
635
|
-
if (welcomeScreen.localLink) {
|
|
636
|
-
if (foundInstanceIDs.length > 1) {
|
|
637
|
-
foundInstanceIDs.forEach(id => {
|
|
638
|
-
const _welcomeScreen = JSON.parse(JSON.stringify(welcomeScreen));
|
|
639
|
-
_welcomeScreen.id = id;
|
|
640
|
-
_welcomeScreen.instance = parseInt(id.split('.').pop(), 10);
|
|
641
|
-
_welcomeScreen.adapter = id.replace(/^system\.adapter\./, '').replace(/\.\d+$/, '');
|
|
642
|
-
list.push(_welcomeScreen);
|
|
643
|
-
});
|
|
644
|
-
} else {
|
|
645
|
-
welcomeScreen.id = foundInstanceIDs[0];
|
|
646
|
-
welcomeScreen.instance = adapterObj.common.instance || 0;
|
|
647
|
-
welcomeScreen.adapter = adapterObj.common.name;
|
|
648
|
-
list.push(welcomeScreen);
|
|
649
|
-
}
|
|
650
|
-
} else {
|
|
651
|
-
welcomeScreen.instance = adapterObj.common.instance || 0;
|
|
652
|
-
welcomeScreen.adapter = adapterObj.common.name;
|
|
653
|
-
list.push(welcomeScreen);
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
async function getListOfAllAdapters(adapter) {
|
|
660
|
-
// read all instances
|
|
661
|
-
const instances = await adapter.getObjectViewAsync('system', 'instance', {});
|
|
662
|
-
const adapters = await adapter.getObjectViewAsync('system', 'adapter', {});
|
|
663
|
-
|
|
664
|
-
// TODO: ignore disabled web adapters
|
|
665
|
-
|
|
666
|
-
const objects = {};
|
|
667
|
-
|
|
668
|
-
let list = [];
|
|
669
|
-
const mapInstance = {};
|
|
670
|
-
for (let r = 0; r < instances.rows.length; r++) {
|
|
671
|
-
mapInstance[instances.rows[r].id] = instances.rows[r].value;
|
|
672
|
-
objects[instances.rows[r].id] = instances.rows[r].value;
|
|
673
|
-
}
|
|
674
|
-
for (let a = 0; a < adapters.rows.length; a++) {
|
|
675
|
-
const obj = adapters.rows[a].value;
|
|
676
|
-
objects[adapters.rows[a].id] = adapters.rows[a].value;
|
|
677
|
-
let found;
|
|
678
|
-
if (instances && instances.rows) {
|
|
679
|
-
found = [];
|
|
680
|
-
// find if any instance of this adapter exists and started
|
|
681
|
-
for (let i = 0; i < instances.rows.length; i++) {
|
|
682
|
-
let id = instances.rows[i].id;
|
|
683
|
-
const ids = id.split('.');
|
|
684
|
-
ids.pop();
|
|
685
|
-
id = ids.join('.');
|
|
686
|
-
if (id === obj._id && instances.rows[i].value.common && instances.rows[i].value.common.enabled) {
|
|
687
|
-
found.push(instances.rows[i].id);
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
if (
|
|
694
|
-
adapter.config.remoteWebInstance &&
|
|
695
|
-
objects[`system.adapter.${adapter.config.remoteWebInstance}`] &&
|
|
696
|
-
objects[`system.adapter.${adapter.config.remoteWebInstance}`].common?.enabled &&
|
|
697
|
-
objects[`system.adapter.vis-2.0`]?.common?.enabled
|
|
698
|
-
) {
|
|
699
|
-
list.push({
|
|
700
|
-
link: 'vis-2/index.html',
|
|
701
|
-
name: objects[`system.adapter.vis-2.0`].common.welcomeScreen?.[0]?.name || 'vis 2 runtime',
|
|
702
|
-
color: objects[`system.adapter.vis-2.0`].common.welcomeScreen?.[0]?.color || '#ffe9c8',
|
|
703
|
-
order: 0,
|
|
704
|
-
});
|
|
705
|
-
list.push({
|
|
706
|
-
link: 'vis-2/edit.html',
|
|
707
|
-
name: objects[`system.adapter.vis-2.0`].common.welcomeScreenPro?.[0]?.name || 'vis 2 editor',
|
|
708
|
-
color: objects[`system.adapter.vis-2.0`].common.welcomeScreenPro?.[0]?.color || '#c8ffe1',
|
|
709
|
-
order: 1,
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
if (
|
|
713
|
-
adapter.config.remoteAdminInstance &&
|
|
714
|
-
objects[`system.adapter.${adapter.config.remoteAdminInstance}`]?.common?.enabled
|
|
715
|
-
) {
|
|
716
|
-
list.push({
|
|
717
|
-
link: 'admin/index.html',
|
|
718
|
-
name:
|
|
719
|
-
objects[`system.adapter.${adapter.config.remoteAdminInstance}`].common.welcomeScreenPro?.[0]?.name ||
|
|
720
|
-
'Admin',
|
|
721
|
-
color:
|
|
722
|
-
objects[`system.adapter.${adapter.config.remoteAdminInstance}`].common.welcomeScreenPro?.[0]?.color ||
|
|
723
|
-
'pink',
|
|
724
|
-
order: 5,
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
return list;
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
let objectsTs = null;
|
|
732
|
-
let cachedObjects = null;
|
|
733
|
-
|
|
734
|
-
async function getAllObjects(adapter) {
|
|
735
|
-
const now = Date.now();
|
|
736
|
-
if (objectsTs && now - objectsTs < 20000) {
|
|
737
|
-
return cachedObjects;
|
|
738
|
-
} else {
|
|
739
|
-
const res = await adapter.getObjectListAsync({ include_docs: true });
|
|
740
|
-
|
|
741
|
-
const objects = {};
|
|
742
|
-
|
|
743
|
-
if (res) {
|
|
744
|
-
const rows = res.rows;
|
|
745
|
-
for (let i = 0; i < rows.length; i++) {
|
|
746
|
-
objects[rows[i].doc._id] = rows[i].doc;
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
adapter.log.info(`[REMOTE] received all objects in ${Date.now() - now}`);
|
|
751
|
-
objectsTs = Date.now();
|
|
752
|
-
cachedObjects = objects;
|
|
753
|
-
|
|
754
|
-
return objects;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
module.exports = {
|
|
759
|
-
getAdapterInstances,
|
|
760
|
-
getAdapters,
|
|
761
|
-
getCompactInstances,
|
|
762
|
-
getCompactAdapters,
|
|
763
|
-
getCompactInstalled,
|
|
764
|
-
updateLicenses,
|
|
765
|
-
getIsEasyModeStrict,
|
|
766
|
-
getCompactRepository,
|
|
767
|
-
getCompactHosts,
|
|
768
|
-
getCompactSystemConfig,
|
|
769
|
-
getRatings,
|
|
770
|
-
readLogs,
|
|
771
|
-
stopGB,
|
|
772
|
-
sendToHost,
|
|
773
|
-
sendTo,
|
|
774
|
-
getEasyMode,
|
|
775
|
-
listPermissions,
|
|
776
|
-
getHostByIp,
|
|
777
|
-
getListOfAllAdapters,
|
|
778
|
-
getAllObjects,
|
|
779
|
-
getCompactSystemRepositories,
|
|
780
|
-
commandsPermissions,
|
|
781
|
-
};
|