From faa276f96acd36e602c422b83d37c028f12add29 Mon Sep 17 00:00:00 2001 From: oznu Date: Mon, 22 Apr 2019 11:55:33 +1000 Subject: [PATCH] fix #263 --- CHANGELOG.md | 10 +++++++++ package-lock.json | 34 +++++++++++++++---------------- package.json | 8 ++++---- src/core/config/config.service.ts | 2 +- src/core/config/config.startup.ts | 2 +- 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 762e52d14..b05802dbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/). +## 4.0.6 (2019-04-22) + +### Bug Fixes + +* Fixed issue causing the UI to crash when `platforms` was not present in the Homebridge `config.json` ([#263](https://github.com/oznu/homebridge-config-ui-x/issues/263)) + +### Other Changes + +* Updated npm dependencies + ## 4.0.5 (2019-04-21) ### Bug Fixes diff --git a/package-lock.json b/package-lock.json index ef96f81ed..6bd87c05c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "homebridge-config-ui-x", - "version": "4.0.5", + "version": "4.0.6", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -231,9 +231,9 @@ "dev": true }, "@types/node": { - "version": "11.13.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.5.tgz", - "integrity": "sha512-/OMMBnjVtDuwX1tg2pkYVSqRIDSmNTnvVvmvP/2xiMAAWf4a5+JozrApCrO4WCAILmXVxfNoQ3E+0HJbNpFVGg==", + "version": "11.13.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.6.tgz", + "integrity": "sha512-Xoo/EBzEe8HxTSwaZNLZjaW6M6tA/+GmD3/DZ6uo8qSaolE/9Oarko0oV1fVfrLqOz0tx0nXJB4rdD5c+vixLw==", "dev": true }, "@types/range-parser": { @@ -5596,9 +5596,9 @@ } }, "pino-pretty": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-2.6.0.tgz", - "integrity": "sha512-0mrKDOCI35tb8Wjrg793ZE+AyFZYivUH7ekJdcd41RJik32BT7cgLsq/Kjh8+lvQa+Mx2PghptN1x0tsO2Trvw==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-2.6.1.tgz", + "integrity": "sha512-e/CWtKLidqkr7sinfIVVcsfcHgnFVlGvuEfKuuPFnxBo+9dZZsmgF8a9Rj7SYJ5LMZ8YBxNY9Ca46eam4ajKtQ==", "dev": true, "requires": { "args": "^5.0.0", @@ -8168,9 +8168,9 @@ } }, "webpack-cli": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.0.tgz", - "integrity": "sha512-t1M7G4z5FhHKJ92WRKwZ1rtvi7rHc0NZoZRbSkol0YKl4HvcC8+DsmGDmK7MmZxHSAetHagiOsjOB6MmzC2TUw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.1.tgz", + "integrity": "sha512-c2inFU7SM0IttEgF7fK6AaUsbBnORRzminvbyRKS+NlbQHVZdCtzKBlavRL5359bFsywXGRAItA5di/IruC8mg==", "dev": true, "requires": { "chalk": "^2.4.1", @@ -8197,15 +8197,13 @@ "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" - }, - "dependencies": { - "semver": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", - "dev": true - } } + }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true } } }, diff --git a/package.json b/package.json index aa586f2fd..446b232da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-config-ui-x", - "version": "4.0.5", + "version": "4.0.6", "description": "Configuration UI plugin for Homebridge", "license": "MIT", "author": "oznu ", @@ -57,7 +57,7 @@ "@oznu/hap-client": "0.0.4", "@types/express": "^4.16.0", "@types/fs-extra": "^5.0.5", - "@types/node": "^11.13.5", + "@types/node": "^11.13.6", "@types/socket.io": "^2.1.2", "bash-color": "0.0.4", "buffer-shims": "^1.0.0", @@ -71,7 +71,7 @@ "nodemon": "^1.18.11", "passport": "^0.4.0", "passport-jwt": "^4.0.0", - "pino-pretty": "^2.6.0", + "pino-pretty": "^2.6.1", "point-of-view": "^3.2.0", "prettier": "^1.17.0", "qr-image": "^3.2.0", @@ -84,7 +84,7 @@ "tslint": "^5.16.0", "typescript": "^3.4.4", "webpack": "^4.30.0", - "webpack-cli": "^3.3.0", + "webpack-cli": "^3.3.1", "webpack-node-externals": "^1.7.2" } } diff --git a/src/core/config/config.service.ts b/src/core/config/config.service.ts index a5f68b7eb..bdd9a220d 100644 --- a/src/core/config/config.service.ts +++ b/src/core/config/config.service.ts @@ -84,7 +84,7 @@ export class ConfigService { constructor() { this.homebridgeConfig = fs.readJSONSync(this.configPath); - this.ui = this.homebridgeConfig.platforms.find(x => x.platform === 'config'); + this.ui = Array.isArray(this.homebridgeConfig.platforms) ? this.homebridgeConfig.platforms.find(x => x.platform === 'config') : undefined; if (!this.ui) { this.ui = { diff --git a/src/core/config/config.startup.ts b/src/core/config/config.startup.ts index f741d4816..7d874b641 100644 --- a/src/core/config/config.startup.ts +++ b/src/core/config/config.startup.ts @@ -9,7 +9,7 @@ export async function getStartupConfig() { const configPath = process.env.UIX_CONFIG_PATH || path.resolve(os.homedir(), '.homebridge/config.json'); const homebridgeConfig = await fs.readJSON(configPath); - const ui = homebridgeConfig.platforms.find(x => x.platform === 'config'); + const ui = Array.isArray(homebridgeConfig.platforms) ? homebridgeConfig.platforms.find(x => x.platform === 'config') : undefined; const config = {} as { host?: '::' | '0.0.0.0' | string;