Add daemon host option and default to localhost instead of all addresses

This commit is contained in:
hensm
2022-08-16 00:16:17 +01:00
parent cb6e9226de
commit 170b80283d
3 changed files with 41 additions and 17 deletions

View File

@@ -15,7 +15,16 @@ async function getBackupServerUrl() {
const { bridgeBackupHost, bridgeBackupPort, bridgeBackupPassword } =
await options.getAll();
const url = new URL(`ws://${bridgeBackupHost}:${bridgeBackupPort}`);
const url = new URL(
`ws://${
// Handle IPv6 address formatting
bridgeBackupHost.includes(":")
? `[${bridgeBackupHost}]`
: bridgeBackupHost
}`
);
url.port = bridgeBackupPort.toString();
if (bridgeBackupPassword) {
url.searchParams.append("password", bridgeBackupPassword);
}