Skip to content

Commit

Permalink
v4.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
oznu committed Apr 20, 2019
1 parent 0927a7f commit 8e5a999
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 5 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@

All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/).

## 4.0.4 (2019-04-20)

### Bug Fixes

* Check for IPv6 interfaces before attempting to listen on `::` ([#261](https://github.com/oznu/homebridge-config-ui-x/issues/261))

### Other Changes

* Added `host` config option to allow users to manually specify which interface/ip address the web interface should listen on

## 4.0.3 (2019-04-20)

### Bug Fixes

* Fixed bug that prevented web service listening on IPv6 interfaces ([#260](https://github.com/oznu/homebridge-config-ui-x/issues/260))
* Fixed bug that prevented the web service listening on IPv6 interfaces ([#260](https://github.com/oznu/homebridge-config-ui-x/issues/260))

## 4.0.2 (2019-04-19)

Expand Down
4 changes: 4 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@
"title": "Do not run the Config UI web server in a seperate process/thread",
"type": "boolean"
},
"host": {
"title": "The host ip address to listen on. In most cases this will be '::' or '0.0.0.0'",
"type": "string"
},
"debug": {
"title": "Enable / disable debug logging",
"type": "boolean"
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-config-ui-x",
"version": "4.0.3",
"version": "4.0.4",
"description": "Configuration UI plugin for Homebridge",
"license": "MIT",
"author": "oznu <dev@oz.nu>",
Expand Down
2 changes: 2 additions & 0 deletions src/core/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class ConfigService {
public ui: {
name: string;
port: number;
host?: '::' | '0.0.0.0' | string;
auth: 'form' | 'none';
theme: string;
sudo?: boolean;
Expand All @@ -71,6 +72,7 @@ export class ConfigService {
shutdown?: string;
restart?: string;
};
debug?: boolean;
proxyHost?: string;
sessionTimeout?: number;
websocketCompatibilityMode?: boolean;
Expand Down
11 changes: 11 additions & 0 deletions src/core/config/config.startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export async function getStartupConfig() {
}

const config = {} as {
host?: '::' | '0.0.0.0' | string;
httpsOptions?: {
key?: Buffer,
cert?: Buffer,
Expand All @@ -26,6 +27,14 @@ export async function getStartupConfig() {
debug?: boolean;
};

// check if IPv6 is available on this host
const ipv6 = Object.entries(os.networkInterfaces()).filter(([net, addresses]) => {
return addresses.find(x => x.family === 'IPv6');
}).length;

config.host = ui.host || (ipv6 ? '::' : '0.0.0.0');

// preload ssl settings
if (ui.ssl && ((ui.ssl.key && ui.ssl.cert) || ui.ssl.pfx)) {
config.httpsOptions = {
key: ui.ssl.key ? await fs.readFile(ui.ssl.key) : undefined,
Expand All @@ -35,10 +44,12 @@ export async function getStartupConfig() {
};
}

// preload proxy host settings
if (ui.proxyHost) {
config.cspWsOveride = `wss://${ui.proxyHost} ws://${ui.proxyHost}`;
}

// preload debug settings
if (ui.debug) {
config.debug = true;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async function bootstrap() {
// serve spa on all 404
app.useGlobalFilters(new SpaFilter());

logger.warn(`Console v${configService.package.version} is listening on port ${configService.ui.port}`);
await app.listen(configService.ui.port, '::');
logger.warn(`Console v${configService.package.version} is listening on ${startupConfig.host} port ${configService.ui.port}`);
await app.listen(configService.ui.port, startupConfig.host);
}
bootstrap();

0 comments on commit 8e5a999

Please sign in to comment.