Compare commits

...

4 Commits

Author SHA1 Message Date
BWS Systems
87f79df8b1 Merge pull request #1115 from bwssytems/target_5_2_next
Fixes #670 Execute select Device when bridge loads [Enhancement Request] enhancement
Fixes #877 Color in Hue/Sat enhancement
Fixes #917 lock device ID #s enhancement
Fixes #1032 Support for HomeGenie enhancement
Fixes #1033 Backup & Restore enhancement
Fixes #1060 Voice command colour change bug question
Fixes #1077 several somfy action in a same Row ID doesn't work bug question
Fixes #1084 Add Mozilla IoT gateway Helper enhancement
Fixes #1092 ha-bridge incompatible with Amazon Echo Dot Gen. 3? enhancement question
Fixes #1093 Alexa Issue : ID conflict between HA Bridge an Hue Bridge enhancement question
Fixes #1094 issue with 5.2.2 and Harmony enhancement question
Fixes #1095 issue with 5.2.2 and fhem enhancement question
Fixes #1098 Home Assistant has new authentication methods and Legacy API Passwords will be removed enhancement question
Fixes #1103 Have single scroll bar for Bridge Devices page. enhancement
Fixes #1108 Add mDNS Discovery to ha-bridge
Fixes #1109 Add HTTPS to ha-bridge
2019-07-29 09:24:22 -05:00
BWS Systems
1142704d22 Change version number for release 2019-07-29 09:20:01 -05:00
BWS Systems
d014240fba Update handling of https info on restart if failure 2019-07-25 13:20:43 -05:00
BWS Systems
5c2d30e24b a few fixes and trying to handle secure https fail on start 2019-07-24 16:10:59 -05:00
8 changed files with 70 additions and 21 deletions

View File

@@ -5,7 +5,7 @@
<groupId>com.bwssystems.HABridge</groupId>
<artifactId>ha-bridge</artifactId>
<version>5.3.0RC12</version>
<version>5.3.0</version>
<packaging>jar</packaging>
<name>HA Bridge</name>

View File

