systeminformation 5.33.3 → 6.0.0-beta.0
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 +873 -957
- package/dist/audio.d.ts +1 -0
- package/dist/audio.js +18 -0
- package/dist/baseboard.d.ts +1 -0
- package/dist/baseboard.js +17 -0
- package/dist/battery.d.ts +1 -0
- package/dist/battery.js +19 -0
- package/dist/bios.d.ts +1 -0
- package/dist/bios.js +17 -0
- package/dist/block-devices.d.ts +1 -0
- package/dist/block-devices.js +17 -0
- package/dist/bluetooth.d.ts +1 -0
- package/dist/bluetooth.js +17 -0
- package/dist/bsd/battery.d.ts +2 -0
- package/dist/bsd/battery.js +27 -0
- package/dist/bsd/cpu-cache.d.ts +1 -0
- package/dist/bsd/cpu-cache.js +37 -0
- package/dist/bsd/cpu-flags.d.ts +1 -0
- package/dist/bsd/cpu-flags.js +28 -0
- package/dist/bsd/cpu-temperature.d.ts +1 -0
- package/dist/bsd/cpu-temperature.js +29 -0
- package/dist/bsd/cpu.d.ts +1 -0
- package/dist/bsd/cpu.js +98 -0
- package/dist/bsd/index.d.ts +38 -0
- package/dist/bsd/index.js +85 -0
- package/dist/bsd/mem.d.ts +1 -0
- package/dist/bsd/mem.js +37 -0
- package/dist/bsd/network-stats.d.ts +2 -0
- package/dist/bsd/network-stats.js +92 -0
- package/dist/bsd/os-info.d.ts +21 -0
- package/dist/bsd/os-info.js +38 -0
- package/dist/bsd/uuid.d.ts +2 -0
- package/dist/bsd/uuid.js +30 -0
- package/dist/camera.d.ts +1 -0
- package/dist/camera.js +17 -0
- package/dist/chassis.d.ts +1 -0
- package/dist/chassis.js +17 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +107 -0
- package/dist/common/codepage.d.ts +1 -0
- package/dist/common/codepage.js +43 -0
- package/dist/common/const.d.ts +25 -0
- package/dist/common/const.js +26 -0
- package/dist/common/cpu.d.ts +2 -0
- package/dist/common/cpu.js +12 -0
- package/dist/common/darwin.d.ts +6 -0
- package/dist/common/darwin.js +266 -0
- package/dist/common/datetime.d.ts +9 -0
- package/dist/common/datetime.js +161 -0
- package/dist/common/defaults.d.ts +25 -0
- package/dist/common/defaults.js +299 -0
- package/dist/common/exec.d.ts +10 -0
- package/dist/common/exec.js +69 -0
- package/dist/common/files.d.ts +2 -0
- package/dist/common/files.js +39 -0
- package/dist/common/filesys.d.ts +11 -0
- package/dist/common/filesys.js +282 -0
- package/dist/common/host.d.ts +2 -0
- package/dist/common/host.js +67 -0
- package/dist/common/index.d.ts +12 -0
- package/dist/common/index.js +146 -0
- package/dist/common/internet.d.ts +1 -0
- package/dist/common/internet.js +47 -0
- package/dist/common/mappings.d.ts +55 -0
- package/dist/common/mappings.js +4133 -0
- package/dist/common/network.d.ts +8 -0
- package/dist/common/network.js +162 -0
- package/dist/common/nvidia.d.ts +22 -0
- package/dist/common/nvidia.js +159 -0
- package/dist/common/parse.d.ts +13 -0
- package/dist/common/parse.js +157 -0
- package/dist/common/raspberry.d.ts +5 -0
- package/dist/common/raspberry.js +277 -0
- package/dist/common/security.d.ts +31 -0
- package/dist/common/security.js +241 -0
- package/dist/common/types.d.ts +992 -0
- package/dist/common/types.js +2 -0
- package/dist/common/windows.d.ts +58 -0
- package/dist/common/windows.js +292 -0
- package/dist/cpu-cache.d.ts +1 -0
- package/dist/cpu-cache.js +19 -0
- package/dist/cpu-current-load.d.ts +2 -0
- package/dist/cpu-current-load.js +249 -0
- package/dist/cpu-current-speed.d.ts +3 -0
- package/dist/cpu-current-speed.js +84 -0
- package/dist/cpu-flags.d.ts +1 -0
- package/dist/cpu-flags.js +19 -0
- package/dist/cpu-full-load.d.ts +1 -0
- package/dist/cpu-full-load.js +30 -0
- package/dist/cpu-temperature.d.ts +1 -0
- package/dist/cpu-temperature.js +19 -0
- package/dist/cpu.d.ts +1 -0
- package/dist/cpu.js +19 -0
- package/dist/darwin/audio.d.ts +2 -0
- package/dist/darwin/audio.js +46 -0
- package/dist/darwin/baseboard.d.ts +1 -0
- package/dist/darwin/baseboard.js +48 -0
- package/dist/darwin/battery.d.ts +2 -0
- package/dist/darwin/battery.js +65 -0
- package/dist/darwin/bios.d.ts +1 -0
- package/dist/darwin/bios.js +45 -0
- package/dist/darwin/block-devices.d.ts +2 -0
- package/dist/darwin/block-devices.js +101 -0
- package/dist/darwin/bluetooth.d.ts +3 -0
- package/dist/darwin/bluetooth.js +84 -0
- package/dist/darwin/camera.d.ts +2 -0
- package/dist/darwin/camera.js +55 -0
- package/dist/darwin/chassis.d.ts +2 -0
- package/dist/darwin/chassis.js +32 -0
- package/dist/darwin/cpu-cache.d.ts +2 -0
- package/dist/darwin/cpu-cache.js +29 -0
- package/dist/darwin/cpu-flags.d.ts +1 -0
- package/dist/darwin/cpu-flags.js +16 -0
- package/dist/darwin/cpu-temperature.d.ts +1 -0
- package/dist/darwin/cpu-temperature.js +44 -0
- package/dist/darwin/cpu.d.ts +1 -0
- package/dist/darwin/cpu.js +69 -0
- package/dist/darwin/disk-layout.d.ts +2 -0
- package/dist/darwin/disk-layout.js +231 -0
- package/dist/darwin/disks-io.d.ts +2 -0
- package/dist/darwin/disks-io.js +56 -0
- package/dist/darwin/displays.d.ts +2 -0
- package/dist/darwin/displays.js +98 -0
- package/dist/darwin/fs-open-files.d.ts +2 -0
- package/dist/darwin/fs-open-files.js +27 -0
- package/dist/darwin/fs-stats.d.ts +2 -0
- package/dist/darwin/fs-stats.js +47 -0
- package/dist/darwin/gpu.d.ts +2 -0
- package/dist/darwin/gpu.js +55 -0
- package/dist/darwin/index.d.ts +56 -0
- package/dist/darwin/index.js +122 -0
- package/dist/darwin/keyboard.d.ts +2 -0
- package/dist/darwin/keyboard.js +73 -0
- package/dist/darwin/mem-layout.d.ts +2 -0
- package/dist/darwin/mem-layout.js +60 -0
- package/dist/darwin/mem.d.ts +2 -0
- package/dist/darwin/mem.js +50 -0
- package/dist/darwin/mouse.d.ts +2 -0
- package/dist/darwin/mouse.js +78 -0
- package/dist/darwin/network-connections.d.ts +2 -0
- package/dist/darwin/network-connections.js +98 -0
- package/dist/darwin/network-gateway-default.d.ts +1 -0
- package/dist/darwin/network-gateway-default.js +26 -0
- package/dist/darwin/network-interface-default.d.ts +2 -0
- package/dist/darwin/network-interface-default.js +41 -0
- package/dist/darwin/network-interfaces.d.ts +2 -0
- package/dist/darwin/network-interfaces.js +205 -0
- package/dist/darwin/network-stats.d.ts +2 -0
- package/dist/darwin/network-stats.js +86 -0
- package/dist/darwin/npm.d.ts +1 -0
- package/dist/darwin/npm.js +5 -0
- package/dist/darwin/npu.d.ts +2 -0
- package/dist/darwin/npu.js +41 -0
- package/dist/darwin/os-info.d.ts +1 -0
- package/dist/darwin/os-info.js +110 -0
- package/dist/darwin/pci.d.ts +2 -0
- package/dist/darwin/pci.js +37 -0
- package/dist/darwin/printer.d.ts +2 -0
- package/dist/darwin/printer.js +45 -0
- package/dist/darwin/software.d.ts +2 -0
- package/dist/darwin/software.js +39 -0
- package/dist/darwin/system.d.ts +1 -0
- package/dist/darwin/system.js +29 -0
- package/dist/darwin/thunderbolt.d.ts +1 -0
- package/dist/darwin/thunderbolt.js +53 -0
- package/dist/darwin/usb.d.ts +3 -0
- package/dist/darwin/usb.js +69 -0
- package/dist/darwin/users.d.ts +2 -0
- package/dist/darwin/users.js +13 -0
- package/dist/darwin/uuid.d.ts +2 -0
- package/dist/darwin/uuid.js +39 -0
- package/dist/darwin/wifi-connections.d.ts +2 -0
- package/dist/darwin/wifi-connections.js +60 -0
- package/dist/darwin/wifi-interfaces.d.ts +2 -0
- package/dist/darwin/wifi-interfaces.js +27 -0
- package/dist/darwin/wifi-networks.d.ts +2 -0
- package/dist/darwin/wifi-networks.js +61 -0
- package/dist/disk-layout.d.ts +1 -0
- package/dist/disk-layout.js +17 -0
- package/dist/disks-io.d.ts +1 -0
- package/dist/disks-io.js +17 -0
- package/dist/displays.d.ts +1 -0
- package/dist/displays.js +17 -0
- package/dist/docker-socket.d.ts +11 -0
- package/dist/docker-socket.js +113 -0
- package/dist/docker.d.ts +102 -0
- package/dist/docker.js +532 -0
- package/dist/fs-open-files.d.ts +1 -0
- package/dist/fs-open-files.js +17 -0
- package/dist/fs-size.d.ts +1 -0
- package/dist/fs-size.js +23 -0
- package/dist/fs-stats.d.ts +1 -0
- package/dist/fs-stats.js +17 -0
- package/dist/get-data.d.ts +110 -0
- package/dist/get-data.js +151 -0
- package/dist/get.d.ts +5 -0
- package/dist/get.js +117 -0
- package/dist/gpu.d.ts +1 -0
- package/dist/gpu.js +17 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +130 -0
- package/dist/inet-checksite.d.ts +1 -0
- package/dist/inet-checksite.js +11 -0
- package/dist/inet-latency.d.ts +1 -0
- package/dist/inet-latency.js +17 -0
- package/dist/keyboard.d.ts +1 -0
- package/dist/keyboard.js +17 -0
- package/dist/linux/audio.d.ts +2 -0
- package/dist/linux/audio.js +67 -0
- package/dist/linux/baseboard.d.ts +1 -0
- package/dist/linux/baseboard.js +81 -0
- package/dist/linux/battery.d.ts +2 -0
- package/dist/linux/battery.js +88 -0
- package/dist/linux/bios.d.ts +2 -0
- package/dist/linux/bios.js +55 -0
- package/dist/linux/block-devices.d.ts +2 -0
- package/dist/linux/block-devices.js +30 -0
- package/dist/linux/bluetooth.d.ts +2 -0
- package/dist/linux/bluetooth.js +86 -0
- package/dist/linux/camera.d.ts +2 -0
- package/dist/linux/camera.js +63 -0
- package/dist/linux/chassis.d.ts +1 -0
- package/dist/linux/chassis.js +41 -0
- package/dist/linux/cpu-cache.d.ts +1 -0
- package/dist/linux/cpu-cache.js +35 -0
- package/dist/linux/cpu-flags.d.ts +1 -0
- package/dist/linux/cpu-flags.js +33 -0
- package/dist/linux/cpu-temperature.d.ts +1 -0
- package/dist/linux/cpu-temperature.js +179 -0
- package/dist/linux/cpu.d.ts +1 -0
- package/dist/linux/cpu.js +135 -0
- package/dist/linux/disk-layout.d.ts +2 -0
- package/dist/linux/disk-layout.js +151 -0
- package/dist/linux/disks-io.d.ts +2 -0
- package/dist/linux/disks-io.js +58 -0
- package/dist/linux/displays.d.ts +2 -0
- package/dist/linux/displays.js +193 -0
- package/dist/linux/fs-open-files.d.ts +2 -0
- package/dist/linux/fs-open-files.js +44 -0
- package/dist/linux/fs-size.d.ts +2 -0
- package/dist/linux/fs-size.js +157 -0
- package/dist/linux/fs-stats.d.ts +2 -0
- package/dist/linux/fs-stats.js +65 -0
- package/dist/linux/gpu.d.ts +2 -0
- package/dist/linux/gpu.js +273 -0
- package/dist/linux/index.d.ts +56 -0
- package/dist/linux/index.js +122 -0
- package/dist/linux/inet-latency.d.ts +1 -0
- package/dist/linux/inet-latency.js +39 -0
- package/dist/linux/keyboard.d.ts +2 -0
- package/dist/linux/keyboard.js +61 -0
- package/dist/linux/mem-layout.d.ts +2 -0
- package/dist/linux/mem-layout.js +112 -0
- package/dist/linux/mem.d.ts +2 -0
- package/dist/linux/mem.js +61 -0
- package/dist/linux/mouse.d.ts +2 -0
- package/dist/linux/mouse.js +73 -0
- package/dist/linux/network-connections.d.ts +2 -0
- package/dist/linux/network-connections.js +114 -0
- package/dist/linux/network-gateway-default.d.ts +1 -0
- package/dist/linux/network-gateway-default.js +22 -0
- package/dist/linux/network-interface-default.d.ts +2 -0
- package/dist/linux/network-interface-default.js +46 -0
- package/dist/linux/network-interfaces.d.ts +3 -0
- package/dist/linux/network-interfaces.js +353 -0
- package/dist/linux/network-stats.d.ts +2 -0
- package/dist/linux/network-stats.js +99 -0
- package/dist/linux/npm.d.ts +1 -0
- package/dist/linux/npm.js +5 -0
- package/dist/linux/npu.d.ts +2 -0
- package/dist/linux/npu.js +77 -0
- package/dist/linux/os-info.d.ts +1 -0
- package/dist/linux/os-info.js +104 -0
- package/dist/linux/pci.d.ts +2 -0
- package/dist/linux/pci.js +56 -0
- package/dist/linux/printer.d.ts +2 -0
- package/dist/linux/printer.js +80 -0
- package/dist/linux/process-load.d.ts +2 -0
- package/dist/linux/process-load.js +164 -0
- package/dist/linux/processes.d.ts +2 -0
- package/dist/linux/processes.js +358 -0
- package/dist/linux/services.d.ts +2 -0
- package/dist/linux/services.js +222 -0
- package/dist/linux/software.d.ts +2 -0
- package/dist/linux/software.js +110 -0
- package/dist/linux/system.d.ts +1 -0
- package/dist/linux/system.js +186 -0
- package/dist/linux/thunderbolt.d.ts +2 -0
- package/dist/linux/thunderbolt.js +51 -0
- package/dist/linux/time.d.ts +6 -0
- package/dist/linux/time.js +28 -0
- package/dist/linux/usb.d.ts +2 -0
- package/dist/linux/usb.js +62 -0
- package/dist/linux/users.d.ts +2 -0
- package/dist/linux/users.js +102 -0
- package/dist/linux/uuid.d.ts +2 -0
- package/dist/linux/uuid.js +44 -0
- package/dist/linux/wifi-connections.d.ts +2 -0
- package/dist/linux/wifi-connections.js +196 -0
- package/dist/linux/wifi-interfaces.d.ts +2 -0
- package/dist/linux/wifi-interfaces.js +96 -0
- package/dist/linux/wifi-networks.d.ts +2 -0
- package/dist/linux/wifi-networks.js +176 -0
- package/dist/mem-layout.d.ts +1 -0
- package/dist/mem-layout.js +17 -0
- package/dist/mem.d.ts +1 -0
- package/dist/mem.js +19 -0
- package/dist/mouse.d.ts +1 -0
- package/dist/mouse.js +17 -0
- package/dist/network-connections.d.ts +1 -0
- package/dist/network-connections.js +17 -0
- package/dist/network-gateway-default.d.ts +1 -0
- package/dist/network-gateway-default.js +17 -0
- package/dist/network-interface-default.d.ts +1 -0
- package/dist/network-interface-default.js +17 -0
- package/dist/network-interfaces.d.ts +1 -0
- package/dist/network-interfaces.js +18 -0
- package/dist/network-stats.d.ts +1 -0
- package/dist/network-stats.js +19 -0
- package/dist/npm.d.ts +2 -0
- package/dist/npm.js +22 -0
- package/dist/npu.d.ts +1 -0
- package/dist/npu.js +17 -0
- package/dist/observe.d.ts +5 -0
- package/dist/observe.js +16 -0
- package/dist/os-info.d.ts +1 -0
- package/dist/os-info.js +21 -0
- package/dist/pci.d.ts +1 -0
- package/dist/pci.js +17 -0
- package/dist/printer.d.ts +1 -0
- package/dist/printer.js +17 -0
- package/dist/process-load.d.ts +1 -0
- package/dist/process-load.js +15 -0
- package/dist/processes.d.ts +1 -0
- package/dist/processes.js +15 -0
- package/dist/services.d.ts +1 -0
- package/dist/services.js +15 -0
- package/dist/shell.d.ts +1 -0
- package/dist/shell.js +16 -0
- package/dist/software.d.ts +1 -0
- package/dist/software.js +17 -0
- package/dist/sun/index.d.ts +17 -0
- package/dist/sun/index.js +43 -0
- package/dist/sun/inet-latency.d.ts +1 -0
- package/dist/sun/inet-latency.js +30 -0
- package/dist/sun/os-info.d.ts +1 -0
- package/dist/sun/os-info.js +26 -0
- package/dist/sun/users.d.ts +2 -0
- package/dist/sun/users.js +13 -0
- package/dist/system.d.ts +1 -0
- package/dist/system.js +17 -0
- package/dist/thunderbolt.d.ts +1 -0
- package/dist/thunderbolt.js +17 -0
- package/dist/time.d.ts +6 -0
- package/dist/time.js +28 -0
- package/dist/usb.d.ts +1 -0
- package/dist/usb.js +17 -0
- package/dist/users.d.ts +1 -0
- package/dist/users.js +21 -0
- package/dist/uuid.d.ts +1 -0
- package/dist/uuid.js +19 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +16 -0
- package/dist/versions.d.ts +2 -0
- package/dist/versions.js +1122 -0
- package/dist/virtualbox.d.ts +2 -0
- package/dist/virtualbox.js +89 -0
- package/dist/wifi-connections.d.ts +1 -0
- package/dist/wifi-connections.js +17 -0
- package/dist/wifi-interfaces.d.ts +1 -0
- package/dist/wifi-interfaces.js +17 -0
- package/dist/wifi-networks.d.ts +1 -0
- package/dist/wifi-networks.js +17 -0
- package/dist/windows/audio.d.ts +2 -0
- package/dist/windows/audio.js +23 -0
- package/dist/windows/baseboard.d.ts +1 -0
- package/dist/windows/baseboard.js +35 -0
- package/dist/windows/battery.d.ts +1 -0
- package/dist/windows/battery.js +81 -0
- package/dist/windows/bios.d.ts +1 -0
- package/dist/windows/bios.js +37 -0
- package/dist/windows/block-devices.d.ts +2 -0
- package/dist/windows/block-devices.js +48 -0
- package/dist/windows/bluetooth.d.ts +2 -0
- package/dist/windows/bluetooth.js +31 -0
- package/dist/windows/camera.d.ts +2 -0
- package/dist/windows/camera.js +47 -0
- package/dist/windows/chassis.d.ts +1 -0
- package/dist/windows/chassis.js +29 -0
- package/dist/windows/cpu-cache.d.ts +2 -0
- package/dist/windows/cpu-cache.js +59 -0
- package/dist/windows/cpu-flags.d.ts +1 -0
- package/dist/windows/cpu-flags.js +61 -0
- package/dist/windows/cpu-temperature.d.ts +1 -0
- package/dist/windows/cpu-temperature.js +32 -0
- package/dist/windows/cpu.d.ts +1 -0
- package/dist/windows/cpu.js +96 -0
- package/dist/windows/disk-layout.d.ts +2 -0
- package/dist/windows/disk-layout.js +112 -0
- package/dist/windows/disks-io.d.ts +2 -0
- package/dist/windows/disks-io.js +43 -0
- package/dist/windows/displays.d.ts +2 -0
- package/dist/windows/displays.js +213 -0
- package/dist/windows/fs-open-files.d.ts +2 -0
- package/dist/windows/fs-open-files.js +22 -0
- package/dist/windows/fs-size.d.ts +2 -0
- package/dist/windows/fs-size.js +47 -0
- package/dist/windows/fs-stats.d.ts +2 -0
- package/dist/windows/fs-stats.js +37 -0
- package/dist/windows/gpu.d.ts +2 -0
- package/dist/windows/gpu.js +128 -0
- package/dist/windows/index.d.ts +56 -0
- package/dist/windows/index.js +122 -0
- package/dist/windows/inet-latency.d.ts +1 -0
- package/dist/windows/inet-latency.js +34 -0
- package/dist/windows/keyboard.d.ts +2 -0
- package/dist/windows/keyboard.js +47 -0
- package/dist/windows/mem-layout.d.ts +2 -0
- package/dist/windows/mem-layout.js +39 -0
- package/dist/windows/mem.d.ts +2 -0
- package/dist/windows/mem.js +33 -0
- package/dist/windows/mouse.d.ts +2 -0
- package/dist/windows/mouse.js +64 -0
- package/dist/windows/network-connections.d.ts +2 -0
- package/dist/windows/network-connections.js +93 -0
- package/dist/windows/network-gateway-default.d.ts +1 -0
- package/dist/windows/network-gateway-default.js +36 -0
- package/dist/windows/network-interface-default.d.ts +2 -0
- package/dist/windows/network-interface-default.js +56 -0
- package/dist/windows/network-interfaces.d.ts +2 -0
- package/dist/windows/network-interfaces.js +346 -0
- package/dist/windows/network-stats.d.ts +2 -0
- package/dist/windows/network-stats.js +135 -0
- package/dist/windows/npm.d.ts +1 -0
- package/dist/windows/npm.js +5 -0
- package/dist/windows/npu.d.ts +2 -0
- package/dist/windows/npu.js +29 -0
- package/dist/windows/os-info.d.ts +1 -0
- package/dist/windows/os-info.js +65 -0
- package/dist/windows/pci.d.ts +2 -0
- package/dist/windows/pci.js +33 -0
- package/dist/windows/printer.d.ts +2 -0
- package/dist/windows/printer.js +36 -0
- package/dist/windows/process-load.d.ts +2 -0
- package/dist/windows/process-load.js +121 -0
- package/dist/windows/processes.d.ts +9 -0
- package/dist/windows/processes.js +139 -0
- package/dist/windows/services.d.ts +2 -0
- package/dist/windows/services.js +83 -0
- package/dist/windows/shell.d.ts +1 -0
- package/dist/windows/shell.js +19 -0
- package/dist/windows/software.d.ts +2 -0
- package/dist/windows/software.js +53 -0
- package/dist/windows/system.d.ts +1 -0
- package/dist/windows/system.js +98 -0
- package/dist/windows/thunderbolt.d.ts +2 -0
- package/dist/windows/thunderbolt.js +34 -0
- package/dist/windows/usb.d.ts +2 -0
- package/dist/windows/usb.js +37 -0
- package/dist/windows/users.d.ts +2 -0
- package/dist/windows/users.js +151 -0
- package/dist/windows/uuid.d.ts +2 -0
- package/dist/windows/uuid.js +28 -0
- package/dist/windows/wifi-connections.d.ts +2 -0
- package/dist/windows/wifi-connections.js +56 -0
- package/dist/windows/wifi-interfaces.d.ts +2 -0
- package/dist/windows/wifi-interfaces.js +45 -0
- package/dist/windows/wifi-networks.d.ts +2 -0
- package/dist/windows/wifi-networks.js +50 -0
- package/package.json +78 -12
- package/lib/audio.js +0 -277
- package/lib/battery.js +0 -334
- package/lib/bluetooth.js +0 -315
- package/lib/bluetoothVendors.js +0 -1138
- package/lib/cli.js +0 -100
- package/lib/cpu.js +0 -2285
- package/lib/docker.js +0 -791
- package/lib/dockerSocket.js +0 -117
- package/lib/filesystem.js +0 -1832
- package/lib/graphics.js +0 -1321
- package/lib/index.d.ts +0 -1051
- package/lib/index.js +0 -520
- package/lib/internet.js +0 -259
- package/lib/memory.js +0 -622
- package/lib/network.js +0 -2008
- package/lib/osinfo.js +0 -1321
- package/lib/printer.js +0 -209
- package/lib/processes.js +0 -1459
- package/lib/system.js +0 -855
- package/lib/usb.js +0 -309
- package/lib/users.js +0 -412
- package/lib/util.js +0 -2824
- package/lib/virtualbox.js +0 -116
- package/lib/wifi.js +0 -839
package/lib/util.js
DELETED
|
@@ -1,2824 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
// @ts-check
|
|
3
|
-
// ==================================================================================
|
|
4
|
-
// utils.js
|
|
5
|
-
// ----------------------------------------------------------------------------------
|
|
6
|
-
// Description: System Information - library
|
|
7
|
-
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 - 2026
|
|
9
|
-
// Author: Sebastian Hildebrandt
|
|
10
|
-
// ----------------------------------------------------------------------------------
|
|
11
|
-
// License: MIT
|
|
12
|
-
// ==================================================================================
|
|
13
|
-
// 0. helper functions
|
|
14
|
-
// ----------------------------------------------------------------------------------
|
|
15
|
-
|
|
16
|
-
const os = require('os');
|
|
17
|
-
const fs = require('fs');
|
|
18
|
-
const path = require('path');
|
|
19
|
-
const spawn = require('child_process').spawn;
|
|
20
|
-
const exec = require('child_process').exec;
|
|
21
|
-
const execSync = require('child_process').execSync;
|
|
22
|
-
const util = require('util');
|
|
23
|
-
|
|
24
|
-
const _platform = process.platform;
|
|
25
|
-
const _linux = _platform === 'linux' || _platform === 'android';
|
|
26
|
-
const _darwin = _platform === 'darwin';
|
|
27
|
-
const _windows = _platform === 'win32';
|
|
28
|
-
const _freebsd = _platform === 'freebsd';
|
|
29
|
-
const _openbsd = _platform === 'openbsd';
|
|
30
|
-
const _netbsd = _platform === 'netbsd';
|
|
31
|
-
|
|
32
|
-
let _cores = 0;
|
|
33
|
-
let codepage = '';
|
|
34
|
-
let _smartMonToolsInstalled = null;
|
|
35
|
-
let _rpi_cpuinfo = null;
|
|
36
|
-
|
|
37
|
-
const WINDIR = process.env.WINDIR || 'C:\\Windows';
|
|
38
|
-
|
|
39
|
-
// powerShell
|
|
40
|
-
let _psChild;
|
|
41
|
-
let _psResult = '';
|
|
42
|
-
const _psCmds = [];
|
|
43
|
-
let _psPersistent = false;
|
|
44
|
-
let _powerShell = '';
|
|
45
|
-
const _psToUTF8 = '$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ';
|
|
46
|
-
const _psCmdStart = '--###START###--';
|
|
47
|
-
const _psError = '--ERROR--';
|
|
48
|
-
const _psCmdSeperator = '--###ENDCMD###--';
|
|
49
|
-
const _psIdSeperator = '--##ID##--';
|
|
50
|
-
|
|
51
|
-
const execOptsWin = {
|
|
52
|
-
windowsHide: true,
|
|
53
|
-
maxBuffer: 1024 * 102400,
|
|
54
|
-
encoding: 'UTF-8',
|
|
55
|
-
env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' })
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const execOptsLinux = {
|
|
59
|
-
maxBuffer: 1024 * 102400,
|
|
60
|
-
encoding: 'UTF-8',
|
|
61
|
-
stdio: ['pipe', 'pipe', 'ignore']
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
function toInt(value) {
|
|
65
|
-
let result = parseInt(value, 10);
|
|
66
|
-
if (isNaN(result)) {
|
|
67
|
-
result = 0;
|
|
68
|
-
}
|
|
69
|
-
return result;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function splitByNumber(str) {
|
|
73
|
-
let numberStarted = false;
|
|
74
|
-
let num = '';
|
|
75
|
-
let cpart = '';
|
|
76
|
-
for (const c of str) {
|
|
77
|
-
if ((c >= '0' && c <= '9') || numberStarted) {
|
|
78
|
-
numberStarted = true;
|
|
79
|
-
num += c;
|
|
80
|
-
} else {
|
|
81
|
-
cpart += c;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return [cpart, num];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const stringObj = new String();
|
|
88
|
-
const stringReplace = new String().replace;
|
|
89
|
-
const stringToLower = new String().toLowerCase;
|
|
90
|
-
const stringToString = new String().toString;
|
|
91
|
-
const stringSubstr = new String().substr;
|
|
92
|
-
const stringSubstring = new String().substring;
|
|
93
|
-
const stringTrim = new String().trim;
|
|
94
|
-
const stringStartWith = new String().startsWith;
|
|
95
|
-
const mathMin = Math.min;
|
|
96
|
-
|
|
97
|
-
function isFunction(functionToCheck) {
|
|
98
|
-
let getType = {};
|
|
99
|
-
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function unique(obj) {
|
|
103
|
-
const uniques = [];
|
|
104
|
-
const stringify = {};
|
|
105
|
-
for (let i = 0; i < obj.length; i++) {
|
|
106
|
-
let keys = Object.keys(obj[i]);
|
|
107
|
-
keys.sort((a, b) => {
|
|
108
|
-
return a - b;
|
|
109
|
-
});
|
|
110
|
-
let str = '';
|
|
111
|
-
for (let j = 0; j < keys.length; j++) {
|
|
112
|
-
str += JSON.stringify(keys[j]);
|
|
113
|
-
str += JSON.stringify(obj[i][keys[j]]);
|
|
114
|
-
}
|
|
115
|
-
if (!{}.hasOwnProperty.call(stringify, str)) {
|
|
116
|
-
uniques.push(obj[i]);
|
|
117
|
-
stringify[str] = true;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return uniques;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function sortByKey(array, keys) {
|
|
124
|
-
return array.sort((a, b) => {
|
|
125
|
-
let x = '';
|
|
126
|
-
let y = '';
|
|
127
|
-
keys.forEach((key) => {
|
|
128
|
-
x = x + a[key];
|
|
129
|
-
y = y + b[key];
|
|
130
|
-
});
|
|
131
|
-
return x < y ? -1 : x > y ? 1 : 0;
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function cores() {
|
|
136
|
-
if (_cores === 0) {
|
|
137
|
-
_cores = os.cpus().length;
|
|
138
|
-
}
|
|
139
|
-
return _cores;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function getValue(lines, property, separator, trimmed, lineMatch) {
|
|
143
|
-
separator = separator || ':';
|
|
144
|
-
property = property.toLowerCase();
|
|
145
|
-
trimmed = trimmed || false;
|
|
146
|
-
lineMatch = lineMatch || false;
|
|
147
|
-
let result = '';
|
|
148
|
-
lines.some((line) => {
|
|
149
|
-
let lineLower = line.toLowerCase().replace(/\t/g, '');
|
|
150
|
-
if (trimmed) {
|
|
151
|
-
lineLower = lineLower.trim();
|
|
152
|
-
}
|
|
153
|
-
if (lineLower.startsWith(property) && (lineMatch ? lineLower.match(property + separator) || lineLower.match(property + ' ' + separator) : true)) {
|
|
154
|
-
const parts = trimmed ? line.trim().split(separator) : line.split(separator);
|
|
155
|
-
if (parts.length >= 2) {
|
|
156
|
-
parts.shift();
|
|
157
|
-
result = parts.join(separator).trim();
|
|
158
|
-
return true;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return false;
|
|
162
|
-
});
|
|
163
|
-
return result;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function decodeEscapeSequence(str, base) {
|
|
167
|
-
base = base || 16;
|
|
168
|
-
return str.replace(/\\x([0-9A-Fa-f]{2})/g, function () {
|
|
169
|
-
return String.fromCharCode(parseInt(arguments[1], base));
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function detectSplit(str) {
|
|
174
|
-
let seperator = '';
|
|
175
|
-
let part = 0;
|
|
176
|
-
str.split('').forEach((element) => {
|
|
177
|
-
if (element >= '0' && element <= '9') {
|
|
178
|
-
if (part === 1) {
|
|
179
|
-
part++;
|
|
180
|
-
}
|
|
181
|
-
} else {
|
|
182
|
-
if (part === 0) {
|
|
183
|
-
part++;
|
|
184
|
-
}
|
|
185
|
-
if (part === 1) {
|
|
186
|
-
seperator += element;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
return seperator;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function parseTime(t, pmDesignator) {
|
|
194
|
-
pmDesignator = pmDesignator || '';
|
|
195
|
-
t = t.toUpperCase();
|
|
196
|
-
let hour = 0;
|
|
197
|
-
let min = 0;
|
|
198
|
-
const splitter = detectSplit(t);
|
|
199
|
-
const parts = t.split(splitter);
|
|
200
|
-
if (parts.length >= 2) {
|
|
201
|
-
if (parts[2]) {
|
|
202
|
-
parts[1] += parts[2];
|
|
203
|
-
}
|
|
204
|
-
const p1 = (parts[1] || '').toLowerCase();
|
|
205
|
-
let isPM = p1.indexOf('pm') > -1 || p1.indexOf('p.m.') > -1 || p1.indexOf('p. m.') > -1 || p1.indexOf('n') > -1 || p1.indexOf('ch') > -1 || p1.indexOf('ös') > -1 || (pmDesignator && p1.indexOf(pmDesignator) > -1);
|
|
206
|
-
hour = parseInt(parts[0], 10);
|
|
207
|
-
min = parseInt(parts[1], 10);
|
|
208
|
-
hour = isPM && hour < 12 ? hour + 12 : hour;
|
|
209
|
-
return ('0' + hour).substr(-2) + ':' + ('0' + min).substr(-2);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function parseDateTime(dt, culture) {
|
|
214
|
-
const result = {
|
|
215
|
-
date: '',
|
|
216
|
-
time: ''
|
|
217
|
-
};
|
|
218
|
-
culture = culture || {};
|
|
219
|
-
const dateFormat = (culture.dateFormat || '').toLowerCase();
|
|
220
|
-
const pmDesignator = culture.pmDesignator || '';
|
|
221
|
-
|
|
222
|
-
const parts = dt.split(' ');
|
|
223
|
-
if (parts[0]) {
|
|
224
|
-
if (parts[0].indexOf('/') >= 0) {
|
|
225
|
-
// Dateformat: mm/dd/yyyy or dd/mm/yyyy or dd/mm/yy or yyyy/mm/dd
|
|
226
|
-
const dtparts = parts[0].split('/');
|
|
227
|
-
if (dtparts.length === 3) {
|
|
228
|
-
if (dtparts[0].length === 4) {
|
|
229
|
-
// Dateformat: yyyy/mm/dd
|
|
230
|
-
result.date = dtparts[0] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[2]).substr(-2);
|
|
231
|
-
} else if (dtparts[2].length === 2) {
|
|
232
|
-
if (dateFormat.indexOf('/d/') > -1 || dateFormat.indexOf('/dd/') > -1) {
|
|
233
|
-
// Dateformat: mm/dd/yy
|
|
234
|
-
result.date = '20' + dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
|
|
235
|
-
} else {
|
|
236
|
-
// Dateformat: dd/mm/yy
|
|
237
|
-
result.date = '20' + dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
|
|
238
|
-
}
|
|
239
|
-
} else {
|
|
240
|
-
// Dateformat: mm/dd/yyyy or dd/mm/yyyy
|
|
241
|
-
const isEN =
|
|
242
|
-
dt.toLowerCase().indexOf('pm') > -1 ||
|
|
243
|
-
dt.toLowerCase().indexOf('p.m.') > -1 ||
|
|
244
|
-
dt.toLowerCase().indexOf('p. m.') > -1 ||
|
|
245
|
-
dt.toLowerCase().indexOf('am') > -1 ||
|
|
246
|
-
dt.toLowerCase().indexOf('a.m.') > -1 ||
|
|
247
|
-
dt.toLowerCase().indexOf('a. m.') > -1;
|
|
248
|
-
if ((isEN || dateFormat.indexOf('/d/') > -1 || dateFormat.indexOf('/dd/') > -1) && dateFormat.indexOf('dd/') !== 0) {
|
|
249
|
-
// Dateformat: mm/dd/yyyy
|
|
250
|
-
result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2);
|
|
251
|
-
} else {
|
|
252
|
-
// Dateformat: dd/mm/yyyy
|
|
253
|
-
result.date = dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
if (parts[0].indexOf('.') >= 0) {
|
|
259
|
-
const dtparts = parts[0].split('.');
|
|
260
|
-
if (dtparts.length === 3) {
|
|
261
|
-
if (dateFormat.indexOf('.d.') > -1 || dateFormat.indexOf('.dd.') > -1) {
|
|
262
|
-
// Dateformat: mm.dd.yyyy
|
|
263
|
-
result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2);
|
|
264
|
-
} else {
|
|
265
|
-
// Dateformat: dd.mm.yyyy
|
|
266
|
-
result.date = dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
if (parts[0].indexOf('-') >= 0) {
|
|
271
|
-
// Dateformat: yyyy-mm-dd
|
|
272
|
-
const dtparts = parts[0].split('-');
|
|
273
|
-
if (dtparts.length === 3) {
|
|
274
|
-
result.date = dtparts[0] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[2]).substr(-2);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
if (parts[1]) {
|
|
279
|
-
parts.shift();
|
|
280
|
-
const time = parts.join(' ');
|
|
281
|
-
result.time = parseTime(time, pmDesignator);
|
|
282
|
-
}
|
|
283
|
-
return result;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function parseHead(head, rights) {
|
|
287
|
-
let space = rights > 0;
|
|
288
|
-
let count = 1;
|
|
289
|
-
let from = 0;
|
|
290
|
-
let to = 0;
|
|
291
|
-
const result = [];
|
|
292
|
-
for (let i = 0; i < head.length; i++) {
|
|
293
|
-
if (count <= rights) {
|
|
294
|
-
if (/\s/.test(head[i]) && !space) {
|
|
295
|
-
to = i - 1;
|
|
296
|
-
result.push({
|
|
297
|
-
from: from,
|
|
298
|
-
to: to + 1,
|
|
299
|
-
cap: head.substring(from, to + 1)
|
|
300
|
-
});
|
|
301
|
-
from = to + 2;
|
|
302
|
-
count++;
|
|
303
|
-
}
|
|
304
|
-
space = head[i] === ' ';
|
|
305
|
-
} else {
|
|
306
|
-
if (!/\s/.test(head[i]) && space) {
|
|
307
|
-
to = i - 1;
|
|
308
|
-
if (from < to) {
|
|
309
|
-
result.push({
|
|
310
|
-
from: from,
|
|
311
|
-
to: to,
|
|
312
|
-
cap: head.substring(from, to)
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
from = to + 1;
|
|
316
|
-
count++;
|
|
317
|
-
}
|
|
318
|
-
space = head[i] === ' ';
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
to = 5000;
|
|
322
|
-
result.push({
|
|
323
|
-
from: from,
|
|
324
|
-
to: to,
|
|
325
|
-
cap: head.substring(from, to)
|
|
326
|
-
});
|
|
327
|
-
let len = result.length;
|
|
328
|
-
for (let i = 0; i < len; i++) {
|
|
329
|
-
if (result[i].cap.replace(/\s/g, '').length === 0) {
|
|
330
|
-
if (i + 1 < len) {
|
|
331
|
-
result[i].to = result[i + 1].to;
|
|
332
|
-
result[i].cap = result[i].cap + result[i + 1].cap;
|
|
333
|
-
result.splice(i + 1, 1);
|
|
334
|
-
len = len - 1;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return result;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
function findObjectByKey(array, key, value) {
|
|
342
|
-
for (let i = 0; i < array.length; i++) {
|
|
343
|
-
if (array[i][key] === value) {
|
|
344
|
-
return i;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
return -1;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
function getPowershell() {
|
|
351
|
-
_powerShell = 'powershell.exe';
|
|
352
|
-
if (_windows) {
|
|
353
|
-
const defaultPath = `${WINDIR}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
354
|
-
if (fs.existsSync(defaultPath)) {
|
|
355
|
-
_powerShell = defaultPath;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function getVboxmanage() {
|
|
361
|
-
const vboxPath = (process.env.VBOX_INSTALL_PATH || process.env.VBOX_MSI_INSTALL_PATH || '').replace(/["%!^&|<>`$;\r\n]/g, '');
|
|
362
|
-
return _windows ? `"${vboxPath}\\VBoxManage.exe"` : 'vboxmanage';
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function powerShellProceedResults(data) {
|
|
366
|
-
let id = '';
|
|
367
|
-
let parts;
|
|
368
|
-
let res = '';
|
|
369
|
-
// startID
|
|
370
|
-
if (data.indexOf(_psCmdStart) >= 0) {
|
|
371
|
-
parts = data.split(_psCmdStart);
|
|
372
|
-
const parts2 = parts[1].split(_psIdSeperator);
|
|
373
|
-
id = parts2[0];
|
|
374
|
-
if (parts2.length > 1) {
|
|
375
|
-
data = parts2.slice(1).join(_psIdSeperator);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
// result;
|
|
379
|
-
if (data.indexOf(_psCmdSeperator) >= 0) {
|
|
380
|
-
parts = data.split(_psCmdSeperator);
|
|
381
|
-
res = parts[0];
|
|
382
|
-
}
|
|
383
|
-
let remove = -1;
|
|
384
|
-
for (let i = 0; i < _psCmds.length; i++) {
|
|
385
|
-
if (_psCmds[i].id === id) {
|
|
386
|
-
remove = i;
|
|
387
|
-
_psCmds[i].callback(res);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
if (remove >= 0) {
|
|
391
|
-
_psCmds.splice(remove, 1);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
function powerShellStart() {
|
|
396
|
-
if (!_psChild) {
|
|
397
|
-
_psChild = spawn(_powerShell, ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
|
|
398
|
-
stdio: 'pipe',
|
|
399
|
-
windowsHide: true,
|
|
400
|
-
maxBuffer: 1024 * 102400,
|
|
401
|
-
encoding: 'UTF-8',
|
|
402
|
-
env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' })
|
|
403
|
-
});
|
|
404
|
-
if (_psChild && _psChild.pid) {
|
|
405
|
-
_psPersistent = true;
|
|
406
|
-
_psChild.stdout.on('data', (data) => {
|
|
407
|
-
_psResult = _psResult + data.toString('utf8');
|
|
408
|
-
let sepIndex = _psResult.indexOf(_psCmdSeperator);
|
|
409
|
-
while (sepIndex >= 0) {
|
|
410
|
-
const end = sepIndex + _psCmdSeperator.length;
|
|
411
|
-
powerShellProceedResults(_psResult.slice(0, end));
|
|
412
|
-
_psResult = _psResult.slice(end);
|
|
413
|
-
sepIndex = _psResult.indexOf(_psCmdSeperator);
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
_psChild.stderr.on('data', () => {
|
|
417
|
-
powerShellProceedResults(_psResult + _psError);
|
|
418
|
-
});
|
|
419
|
-
_psChild.on('error', () => {
|
|
420
|
-
powerShellProceedResults(_psResult + _psError);
|
|
421
|
-
});
|
|
422
|
-
_psChild.on('close', () => {
|
|
423
|
-
if (_psChild) {
|
|
424
|
-
_psChild.kill();
|
|
425
|
-
}
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
function powerShellRelease() {
|
|
432
|
-
try {
|
|
433
|
-
if (_psChild) {
|
|
434
|
-
_psChild.stdin.write('exit' + os.EOL);
|
|
435
|
-
_psChild.stdin.end();
|
|
436
|
-
}
|
|
437
|
-
} catch {
|
|
438
|
-
if (_psChild) {
|
|
439
|
-
_psChild.kill();
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
_psPersistent = false;
|
|
443
|
-
_psChild = null;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
function powerShell(cmd) {
|
|
447
|
-
if (_psPersistent) {
|
|
448
|
-
const id = Math.random().toString(36).substring(2, 12);
|
|
449
|
-
return new Promise((resolve) => {
|
|
450
|
-
process.nextTick(() => {
|
|
451
|
-
function callback(data) {
|
|
452
|
-
resolve(data);
|
|
453
|
-
}
|
|
454
|
-
_psCmds.push({
|
|
455
|
-
id,
|
|
456
|
-
cmd,
|
|
457
|
-
callback,
|
|
458
|
-
start: new Date()
|
|
459
|
-
});
|
|
460
|
-
try {
|
|
461
|
-
if (_psChild && _psChild.pid) {
|
|
462
|
-
_psChild.stdin.write(_psToUTF8 + 'echo ' + _psCmdStart + id + _psIdSeperator + '; ' + os.EOL + cmd + os.EOL + 'echo ' + _psCmdSeperator + os.EOL);
|
|
463
|
-
}
|
|
464
|
-
} catch {
|
|
465
|
-
resolve('');
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
});
|
|
469
|
-
} else {
|
|
470
|
-
let result = '';
|
|
471
|
-
|
|
472
|
-
return new Promise((resolve) => {
|
|
473
|
-
process.nextTick(() => {
|
|
474
|
-
try {
|
|
475
|
-
const osVersion = os.release().split('.').map(Number);
|
|
476
|
-
// windows 7 compatibility issue
|
|
477
|
-
const spanOptions =
|
|
478
|
-
osVersion[0] < 10
|
|
479
|
-
? ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-']
|
|
480
|
-
: ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-ExecutionPolicy', 'Unrestricted', '-Command', _psToUTF8 + cmd];
|
|
481
|
-
const child = spawn(_powerShell, spanOptions, {
|
|
482
|
-
stdio: 'pipe',
|
|
483
|
-
windowsHide: true,
|
|
484
|
-
maxBuffer: 1024 * 102400,
|
|
485
|
-
encoding: 'UTF-8',
|
|
486
|
-
env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' })
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
if (child && !child.pid) {
|
|
490
|
-
child.on('error', () => {
|
|
491
|
-
resolve(result);
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
if (child && child.pid) {
|
|
495
|
-
child.stdout.on('data', (data) => {
|
|
496
|
-
result = result + data.toString('utf8');
|
|
497
|
-
});
|
|
498
|
-
child.stderr.on('data', () => {
|
|
499
|
-
child.kill();
|
|
500
|
-
resolve(result);
|
|
501
|
-
});
|
|
502
|
-
child.on('close', () => {
|
|
503
|
-
child.kill();
|
|
504
|
-
|
|
505
|
-
resolve(result);
|
|
506
|
-
});
|
|
507
|
-
child.on('error', () => {
|
|
508
|
-
child.kill();
|
|
509
|
-
resolve(result);
|
|
510
|
-
});
|
|
511
|
-
if (osVersion[0] < 10) {
|
|
512
|
-
try {
|
|
513
|
-
child.stdin.write(_psToUTF8 + cmd + os.EOL);
|
|
514
|
-
child.stdin.write('exit' + os.EOL);
|
|
515
|
-
child.stdin.end();
|
|
516
|
-
} catch {
|
|
517
|
-
child.kill();
|
|
518
|
-
resolve(result);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
} else {
|
|
522
|
-
resolve(result);
|
|
523
|
-
}
|
|
524
|
-
} catch {
|
|
525
|
-
resolve(result);
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
function execSafe(cmd, args, options) {
|
|
533
|
-
let result = '';
|
|
534
|
-
options = options || {};
|
|
535
|
-
|
|
536
|
-
return new Promise((resolve) => {
|
|
537
|
-
process.nextTick(() => {
|
|
538
|
-
try {
|
|
539
|
-
const child = spawn(cmd, args, options);
|
|
540
|
-
|
|
541
|
-
if (child && !child.pid) {
|
|
542
|
-
child.on('error', () => {
|
|
543
|
-
resolve(result);
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
if (child && child.pid) {
|
|
547
|
-
child.stdout.on('data', (data) => {
|
|
548
|
-
result += data.toString();
|
|
549
|
-
});
|
|
550
|
-
child.on('close', () => {
|
|
551
|
-
child.kill();
|
|
552
|
-
resolve(result);
|
|
553
|
-
});
|
|
554
|
-
child.on('error', () => {
|
|
555
|
-
child.kill();
|
|
556
|
-
resolve(result);
|
|
557
|
-
});
|
|
558
|
-
} else {
|
|
559
|
-
resolve(result);
|
|
560
|
-
}
|
|
561
|
-
} catch {
|
|
562
|
-
resolve(result);
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
function getCodepage() {
|
|
569
|
-
if (_windows) {
|
|
570
|
-
if (!codepage) {
|
|
571
|
-
try {
|
|
572
|
-
const stdout = execSync('chcp', execOptsWin);
|
|
573
|
-
const lines = stdout.toString().split('\r\n');
|
|
574
|
-
const parts = lines[0].split(':');
|
|
575
|
-
codepage = parts.length > 1 ? parts[1].replace('.', '').trim() : '';
|
|
576
|
-
} catch {
|
|
577
|
-
codepage = '437';
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
return codepage;
|
|
581
|
-
}
|
|
582
|
-
if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
|
|
583
|
-
if (!codepage) {
|
|
584
|
-
try {
|
|
585
|
-
const stdout = execSync('echo $LANG', execOptsLinux);
|
|
586
|
-
const lines = stdout.toString().split('\r\n');
|
|
587
|
-
const parts = lines[0].split('.');
|
|
588
|
-
codepage = parts.length > 1 ? parts[1].trim() : '';
|
|
589
|
-
if (!codepage) {
|
|
590
|
-
codepage = 'UTF-8';
|
|
591
|
-
}
|
|
592
|
-
} catch {
|
|
593
|
-
codepage = 'UTF-8';
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
return codepage;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
function smartMonToolsInstalled() {
|
|
601
|
-
if (_smartMonToolsInstalled !== null) {
|
|
602
|
-
return _smartMonToolsInstalled;
|
|
603
|
-
}
|
|
604
|
-
_smartMonToolsInstalled = false;
|
|
605
|
-
if (_windows) {
|
|
606
|
-
try {
|
|
607
|
-
const pathArray = execSync('WHERE smartctl 2>nul', execOptsWin).toString().split('\r\n');
|
|
608
|
-
if (pathArray && pathArray.length) {
|
|
609
|
-
_smartMonToolsInstalled = pathArray[0].indexOf(':\\') >= 0;
|
|
610
|
-
} else {
|
|
611
|
-
_smartMonToolsInstalled = false;
|
|
612
|
-
}
|
|
613
|
-
} catch {
|
|
614
|
-
_smartMonToolsInstalled = false;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
|
|
618
|
-
try {
|
|
619
|
-
const pathArray = execSync('which smartctl 2>/dev/null', execOptsLinux).toString().split('\r\n');
|
|
620
|
-
_smartMonToolsInstalled = pathArray.length > 0;
|
|
621
|
-
} catch {
|
|
622
|
-
noop();
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
return _smartMonToolsInstalled;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
// reference values: https://elinux.org/RPi_HardwareHistory
|
|
629
|
-
// https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
|
|
630
|
-
// https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#hardware-revision-codes
|
|
631
|
-
|
|
632
|
-
function isRaspberry(cpuinfo) {
|
|
633
|
-
const PI_MODEL_NO = ['BCM2708', 'BCM2709', 'BCM2710', 'BCM2711', 'BCM2712', 'BCM2835', 'BCM2836', 'BCM2837', 'BCM2837B0'];
|
|
634
|
-
if (_rpi_cpuinfo !== null) {
|
|
635
|
-
cpuinfo = _rpi_cpuinfo;
|
|
636
|
-
} else if (cpuinfo === undefined) {
|
|
637
|
-
try {
|
|
638
|
-
cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
|
|
639
|
-
_rpi_cpuinfo = cpuinfo;
|
|
640
|
-
} catch {
|
|
641
|
-
return false;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
const hardware = getValue(cpuinfo, 'hardware');
|
|
646
|
-
const model = getValue(cpuinfo, 'model');
|
|
647
|
-
return (hardware && PI_MODEL_NO.indexOf(hardware) > -1) || (model && model.indexOf('Raspberry Pi') > -1);
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
function isRaspbian() {
|
|
651
|
-
let osrelease = [];
|
|
652
|
-
try {
|
|
653
|
-
osrelease = fs.readFileSync('/etc/os-release', { encoding: 'utf8' }).toString().split('\n');
|
|
654
|
-
} catch {
|
|
655
|
-
return false;
|
|
656
|
-
}
|
|
657
|
-
const id = getValue(osrelease, 'id', '=');
|
|
658
|
-
return id && id.indexOf('raspbian') > -1;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
function execWin(cmd, opts, callback) {
|
|
662
|
-
if (!callback) {
|
|
663
|
-
callback = opts;
|
|
664
|
-
opts = execOptsWin;
|
|
665
|
-
}
|
|
666
|
-
let newCmd = 'chcp 65001 > nul && cmd /C ' + cmd + ' && chcp ' + codepage + ' > nul';
|
|
667
|
-
exec(newCmd, opts, (error, stdout) => {
|
|
668
|
-
callback(error, stdout);
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
function darwinXcodeExists() {
|
|
673
|
-
const cmdLineToolsExists = fs.existsSync('/Library/Developer/CommandLineTools/usr/bin/');
|
|
674
|
-
const xcodeAppExists = fs.existsSync('/Applications/Xcode.app/Contents/Developer/Tools');
|
|
675
|
-
const xcodeExists = fs.existsSync('/Library/Developer/Xcode/');
|
|
676
|
-
return cmdLineToolsExists || xcodeExists || xcodeAppExists;
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
function nanoSeconds() {
|
|
680
|
-
const time = process.hrtime();
|
|
681
|
-
if (!Array.isArray(time) || time.length !== 2) {
|
|
682
|
-
return 0;
|
|
683
|
-
}
|
|
684
|
-
return +time[0] * 1e9 + +time[1];
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
function countUniqueLines(lines, startingWith) {
|
|
688
|
-
startingWith = startingWith || '';
|
|
689
|
-
const uniqueLines = [];
|
|
690
|
-
lines.forEach((line) => {
|
|
691
|
-
if (line.startsWith(startingWith)) {
|
|
692
|
-
if (uniqueLines.indexOf(line) === -1) {
|
|
693
|
-
uniqueLines.push(line);
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
});
|
|
697
|
-
return uniqueLines.length;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
function countLines(lines, startingWith) {
|
|
701
|
-
startingWith = startingWith || '';
|
|
702
|
-
const uniqueLines = [];
|
|
703
|
-
lines.forEach((line) => {
|
|
704
|
-
if (line.startsWith(startingWith)) {
|
|
705
|
-
uniqueLines.push(line);
|
|
706
|
-
}
|
|
707
|
-
});
|
|
708
|
-
return uniqueLines.length;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
function sanitizeShellString(str, strict) {
|
|
712
|
-
if (typeof strict === 'undefined') {
|
|
713
|
-
strict = false;
|
|
714
|
-
}
|
|
715
|
-
const s = str || '';
|
|
716
|
-
let result = '';
|
|
717
|
-
const l = mathMin(s.length, 2000);
|
|
718
|
-
for (let i = 0; i <= l; i++) {
|
|
719
|
-
if (
|
|
720
|
-
!(
|
|
721
|
-
s[i] === undefined ||
|
|
722
|
-
s[i] === '>' ||
|
|
723
|
-
s[i] === '<' ||
|
|
724
|
-
s[i] === '*' ||
|
|
725
|
-
s[i] === '?' ||
|
|
726
|
-
s[i] === '[' ||
|
|
727
|
-
s[i] === ']' ||
|
|
728
|
-
s[i] === '|' ||
|
|
729
|
-
s[i] === '˚' ||
|
|
730
|
-
s[i] === '$' ||
|
|
731
|
-
s[i] === ';' ||
|
|
732
|
-
s[i] === '&' ||
|
|
733
|
-
s[i] === ']' ||
|
|
734
|
-
s[i] === '#' ||
|
|
735
|
-
s[i] === '%' ||
|
|
736
|
-
s[i] === '!' ||
|
|
737
|
-
s[i] === '^' ||
|
|
738
|
-
s[i] === '\\' ||
|
|
739
|
-
s[i] === '\t' ||
|
|
740
|
-
s[i] === '\n' ||
|
|
741
|
-
s[i] === '\r' ||
|
|
742
|
-
s[i] === "'" ||
|
|
743
|
-
s[i] === '`' ||
|
|
744
|
-
s[i] === '"' ||
|
|
745
|
-
s[i].length > 1 ||
|
|
746
|
-
(strict && s[i] === '(') ||
|
|
747
|
-
(strict && s[i] === ')') ||
|
|
748
|
-
(strict && s[i] === '@') ||
|
|
749
|
-
(strict && s[i] === ' ') ||
|
|
750
|
-
(strict && s[i] === '{') ||
|
|
751
|
-
(strict && s[i] === ';') ||
|
|
752
|
-
(strict && s[i] === '}')
|
|
753
|
-
)
|
|
754
|
-
) {
|
|
755
|
-
result = result + s[i];
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
return result;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
function sanitizeContainerID(str) {
|
|
762
|
-
const s = String(str || '')
|
|
763
|
-
.substring(0, 2000)
|
|
764
|
-
.replace(/[^a-zA-Z0-9_.,*-]/g, '');
|
|
765
|
-
return s.indexOf('..') === -1 ? s : '';
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
function sanitizeImageID(str) {
|
|
769
|
-
const s = String(str || '')
|
|
770
|
-
.substring(0, 2000)
|
|
771
|
-
.replace(/[^a-zA-Z0-9_.,:@/-]/g, '');
|
|
772
|
-
return s.indexOf('..') === -1 ? s : '';
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
function isPrototypePolluted() {
|
|
776
|
-
const s = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
777
|
-
let notPolluted = true;
|
|
778
|
-
let st = '';
|
|
779
|
-
|
|
780
|
-
try {
|
|
781
|
-
st.__proto__.replace = stringReplace;
|
|
782
|
-
st.__proto__.toLowerCase = stringToLower;
|
|
783
|
-
st.__proto__.toString = stringToString;
|
|
784
|
-
st.__proto__.substr = stringSubstr;
|
|
785
|
-
st.__proto__.substring = stringSubstring;
|
|
786
|
-
st.__proto__.trim = stringTrim;
|
|
787
|
-
st.__proto__.startsWith = stringStartWith;
|
|
788
|
-
} catch (e) {
|
|
789
|
-
Object.setPrototypeOf(st, stringObj);
|
|
790
|
-
}
|
|
791
|
-
notPolluted = notPolluted || s.length !== 62;
|
|
792
|
-
const ms = Date.now();
|
|
793
|
-
if (typeof ms === 'number' && ms > 1600000000000) {
|
|
794
|
-
const l = (ms % 100) + 15;
|
|
795
|
-
for (let i = 0; i < l; i++) {
|
|
796
|
-
const r = Math.random() * 61.99999999 + 1;
|
|
797
|
-
const rs = parseInt(Math.floor(r).toString(), 10);
|
|
798
|
-
const rs2 = parseInt(r.toString().split('.')[0], 10);
|
|
799
|
-
const q = Math.random() * 61.99999999 + 1;
|
|
800
|
-
const qs = parseInt(Math.floor(q).toString(), 10);
|
|
801
|
-
const qs2 = parseInt(q.toString().split('.')[0], 10);
|
|
802
|
-
notPolluted = notPolluted && r !== q;
|
|
803
|
-
notPolluted = notPolluted && rs === rs2 && qs === qs2;
|
|
804
|
-
st += s[rs - 1];
|
|
805
|
-
}
|
|
806
|
-
notPolluted = notPolluted && st.length === l;
|
|
807
|
-
// string manipulation
|
|
808
|
-
let p = Math.random() * l * 0.9999999999;
|
|
809
|
-
let stm = st.substr(0, p) + ' ' + st.substr(p, 2000);
|
|
810
|
-
try {
|
|
811
|
-
stm.__proto__.replace = stringReplace;
|
|
812
|
-
} catch (e) {
|
|
813
|
-
Object.setPrototypeOf(stm, stringObj);
|
|
814
|
-
}
|
|
815
|
-
let sto = stm.replace(/ /g, '');
|
|
816
|
-
notPolluted = notPolluted && st === sto;
|
|
817
|
-
p = Math.random() * l * 0.9999999999;
|
|
818
|
-
stm = st.substr(0, p) + '{' + st.substr(p, 2000);
|
|
819
|
-
sto = stm.replace(/{/g, '');
|
|
820
|
-
notPolluted = notPolluted && st === sto;
|
|
821
|
-
p = Math.random() * l * 0.9999999999;
|
|
822
|
-
stm = st.substr(0, p) + '*' + st.substr(p, 2000);
|
|
823
|
-
sto = stm.replace(/\*/g, '');
|
|
824
|
-
notPolluted = notPolluted && st === sto;
|
|
825
|
-
p = Math.random() * l * 0.9999999999;
|
|
826
|
-
stm = st.substr(0, p) + '$' + st.substr(p, 2000);
|
|
827
|
-
sto = stm.replace(/\$/g, '');
|
|
828
|
-
notPolluted = notPolluted && st === sto;
|
|
829
|
-
|
|
830
|
-
// lower
|
|
831
|
-
const stl = st.toLowerCase();
|
|
832
|
-
notPolluted = notPolluted && stl.length === l && stl[l - 1] && !stl[l];
|
|
833
|
-
for (let i = 0; i < l; i++) {
|
|
834
|
-
const s1 = st[i];
|
|
835
|
-
try {
|
|
836
|
-
s1.__proto__.toLowerCase = stringToLower;
|
|
837
|
-
} catch {
|
|
838
|
-
Object.setPrototypeOf(st, stringObj);
|
|
839
|
-
}
|
|
840
|
-
const s2 = stl ? stl[i] : '';
|
|
841
|
-
const s1l = s1.toLowerCase();
|
|
842
|
-
notPolluted = notPolluted && s1l[0] === s2 && s1l[0] && !s1l[1];
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
return !notPolluted;
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
function sanitizeString(str, strict) {
|
|
849
|
-
if (typeof strict === 'undefined') {
|
|
850
|
-
strict = false;
|
|
851
|
-
}
|
|
852
|
-
let result = '';
|
|
853
|
-
const s = isPrototypePolluted() ? '---' : sanitizeShellString(str, strict);
|
|
854
|
-
const l = mathMin(s.length, 2000);
|
|
855
|
-
|
|
856
|
-
for (let i = 0; i <= l; i++) {
|
|
857
|
-
if (s[i] !== undefined) {
|
|
858
|
-
result = result + s[i];
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
return result;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
function hex2bin(hex) {
|
|
865
|
-
return ('00000000' + parseInt(hex, 16).toString(2)).substr(-8);
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
function getFilesInPath(source) {
|
|
869
|
-
const lstatSync = fs.lstatSync;
|
|
870
|
-
const readdirSync = fs.readdirSync;
|
|
871
|
-
const join = path.join;
|
|
872
|
-
|
|
873
|
-
function isDirectory(source) {
|
|
874
|
-
return lstatSync(source).isDirectory();
|
|
875
|
-
}
|
|
876
|
-
function isFile(source) {
|
|
877
|
-
return lstatSync(source).isFile();
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
function getDirectories(source) {
|
|
881
|
-
return readdirSync(source)
|
|
882
|
-
.map((name) => {
|
|
883
|
-
return join(source, name);
|
|
884
|
-
})
|
|
885
|
-
.filter(isDirectory);
|
|
886
|
-
}
|
|
887
|
-
function getFiles(source) {
|
|
888
|
-
return readdirSync(source)
|
|
889
|
-
.map((name) => {
|
|
890
|
-
return join(source, name);
|
|
891
|
-
})
|
|
892
|
-
.filter(isFile);
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
function getFilesRecursively(source) {
|
|
896
|
-
try {
|
|
897
|
-
const dirs = getDirectories(source);
|
|
898
|
-
const files = dirs
|
|
899
|
-
.map((dir) => {
|
|
900
|
-
return getFilesRecursively(dir);
|
|
901
|
-
})
|
|
902
|
-
.reduce((a, b) => {
|
|
903
|
-
return a.concat(b);
|
|
904
|
-
}, []);
|
|
905
|
-
return files.concat(getFiles(source));
|
|
906
|
-
} catch {
|
|
907
|
-
return [];
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
if (fs.existsSync(source)) {
|
|
912
|
-
return getFilesRecursively(source);
|
|
913
|
-
} else {
|
|
914
|
-
return [];
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
function decodePiCpuinfo(lines) {
|
|
919
|
-
if (_rpi_cpuinfo === null) {
|
|
920
|
-
_rpi_cpuinfo = lines;
|
|
921
|
-
} else if (lines === undefined) {
|
|
922
|
-
lines = _rpi_cpuinfo;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
// https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
|
|
926
|
-
|
|
927
|
-
const oldRevisionCodes = {
|
|
928
|
-
'0002': {
|
|
929
|
-
type: 'B',
|
|
930
|
-
revision: '1.0',
|
|
931
|
-
memory: 256,
|
|
932
|
-
manufacturer: 'Egoman',
|
|
933
|
-
processor: 'BCM2835'
|
|
934
|
-
},
|
|
935
|
-
'0003': {
|
|
936
|
-
type: 'B',
|
|
937
|
-
revision: '1.0',
|
|
938
|
-
memory: 256,
|
|
939
|
-
manufacturer: 'Egoman',
|
|
940
|
-
processor: 'BCM2835'
|
|
941
|
-
},
|
|
942
|
-
'0004': {
|
|
943
|
-
type: 'B',
|
|
944
|
-
revision: '2.0',
|
|
945
|
-
memory: 256,
|
|
946
|
-
manufacturer: 'Sony UK',
|
|
947
|
-
processor: 'BCM2835'
|
|
948
|
-
},
|
|
949
|
-
'0005': {
|
|
950
|
-
type: 'B',
|
|
951
|
-
revision: '2.0',
|
|
952
|
-
memory: 256,
|
|
953
|
-
manufacturer: 'Qisda',
|
|
954
|
-
processor: 'BCM2835'
|
|
955
|
-
},
|
|
956
|
-
'0006': {
|
|
957
|
-
type: 'B',
|
|
958
|
-
revision: '2.0',
|
|
959
|
-
memory: 256,
|
|
960
|
-
manufacturer: 'Egoman',
|
|
961
|
-
processor: 'BCM2835'
|
|
962
|
-
},
|
|
963
|
-
'0007': {
|
|
964
|
-
type: 'A',
|
|
965
|
-
revision: '2.0',
|
|
966
|
-
memory: 256,
|
|
967
|
-
manufacturer: 'Egoman',
|
|
968
|
-
processor: 'BCM2835'
|
|
969
|
-
},
|
|
970
|
-
'0008': {
|
|
971
|
-
type: 'A',
|
|
972
|
-
revision: '2.0',
|
|
973
|
-
memory: 256,
|
|
974
|
-
manufacturer: 'Sony UK',
|
|
975
|
-
processor: 'BCM2835'
|
|
976
|
-
},
|
|
977
|
-
'0009': {
|
|
978
|
-
type: 'A',
|
|
979
|
-
revision: '2.0',
|
|
980
|
-
memory: 256,
|
|
981
|
-
manufacturer: 'Qisda',
|
|
982
|
-
processor: 'BCM2835'
|
|
983
|
-
},
|
|
984
|
-
'000d': {
|
|
985
|
-
type: 'B',
|
|
986
|
-
revision: '2.0',
|
|
987
|
-
memory: 512,
|
|
988
|
-
manufacturer: 'Egoman',
|
|
989
|
-
processor: 'BCM2835'
|
|
990
|
-
},
|
|
991
|
-
'000e': {
|
|
992
|
-
type: 'B',
|
|
993
|
-
revision: '2.0',
|
|
994
|
-
memory: 512,
|
|
995
|
-
manufacturer: 'Sony UK',
|
|
996
|
-
processor: 'BCM2835'
|
|
997
|
-
},
|
|
998
|
-
'000f': {
|
|
999
|
-
type: 'B',
|
|
1000
|
-
revision: '2.0',
|
|
1001
|
-
memory: 512,
|
|
1002
|
-
manufacturer: 'Egoman',
|
|
1003
|
-
processor: 'BCM2835'
|
|
1004
|
-
},
|
|
1005
|
-
'0010': {
|
|
1006
|
-
type: 'B+',
|
|
1007
|
-
revision: '1.2',
|
|
1008
|
-
memory: 512,
|
|
1009
|
-
manufacturer: 'Sony UK',
|
|
1010
|
-
processor: 'BCM2835'
|
|
1011
|
-
},
|
|
1012
|
-
'0011': {
|
|
1013
|
-
type: 'CM1',
|
|
1014
|
-
revision: '1.0',
|
|
1015
|
-
memory: 512,
|
|
1016
|
-
manufacturer: 'Sony UK',
|
|
1017
|
-
processor: 'BCM2835'
|
|
1018
|
-
},
|
|
1019
|
-
'0012': {
|
|
1020
|
-
type: 'A+',
|
|
1021
|
-
revision: '1.1',
|
|
1022
|
-
memory: 256,
|
|
1023
|
-
manufacturer: 'Sony UK',
|
|
1024
|
-
processor: 'BCM2835'
|
|
1025
|
-
},
|
|
1026
|
-
'0013': {
|
|
1027
|
-
type: 'B+',
|
|
1028
|
-
revision: '1.2',
|
|
1029
|
-
memory: 512,
|
|
1030
|
-
manufacturer: 'Embest',
|
|
1031
|
-
processor: 'BCM2835'
|
|
1032
|
-
},
|
|
1033
|
-
'0014': {
|
|
1034
|
-
type: 'CM1',
|
|
1035
|
-
revision: '1.0',
|
|
1036
|
-
memory: 512,
|
|
1037
|
-
manufacturer: 'Embest',
|
|
1038
|
-
processor: 'BCM2835'
|
|
1039
|
-
},
|
|
1040
|
-
'0015': {
|
|
1041
|
-
type: 'A+',
|
|
1042
|
-
revision: '1.1',
|
|
1043
|
-
memory: 256,
|
|
1044
|
-
manufacturer: '512MB Embest',
|
|
1045
|
-
processor: 'BCM2835'
|
|
1046
|
-
}
|
|
1047
|
-
};
|
|
1048
|
-
|
|
1049
|
-
const processorList = ['BCM2835', 'BCM2836', 'BCM2837', 'BCM2711', 'BCM2712'];
|
|
1050
|
-
const manufacturerList = ['Sony UK', 'Egoman', 'Embest', 'Sony Japan', 'Embest', 'Stadium'];
|
|
1051
|
-
const typeList = {
|
|
1052
|
-
'00': 'A',
|
|
1053
|
-
'01': 'B',
|
|
1054
|
-
'02': 'A+',
|
|
1055
|
-
'03': 'B+',
|
|
1056
|
-
'04': '2B',
|
|
1057
|
-
'05': 'Alpha (early prototype)',
|
|
1058
|
-
'06': 'CM1',
|
|
1059
|
-
'08': '3B',
|
|
1060
|
-
'09': 'Zero',
|
|
1061
|
-
'0a': 'CM3',
|
|
1062
|
-
'0c': 'Zero W',
|
|
1063
|
-
'0d': '3B+',
|
|
1064
|
-
'0e': '3A+',
|
|
1065
|
-
'0f': 'Internal use only',
|
|
1066
|
-
10: 'CM3+',
|
|
1067
|
-
11: '4B',
|
|
1068
|
-
12: 'Zero 2 W',
|
|
1069
|
-
13: '400',
|
|
1070
|
-
14: 'CM4',
|
|
1071
|
-
15: 'CM4S',
|
|
1072
|
-
16: 'Internal use only',
|
|
1073
|
-
17: '5',
|
|
1074
|
-
18: 'CM5',
|
|
1075
|
-
19: '500/500+',
|
|
1076
|
-
'1a': 'CM5 Lite'
|
|
1077
|
-
};
|
|
1078
|
-
|
|
1079
|
-
const revisionCode = getValue(lines, 'revision', ':', true);
|
|
1080
|
-
const model = getValue(lines, 'model:', ':', true);
|
|
1081
|
-
const serial = getValue(lines, 'serial', ':', true);
|
|
1082
|
-
|
|
1083
|
-
let result = {};
|
|
1084
|
-
if ({}.hasOwnProperty.call(oldRevisionCodes, revisionCode)) {
|
|
1085
|
-
// old revision codes
|
|
1086
|
-
result = {
|
|
1087
|
-
model,
|
|
1088
|
-
serial,
|
|
1089
|
-
revisionCode,
|
|
1090
|
-
memory: oldRevisionCodes[revisionCode].memory,
|
|
1091
|
-
manufacturer: oldRevisionCodes[revisionCode].manufacturer,
|
|
1092
|
-
processor: oldRevisionCodes[revisionCode].processor,
|
|
1093
|
-
type: oldRevisionCodes[revisionCode].type,
|
|
1094
|
-
revision: oldRevisionCodes[revisionCode].revision
|
|
1095
|
-
};
|
|
1096
|
-
} else {
|
|
1097
|
-
// new revision code
|
|
1098
|
-
const revision = ('00000000' + getValue(lines, 'revision', ':', true).toLowerCase()).substr(-8);
|
|
1099
|
-
const memSizeCode = parseInt(hex2bin(revision.substr(2, 1)).substr(5, 3), 2) || 0;
|
|
1100
|
-
const manufacturer = manufacturerList[parseInt(revision.substr(3, 1), 10)];
|
|
1101
|
-
const processor = processorList[parseInt(revision.substr(4, 1), 10)];
|
|
1102
|
-
const typeCode = revision.substr(5, 2);
|
|
1103
|
-
|
|
1104
|
-
result = {
|
|
1105
|
-
model,
|
|
1106
|
-
serial,
|
|
1107
|
-
revisionCode,
|
|
1108
|
-
memory: 256 * Math.pow(2, memSizeCode),
|
|
1109
|
-
manufacturer,
|
|
1110
|
-
processor,
|
|
1111
|
-
type: {}.hasOwnProperty.call(typeList, typeCode) ? typeList[typeCode] : '',
|
|
1112
|
-
revision: '1.' + revision.substr(7, 1)
|
|
1113
|
-
};
|
|
1114
|
-
}
|
|
1115
|
-
return result;
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
function getRpiGpu(cpuinfo) {
|
|
1119
|
-
if (_rpi_cpuinfo === null && cpuinfo !== undefined) {
|
|
1120
|
-
_rpi_cpuinfo = cpuinfo;
|
|
1121
|
-
} else if (cpuinfo === undefined && _rpi_cpuinfo !== null) {
|
|
1122
|
-
cpuinfo = _rpi_cpuinfo;
|
|
1123
|
-
} else {
|
|
1124
|
-
try {
|
|
1125
|
-
cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
|
|
1126
|
-
_rpi_cpuinfo = cpuinfo;
|
|
1127
|
-
} catch {
|
|
1128
|
-
return false;
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
const rpi = decodePiCpuinfo(cpuinfo);
|
|
1133
|
-
if (rpi.type === '4B' || rpi.type === 'CM4' || rpi.type === 'CM4S' || rpi.type === '400') {
|
|
1134
|
-
return 'VideoCore VI';
|
|
1135
|
-
}
|
|
1136
|
-
if (rpi.type === '5' || rpi.type === '500') {
|
|
1137
|
-
return 'VideoCore VII';
|
|
1138
|
-
}
|
|
1139
|
-
return 'VideoCore IV';
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
function promiseAll(promises) {
|
|
1143
|
-
const resolvingPromises = promises.map(
|
|
1144
|
-
(promise) =>
|
|
1145
|
-
new Promise((resolve) => {
|
|
1146
|
-
const payload = new Array(2);
|
|
1147
|
-
promise
|
|
1148
|
-
.then((result) => {
|
|
1149
|
-
payload[0] = result;
|
|
1150
|
-
})
|
|
1151
|
-
.catch((error) => {
|
|
1152
|
-
payload[1] = error;
|
|
1153
|
-
})
|
|
1154
|
-
.then(() => {
|
|
1155
|
-
// The wrapped Promise returns an array: 0 = result, 1 = error ... we resolve all
|
|
1156
|
-
resolve(payload);
|
|
1157
|
-
});
|
|
1158
|
-
})
|
|
1159
|
-
);
|
|
1160
|
-
const errors = [];
|
|
1161
|
-
const results = [];
|
|
1162
|
-
|
|
1163
|
-
// Execute all wrapped Promises
|
|
1164
|
-
return Promise.all(resolvingPromises).then((items) => {
|
|
1165
|
-
items.forEach((payload) => {
|
|
1166
|
-
if (payload[1]) {
|
|
1167
|
-
errors.push(payload[1]);
|
|
1168
|
-
results.push(null);
|
|
1169
|
-
} else {
|
|
1170
|
-
errors.push(null);
|
|
1171
|
-
results.push(payload[0]);
|
|
1172
|
-
}
|
|
1173
|
-
});
|
|
1174
|
-
|
|
1175
|
-
return {
|
|
1176
|
-
errors: errors,
|
|
1177
|
-
results: results
|
|
1178
|
-
};
|
|
1179
|
-
});
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
function promisify(nodeStyleFunction) {
|
|
1183
|
-
return function () {
|
|
1184
|
-
const args = Array.prototype.slice.call(arguments);
|
|
1185
|
-
return new Promise((resolve, reject) => {
|
|
1186
|
-
args.push((err, data) => {
|
|
1187
|
-
if (err) {
|
|
1188
|
-
reject(err);
|
|
1189
|
-
} else {
|
|
1190
|
-
resolve(data);
|
|
1191
|
-
}
|
|
1192
|
-
});
|
|
1193
|
-
nodeStyleFunction.apply(null, args);
|
|
1194
|
-
});
|
|
1195
|
-
};
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
function promisifySave(nodeStyleFunction) {
|
|
1199
|
-
return function () {
|
|
1200
|
-
const args = Array.prototype.slice.call(arguments);
|
|
1201
|
-
return new Promise((resolve) => {
|
|
1202
|
-
args.push((err, data) => {
|
|
1203
|
-
resolve(data);
|
|
1204
|
-
});
|
|
1205
|
-
nodeStyleFunction.apply(null, args);
|
|
1206
|
-
});
|
|
1207
|
-
};
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
function linuxVersion() {
|
|
1211
|
-
let result = '';
|
|
1212
|
-
if (_linux) {
|
|
1213
|
-
try {
|
|
1214
|
-
result = execSync('uname -v', execOptsLinux).toString();
|
|
1215
|
-
} catch {
|
|
1216
|
-
result = '';
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
return result;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
function plistParser(xmlStr) {
|
|
1223
|
-
const tags = ['array', 'dict', 'key', 'string', 'integer', 'date', 'real', 'data', 'boolean', 'arrayEmpty'];
|
|
1224
|
-
const startStr = '<plist version';
|
|
1225
|
-
|
|
1226
|
-
let pos = xmlStr.indexOf(startStr);
|
|
1227
|
-
let len = xmlStr.length;
|
|
1228
|
-
while (xmlStr[pos] !== '>' && pos < len) {
|
|
1229
|
-
pos++;
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
let depth = 0;
|
|
1233
|
-
let inTagStart = false;
|
|
1234
|
-
let inTagContent = false;
|
|
1235
|
-
let inTagEnd = false;
|
|
1236
|
-
let metaData = [{ tagStart: '', tagEnd: '', tagContent: '', key: '', data: null }];
|
|
1237
|
-
let c = '';
|
|
1238
|
-
let cn = xmlStr[pos];
|
|
1239
|
-
|
|
1240
|
-
while (pos < len) {
|
|
1241
|
-
c = cn;
|
|
1242
|
-
if (pos + 1 < len) {
|
|
1243
|
-
cn = xmlStr[pos + 1];
|
|
1244
|
-
}
|
|
1245
|
-
if (c === '<') {
|
|
1246
|
-
inTagContent = false;
|
|
1247
|
-
if (cn === '/') {
|
|
1248
|
-
inTagEnd = true;
|
|
1249
|
-
} else if (metaData[depth].tagStart) {
|
|
1250
|
-
metaData[depth].tagContent = '';
|
|
1251
|
-
if (!metaData[depth].data) {
|
|
1252
|
-
metaData[depth].data = metaData[depth].tagStart === 'array' ? [] : {};
|
|
1253
|
-
}
|
|
1254
|
-
depth++;
|
|
1255
|
-
metaData.push({ tagStart: '', tagEnd: '', tagContent: '', key: null, data: null });
|
|
1256
|
-
inTagStart = true;
|
|
1257
|
-
inTagContent = false;
|
|
1258
|
-
} else if (!inTagStart) {
|
|
1259
|
-
inTagStart = true;
|
|
1260
|
-
}
|
|
1261
|
-
} else if (c === '>') {
|
|
1262
|
-
if (metaData[depth].tagStart === 'true/') {
|
|
1263
|
-
inTagStart = false;
|
|
1264
|
-
inTagEnd = true;
|
|
1265
|
-
metaData[depth].tagStart = '';
|
|
1266
|
-
metaData[depth].tagEnd = '/boolean';
|
|
1267
|
-
metaData[depth].data = true;
|
|
1268
|
-
}
|
|
1269
|
-
if (metaData[depth].tagStart === 'false/') {
|
|
1270
|
-
inTagStart = false;
|
|
1271
|
-
inTagEnd = true;
|
|
1272
|
-
metaData[depth].tagStart = '';
|
|
1273
|
-
metaData[depth].tagEnd = '/boolean';
|
|
1274
|
-
metaData[depth].data = false;
|
|
1275
|
-
}
|
|
1276
|
-
if (metaData[depth].tagStart === 'array/') {
|
|
1277
|
-
inTagStart = false;
|
|
1278
|
-
inTagEnd = true;
|
|
1279
|
-
metaData[depth].tagStart = '';
|
|
1280
|
-
metaData[depth].tagEnd = '/arrayEmpty';
|
|
1281
|
-
metaData[depth].data = [];
|
|
1282
|
-
}
|
|
1283
|
-
if (inTagContent) {
|
|
1284
|
-
inTagContent = false;
|
|
1285
|
-
}
|
|
1286
|
-
if (inTagStart) {
|
|
1287
|
-
inTagStart = false;
|
|
1288
|
-
inTagContent = true;
|
|
1289
|
-
if (metaData[depth].tagStart === 'array') {
|
|
1290
|
-
metaData[depth].data = [];
|
|
1291
|
-
}
|
|
1292
|
-
if (metaData[depth].tagStart === 'dict') {
|
|
1293
|
-
metaData[depth].data = {};
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
if (inTagEnd) {
|
|
1297
|
-
inTagEnd = false;
|
|
1298
|
-
if (metaData[depth].tagEnd && tags.indexOf(metaData[depth].tagEnd.substr(1)) >= 0) {
|
|
1299
|
-
if (metaData[depth].tagEnd === '/dict' || metaData[depth].tagEnd === '/array') {
|
|
1300
|
-
if (depth > 1 && metaData[depth - 2].tagStart === 'array') {
|
|
1301
|
-
metaData[depth - 2].data.push(metaData[depth - 1].data);
|
|
1302
|
-
}
|
|
1303
|
-
if (depth > 1 && metaData[depth - 2].tagStart === 'dict' && !isProtoKey(metaData[depth - 1].key)) {
|
|
1304
|
-
metaData[depth - 2].data[metaData[depth - 1].key] = metaData[depth - 1].data;
|
|
1305
|
-
}
|
|
1306
|
-
depth--;
|
|
1307
|
-
metaData.pop();
|
|
1308
|
-
metaData[depth].tagContent = '';
|
|
1309
|
-
metaData[depth].tagStart = '';
|
|
1310
|
-
metaData[depth].tagEnd = '';
|
|
1311
|
-
} else {
|
|
1312
|
-
if (metaData[depth].tagEnd === '/key' && metaData[depth].tagContent) {
|
|
1313
|
-
metaData[depth].key = metaData[depth].tagContent;
|
|
1314
|
-
} else {
|
|
1315
|
-
if (metaData[depth].tagEnd === '/real' && metaData[depth].tagContent) {
|
|
1316
|
-
metaData[depth].data = parseFloat(metaData[depth].tagContent) || 0;
|
|
1317
|
-
}
|
|
1318
|
-
if (metaData[depth].tagEnd === '/integer' && metaData[depth].tagContent) {
|
|
1319
|
-
metaData[depth].data = parseInt(metaData[depth].tagContent) || 0;
|
|
1320
|
-
}
|
|
1321
|
-
if (metaData[depth].tagEnd === '/string' && metaData[depth].tagContent) {
|
|
1322
|
-
metaData[depth].data = metaData[depth].tagContent || '';
|
|
1323
|
-
}
|
|
1324
|
-
if (metaData[depth].tagEnd === '/boolean') {
|
|
1325
|
-
metaData[depth].data = metaData[depth].tagContent || false;
|
|
1326
|
-
}
|
|
1327
|
-
if (metaData[depth].tagEnd === '/arrayEmpty') {
|
|
1328
|
-
metaData[depth].data = metaData[depth].tagContent || [];
|
|
1329
|
-
}
|
|
1330
|
-
if (depth > 0 && metaData[depth - 1].tagStart === 'array') {
|
|
1331
|
-
metaData[depth - 1].data.push(metaData[depth].data);
|
|
1332
|
-
}
|
|
1333
|
-
if (depth > 0 && metaData[depth - 1].tagStart === 'dict' && !isProtoKey(metaData[depth].key)) {
|
|
1334
|
-
metaData[depth - 1].data[metaData[depth].key] = metaData[depth].data;
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
metaData[depth].tagContent = '';
|
|
1338
|
-
metaData[depth].tagStart = '';
|
|
1339
|
-
metaData[depth].tagEnd = '';
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
metaData[depth].tagEnd = '';
|
|
1343
|
-
inTagStart = false;
|
|
1344
|
-
inTagContent = false;
|
|
1345
|
-
}
|
|
1346
|
-
} else {
|
|
1347
|
-
if (inTagStart) {
|
|
1348
|
-
metaData[depth].tagStart += c;
|
|
1349
|
-
}
|
|
1350
|
-
if (inTagEnd) {
|
|
1351
|
-
metaData[depth].tagEnd += c;
|
|
1352
|
-
}
|
|
1353
|
-
if (inTagContent) {
|
|
1354
|
-
metaData[depth].tagContent += c;
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
pos++;
|
|
1358
|
-
}
|
|
1359
|
-
return metaData[0].data;
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
function strIsNumeric(str) {
|
|
1363
|
-
return typeof str === 'string' && !isNaN(str) && !isNaN(parseFloat(str));
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
function plistReader(output) {
|
|
1367
|
-
const lines = output.split('\n');
|
|
1368
|
-
for (let i = 0; i < lines.length; i++) {
|
|
1369
|
-
if (lines[i].indexOf(' = ') >= 0) {
|
|
1370
|
-
const lineParts = lines[i].split(' = ');
|
|
1371
|
-
lineParts[0] = lineParts[0].trim();
|
|
1372
|
-
if (!lineParts[0].startsWith('"')) {
|
|
1373
|
-
lineParts[0] = '"' + lineParts[0] + '"';
|
|
1374
|
-
}
|
|
1375
|
-
lineParts[1] = lineParts[1].trim();
|
|
1376
|
-
if (lineParts[1].indexOf('"') === -1 && lineParts[1].endsWith(';')) {
|
|
1377
|
-
const valueString = lineParts[1].substring(0, lineParts[1].length - 1);
|
|
1378
|
-
if (!strIsNumeric(valueString)) {
|
|
1379
|
-
lineParts[1] = `"${valueString}";`;
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
if (lineParts[1].indexOf('"') >= 0 && lineParts[1].endsWith(';')) {
|
|
1383
|
-
const valueString = lineParts[1].substring(0, lineParts[1].length - 1).replace(/"/g, '');
|
|
1384
|
-
if (strIsNumeric(valueString)) {
|
|
1385
|
-
lineParts[1] = `${valueString};`;
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
lines[i] = lineParts.join(' : ');
|
|
1389
|
-
}
|
|
1390
|
-
lines[i] = lines[i].replace(/\(/g, '[').replace(/\)/g, ']').replace(/;/g, ',').trim();
|
|
1391
|
-
if (lines[i].startsWith('}') && lines[i - 1] && lines[i - 1].endsWith(',')) {
|
|
1392
|
-
lines[i - 1] = lines[i - 1].substring(0, lines[i - 1].length - 1);
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
output = lines.join('');
|
|
1396
|
-
let obj = {};
|
|
1397
|
-
try {
|
|
1398
|
-
obj = JSON.parse(output);
|
|
1399
|
-
} catch (e) {
|
|
1400
|
-
noop();
|
|
1401
|
-
}
|
|
1402
|
-
return obj;
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
function semverCompare(v1, v2) {
|
|
1406
|
-
let res = 0;
|
|
1407
|
-
const parts1 = v1.split('.').map((p) => parseInt(p, 10) || 0);
|
|
1408
|
-
const parts2 = v2.split('.').map((p) => parseInt(p, 10) || 0);
|
|
1409
|
-
if (parts1[0] < parts2[0]) {
|
|
1410
|
-
res = 1;
|
|
1411
|
-
} else if (parts1[0] > parts2[0]) {
|
|
1412
|
-
res = -1;
|
|
1413
|
-
} else if (parts1[0] === parts2[0] && parts1.length >= 2 && parts2.length >= 2) {
|
|
1414
|
-
if (parts1[1] < parts2[1]) {
|
|
1415
|
-
res = 1;
|
|
1416
|
-
} else if (parts1[1] > parts2[1]) {
|
|
1417
|
-
res = -1;
|
|
1418
|
-
} else if (parts1[1] === parts2[1]) {
|
|
1419
|
-
if (parts1.length >= 3 && parts2.length >= 3) {
|
|
1420
|
-
if (parts1[2] < parts2[2]) {
|
|
1421
|
-
res = 1;
|
|
1422
|
-
} else if (parts1[2] > parts2[2]) {
|
|
1423
|
-
res = -1;
|
|
1424
|
-
}
|
|
1425
|
-
} else if (parts2.length >= 3) {
|
|
1426
|
-
res = 1;
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
return res;
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
function getAppleModel(key) {
|
|
1434
|
-
const appleModelIds = [
|
|
1435
|
-
{
|
|
1436
|
-
key: 'Mac17,9',
|
|
1437
|
-
name: 'MacBook Pro',
|
|
1438
|
-
size: '14-inch',
|
|
1439
|
-
processor: 'M5 Pro',
|
|
1440
|
-
year: '2026',
|
|
1441
|
-
additional: ''
|
|
1442
|
-
},
|
|
1443
|
-
{
|
|
1444
|
-
key: 'Mac17,8',
|
|
1445
|
-
name: 'MacBook Pro',
|
|
1446
|
-
size: '16-inch',
|
|
1447
|
-
processor: 'M5 Pro',
|
|
1448
|
-
year: '2026',
|
|
1449
|
-
additional: ''
|
|
1450
|
-
},
|
|
1451
|
-
{
|
|
1452
|
-
key: 'Mac17,7',
|
|
1453
|
-
name: 'MacBook Pro',
|
|
1454
|
-
size: '14-inch',
|
|
1455
|
-
processor: 'M5 Max',
|
|
1456
|
-
year: '2026',
|
|
1457
|
-
additional: ''
|
|
1458
|
-
},
|
|
1459
|
-
{
|
|
1460
|
-
key: 'Mac17,6',
|
|
1461
|
-
name: 'MacBook Pro',
|
|
1462
|
-
size: '16-inch',
|
|
1463
|
-
processor: 'M5 Max',
|
|
1464
|
-
year: '2026',
|
|
1465
|
-
additional: ''
|
|
1466
|
-
},
|
|
1467
|
-
{
|
|
1468
|
-
key: 'Mac17,5',
|
|
1469
|
-
name: 'MacBook Pro',
|
|
1470
|
-
size: '16-inch',
|
|
1471
|
-
processor: 'M5 Pro',
|
|
1472
|
-
year: '2026',
|
|
1473
|
-
additional: ''
|
|
1474
|
-
},
|
|
1475
|
-
{
|
|
1476
|
-
key: 'Mac17,4',
|
|
1477
|
-
name: 'MacBook Pro',
|
|
1478
|
-
size: '14-inch',
|
|
1479
|
-
processor: 'M5 Pro',
|
|
1480
|
-
year: '2026',
|
|
1481
|
-
additional: ''
|
|
1482
|
-
},
|
|
1483
|
-
{
|
|
1484
|
-
key: 'Mac17,1',
|
|
1485
|
-
name: 'MacBook Neo',
|
|
1486
|
-
size: '14-inch',
|
|
1487
|
-
processor: 'A18 Pro',
|
|
1488
|
-
year: '2026',
|
|
1489
|
-
additional: ''
|
|
1490
|
-
},
|
|
1491
|
-
{
|
|
1492
|
-
key: 'Mac17,3',
|
|
1493
|
-
name: 'MacBook Pro',
|
|
1494
|
-
size: '16-inch',
|
|
1495
|
-
processor: 'M5',
|
|
1496
|
-
year: '2025',
|
|
1497
|
-
additional: ''
|
|
1498
|
-
},
|
|
1499
|
-
{
|
|
1500
|
-
key: 'Mac17,2',
|
|
1501
|
-
name: 'MacBook Pro',
|
|
1502
|
-
size: '14-inch',
|
|
1503
|
-
processor: 'M5',
|
|
1504
|
-
year: '2025',
|
|
1505
|
-
additional: ''
|
|
1506
|
-
},
|
|
1507
|
-
{
|
|
1508
|
-
key: 'Mac16,13',
|
|
1509
|
-
name: 'MacBook Air',
|
|
1510
|
-
size: '15-inch',
|
|
1511
|
-
processor: 'M4',
|
|
1512
|
-
year: '2025',
|
|
1513
|
-
additional: ''
|
|
1514
|
-
},
|
|
1515
|
-
{
|
|
1516
|
-
key: 'Mac16,12',
|
|
1517
|
-
name: 'MacBook Air',
|
|
1518
|
-
size: '13-inch',
|
|
1519
|
-
processor: 'M4',
|
|
1520
|
-
year: '2025',
|
|
1521
|
-
additional: ''
|
|
1522
|
-
},
|
|
1523
|
-
{
|
|
1524
|
-
key: 'Mac15,13',
|
|
1525
|
-
name: 'MacBook Air',
|
|
1526
|
-
size: '15-inch',
|
|
1527
|
-
processor: 'M3',
|
|
1528
|
-
year: '2024',
|
|
1529
|
-
additional: ''
|
|
1530
|
-
},
|
|
1531
|
-
{
|
|
1532
|
-
key: 'Mac15,12',
|
|
1533
|
-
name: 'MacBook Air',
|
|
1534
|
-
size: '13-inch',
|
|
1535
|
-
processor: 'M3',
|
|
1536
|
-
year: '2024',
|
|
1537
|
-
additional: ''
|
|
1538
|
-
},
|
|
1539
|
-
{
|
|
1540
|
-
key: 'Mac14,15',
|
|
1541
|
-
name: 'MacBook Air',
|
|
1542
|
-
size: '15-inch',
|
|
1543
|
-
processor: 'M2',
|
|
1544
|
-
year: '2024',
|
|
1545
|
-
additional: ''
|
|
1546
|
-
},
|
|
1547
|
-
{
|
|
1548
|
-
key: 'Mac14,2',
|
|
1549
|
-
name: 'MacBook Air',
|
|
1550
|
-
size: '13-inch',
|
|
1551
|
-
processor: 'M2',
|
|
1552
|
-
year: '2022',
|
|
1553
|
-
additional: ''
|
|
1554
|
-
},
|
|
1555
|
-
{
|
|
1556
|
-
key: 'MacBookAir10,1',
|
|
1557
|
-
name: 'MacBook Air',
|
|
1558
|
-
size: '13-inch',
|
|
1559
|
-
processor: 'M1',
|
|
1560
|
-
year: '2020',
|
|
1561
|
-
additional: ''
|
|
1562
|
-
},
|
|
1563
|
-
{
|
|
1564
|
-
key: 'MacBookAir9,1',
|
|
1565
|
-
name: 'MacBook Air',
|
|
1566
|
-
size: '13-inch',
|
|
1567
|
-
processor: '',
|
|
1568
|
-
year: '2020',
|
|
1569
|
-
additional: ''
|
|
1570
|
-
},
|
|
1571
|
-
{
|
|
1572
|
-
key: 'MacBookAir8,2',
|
|
1573
|
-
name: 'MacBook Air',
|
|
1574
|
-
size: '13-inch',
|
|
1575
|
-
processor: '',
|
|
1576
|
-
year: '2019',
|
|
1577
|
-
additional: ''
|
|
1578
|
-
},
|
|
1579
|
-
{
|
|
1580
|
-
key: 'MacBookAir8,1',
|
|
1581
|
-
name: 'MacBook Air',
|
|
1582
|
-
size: '13-inch',
|
|
1583
|
-
processor: '',
|
|
1584
|
-
year: '2018',
|
|
1585
|
-
additional: ''
|
|
1586
|
-
},
|
|
1587
|
-
{
|
|
1588
|
-
key: 'MacBookAir7,2',
|
|
1589
|
-
name: 'MacBook Air',
|
|
1590
|
-
size: '13-inch',
|
|
1591
|
-
processor: '',
|
|
1592
|
-
year: '2017',
|
|
1593
|
-
additional: ''
|
|
1594
|
-
},
|
|
1595
|
-
{
|
|
1596
|
-
key: 'MacBookAir7,2',
|
|
1597
|
-
name: 'MacBook Air',
|
|
1598
|
-
size: '13-inch',
|
|
1599
|
-
processor: '',
|
|
1600
|
-
year: 'Early 2015',
|
|
1601
|
-
additional: ''
|
|
1602
|
-
},
|
|
1603
|
-
{
|
|
1604
|
-
key: 'MacBookAir7,1',
|
|
1605
|
-
name: 'MacBook Air',
|
|
1606
|
-
size: '11-inch',
|
|
1607
|
-
processor: '',
|
|
1608
|
-
year: 'Early 2015',
|
|
1609
|
-
additional: ''
|
|
1610
|
-
},
|
|
1611
|
-
{
|
|
1612
|
-
key: 'MacBookAir6,2',
|
|
1613
|
-
name: 'MacBook Air',
|
|
1614
|
-
size: '13-inch',
|
|
1615
|
-
processor: '',
|
|
1616
|
-
year: 'Early 2014',
|
|
1617
|
-
additional: ''
|
|
1618
|
-
},
|
|
1619
|
-
{
|
|
1620
|
-
key: 'MacBookAir6,1',
|
|
1621
|
-
name: 'MacBook Air',
|
|
1622
|
-
size: '11-inch',
|
|
1623
|
-
processor: '',
|
|
1624
|
-
year: 'Early 2014',
|
|
1625
|
-
additional: ''
|
|
1626
|
-
},
|
|
1627
|
-
{
|
|
1628
|
-
key: 'MacBookAir6,2',
|
|
1629
|
-
name: 'MacBook Air',
|
|
1630
|
-
size: '13-inch',
|
|
1631
|
-
processor: '',
|
|
1632
|
-
year: 'Mid 2013',
|
|
1633
|
-
additional: ''
|
|
1634
|
-
},
|
|
1635
|
-
{
|
|
1636
|
-
key: 'MacBookAir6,1',
|
|
1637
|
-
name: 'MacBook Air',
|
|
1638
|
-
size: '11-inch',
|
|
1639
|
-
processor: '',
|
|
1640
|
-
year: 'Mid 2013',
|
|
1641
|
-
additional: ''
|
|
1642
|
-
},
|
|
1643
|
-
{
|
|
1644
|
-
key: 'MacBookAir5,2',
|
|
1645
|
-
name: 'MacBook Air',
|
|
1646
|
-
size: '13-inch',
|
|
1647
|
-
processor: '',
|
|
1648
|
-
year: 'Mid 2012',
|
|
1649
|
-
additional: ''
|
|
1650
|
-
},
|
|
1651
|
-
{
|
|
1652
|
-
key: 'MacBookAir5,1',
|
|
1653
|
-
name: 'MacBook Air',
|
|
1654
|
-
size: '11-inch',
|
|
1655
|
-
processor: '',
|
|
1656
|
-
year: 'Mid 2012',
|
|
1657
|
-
additional: ''
|
|
1658
|
-
},
|
|
1659
|
-
{
|
|
1660
|
-
key: 'MacBookAir4,2',
|
|
1661
|
-
name: 'MacBook Air',
|
|
1662
|
-
size: '13-inch',
|
|
1663
|
-
processor: '',
|
|
1664
|
-
year: 'Mid 2011',
|
|
1665
|
-
additional: ''
|
|
1666
|
-
},
|
|
1667
|
-
{
|
|
1668
|
-
key: 'MacBookAir4,1',
|
|
1669
|
-
name: 'MacBook Air',
|
|
1670
|
-
size: '11-inch',
|
|
1671
|
-
processor: '',
|
|
1672
|
-
year: 'Mid 2011',
|
|
1673
|
-
additional: ''
|
|
1674
|
-
},
|
|
1675
|
-
{
|
|
1676
|
-
key: 'MacBookAir3,2',
|
|
1677
|
-
name: 'MacBook Air',
|
|
1678
|
-
size: '13-inch',
|
|
1679
|
-
processor: '',
|
|
1680
|
-
year: 'Late 2010',
|
|
1681
|
-
additional: ''
|
|
1682
|
-
},
|
|
1683
|
-
{
|
|
1684
|
-
key: 'MacBookAir3,1',
|
|
1685
|
-
name: 'MacBook Air',
|
|
1686
|
-
size: '11-inch',
|
|
1687
|
-
processor: '',
|
|
1688
|
-
year: 'Late 2010',
|
|
1689
|
-
additional: ''
|
|
1690
|
-
},
|
|
1691
|
-
{
|
|
1692
|
-
key: 'MacBookAir2,1',
|
|
1693
|
-
name: 'MacBook Air',
|
|
1694
|
-
size: '13-inch',
|
|
1695
|
-
processor: '',
|
|
1696
|
-
year: 'Mid 2009',
|
|
1697
|
-
additional: ''
|
|
1698
|
-
},
|
|
1699
|
-
{
|
|
1700
|
-
key: 'Mac16,1',
|
|
1701
|
-
name: 'MacBook Pro',
|
|
1702
|
-
size: '14-inch',
|
|
1703
|
-
processor: 'M4',
|
|
1704
|
-
year: '2024',
|
|
1705
|
-
additional: ''
|
|
1706
|
-
},
|
|
1707
|
-
{
|
|
1708
|
-
key: 'Mac16,6',
|
|
1709
|
-
name: 'MacBook Pro',
|
|
1710
|
-
size: '14-inch',
|
|
1711
|
-
processor: 'M4 Pro',
|
|
1712
|
-
year: '2024',
|
|
1713
|
-
additional: ''
|
|
1714
|
-
},
|
|
1715
|
-
{
|
|
1716
|
-
key: 'Mac16,8',
|
|
1717
|
-
name: 'MacBook Pro',
|
|
1718
|
-
size: '14-inch',
|
|
1719
|
-
processor: 'M4 Max',
|
|
1720
|
-
year: '2024',
|
|
1721
|
-
additional: ''
|
|
1722
|
-
},
|
|
1723
|
-
{
|
|
1724
|
-
key: 'Mac16,5',
|
|
1725
|
-
name: 'MacBook Pro',
|
|
1726
|
-
size: '16-inch',
|
|
1727
|
-
processor: 'M4 Pro',
|
|
1728
|
-
year: '2024',
|
|
1729
|
-
additional: ''
|
|
1730
|
-
},
|
|
1731
|
-
{
|
|
1732
|
-
key: 'Mac16,6',
|
|
1733
|
-
name: 'MacBook Pro',
|
|
1734
|
-
size: '16-inch',
|
|
1735
|
-
processor: 'M4 Max',
|
|
1736
|
-
year: '2024',
|
|
1737
|
-
additional: ''
|
|
1738
|
-
},
|
|
1739
|
-
{
|
|
1740
|
-
key: 'Mac15,3',
|
|
1741
|
-
name: 'MacBook Pro',
|
|
1742
|
-
size: '14-inch',
|
|
1743
|
-
processor: 'M3',
|
|
1744
|
-
year: 'Nov 2023',
|
|
1745
|
-
additional: ''
|
|
1746
|
-
},
|
|
1747
|
-
{
|
|
1748
|
-
key: 'Mac15,6',
|
|
1749
|
-
name: 'MacBook Pro',
|
|
1750
|
-
size: '14-inch',
|
|
1751
|
-
processor: 'M3 Pro',
|
|
1752
|
-
year: 'Nov 2023',
|
|
1753
|
-
additional: ''
|
|
1754
|
-
},
|
|
1755
|
-
{
|
|
1756
|
-
key: 'Mac15,8',
|
|
1757
|
-
name: 'MacBook Pro',
|
|
1758
|
-
size: '14-inch',
|
|
1759
|
-
processor: 'M3 Pro',
|
|
1760
|
-
year: 'Nov 2023',
|
|
1761
|
-
additional: ''
|
|
1762
|
-
},
|
|
1763
|
-
{
|
|
1764
|
-
key: 'Mac15,10',
|
|
1765
|
-
name: 'MacBook Pro',
|
|
1766
|
-
size: '14-inch',
|
|
1767
|
-
processor: 'M3 Max',
|
|
1768
|
-
year: 'Nov 2023',
|
|
1769
|
-
additional: ''
|
|
1770
|
-
},
|
|
1771
|
-
{
|
|
1772
|
-
key: 'Mac15,7',
|
|
1773
|
-
name: 'MacBook Pro',
|
|
1774
|
-
size: '16-inch',
|
|
1775
|
-
processor: 'M3 Pro',
|
|
1776
|
-
year: 'Nov 2023',
|
|
1777
|
-
additional: ''
|
|
1778
|
-
},
|
|
1779
|
-
{
|
|
1780
|
-
key: 'Mac15,9',
|
|
1781
|
-
name: 'MacBook Pro',
|
|
1782
|
-
size: '16-inch',
|
|
1783
|
-
processor: 'M3 Pro',
|
|
1784
|
-
year: 'Nov 2023',
|
|
1785
|
-
additional: ''
|
|
1786
|
-
},
|
|
1787
|
-
{
|
|
1788
|
-
key: 'Mac15,11',
|
|
1789
|
-
name: 'MacBook Pro',
|
|
1790
|
-
size: '16-inch',
|
|
1791
|
-
processor: 'M3 Max',
|
|
1792
|
-
year: 'Nov 2023',
|
|
1793
|
-
additional: ''
|
|
1794
|
-
},
|
|
1795
|
-
{
|
|
1796
|
-
key: 'Mac14,5',
|
|
1797
|
-
name: 'MacBook Pro',
|
|
1798
|
-
size: '14-inch',
|
|
1799
|
-
processor: 'M2 Max',
|
|
1800
|
-
year: '2023',
|
|
1801
|
-
additional: ''
|
|
1802
|
-
},
|
|
1803
|
-
{
|
|
1804
|
-
key: 'Mac14,9',
|
|
1805
|
-
name: 'MacBook Pro',
|
|
1806
|
-
size: '14-inch',
|
|
1807
|
-
processor: 'M2 Max',
|
|
1808
|
-
year: '2023',
|
|
1809
|
-
additional: ''
|
|
1810
|
-
},
|
|
1811
|
-
{
|
|
1812
|
-
key: 'Mac14,6',
|
|
1813
|
-
name: 'MacBook Pro',
|
|
1814
|
-
size: '16-inch',
|
|
1815
|
-
processor: 'M2 Max',
|
|
1816
|
-
year: '2023',
|
|
1817
|
-
additional: ''
|
|
1818
|
-
},
|
|
1819
|
-
{
|
|
1820
|
-
key: 'Mac14,10',
|
|
1821
|
-
name: 'MacBook Pro',
|
|
1822
|
-
size: '16-inch',
|
|
1823
|
-
processor: 'M2 Max',
|
|
1824
|
-
year: '2023',
|
|
1825
|
-
additional: ''
|
|
1826
|
-
},
|
|
1827
|
-
{
|
|
1828
|
-
key: 'Mac14,7',
|
|
1829
|
-
name: 'MacBook Pro',
|
|
1830
|
-
size: '13-inch',
|
|
1831
|
-
processor: 'M2',
|
|
1832
|
-
year: '2022',
|
|
1833
|
-
additional: ''
|
|
1834
|
-
},
|
|
1835
|
-
{
|
|
1836
|
-
key: 'MacBookPro18,3',
|
|
1837
|
-
name: 'MacBook Pro',
|
|
1838
|
-
size: '14-inch',
|
|
1839
|
-
processor: 'M1 Pro',
|
|
1840
|
-
year: '2021',
|
|
1841
|
-
additional: ''
|
|
1842
|
-
},
|
|
1843
|
-
{
|
|
1844
|
-
key: 'MacBookPro18,4',
|
|
1845
|
-
name: 'MacBook Pro',
|
|
1846
|
-
size: '14-inch',
|
|
1847
|
-
processor: 'M1 Max',
|
|
1848
|
-
year: '2021',
|
|
1849
|
-
additional: ''
|
|
1850
|
-
},
|
|
1851
|
-
{
|
|
1852
|
-
key: 'MacBookPro18,1',
|
|
1853
|
-
name: 'MacBook Pro',
|
|
1854
|
-
size: '16-inch',
|
|
1855
|
-
processor: 'M1 Pro',
|
|
1856
|
-
year: '2021',
|
|
1857
|
-
additional: ''
|
|
1858
|
-
},
|
|
1859
|
-
{
|
|
1860
|
-
key: 'MacBookPro18,2',
|
|
1861
|
-
name: 'MacBook Pro',
|
|
1862
|
-
size: '16-inch',
|
|
1863
|
-
processor: 'M1 Max',
|
|
1864
|
-
year: '2021',
|
|
1865
|
-
additional: ''
|
|
1866
|
-
},
|
|
1867
|
-
{
|
|
1868
|
-
key: 'MacBookPro17,1',
|
|
1869
|
-
name: 'MacBook Pro',
|
|
1870
|
-
size: '13-inch',
|
|
1871
|
-
processor: 'M1',
|
|
1872
|
-
year: '2020',
|
|
1873
|
-
additional: ''
|
|
1874
|
-
},
|
|
1875
|
-
{
|
|
1876
|
-
key: 'MacBookPro16,3',
|
|
1877
|
-
name: 'MacBook Pro',
|
|
1878
|
-
size: '13-inch',
|
|
1879
|
-
processor: '',
|
|
1880
|
-
year: '2020',
|
|
1881
|
-
additional: 'Two Thunderbolt 3 ports'
|
|
1882
|
-
},
|
|
1883
|
-
{
|
|
1884
|
-
key: 'MacBookPro16,2',
|
|
1885
|
-
name: 'MacBook Pro',
|
|
1886
|
-
size: '13-inch',
|
|
1887
|
-
processor: '',
|
|
1888
|
-
year: '2020',
|
|
1889
|
-
additional: 'Four Thunderbolt 3 ports'
|
|
1890
|
-
},
|
|
1891
|
-
{
|
|
1892
|
-
key: 'MacBookPro16,1',
|
|
1893
|
-
name: 'MacBook Pro',
|
|
1894
|
-
size: '16-inch',
|
|
1895
|
-
processor: '',
|
|
1896
|
-
year: '2019',
|
|
1897
|
-
additional: ''
|
|
1898
|
-
},
|
|
1899
|
-
{
|
|
1900
|
-
key: 'MacBookPro16,4',
|
|
1901
|
-
name: 'MacBook Pro',
|
|
1902
|
-
size: '16-inch',
|
|
1903
|
-
processor: '',
|
|
1904
|
-
year: '2019',
|
|
1905
|
-
additional: ''
|
|
1906
|
-
},
|
|
1907
|
-
{
|
|
1908
|
-
key: 'MacBookPro15,3',
|
|
1909
|
-
name: 'MacBook Pro',
|
|
1910
|
-
size: '15-inch',
|
|
1911
|
-
processor: '',
|
|
1912
|
-
year: '2019',
|
|
1913
|
-
additional: ''
|
|
1914
|
-
},
|
|
1915
|
-
{
|
|
1916
|
-
key: 'MacBookPro15,2',
|
|
1917
|
-
name: 'MacBook Pro',
|
|
1918
|
-
size: '13-inch',
|
|
1919
|
-
processor: '',
|
|
1920
|
-
year: '2019',
|
|
1921
|
-
additional: ''
|
|
1922
|
-
},
|
|
1923
|
-
{
|
|
1924
|
-
key: 'MacBookPro15,1',
|
|
1925
|
-
name: 'MacBook Pro',
|
|
1926
|
-
size: '15-inch',
|
|
1927
|
-
processor: '',
|
|
1928
|
-
year: '2019',
|
|
1929
|
-
additional: ''
|
|
1930
|
-
},
|
|
1931
|
-
{
|
|
1932
|
-
key: 'MacBookPro15,4',
|
|
1933
|
-
name: 'MacBook Pro',
|
|
1934
|
-
size: '13-inch',
|
|
1935
|
-
processor: '',
|
|
1936
|
-
year: '2019',
|
|
1937
|
-
additional: 'Two Thunderbolt 3 ports'
|
|
1938
|
-
},
|
|
1939
|
-
{
|
|
1940
|
-
key: 'MacBookPro15,1',
|
|
1941
|
-
name: 'MacBook Pro',
|
|
1942
|
-
size: '15-inch',
|
|
1943
|
-
processor: '',
|
|
1944
|
-
year: '2018',
|
|
1945
|
-
additional: ''
|
|
1946
|
-
},
|
|
1947
|
-
{
|
|
1948
|
-
key: 'MacBookPro15,2',
|
|
1949
|
-
name: 'MacBook Pro',
|
|
1950
|
-
size: '13-inch',
|
|
1951
|
-
processor: '',
|
|
1952
|
-
year: '2018',
|
|
1953
|
-
additional: 'Four Thunderbolt 3 ports'
|
|
1954
|
-
},
|
|
1955
|
-
{
|
|
1956
|
-
key: 'MacBookPro14,1',
|
|
1957
|
-
name: 'MacBook Pro',
|
|
1958
|
-
size: '13-inch',
|
|
1959
|
-
processor: '',
|
|
1960
|
-
year: '2017',
|
|
1961
|
-
additional: 'Two Thunderbolt 3 ports'
|
|
1962
|
-
},
|
|
1963
|
-
{
|
|
1964
|
-
key: 'MacBookPro14,2',
|
|
1965
|
-
name: 'MacBook Pro',
|
|
1966
|
-
size: '13-inch',
|
|
1967
|
-
processor: '',
|
|
1968
|
-
year: '2017',
|
|
1969
|
-
additional: 'Four Thunderbolt 3 ports'
|
|
1970
|
-
},
|
|
1971
|
-
{
|
|
1972
|
-
key: 'MacBookPro14,3',
|
|
1973
|
-
name: 'MacBook Pro',
|
|
1974
|
-
size: '15-inch',
|
|
1975
|
-
processor: '',
|
|
1976
|
-
year: '2017',
|
|
1977
|
-
additional: ''
|
|
1978
|
-
},
|
|
1979
|
-
{
|
|
1980
|
-
key: 'MacBookPro13,1',
|
|
1981
|
-
name: 'MacBook Pro',
|
|
1982
|
-
size: '13-inch',
|
|
1983
|
-
processor: '',
|
|
1984
|
-
year: '2016',
|
|
1985
|
-
additional: 'Two Thunderbolt 3 ports'
|
|
1986
|
-
},
|
|
1987
|
-
{
|
|
1988
|
-
key: 'MacBookPro13,2',
|
|
1989
|
-
name: 'MacBook Pro',
|
|
1990
|
-
size: '13-inch',
|
|
1991
|
-
processor: '',
|
|
1992
|
-
year: '2016',
|
|
1993
|
-
additional: 'Four Thunderbolt 3 ports'
|
|
1994
|
-
},
|
|
1995
|
-
{
|
|
1996
|
-
key: 'MacBookPro13,3',
|
|
1997
|
-
name: 'MacBook Pro',
|
|
1998
|
-
size: '15-inch',
|
|
1999
|
-
processor: '',
|
|
2000
|
-
year: '2016',
|
|
2001
|
-
additional: ''
|
|
2002
|
-
},
|
|
2003
|
-
{
|
|
2004
|
-
key: 'MacBookPro11,4',
|
|
2005
|
-
name: 'MacBook Pro',
|
|
2006
|
-
size: '15-inch',
|
|
2007
|
-
processor: '',
|
|
2008
|
-
year: 'Mid 2015',
|
|
2009
|
-
additional: ''
|
|
2010
|
-
},
|
|
2011
|
-
{
|
|
2012
|
-
key: 'MacBookPro11,5',
|
|
2013
|
-
name: 'MacBook Pro',
|
|
2014
|
-
size: '15-inch',
|
|
2015
|
-
processor: '',
|
|
2016
|
-
year: 'Mid 2015',
|
|
2017
|
-
additional: ''
|
|
2018
|
-
},
|
|
2019
|
-
{
|
|
2020
|
-
key: 'MacBookPro12,1',
|
|
2021
|
-
name: 'MacBook Pro',
|
|
2022
|
-
size: '13-inch',
|
|
2023
|
-
processor: '',
|
|
2024
|
-
year: 'Early 2015',
|
|
2025
|
-
additional: ''
|
|
2026
|
-
},
|
|
2027
|
-
{
|
|
2028
|
-
key: 'MacBookPro11,2',
|
|
2029
|
-
name: 'MacBook Pro',
|
|
2030
|
-
size: '15-inch',
|
|
2031
|
-
processor: '',
|
|
2032
|
-
year: 'Late 2013',
|
|
2033
|
-
additional: ''
|
|
2034
|
-
},
|
|
2035
|
-
{
|
|
2036
|
-
key: 'MacBookPro11,3',
|
|
2037
|
-
name: 'MacBook Pro',
|
|
2038
|
-
size: '15-inch',
|
|
2039
|
-
processor: '',
|
|
2040
|
-
year: 'Late 2013',
|
|
2041
|
-
additional: ''
|
|
2042
|
-
},
|
|
2043
|
-
{
|
|
2044
|
-
key: 'MacBookPro11,1',
|
|
2045
|
-
name: 'MacBook Pro',
|
|
2046
|
-
size: '13-inch',
|
|
2047
|
-
processor: '',
|
|
2048
|
-
year: 'Late 2013',
|
|
2049
|
-
additional: ''
|
|
2050
|
-
},
|
|
2051
|
-
{
|
|
2052
|
-
key: 'MacBookPro10,1',
|
|
2053
|
-
name: 'MacBook Pro',
|
|
2054
|
-
size: '15-inch',
|
|
2055
|
-
processor: '',
|
|
2056
|
-
year: 'Mid 2012',
|
|
2057
|
-
additional: ''
|
|
2058
|
-
},
|
|
2059
|
-
{
|
|
2060
|
-
key: 'MacBookPro10,2',
|
|
2061
|
-
name: 'MacBook Pro',
|
|
2062
|
-
size: '13-inch',
|
|
2063
|
-
processor: '',
|
|
2064
|
-
year: 'Late 2012',
|
|
2065
|
-
additional: ''
|
|
2066
|
-
},
|
|
2067
|
-
{
|
|
2068
|
-
key: 'MacBookPro9,1',
|
|
2069
|
-
name: 'MacBook Pro',
|
|
2070
|
-
size: '15-inch',
|
|
2071
|
-
processor: '',
|
|
2072
|
-
year: 'Mid 2012',
|
|
2073
|
-
additional: ''
|
|
2074
|
-
},
|
|
2075
|
-
{
|
|
2076
|
-
key: 'MacBookPro9,2',
|
|
2077
|
-
name: 'MacBook Pro',
|
|
2078
|
-
size: '13-inch',
|
|
2079
|
-
processor: '',
|
|
2080
|
-
year: 'Mid 2012',
|
|
2081
|
-
additional: ''
|
|
2082
|
-
},
|
|
2083
|
-
{
|
|
2084
|
-
key: 'MacBookPro8,3',
|
|
2085
|
-
name: 'MacBook Pro',
|
|
2086
|
-
size: '17-inch',
|
|
2087
|
-
processor: '',
|
|
2088
|
-
year: 'Early 2011',
|
|
2089
|
-
additional: ''
|
|
2090
|
-
},
|
|
2091
|
-
{
|
|
2092
|
-
key: 'MacBookPro8,2',
|
|
2093
|
-
name: 'MacBook Pro',
|
|
2094
|
-
size: '15-inch',
|
|
2095
|
-
processor: '',
|
|
2096
|
-
year: 'Early 2011',
|
|
2097
|
-
additional: ''
|
|
2098
|
-
},
|
|
2099
|
-
{
|
|
2100
|
-
key: 'MacBookPro8,1',
|
|
2101
|
-
name: 'MacBook Pro',
|
|
2102
|
-
size: '13-inch',
|
|
2103
|
-
processor: '',
|
|
2104
|
-
year: 'Early 2011',
|
|
2105
|
-
additional: ''
|
|
2106
|
-
},
|
|
2107
|
-
{
|
|
2108
|
-
key: 'MacBookPro6,1',
|
|
2109
|
-
name: 'MacBook Pro',
|
|
2110
|
-
size: '17-inch',
|
|
2111
|
-
processor: '',
|
|
2112
|
-
year: 'Mid 2010',
|
|
2113
|
-
additional: ''
|
|
2114
|
-
},
|
|
2115
|
-
{
|
|
2116
|
-
key: 'MacBookPro6,2',
|
|
2117
|
-
name: 'MacBook Pro',
|
|
2118
|
-
size: '15-inch',
|
|
2119
|
-
processor: '',
|
|
2120
|
-
year: 'Mid 2010',
|
|
2121
|
-
additional: ''
|
|
2122
|
-
},
|
|
2123
|
-
{
|
|
2124
|
-
key: 'MacBookPro7,1',
|
|
2125
|
-
name: 'MacBook Pro',
|
|
2126
|
-
size: '13-inch',
|
|
2127
|
-
processor: '',
|
|
2128
|
-
year: 'Mid 2010',
|
|
2129
|
-
additional: ''
|
|
2130
|
-
},
|
|
2131
|
-
{
|
|
2132
|
-
key: 'MacBookPro5,2',
|
|
2133
|
-
name: 'MacBook Pro',
|
|
2134
|
-
size: '17-inch',
|
|
2135
|
-
processor: '',
|
|
2136
|
-
year: 'Early 2009',
|
|
2137
|
-
additional: ''
|
|
2138
|
-
},
|
|
2139
|
-
{
|
|
2140
|
-
key: 'MacBookPro5,3',
|
|
2141
|
-
name: 'MacBook Pro',
|
|
2142
|
-
size: '15-inch',
|
|
2143
|
-
processor: '',
|
|
2144
|
-
year: 'Mid 2009',
|
|
2145
|
-
additional: ''
|
|
2146
|
-
},
|
|
2147
|
-
{
|
|
2148
|
-
key: 'MacBookPro5,5',
|
|
2149
|
-
name: 'MacBook Pro',
|
|
2150
|
-
size: '13-inch',
|
|
2151
|
-
processor: '',
|
|
2152
|
-
year: 'Mid 2009',
|
|
2153
|
-
additional: ''
|
|
2154
|
-
},
|
|
2155
|
-
{
|
|
2156
|
-
key: 'MacBookPro5,1',
|
|
2157
|
-
name: 'MacBook Pro',
|
|
2158
|
-
size: '15-inch',
|
|
2159
|
-
processor: '',
|
|
2160
|
-
year: 'Late 2008',
|
|
2161
|
-
additional: ''
|
|
2162
|
-
},
|
|
2163
|
-
{
|
|
2164
|
-
key: 'MacBookPro4,1',
|
|
2165
|
-
name: 'MacBook Pro',
|
|
2166
|
-
size: '15-inch',
|
|
2167
|
-
processor: '',
|
|
2168
|
-
year: 'Early 2008',
|
|
2169
|
-
additional: ''
|
|
2170
|
-
},
|
|
2171
|
-
{
|
|
2172
|
-
key: 'MacBook10,1',
|
|
2173
|
-
name: 'MacBook',
|
|
2174
|
-
size: '12-inch',
|
|
2175
|
-
processor: '',
|
|
2176
|
-
year: '2017',
|
|
2177
|
-
additional: ''
|
|
2178
|
-
},
|
|
2179
|
-
{
|
|
2180
|
-
key: 'MacBook9,1',
|
|
2181
|
-
name: 'MacBook',
|
|
2182
|
-
size: '12-inch',
|
|
2183
|
-
processor: '',
|
|
2184
|
-
year: 'Early 2016',
|
|
2185
|
-
additional: ''
|
|
2186
|
-
},
|
|
2187
|
-
{
|
|
2188
|
-
key: 'MacBook8,1',
|
|
2189
|
-
name: 'MacBook',
|
|
2190
|
-
size: '12-inch',
|
|
2191
|
-
processor: '',
|
|
2192
|
-
year: 'Early 2015',
|
|
2193
|
-
additional: ''
|
|
2194
|
-
},
|
|
2195
|
-
{
|
|
2196
|
-
key: 'MacBook7,1',
|
|
2197
|
-
name: 'MacBook',
|
|
2198
|
-
size: '13-inch',
|
|
2199
|
-
processor: '',
|
|
2200
|
-
year: 'Mid 2010',
|
|
2201
|
-
additional: ''
|
|
2202
|
-
},
|
|
2203
|
-
{
|
|
2204
|
-
key: 'MacBook6,1',
|
|
2205
|
-
name: 'MacBook',
|
|
2206
|
-
size: '13-inch',
|
|
2207
|
-
processor: '',
|
|
2208
|
-
year: 'Late 2009',
|
|
2209
|
-
additional: ''
|
|
2210
|
-
},
|
|
2211
|
-
{
|
|
2212
|
-
key: 'MacBook5,2',
|
|
2213
|
-
name: 'MacBook',
|
|
2214
|
-
size: '13-inch',
|
|
2215
|
-
processor: '',
|
|
2216
|
-
year: 'Early 2009',
|
|
2217
|
-
additional: ''
|
|
2218
|
-
},
|
|
2219
|
-
{
|
|
2220
|
-
key: 'Mac14,13',
|
|
2221
|
-
name: 'Mac Studio',
|
|
2222
|
-
size: '',
|
|
2223
|
-
processor: 'M2 Max',
|
|
2224
|
-
year: '2023',
|
|
2225
|
-
additional: ''
|
|
2226
|
-
},
|
|
2227
|
-
{
|
|
2228
|
-
key: 'Mac14,14',
|
|
2229
|
-
name: 'Mac Studio',
|
|
2230
|
-
size: '',
|
|
2231
|
-
processor: 'M2 Ultra',
|
|
2232
|
-
year: '2023',
|
|
2233
|
-
additional: ''
|
|
2234
|
-
},
|
|
2235
|
-
{
|
|
2236
|
-
key: 'Mac15,14',
|
|
2237
|
-
name: 'Mac Studio',
|
|
2238
|
-
size: '',
|
|
2239
|
-
processor: 'M3 Ultra',
|
|
2240
|
-
year: '2025',
|
|
2241
|
-
additional: ''
|
|
2242
|
-
},
|
|
2243
|
-
{
|
|
2244
|
-
key: 'Mac16,9',
|
|
2245
|
-
name: 'Mac Studio',
|
|
2246
|
-
size: '',
|
|
2247
|
-
processor: 'M4 Max',
|
|
2248
|
-
year: '2025',
|
|
2249
|
-
additional: ''
|
|
2250
|
-
},
|
|
2251
|
-
{
|
|
2252
|
-
key: 'Mac13,1',
|
|
2253
|
-
name: 'Mac Studio',
|
|
2254
|
-
size: '',
|
|
2255
|
-
processor: 'M1 Max',
|
|
2256
|
-
year: '2022',
|
|
2257
|
-
additional: ''
|
|
2258
|
-
},
|
|
2259
|
-
{
|
|
2260
|
-
key: 'Mac13,2',
|
|
2261
|
-
name: 'Mac Studio',
|
|
2262
|
-
size: '',
|
|
2263
|
-
processor: 'M1 Ultra',
|
|
2264
|
-
year: '2022',
|
|
2265
|
-
additional: ''
|
|
2266
|
-
},
|
|
2267
|
-
{
|
|
2268
|
-
key: 'Mac16,11',
|
|
2269
|
-
name: 'Mac mini',
|
|
2270
|
-
size: '',
|
|
2271
|
-
processor: 'M4 Pro',
|
|
2272
|
-
year: '2024',
|
|
2273
|
-
additional: ''
|
|
2274
|
-
},
|
|
2275
|
-
{
|
|
2276
|
-
key: 'Mac16,10',
|
|
2277
|
-
name: 'Mac mini',
|
|
2278
|
-
size: '',
|
|
2279
|
-
processor: 'M4',
|
|
2280
|
-
year: '2024',
|
|
2281
|
-
additional: ''
|
|
2282
|
-
},
|
|
2283
|
-
{
|
|
2284
|
-
key: 'Mac14,3',
|
|
2285
|
-
name: 'Mac mini',
|
|
2286
|
-
size: '',
|
|
2287
|
-
processor: 'M2',
|
|
2288
|
-
year: '2023',
|
|
2289
|
-
additional: ''
|
|
2290
|
-
},
|
|
2291
|
-
{
|
|
2292
|
-
key: 'Mac14,12',
|
|
2293
|
-
name: 'Mac mini',
|
|
2294
|
-
size: '',
|
|
2295
|
-
processor: 'M2 Pro',
|
|
2296
|
-
year: '2023',
|
|
2297
|
-
additional: ''
|
|
2298
|
-
},
|
|
2299
|
-
{
|
|
2300
|
-
key: 'Macmini9,1',
|
|
2301
|
-
name: 'Mac mini',
|
|
2302
|
-
size: '',
|
|
2303
|
-
processor: 'M1',
|
|
2304
|
-
year: '2020',
|
|
2305
|
-
additional: ''
|
|
2306
|
-
},
|
|
2307
|
-
{
|
|
2308
|
-
key: 'Macmini8,1',
|
|
2309
|
-
name: 'Mac mini',
|
|
2310
|
-
size: '',
|
|
2311
|
-
processor: '',
|
|
2312
|
-
year: 'Late 2018',
|
|
2313
|
-
additional: ''
|
|
2314
|
-
},
|
|
2315
|
-
{
|
|
2316
|
-
key: 'Macmini7,1',
|
|
2317
|
-
name: 'Mac mini',
|
|
2318
|
-
size: '',
|
|
2319
|
-
processor: '',
|
|
2320
|
-
year: 'Late 2014',
|
|
2321
|
-
additional: ''
|
|
2322
|
-
},
|
|
2323
|
-
{
|
|
2324
|
-
key: 'Macmini6,1',
|
|
2325
|
-
name: 'Mac mini',
|
|
2326
|
-
size: '',
|
|
2327
|
-
processor: '',
|
|
2328
|
-
year: 'Late 2012',
|
|
2329
|
-
additional: ''
|
|
2330
|
-
},
|
|
2331
|
-
{
|
|
2332
|
-
key: 'Macmini6,2',
|
|
2333
|
-
name: 'Mac mini',
|
|
2334
|
-
size: '',
|
|
2335
|
-
processor: '',
|
|
2336
|
-
year: 'Late 2012',
|
|
2337
|
-
additional: ''
|
|
2338
|
-
},
|
|
2339
|
-
{
|
|
2340
|
-
key: 'Macmini5,1',
|
|
2341
|
-
name: 'Mac mini',
|
|
2342
|
-
size: '',
|
|
2343
|
-
processor: '',
|
|
2344
|
-
year: 'Mid 2011',
|
|
2345
|
-
additional: ''
|
|
2346
|
-
},
|
|
2347
|
-
{
|
|
2348
|
-
key: 'Macmini5,2',
|
|
2349
|
-
name: 'Mac mini',
|
|
2350
|
-
size: '',
|
|
2351
|
-
processor: '',
|
|
2352
|
-
year: 'Mid 2011',
|
|
2353
|
-
additional: ''
|
|
2354
|
-
},
|
|
2355
|
-
{
|
|
2356
|
-
key: 'Macmini4,1',
|
|
2357
|
-
name: 'Mac mini',
|
|
2358
|
-
size: '',
|
|
2359
|
-
processor: '',
|
|
2360
|
-
year: 'Mid 2010',
|
|
2361
|
-
additional: ''
|
|
2362
|
-
},
|
|
2363
|
-
{
|
|
2364
|
-
key: 'Macmini3,1',
|
|
2365
|
-
name: 'Mac mini',
|
|
2366
|
-
size: '',
|
|
2367
|
-
processor: '',
|
|
2368
|
-
year: 'Early 2009',
|
|
2369
|
-
additional: ''
|
|
2370
|
-
},
|
|
2371
|
-
{
|
|
2372
|
-
key: 'Mac16,3',
|
|
2373
|
-
name: 'iMac',
|
|
2374
|
-
size: '24-inch',
|
|
2375
|
-
processor: 'M4',
|
|
2376
|
-
year: '2024',
|
|
2377
|
-
additional: 'Four ports'
|
|
2378
|
-
},
|
|
2379
|
-
{
|
|
2380
|
-
key: 'Mac16,2',
|
|
2381
|
-
name: 'iMac',
|
|
2382
|
-
size: '24-inch',
|
|
2383
|
-
processor: 'M4',
|
|
2384
|
-
year: '2024',
|
|
2385
|
-
additional: 'Two ports'
|
|
2386
|
-
},
|
|
2387
|
-
{
|
|
2388
|
-
key: 'Mac15,5',
|
|
2389
|
-
name: 'iMac',
|
|
2390
|
-
size: '24-inch',
|
|
2391
|
-
processor: 'M3',
|
|
2392
|
-
year: '2023',
|
|
2393
|
-
additional: 'Four ports'
|
|
2394
|
-
},
|
|
2395
|
-
{
|
|
2396
|
-
key: 'Mac15,4',
|
|
2397
|
-
name: 'iMac',
|
|
2398
|
-
size: '24-inch',
|
|
2399
|
-
processor: 'M3',
|
|
2400
|
-
year: '2023',
|
|
2401
|
-
additional: 'Two ports'
|
|
2402
|
-
},
|
|
2403
|
-
{
|
|
2404
|
-
key: 'iMac21,1',
|
|
2405
|
-
name: 'iMac',
|
|
2406
|
-
size: '24-inch',
|
|
2407
|
-
processor: 'M1',
|
|
2408
|
-
year: '2021',
|
|
2409
|
-
additional: ''
|
|
2410
|
-
},
|
|
2411
|
-
{
|
|
2412
|
-
key: 'iMac21,2',
|
|
2413
|
-
name: 'iMac',
|
|
2414
|
-
size: '24-inch',
|
|
2415
|
-
processor: 'M1',
|
|
2416
|
-
year: '2021',
|
|
2417
|
-
additional: ''
|
|
2418
|
-
},
|
|
2419
|
-
{
|
|
2420
|
-
key: 'iMac20,1',
|
|
2421
|
-
name: 'iMac',
|
|
2422
|
-
size: '27-inch',
|
|
2423
|
-
processor: '',
|
|
2424
|
-
year: '2020',
|
|
2425
|
-
additional: 'Retina 5K'
|
|
2426
|
-
},
|
|
2427
|
-
{
|
|
2428
|
-
key: 'iMac20,2',
|
|
2429
|
-
name: 'iMac',
|
|
2430
|
-
size: '27-inch',
|
|
2431
|
-
processor: '',
|
|
2432
|
-
year: '2020',
|
|
2433
|
-
additional: 'Retina 5K'
|
|
2434
|
-
},
|
|
2435
|
-
{
|
|
2436
|
-
key: 'iMac19,1',
|
|
2437
|
-
name: 'iMac',
|
|
2438
|
-
size: '27-inch',
|
|
2439
|
-
processor: '',
|
|
2440
|
-
year: '2019',
|
|
2441
|
-
additional: 'Retina 5K'
|
|
2442
|
-
},
|
|
2443
|
-
{
|
|
2444
|
-
key: 'iMac19,2',
|
|
2445
|
-
name: 'iMac',
|
|
2446
|
-
size: '21.5-inch',
|
|
2447
|
-
processor: '',
|
|
2448
|
-
year: '2019',
|
|
2449
|
-
additional: 'Retina 4K'
|
|
2450
|
-
},
|
|
2451
|
-
{
|
|
2452
|
-
key: 'iMacPro1,1',
|
|
2453
|
-
name: 'iMac Pro',
|
|
2454
|
-
size: '',
|
|
2455
|
-
processor: '',
|
|
2456
|
-
year: '2017',
|
|
2457
|
-
additional: ''
|
|
2458
|
-
},
|
|
2459
|
-
{
|
|
2460
|
-
key: 'iMac18,3',
|
|
2461
|
-
name: 'iMac',
|
|
2462
|
-
size: '27-inch',
|
|
2463
|
-
processor: '',
|
|
2464
|
-
year: '2017',
|
|
2465
|
-
additional: 'Retina 5K'
|
|
2466
|
-
},
|
|
2467
|
-
{
|
|
2468
|
-
key: 'iMac18,2',
|
|
2469
|
-
name: 'iMac',
|
|
2470
|
-
size: '21.5-inch',
|
|
2471
|
-
processor: '',
|
|
2472
|
-
year: '2017',
|
|
2473
|
-
additional: 'Retina 4K'
|
|
2474
|
-
},
|
|
2475
|
-
{
|
|
2476
|
-
key: 'iMac18,1',
|
|
2477
|
-
name: 'iMac',
|
|
2478
|
-
size: '21.5-inch',
|
|
2479
|
-
processor: '',
|
|
2480
|
-
year: '2017',
|
|
2481
|
-
additional: ''
|
|
2482
|
-
},
|
|
2483
|
-
{
|
|
2484
|
-
key: 'iMac17,1',
|
|
2485
|
-
name: 'iMac',
|
|
2486
|
-
size: '27-inch',
|
|
2487
|
-
processor: '',
|
|
2488
|
-
year: 'Late 2015',
|
|
2489
|
-
additional: 'Retina 5K'
|
|
2490
|
-
},
|
|
2491
|
-
{
|
|
2492
|
-
key: 'iMac16,2',
|
|
2493
|
-
name: 'iMac',
|
|
2494
|
-
size: '21.5-inch',
|
|
2495
|
-
processor: '',
|
|
2496
|
-
year: 'Late 2015',
|
|
2497
|
-
additional: 'Retina 4K'
|
|
2498
|
-
},
|
|
2499
|
-
{
|
|
2500
|
-
key: 'iMac16,1',
|
|
2501
|
-
name: 'iMac',
|
|
2502
|
-
size: '21.5-inch',
|
|
2503
|
-
processor: '',
|
|
2504
|
-
year: 'Late 2015',
|
|
2505
|
-
additional: ''
|
|
2506
|
-
},
|
|
2507
|
-
{
|
|
2508
|
-
key: 'iMac15,1',
|
|
2509
|
-
name: 'iMac',
|
|
2510
|
-
size: '27-inch',
|
|
2511
|
-
processor: '',
|
|
2512
|
-
year: 'Late 2014',
|
|
2513
|
-
additional: 'Retina 5K'
|
|
2514
|
-
},
|
|
2515
|
-
{
|
|
2516
|
-
key: 'iMac14,4',
|
|
2517
|
-
name: 'iMac',
|
|
2518
|
-
size: '21.5-inch',
|
|
2519
|
-
processor: '',
|
|
2520
|
-
year: 'Mid 2014',
|
|
2521
|
-
additional: ''
|
|
2522
|
-
},
|
|
2523
|
-
{
|
|
2524
|
-
key: 'iMac14,2',
|
|
2525
|
-
name: 'iMac',
|
|
2526
|
-
size: '27-inch',
|
|
2527
|
-
processor: '',
|
|
2528
|
-
year: 'Late 2013',
|
|
2529
|
-
additional: ''
|
|
2530
|
-
},
|
|
2531
|
-
{
|
|
2532
|
-
key: 'iMac14,1',
|
|
2533
|
-
name: 'iMac',
|
|
2534
|
-
size: '21.5-inch',
|
|
2535
|
-
processor: '',
|
|
2536
|
-
year: 'Late 2013',
|
|
2537
|
-
additional: ''
|
|
2538
|
-
},
|
|
2539
|
-
{
|
|
2540
|
-
key: 'iMac13,2',
|
|
2541
|
-
name: 'iMac',
|
|
2542
|
-
size: '27-inch',
|
|
2543
|
-
processor: '',
|
|
2544
|
-
year: 'Late 2012',
|
|
2545
|
-
additional: ''
|
|
2546
|
-
},
|
|
2547
|
-
{
|
|
2548
|
-
key: 'iMac13,1',
|
|
2549
|
-
name: 'iMac',
|
|
2550
|
-
size: '21.5-inch',
|
|
2551
|
-
processor: '',
|
|
2552
|
-
year: 'Late 2012',
|
|
2553
|
-
additional: ''
|
|
2554
|
-
},
|
|
2555
|
-
{
|
|
2556
|
-
key: 'iMac12,2',
|
|
2557
|
-
name: 'iMac',
|
|
2558
|
-
size: '27-inch',
|
|
2559
|
-
processor: '',
|
|
2560
|
-
year: 'Mid 2011',
|
|
2561
|
-
additional: ''
|
|
2562
|
-
},
|
|
2563
|
-
{
|
|
2564
|
-
key: 'iMac12,1',
|
|
2565
|
-
name: 'iMac',
|
|
2566
|
-
size: '21.5-inch',
|
|
2567
|
-
processor: '',
|
|
2568
|
-
year: 'Mid 2011',
|
|
2569
|
-
additional: ''
|
|
2570
|
-
},
|
|
2571
|
-
{
|
|
2572
|
-
key: 'iMac11,3',
|
|
2573
|
-
name: 'iMac',
|
|
2574
|
-
size: '27-inch',
|
|
2575
|
-
processor: '',
|
|
2576
|
-
year: 'Mid 2010',
|
|
2577
|
-
additional: ''
|
|
2578
|
-
},
|
|
2579
|
-
{
|
|
2580
|
-
key: 'iMac11,2',
|
|
2581
|
-
name: 'iMac',
|
|
2582
|
-
size: '21.5-inch',
|
|
2583
|
-
processor: '',
|
|
2584
|
-
year: 'Mid 2010',
|
|
2585
|
-
additional: ''
|
|
2586
|
-
},
|
|
2587
|
-
{
|
|
2588
|
-
key: 'iMac10,1',
|
|
2589
|
-
name: 'iMac',
|
|
2590
|
-
size: '21.5-inch',
|
|
2591
|
-
processor: '',
|
|
2592
|
-
year: 'Late 2009',
|
|
2593
|
-
additional: ''
|
|
2594
|
-
},
|
|
2595
|
-
{
|
|
2596
|
-
key: 'iMac9,1',
|
|
2597
|
-
name: 'iMac',
|
|
2598
|
-
size: '20-inch',
|
|
2599
|
-
processor: '',
|
|
2600
|
-
year: 'Early 2009',
|
|
2601
|
-
additional: ''
|
|
2602
|
-
},
|
|
2603
|
-
{
|
|
2604
|
-
key: 'Mac14,8',
|
|
2605
|
-
name: 'Mac Pro',
|
|
2606
|
-
size: '',
|
|
2607
|
-
processor: '',
|
|
2608
|
-
year: '2023',
|
|
2609
|
-
additional: ''
|
|
2610
|
-
},
|
|
2611
|
-
{
|
|
2612
|
-
key: 'Mac14,8',
|
|
2613
|
-
name: 'Mac Pro',
|
|
2614
|
-
size: '',
|
|
2615
|
-
processor: '',
|
|
2616
|
-
year: '2023',
|
|
2617
|
-
additional: 'Rack'
|
|
2618
|
-
},
|
|
2619
|
-
{
|
|
2620
|
-
key: 'MacPro7,1',
|
|
2621
|
-
name: 'Mac Pro',
|
|
2622
|
-
size: '',
|
|
2623
|
-
processor: '',
|
|
2624
|
-
year: '2019',
|
|
2625
|
-
additional: ''
|
|
2626
|
-
},
|
|
2627
|
-
{
|
|
2628
|
-
key: 'MacPro7,1',
|
|
2629
|
-
name: 'Mac Pro',
|
|
2630
|
-
size: '',
|
|
2631
|
-
processor: '',
|
|
2632
|
-
year: '2019',
|
|
2633
|
-
additional: 'Rack'
|
|
2634
|
-
},
|
|
2635
|
-
{
|
|
2636
|
-
key: 'MacPro6,1',
|
|
2637
|
-
name: 'Mac Pro',
|
|
2638
|
-
size: '',
|
|
2639
|
-
processor: '',
|
|
2640
|
-
year: 'Late 2013',
|
|
2641
|
-
additional: ''
|
|
2642
|
-
},
|
|
2643
|
-
{
|
|
2644
|
-
key: 'MacPro5,1',
|
|
2645
|
-
name: 'Mac Pro',
|
|
2646
|
-
size: '',
|
|
2647
|
-
processor: '',
|
|
2648
|
-
year: 'Mid 2012',
|
|
2649
|
-
additional: ''
|
|
2650
|
-
},
|
|
2651
|
-
{
|
|
2652
|
-
key: 'MacPro5,1',
|
|
2653
|
-
name: 'Mac Pro Server',
|
|
2654
|
-
size: '',
|
|
2655
|
-
processor: '',
|
|
2656
|
-
year: 'Mid 2012',
|
|
2657
|
-
additional: 'Server'
|
|
2658
|
-
},
|
|
2659
|
-
{
|
|
2660
|
-
key: 'MacPro5,1',
|
|
2661
|
-
name: 'Mac Pro',
|
|
2662
|
-
size: '',
|
|
2663
|
-
processor: '',
|
|
2664
|
-
year: 'Mid 2010',
|
|
2665
|
-
additional: ''
|
|
2666
|
-
},
|
|
2667
|
-
{
|
|
2668
|
-
key: 'MacPro5,1',
|
|
2669
|
-
name: 'Mac Pro Server',
|
|
2670
|
-
size: '',
|
|
2671
|
-
processor: '',
|
|
2672
|
-
year: 'Mid 2010',
|
|
2673
|
-
additional: 'Server'
|
|
2674
|
-
},
|
|
2675
|
-
{
|
|
2676
|
-
key: 'MacPro4,1',
|
|
2677
|
-
name: 'Mac Pro',
|
|
2678
|
-
size: '',
|
|
2679
|
-
processor: '',
|
|
2680
|
-
year: 'Early 2009',
|
|
2681
|
-
additional: ''
|
|
2682
|
-
}
|
|
2683
|
-
];
|
|
2684
|
-
|
|
2685
|
-
const list = appleModelIds.filter((model) => model.key === key);
|
|
2686
|
-
if (list.length === 0) {
|
|
2687
|
-
return {
|
|
2688
|
-
key: key,
|
|
2689
|
-
model: 'Apple',
|
|
2690
|
-
version: 'Unknown'
|
|
2691
|
-
};
|
|
2692
|
-
}
|
|
2693
|
-
const features = [];
|
|
2694
|
-
if (list[0].size) {
|
|
2695
|
-
features.push(list[0].size);
|
|
2696
|
-
}
|
|
2697
|
-
if (list[0].processor) {
|
|
2698
|
-
features.push(list[0].processor);
|
|
2699
|
-
}
|
|
2700
|
-
if (list[0].year) {
|
|
2701
|
-
features.push(list[0].year);
|
|
2702
|
-
}
|
|
2703
|
-
if (list[0].additional) {
|
|
2704
|
-
features.push(list[0].additional);
|
|
2705
|
-
}
|
|
2706
|
-
return {
|
|
2707
|
-
key: key,
|
|
2708
|
-
model: list[0].name,
|
|
2709
|
-
version: list[0].name + ' (' + features.join(', ') + ')'
|
|
2710
|
-
};
|
|
2711
|
-
}
|
|
2712
|
-
|
|
2713
|
-
function checkWebsite(url, timeout = 5000) {
|
|
2714
|
-
const http = url.startsWith('https:') || url.indexOf(':443/') > 0 || url.indexOf(':8443/') > 0 ? require('https') : require('http');
|
|
2715
|
-
const t = Date.now();
|
|
2716
|
-
return new Promise((resolve) => {
|
|
2717
|
-
const request = http
|
|
2718
|
-
.get(url, (res) => {
|
|
2719
|
-
res.on('data', () => {});
|
|
2720
|
-
res.on('end', () => {
|
|
2721
|
-
resolve({
|
|
2722
|
-
url,
|
|
2723
|
-
statusCode: res.statusCode,
|
|
2724
|
-
message: res.statusMessage,
|
|
2725
|
-
time: Date.now() - t
|
|
2726
|
-
});
|
|
2727
|
-
});
|
|
2728
|
-
})
|
|
2729
|
-
.on('error', (e) => {
|
|
2730
|
-
resolve({
|
|
2731
|
-
url,
|
|
2732
|
-
statusCode: 404,
|
|
2733
|
-
message: e.message,
|
|
2734
|
-
time: Date.now() - t
|
|
2735
|
-
});
|
|
2736
|
-
})
|
|
2737
|
-
.setTimeout(timeout, () => {
|
|
2738
|
-
request.destroy();
|
|
2739
|
-
resolve({
|
|
2740
|
-
url,
|
|
2741
|
-
statusCode: 408,
|
|
2742
|
-
message: 'Request Timeout',
|
|
2743
|
-
time: Date.now() - t
|
|
2744
|
-
});
|
|
2745
|
-
});
|
|
2746
|
-
});
|
|
2747
|
-
}
|
|
2748
|
-
|
|
2749
|
-
function cleanString(str) {
|
|
2750
|
-
return str.replace(/To Be Filled By O.E.M./g, '');
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2753
|
-
function grep(str, pattern) {
|
|
2754
|
-
const result = str
|
|
2755
|
-
.split('\n')
|
|
2756
|
-
.filter((line) => line.includes(pattern))
|
|
2757
|
-
.join('\n');
|
|
2758
|
-
return result;
|
|
2759
|
-
}
|
|
2760
|
-
|
|
2761
|
-
function noop() {}
|
|
2762
|
-
|
|
2763
|
-
function isProtoKey(key) {
|
|
2764
|
-
return key === '__proto__' || key === 'constructor' || key === 'prototype';
|
|
2765
|
-
}
|
|
2766
|
-
|
|
2767
|
-
exports.toInt = toInt;
|
|
2768
|
-
exports.splitByNumber = splitByNumber;
|
|
2769
|
-
exports.execOptsWin = execOptsWin;
|
|
2770
|
-
exports.execOptsLinux = execOptsLinux;
|
|
2771
|
-
exports.getCodepage = getCodepage;
|
|
2772
|
-
exports.execWin = execWin;
|
|
2773
|
-
exports.isFunction = isFunction;
|
|
2774
|
-
exports.unique = unique;
|
|
2775
|
-
exports.sortByKey = sortByKey;
|
|
2776
|
-
exports.cores = cores;
|
|
2777
|
-
exports.getValue = getValue;
|
|
2778
|
-
exports.decodeEscapeSequence = decodeEscapeSequence;
|
|
2779
|
-
exports.parseDateTime = parseDateTime;
|
|
2780
|
-
exports.parseHead = parseHead;
|
|
2781
|
-
exports.findObjectByKey = findObjectByKey;
|
|
2782
|
-
exports.darwinXcodeExists = darwinXcodeExists;
|
|
2783
|
-
exports.getVboxmanage = getVboxmanage;
|
|
2784
|
-
exports.powerShell = powerShell;
|
|
2785
|
-
exports.powerShellStart = powerShellStart;
|
|
2786
|
-
exports.powerShellRelease = powerShellRelease;
|
|
2787
|
-
exports.execSafe = execSafe;
|
|
2788
|
-
exports.nanoSeconds = nanoSeconds;
|
|
2789
|
-
exports.countUniqueLines = countUniqueLines;
|
|
2790
|
-
exports.countLines = countLines;
|
|
2791
|
-
exports.noop = noop;
|
|
2792
|
-
exports.isRaspberry = isRaspberry;
|
|
2793
|
-
exports.isRaspbian = isRaspbian;
|
|
2794
|
-
exports.sanitizeShellString = sanitizeShellString;
|
|
2795
|
-
exports.sanitizeContainerID = sanitizeContainerID;
|
|
2796
|
-
exports.sanitizeImageID = sanitizeImageID;
|
|
2797
|
-
exports.isPrototypePolluted = isPrototypePolluted;
|
|
2798
|
-
exports.sanitizeString = sanitizeString;
|
|
2799
|
-
exports.decodePiCpuinfo = decodePiCpuinfo;
|
|
2800
|
-
exports.getRpiGpu = getRpiGpu;
|
|
2801
|
-
exports.promiseAll = promiseAll;
|
|
2802
|
-
exports.promisify = promisify;
|
|
2803
|
-
exports.promisifySave = promisifySave;
|
|
2804
|
-
exports.smartMonToolsInstalled = smartMonToolsInstalled;
|
|
2805
|
-
exports.linuxVersion = linuxVersion;
|
|
2806
|
-
exports.plistParser = plistParser;
|
|
2807
|
-
exports.plistReader = plistReader;
|
|
2808
|
-
exports.stringObj = stringObj;
|
|
2809
|
-
exports.stringReplace = stringReplace;
|
|
2810
|
-
exports.stringToLower = stringToLower;
|
|
2811
|
-
exports.stringToString = stringToString;
|
|
2812
|
-
exports.stringSubstr = stringSubstr;
|
|
2813
|
-
exports.stringSubstring = stringSubstring;
|
|
2814
|
-
exports.stringTrim = stringTrim;
|
|
2815
|
-
exports.stringStartWith = stringStartWith;
|
|
2816
|
-
exports.mathMin = mathMin;
|
|
2817
|
-
exports.WINDIR = WINDIR;
|
|
2818
|
-
exports.getFilesInPath = getFilesInPath;
|
|
2819
|
-
exports.semverCompare = semverCompare;
|
|
2820
|
-
exports.getAppleModel = getAppleModel;
|
|
2821
|
-
exports.checkWebsite = checkWebsite;
|
|
2822
|
-
exports.cleanString = cleanString;
|
|
2823
|
-
exports.grep = grep;
|
|
2824
|
-
exports.getPowershell = getPowershell;
|