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/Utils.js
DELETED
|
@@ -1,608 +0,0 @@
|
|
|
1
|
-
// this file was taken unchanged from admin/src-rx/src/Utils.js
|
|
2
|
-
|
|
3
|
-
const ANSI_RESET = 0;
|
|
4
|
-
const ANSI_RESET_COLOR = 39;
|
|
5
|
-
const ANSI_RESET_BG_COLOR = 49;
|
|
6
|
-
const ANSI_BOLD = 1;
|
|
7
|
-
const ANSI_RESET_BOLD = 22;
|
|
8
|
-
|
|
9
|
-
const STYLES = {
|
|
10
|
-
30: { color: 'black' }, // ANSI_BLACK
|
|
11
|
-
31: { color: 'red' }, // ANSI_RED
|
|
12
|
-
32: { color: 'green' }, // ANSI_GREEN
|
|
13
|
-
33: { color: 'yellow' }, // ANSI_YELLOW
|
|
14
|
-
34: { color: 'blue' }, // ANSI_BLUE
|
|
15
|
-
35: { color: 'purple' }, // ANSI_PURPLE
|
|
16
|
-
36: { color: 'cyan' }, // ANSI_CYAN
|
|
17
|
-
37: { color: 'white' }, // ANSI_WHITE
|
|
18
|
-
|
|
19
|
-
90: { color: 'grey' }, // ANSI_BRIGHT_BLACK
|
|
20
|
-
91: { color: 'lightred' }, // ANSI_BRIGHT_RED
|
|
21
|
-
92: { color: 'lightgreen' }, // ANSI_BRIGHT_GREEN
|
|
22
|
-
93: { color: 'lightyellow' }, // ANSI_BRIGHT_YELLOW
|
|
23
|
-
94: { color: 'lightblue' }, // ANSI_BRIGHT_BLUE
|
|
24
|
-
95: { color: 'lightpurple' }, // ANSI_BRIGHT_PURPLE
|
|
25
|
-
96: { color: 'lightcyan' }, // ANSI_BRIGHT_CYAN
|
|
26
|
-
97: { color: 'white' }, // ANSI_BRIGHT_WHITE
|
|
27
|
-
|
|
28
|
-
40: { backgroundColor: 'black' }, // ANSI_BG_BLACK
|
|
29
|
-
41: { backgroundColor: 'red' }, // ANSI_BG_RED
|
|
30
|
-
42: { backgroundColor: 'green' }, // ANSI_BG_GREEN
|
|
31
|
-
43: { backgroundColor: 'yellow' }, // ANSI_BG_YELLOW
|
|
32
|
-
44: { backgroundColor: 'blue' }, // ANSI_BG_BLUE
|
|
33
|
-
45: { backgroundColor: 'purple' }, // ANSI_BG_PURPLE
|
|
34
|
-
46: { backgroundColor: 'cyan' }, // ANSI_BG_CYAN
|
|
35
|
-
47: { backgroundColor: 'white' }, // ANSI_BG_WHITE
|
|
36
|
-
|
|
37
|
-
100: { backgroundColor: 'grey' }, // ANSI_BRIGHT_BG_BLACK
|
|
38
|
-
101: { backgroundColor: 'lightred' }, // ANSI_BRIGHT_BG_RED
|
|
39
|
-
102: { backgroundColor: 'lightgreen' }, // ANSI_BRIGHT_BG_GREEN
|
|
40
|
-
103: { backgroundColor: 'lightyellow' }, // ANSI_BRIGHT_BG_YELLOW
|
|
41
|
-
104: { backgroundColor: 'lightblue' }, // ANSI_BRIGHT_BG_BLUE
|
|
42
|
-
105: { backgroundColor: 'lightpurple' }, // ANSI_BRIGHT_BG_PURPLE
|
|
43
|
-
106: { backgroundColor: 'lightcyan' }, // ANSI_BRIGHT_BG_CYAN
|
|
44
|
-
107: { backgroundColor: 'white' }, // ANSI_BRIGHT_BG_WHITE
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
class Utils {
|
|
48
|
-
/**
|
|
49
|
-
* Format bytes to MB or GB
|
|
50
|
-
* @param {!number} bytes
|
|
51
|
-
* @returns {String}
|
|
52
|
-
*/
|
|
53
|
-
static formatRam(bytes) {
|
|
54
|
-
const GB = Math.floor((bytes / (1024 * 1024 * 1024)) * 10) / 10;
|
|
55
|
-
bytes %= 1024 * 1024 * 1024;
|
|
56
|
-
const MB = Math.floor((bytes / (1024 * 1024)) * 10) / 10;
|
|
57
|
-
let text = '';
|
|
58
|
-
|
|
59
|
-
if (GB > 1) {
|
|
60
|
-
text += GB + ' GB';
|
|
61
|
-
} else {
|
|
62
|
-
text += MB + ' MB';
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return text;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
static formatSpeed(mhz) {
|
|
69
|
-
return mhz + ' MHz';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
static formatBytes(bytes) {
|
|
73
|
-
if (Math.abs(bytes) < 1024) {
|
|
74
|
-
return bytes + ' B';
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const units = ['KB', 'MB', 'GB'];
|
|
78
|
-
//const units = ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
|
|
79
|
-
let u = -1;
|
|
80
|
-
|
|
81
|
-
do {
|
|
82
|
-
bytes /= 1024;
|
|
83
|
-
++u;
|
|
84
|
-
} while (Math.abs(bytes) >= 1024 && u < units.length - 1);
|
|
85
|
-
|
|
86
|
-
return bytes.toFixed(1) + ' ' + units[u];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
static getFileExtension(fileName) {
|
|
90
|
-
const pos = fileName.lastIndexOf('.');
|
|
91
|
-
if (pos !== -1) {
|
|
92
|
-
return fileName.substring(pos + 1).toLowerCase();
|
|
93
|
-
} else {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Big thanks to : https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color
|
|
99
|
-
static invertColor(hex, bw) {
|
|
100
|
-
if (hex === undefined || hex === null || hex === '' || typeof hex !== 'string') {
|
|
101
|
-
return '';
|
|
102
|
-
}
|
|
103
|
-
if (hex.indexOf('#') === 0) {
|
|
104
|
-
hex = hex.slice(1);
|
|
105
|
-
}
|
|
106
|
-
// convert 3-digit hex to 6-digits.
|
|
107
|
-
if (hex.length === 3) {
|
|
108
|
-
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
109
|
-
}
|
|
110
|
-
if (hex.length !== 6) {
|
|
111
|
-
throw new Error('Invalid HEX color.');
|
|
112
|
-
}
|
|
113
|
-
let r = parseInt(hex.slice(0, 2), 16);
|
|
114
|
-
let g = parseInt(hex.slice(2, 4), 16);
|
|
115
|
-
let b = parseInt(hex.slice(4, 6), 16);
|
|
116
|
-
|
|
117
|
-
if (bw) {
|
|
118
|
-
// http://stackoverflow.com/a/3943023/112731
|
|
119
|
-
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? '#000000' : '#FFFFFF';
|
|
120
|
-
}
|
|
121
|
-
// invert color components
|
|
122
|
-
r = (255 - r).toString(16);
|
|
123
|
-
g = (255 - g).toString(16);
|
|
124
|
-
b = (255 - b).toString(16);
|
|
125
|
-
// pad each with zeros and return
|
|
126
|
-
return '#' + r.padStart(2, '0') + g.padStart(2, '0') + b.padStart(2, '0');
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Format number in seconds to a time text
|
|
131
|
-
* @param {string} seconds
|
|
132
|
-
* @param {function} t translate function
|
|
133
|
-
* @returns {String}
|
|
134
|
-
*/
|
|
135
|
-
static formatSeconds(seconds, t) {
|
|
136
|
-
const days = Math.floor(seconds / (3600 * 24));
|
|
137
|
-
seconds %= 3600 * 24;
|
|
138
|
-
let hours = Math.floor(seconds / 3600);
|
|
139
|
-
if (hours < 10) {
|
|
140
|
-
hours = `0${hours}`;
|
|
141
|
-
}
|
|
142
|
-
seconds %= 3600;
|
|
143
|
-
let minutes = Math.floor(seconds / 60);
|
|
144
|
-
if (minutes < 10) {
|
|
145
|
-
minutes = `0${minutes}`;
|
|
146
|
-
}
|
|
147
|
-
seconds %= 60;
|
|
148
|
-
seconds = Math.floor(seconds);
|
|
149
|
-
if (seconds < 10) {
|
|
150
|
-
seconds = `0${seconds}`;
|
|
151
|
-
}
|
|
152
|
-
let text = '';
|
|
153
|
-
if (days) {
|
|
154
|
-
text += `${days} ${t('daysShortText')} `;
|
|
155
|
-
}
|
|
156
|
-
text += `${hours}:${minutes}:${seconds}`;
|
|
157
|
-
|
|
158
|
-
return text;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// internal use
|
|
162
|
-
static _replaceLink(link, objects, adapterInstance, attr, placeholder, hosts, hostname, adminInstance) {
|
|
163
|
-
if (attr === 'protocol') {
|
|
164
|
-
attr = 'secure';
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
try {
|
|
168
|
-
const object = objects['system.adapter.' + adapterInstance];
|
|
169
|
-
|
|
170
|
-
if (link && object) {
|
|
171
|
-
if (attr === 'secure') {
|
|
172
|
-
link = link.replace(`%${placeholder}%`, object.native[attr] ? 'https' : 'http');
|
|
173
|
-
} else {
|
|
174
|
-
let value = object.native[attr];
|
|
175
|
-
// workaround for port
|
|
176
|
-
if ((attr === 'webinterfacePort' || attr === 'port') && (!value || value === '0')) {
|
|
177
|
-
if (object.native.secure === true) {
|
|
178
|
-
value = 443;
|
|
179
|
-
} else {
|
|
180
|
-
value = 80;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (attr === 'bind' || attr === 'ip') {
|
|
185
|
-
let ip = object.native.bind || object.native.ip;
|
|
186
|
-
if (ip === '0.0.0.0') {
|
|
187
|
-
ip = Utils.getHostname(object, objects, hosts, hostname, adminInstance);
|
|
188
|
-
}
|
|
189
|
-
if (!link.includes(`%${placeholder}%`)) {
|
|
190
|
-
link = link.replace(`%native_${placeholder}%`, ip || '');
|
|
191
|
-
} else {
|
|
192
|
-
link = link.replace(`%${placeholder}%`, ip || '');
|
|
193
|
-
}
|
|
194
|
-
} else if (!link.includes(`%${placeholder}%`)) {
|
|
195
|
-
link = link.replace(`%native_${placeholder}%`, value);
|
|
196
|
-
} else {
|
|
197
|
-
link = link.replace(`%${placeholder}%`, value);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
} else {
|
|
201
|
-
console.log('Cannot get link ' + attr);
|
|
202
|
-
link = link.replace(`%${placeholder}%`, '');
|
|
203
|
-
}
|
|
204
|
-
} catch (error) {
|
|
205
|
-
console.log(error);
|
|
206
|
-
}
|
|
207
|
-
return link;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
static ip2int(ip) {
|
|
211
|
-
return ip.split('.').reduce((ipInt, octet) => (ipInt << 8) + parseInt(octet, 10), 0) >>> 0;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
static findNetworkAddressOfHost(obj, localIp) {
|
|
215
|
-
const networkInterfaces = obj && obj.native && obj.native.hardware && obj.native.hardware.networkInterfaces;
|
|
216
|
-
if (!networkInterfaces) {
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
let hostIp;
|
|
221
|
-
Object.keys(networkInterfaces).forEach(inter => {
|
|
222
|
-
networkInterfaces[inter].forEach(ip => {
|
|
223
|
-
if (ip.internal) {
|
|
224
|
-
return;
|
|
225
|
-
} else if (localIp.includes(':') && ip.family !== 'IPv6') {
|
|
226
|
-
return;
|
|
227
|
-
} else if (localIp.includes('.') && !localIp.match(/[^.\d]/) && ip.family !== 'IPv4') {
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
if (localIp === '127.0.0.0' || localIp === 'localhost' || localIp.match(/[^.\d]/)) {
|
|
231
|
-
// if DNS name
|
|
232
|
-
hostIp = ip.address;
|
|
233
|
-
} else {
|
|
234
|
-
if (
|
|
235
|
-
ip.family === 'IPv4' &&
|
|
236
|
-
localIp.includes('.') &&
|
|
237
|
-
(Utils.ip2int(localIp) & Utils.ip2int(ip.netmask)) ===
|
|
238
|
-
(Utils.ip2int(ip.address) & Utils.ip2int(ip.netmask))
|
|
239
|
-
) {
|
|
240
|
-
hostIp = ip.address;
|
|
241
|
-
} else {
|
|
242
|
-
hostIp = ip.address;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
if (!hostIp) {
|
|
249
|
-
Object.keys(networkInterfaces).forEach(inter => {
|
|
250
|
-
networkInterfaces[inter].forEach(ip => {
|
|
251
|
-
if (ip.internal) {
|
|
252
|
-
return;
|
|
253
|
-
} else if (localIp.includes(':') && ip.family !== 'IPv6') {
|
|
254
|
-
return;
|
|
255
|
-
} else if (localIp.includes('.') && !localIp.match(/[^.\d]/) && ip.family !== 'IPv4') {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
if (localIp === '127.0.0.0' || localIp === 'localhost' || localIp.match(/[^.\d]/)) {
|
|
259
|
-
// if DNS name
|
|
260
|
-
hostIp = ip.address;
|
|
261
|
-
} else {
|
|
262
|
-
hostIp = ip.address;
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
if (!hostIp) {
|
|
269
|
-
Object.keys(networkInterfaces).forEach(inter => {
|
|
270
|
-
networkInterfaces[inter].forEach(ip => {
|
|
271
|
-
if (ip.internal) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
hostIp = ip.address;
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
return hostIp;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
static getHostname(instanceObj, objects, hosts, currentHostname, adminInstance) {
|
|
283
|
-
if (!instanceObj || !instanceObj.common) {
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
let hostname;
|
|
288
|
-
// check if the adapter from the same host as admin
|
|
289
|
-
const adminHost =
|
|
290
|
-
objects['system.adapter.' + adminInstance] &&
|
|
291
|
-
objects['system.adapter.' + adminInstance].common &&
|
|
292
|
-
objects['system.adapter.' + adminInstance].common.host;
|
|
293
|
-
if (instanceObj.common.host !== adminHost) {
|
|
294
|
-
// find IP address
|
|
295
|
-
const host = hosts.find(obj => obj._id === 'system.host.' + instanceObj.common.host);
|
|
296
|
-
if (host) {
|
|
297
|
-
const ip = Utils.findNetworkAddressOfHost(host, currentHostname);
|
|
298
|
-
if (ip) {
|
|
299
|
-
hostname = ip;
|
|
300
|
-
} else {
|
|
301
|
-
console.warn(`Cannot find suitable IP in host ${instanceObj.common.host} for ${instanceObj._id}`);
|
|
302
|
-
return null;
|
|
303
|
-
}
|
|
304
|
-
} else {
|
|
305
|
-
console.warn(`Cannot find host ${instanceObj.common.host} for ${instanceObj._id}`);
|
|
306
|
-
return null;
|
|
307
|
-
}
|
|
308
|
-
} else {
|
|
309
|
-
hostname = currentHostname;
|
|
310
|
-
}
|
|
311
|
-
return hostname;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Format number in seconds to time text
|
|
316
|
-
* @param {string} link pattern for link
|
|
317
|
-
* @param {string} adapter admin name
|
|
318
|
-
* @param {string} instance admin instance
|
|
319
|
-
* @param {object} context {objects, hostname(of browser), protocol(of browser)}
|
|
320
|
-
* @returns {array<any>}
|
|
321
|
-
*/
|
|
322
|
-
static replaceLink(link, adapter, instance, context) {
|
|
323
|
-
const _urls = [];
|
|
324
|
-
let port;
|
|
325
|
-
|
|
326
|
-
if (link) {
|
|
327
|
-
const instanceObj = context.objects[`system.adapter.${adapter}.${instance}`];
|
|
328
|
-
const native = (instanceObj && instanceObj.native) || {};
|
|
329
|
-
|
|
330
|
-
let placeholders = link.match(/%(\w+)%/g);
|
|
331
|
-
|
|
332
|
-
if (placeholders) {
|
|
333
|
-
for (let p = 0; p < placeholders.length; p++) {
|
|
334
|
-
let placeholder = placeholders[p];
|
|
335
|
-
|
|
336
|
-
if (placeholder === '%ip%') {
|
|
337
|
-
let ip = native.bind || native.ip;
|
|
338
|
-
if (!ip || ip === '127.0.0.1' || ip === 'localhost' || ip === '0.0.0.0') {
|
|
339
|
-
// Check host
|
|
340
|
-
ip = Utils.getHostname(
|
|
341
|
-
instanceObj,
|
|
342
|
-
context.objects,
|
|
343
|
-
context.hosts,
|
|
344
|
-
context.hostname,
|
|
345
|
-
context.adminInstance,
|
|
346
|
-
);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
if (_urls.length) {
|
|
350
|
-
_urls.forEach(item => (item.url = item.url.replace('%ip%', ip)));
|
|
351
|
-
} else {
|
|
352
|
-
link = link.replace('%ip%', ip || '');
|
|
353
|
-
}
|
|
354
|
-
} else if (placeholder === '%protocol%') {
|
|
355
|
-
let protocol = native.secure === undefined ? native.protocol : native.secure;
|
|
356
|
-
if (protocol === true || protocol === 'true') {
|
|
357
|
-
protocol = 'https';
|
|
358
|
-
} else if (protocol === false || protocol === 'false' || !protocol) {
|
|
359
|
-
protocol = 'http';
|
|
360
|
-
}
|
|
361
|
-
protocol = protocol.replace(/:$/, '');
|
|
362
|
-
|
|
363
|
-
if (_urls.length) {
|
|
364
|
-
_urls.forEach(item => (item.url = item.url.replace('%protocol%', protocol)));
|
|
365
|
-
} else {
|
|
366
|
-
link = link.replace('%protocol%', protocol);
|
|
367
|
-
}
|
|
368
|
-
} else if (placeholder === '%instance%') {
|
|
369
|
-
link = link.replace('%instance%', instance);
|
|
370
|
-
if (_urls.length) {
|
|
371
|
-
_urls.forEach(item => (item.url = item.url.replace('%instance%', instance)));
|
|
372
|
-
} else {
|
|
373
|
-
link = link.replace('%instance%', instance);
|
|
374
|
-
}
|
|
375
|
-
} else {
|
|
376
|
-
// remove %%
|
|
377
|
-
placeholder = placeholder.replace(/%/g, '');
|
|
378
|
-
|
|
379
|
-
if (placeholder.startsWith('native_')) {
|
|
380
|
-
placeholder = placeholder.substring(7);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// like web.0_port or web_protocol
|
|
384
|
-
if (!placeholder.includes('_')) {
|
|
385
|
-
// if only one instance
|
|
386
|
-
const adapterInstance = adapter + '.' + instance;
|
|
387
|
-
if (_urls.length) {
|
|
388
|
-
_urls.forEach(
|
|
389
|
-
item =>
|
|
390
|
-
(item.url = Utils._replaceLink(
|
|
391
|
-
item.url,
|
|
392
|
-
context.objects,
|
|
393
|
-
adapterInstance,
|
|
394
|
-
placeholder,
|
|
395
|
-
placeholder,
|
|
396
|
-
context.hosts,
|
|
397
|
-
context.hostname,
|
|
398
|
-
context.adminInstance,
|
|
399
|
-
)),
|
|
400
|
-
);
|
|
401
|
-
} else {
|
|
402
|
-
link = Utils._replaceLink(
|
|
403
|
-
link,
|
|
404
|
-
context.objects,
|
|
405
|
-
adapterInstance,
|
|
406
|
-
placeholder,
|
|
407
|
-
placeholder,
|
|
408
|
-
context.hosts,
|
|
409
|
-
context.hostname,
|
|
410
|
-
context.adminInstance,
|
|
411
|
-
);
|
|
412
|
-
port =
|
|
413
|
-
context.objects['system.adapter.' + adapterInstance] &&
|
|
414
|
-
context.objects['system.adapter.' + adapterInstance].native &&
|
|
415
|
-
context.objects['system.adapter.' + adapterInstance].native.port;
|
|
416
|
-
}
|
|
417
|
-
} else {
|
|
418
|
-
const [adapterInstance, attr] = placeholder.split('_');
|
|
419
|
-
|
|
420
|
-
// if instance number not found
|
|
421
|
-
if (!adapterInstance.match(/\.[0-9]+$/)) {
|
|
422
|
-
// list all possible instances
|
|
423
|
-
let ids;
|
|
424
|
-
if (adapter === adapterInstance) {
|
|
425
|
-
// take only this one instance and that's all
|
|
426
|
-
ids = [adapter + '.' + instance];
|
|
427
|
-
} else {
|
|
428
|
-
ids = Object.keys(context.objects)
|
|
429
|
-
.filter(
|
|
430
|
-
id =>
|
|
431
|
-
id.startsWith('system.adapter.' + adapterInstance + '.') &&
|
|
432
|
-
context.objects[id].common.enabled,
|
|
433
|
-
)
|
|
434
|
-
.map(id => id.substring(15));
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// eslint-disable-next-line
|
|
438
|
-
ids.forEach(id => {
|
|
439
|
-
if (_urls.length) {
|
|
440
|
-
const item = _urls.find(t => t.instance === id);
|
|
441
|
-
if (item) {
|
|
442
|
-
item.url = Utils._replaceLink(
|
|
443
|
-
item.url,
|
|
444
|
-
context.objects,
|
|
445
|
-
id,
|
|
446
|
-
attr,
|
|
447
|
-
placeholder,
|
|
448
|
-
context.hosts,
|
|
449
|
-
context.hostname,
|
|
450
|
-
context.adminInstance,
|
|
451
|
-
);
|
|
452
|
-
} else {
|
|
453
|
-
// add new
|
|
454
|
-
const _link = Utils._replaceLink(
|
|
455
|
-
link,
|
|
456
|
-
context.objects,
|
|
457
|
-
id,
|
|
458
|
-
attr,
|
|
459
|
-
placeholder,
|
|
460
|
-
context.hosts,
|
|
461
|
-
context.hostname,
|
|
462
|
-
context.adminInstance,
|
|
463
|
-
);
|
|
464
|
-
const _port =
|
|
465
|
-
context.objects['system.adapter.' + id] &&
|
|
466
|
-
context.objects['system.adapter.' + id].native &&
|
|
467
|
-
context.objects['system.adapter.' + id].native.port;
|
|
468
|
-
_urls.push({ url: _link, port: _port, instance: id });
|
|
469
|
-
}
|
|
470
|
-
} else {
|
|
471
|
-
const _link = Utils._replaceLink(
|
|
472
|
-
link,
|
|
473
|
-
context.objects,
|
|
474
|
-
id,
|
|
475
|
-
attr,
|
|
476
|
-
placeholder,
|
|
477
|
-
context.hosts,
|
|
478
|
-
context.hostname,
|
|
479
|
-
context.adminInstance,
|
|
480
|
-
);
|
|
481
|
-
const _port =
|
|
482
|
-
context.objects['system.adapter.' + id] &&
|
|
483
|
-
context.objects['system.adapter.' + id].native &&
|
|
484
|
-
context.objects['system.adapter.' + id].native.port;
|
|
485
|
-
_urls.push({ url: _link, port: _port, instance: id });
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
} else {
|
|
489
|
-
link = Utils._replaceLink(
|
|
490
|
-
link,
|
|
491
|
-
context.objects,
|
|
492
|
-
adapterInstance,
|
|
493
|
-
attr,
|
|
494
|
-
placeholder,
|
|
495
|
-
context.hosts,
|
|
496
|
-
context.hostname,
|
|
497
|
-
context.adminInstance,
|
|
498
|
-
);
|
|
499
|
-
port =
|
|
500
|
-
context.objects['system.adapter.' + adapterInstance] &&
|
|
501
|
-
context.objects['system.adapter.' + adapterInstance].native &&
|
|
502
|
-
context.objects['system.adapter.' + adapterInstance].native.port;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
if (_urls.length) {
|
|
511
|
-
return _urls;
|
|
512
|
-
} else {
|
|
513
|
-
return [{ url: link, port }];
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
static objectMap(object, callback) {
|
|
518
|
-
let result = [];
|
|
519
|
-
for (let key in object) {
|
|
520
|
-
result.push(callback(object[key], key));
|
|
521
|
-
}
|
|
522
|
-
return result;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
static fixAdminUI(obj) {
|
|
526
|
-
if (obj && obj.common && !obj.common.adminUI) {
|
|
527
|
-
if (obj.common.noConfig) {
|
|
528
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
529
|
-
obj.common.adminUI.config = 'none';
|
|
530
|
-
} else if (obj.common.jsonConfig) {
|
|
531
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
532
|
-
obj.common.adminUI.config = 'json';
|
|
533
|
-
} else if (obj.common.materialize) {
|
|
534
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
535
|
-
obj.common.adminUI.config = 'materialize';
|
|
536
|
-
} else {
|
|
537
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
538
|
-
obj.common.adminUI.config = 'html';
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
if (obj.common.jsonCustom) {
|
|
542
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
543
|
-
obj.common.adminUI.custom = 'json';
|
|
544
|
-
} else if (obj.common.supportCustoms) {
|
|
545
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
546
|
-
obj.common.adminUI.custom = 'json';
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
if (obj.common.materializeTab && obj.common.adminTab) {
|
|
550
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
551
|
-
obj.common.adminUI.tab = 'materialize';
|
|
552
|
-
} else if (obj.common.adminTab) {
|
|
553
|
-
obj.common.adminUI = obj.common.adminUI || {};
|
|
554
|
-
obj.common.adminUI.tab = 'html';
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
obj.common.adminUI &&
|
|
558
|
-
console.warn(
|
|
559
|
-
`Please add to "${obj._id.replace(/\.\d+$/, '')}" common.adminUI=${JSON.stringify(obj.common.adminUI)}`,
|
|
560
|
-
);
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
static parseColorMessage(text) {
|
|
565
|
-
if (text && (text.includes('\u001b[') || text.includes('\u001B['))) {
|
|
566
|
-
// eslint-disable-next-line
|
|
567
|
-
let m = text.match(/\u001b\[\d+m/gi);
|
|
568
|
-
if (m) {
|
|
569
|
-
const original = text;
|
|
570
|
-
const result = [];
|
|
571
|
-
let style = {};
|
|
572
|
-
for (let i = 0; i < m.length; i++) {
|
|
573
|
-
const pos = text.indexOf(m[i]);
|
|
574
|
-
if (pos) {
|
|
575
|
-
result.push({ text: text.substring(0, pos), style: JSON.parse(JSON.stringify(style)) });
|
|
576
|
-
}
|
|
577
|
-
const code = parseInt(m[i].substring(2), 10);
|
|
578
|
-
if (STYLES[code]) {
|
|
579
|
-
Object.assign(style, STYLES[code]);
|
|
580
|
-
} else if (ANSI_RESET_COLOR === code) {
|
|
581
|
-
delete style.color;
|
|
582
|
-
} else if (ANSI_RESET_BG_COLOR === code) {
|
|
583
|
-
delete style.backgroundColor;
|
|
584
|
-
} else if (ANSI_RESET_BOLD === code) {
|
|
585
|
-
delete style.fontWeight;
|
|
586
|
-
} else if (ANSI_BOLD === code) {
|
|
587
|
-
style.fontWeight = 'bold';
|
|
588
|
-
} else if (ANSI_RESET === code) {
|
|
589
|
-
style = {};
|
|
590
|
-
}
|
|
591
|
-
text = text.substring(m[i].length + pos);
|
|
592
|
-
}
|
|
593
|
-
if (text) {
|
|
594
|
-
result.push({ text, style: JSON.parse(JSON.stringify(style)) });
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
return { original, parts: result };
|
|
598
|
-
} else {
|
|
599
|
-
return text;
|
|
600
|
-
}
|
|
601
|
-
} else {
|
|
602
|
-
return text;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
module.exports = Utils;
|
|
608
|
-
// export default Utils;
|