@@ -376,6 +376,13 @@ public class BridgeSecurity {
return newUser;
}
public void removeHttpsSettings() {
securityDescriptor.setUseHttps(false);
securityDescriptor.setKeyfilePassword(null);
securityDescriptor.setKeyfilePath(null);
setSettingsChanged(true);
}
public void removeTestUsers() {
if (securityDescriptor.getWhitelist() != null) {

View File

@@ -15,6 +15,7 @@ import com.bwssystems.HABridge.upnp.UpnpSettingsResource;
import com.bwssystems.HABridge.util.UDPDatagramSender;
public class HABridge {
private static SystemControl theSystem;
/*
* This program is based on the work of armzilla from this github repository:
@@ -39,7 +40,6 @@ public class HABridge {
UDPDatagramSender udpSender;
UpnpSettingsResource theSettingResponder;
UpnpListener theUpnpListener;
SystemControl theSystem;
BridgeSettings bridgeSettings;
Version theVersion;
@SuppressWarnings("unused")
@@ -153,8 +153,14 @@ public class HABridge {
}
private static void theExceptionHandler(Exception e, Integer thePort) {
Logger log = LoggerFactory.getLogger(HABridge.class);
log.error("Could not start ha-bridge webservice on port [{}] due to: {}", thePort, e.getMessage());
System.exit(0);
}
Logger log = LoggerFactory.getLogger(HABridge.class);
if(e.getMessage().equals("no valid keystore") || e.getMessage().equals("keystore password was incorrect")) {
log.error("Https settings have been removed as {}. Restart system manually after this process exits....", e.getMessage());
log.warn(theSystem.removeHttpsSettings());
}
else {
log.error("Could not start ha-bridge webservice on port [{}] due to: {}", thePort, e.getMessage());
log.warn(theSystem.stop());
}
}
}

View File

@@ -598,7 +598,12 @@ public class SystemControl {
log.warn("Error pinging listener. " + e.getMessage());
}
}
public String removeHttpsSettings() {
bridgeSettings.getBridgeSecurity().removeHttpsSettings();
return stop();
}
public String reinit() {
bridgeSettings.getBridgeControl().setReinit(true);
pingListener();

View File

@@ -201,11 +201,15 @@ public class GroupRepository extends BackupHandler {
private String repositoryReader(Path filePath) {
String content = null;
if(Files.notExists(filePath) || !Files.isReadable(filePath)){
log.warn("Error reading the file: " + filePath + " - Does not exist or is not readable. continuing...");
if(Files.notExists(filePath)){
log.debug("Error, the file: " + filePath + " - does not exist. continuing...");
return null;
}
if(!Files.isReadable(filePath)){
log.warn("Error, the file: " + filePath + " - is not readable. continuing...");
return null;
}
try {
content = new String(Files.readAllBytes(filePath));

View File

@@ -133,6 +133,11 @@ public class UpnpListener {
}
public boolean startListening() {
if (bridgeControl.isReinit() || bridgeControl.isStop()) {
log.warn("UPNP Listener exiting as reinit or stop requested....");
return false;
}
log.info("UPNP Discovery Listener starting....");
Enumeration<NetworkInterface> ifs = null;
@@ -206,6 +211,11 @@ public class UpnpListener {
}
}
if (bridgeControl.isReinit() || bridgeControl.isStop()) {
log.warn("UPNP Listener exiting as reinit or stop requested....");
return false;
}
log.info("UPNP Discovery Listener running and ready....");
boolean loopControl = true;
boolean error = false;

View File

@@ -367,6 +367,18 @@ app.service('bridgeService', function ($rootScope, $http, $base64, $location, ng
};
this.changeSecuritySettings = function (useLinkButton, secureHueApi, execGarden, useHttps, keyfilePath, keyfilePassword) {
if(useHttps) {
if(!keyfilePassword || keyfilePassword.length == 0 || !keyfilePassword.trim()) {
self.displayErrorMessage("Use HTTPS - ", "Key File Password cannot be empty.");
return;
}
if(!keyfilePath || keyfilePath.length == 0 || !keyfilePath.trim()) {
self.displayErrorMessage("Use HTTPS - ", "Key File Path cannot be empty.");
return;
}
}
var newSecurityInfo = {};
newSecurityInfo = {
useLinkButton: useLinkButton,
@@ -376,6 +388,7 @@ app.service('bridgeService', function ($rootScope, $http, $base64, $location, ng
keyfilePath: keyfilePath,
keyfilePassword: keyfilePassword
};
return $http.post(this.state.systemsbase + "/changesecurityinfo", newSecurityInfo).then(
function (response) {
self.state.securityInfo = response.data;
@@ -2082,21 +2095,25 @@ app.controller('SystemController', function ($scope, $location, bridgeService, n
}
var othertypes = [];
othertypes = newhomegenieothertypes.split(",");
var theModuleTypes = [];
var count = 0;
if (othertypes.length > 0) {
for (var i = 0; i < othertypes.length; i++) {
var aType = othertypes[i].trim();
if (aType.length > 0) {
var moduleType = {
moduleType: aType
};
theModuleTypes.push(moduleType);
count++;
var theModuleTypes = [];
if(newhomegenieothertypes && newhomegenieothertypes.trim() && newhomegenieothertypes.length > 0) {
othertypes = newhomegenieothertypes.split(",");
if (othertypes.length > 0) {
for (var i = 0; i < othertypes.length; i++) {
var aType = othertypes[i].trim();
if (aType.length > 0) {
var moduleType = {
moduleType: aType
};
theModuleTypes.push(moduleType);
count++;
}
}
}
}
var theExtension;
if (count == 0) {
theExtension = undefined;

View File

@@ -761,7 +761,7 @@
<td><input type="checkbox" ng-model="newhomegeniesecure" ng-true-value=true
ng-false-value=false></td>
<td><button class="btn btn-success" type="submit"
ng-click="addHomeGenietoSettings(newhomegeniename, newhomegenieip, newhomegenieport, newshomegenieusername, newhomegeniepassword, newhomegeniewebhook, newhomegeniesecure, newhomegenieothertypes)">Add</button>
ng-click="addHomeGenietoSettings(newhomegeniename, newhomegenieip, newhomegenieport, newhomegenieusername, newhomegeniepassword, newhomegeniewebhook, newhomegeniesecure, newhomegenieothertypes)">Add</button>
</td>
</tr>
</table>