From ff9d0a5a779d9827119f7c3eecf2f36dc3eda0c6 Mon Sep 17 00:00:00 2001 From: Admin Date: Tue, 4 Apr 2017 15:54:58 -0500 Subject: [PATCH] Moving to release candidate 1 --- README.md | 13 +++++++++++-- pom.xml | 2 +- .../com/bwssystems/HABridge/BridgeSecurity.java | 12 ++++-------- .../com/bwssystems/HABridge/BridgeSettings.java | 3 ++- .../java/com/bwssystems/HABridge/SecurityInfo.java | 7 ------- .../com/bwssystems/HABridge/SystemControl.java | 2 -- .../HABridge/plugins/exec/CommandHome.java | 3 +-- src/main/resources/public/css/main.css | 7 ------- src/main/resources/public/scripts/app.js | 11 +++++++++++ src/main/resources/public/views/login.html | 6 +++--- .../resources/public/views/securitydialog.html | 14 ++++---------- 11 files changed, 37 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 29a31cc..dc56f0e 100644 --- a/README.md +++ b/README.md @@ -214,10 +214,15 @@ The default ip address for the bridge to listen on is all interfaces (0.0.0.0). java -jar -Dserver.ip=192.168.1.1 ha-bridge-W.X.Y.jar ``` ### -Dsecurity.key=`` -The default security key is encoded into the Java code. This should not be used as anyone with access to the code can decode your passworsd. To override what the default , specify -Dsecurity.key=`` explicitly on the command line. This is will prevent any issues if your config file gets haced. The command line example: +The default security key is encoded into the Java code. The default should not be used as anyone with access to the code can decode your password. To override what the default , specify -Dsecurity.key=`` explicitly on the command line. This is will prevent any issues if your config file gets hacked. The command line example: ``` java -jar -Dsecurity.key=Xfawer354WertSdf321234asd ha-bridge-W.X.Y.jar ``` +### -Dexec.garden=`` +The default exec garden path is not set which allows any program or script to be called. The default should not be used as anyone with access to the your system can create a exec command call and execute it from the api. To override what the default , specify -Dexec.garden=`` explicitly on the command line. This is will prevent any issues if your system file gets hacked. The command line example: +``` +java -jar -Dexec.garden=C:\Users\John\bin +``` ## HA Bridge Usage and Configuration This section will cover the basics of configuration and where this configuration can be done. This requires that you have started your bridge process and then have pointed your favorite web interface by going to the http://: or http://localhost: with port you have assigned. The default quick link is http://localhost for your reference. @@ -225,6 +230,10 @@ favorite web interface by going to the http://: or http://l This screen allows you to see your devices you have configured for the ha-bridge to present to a controller, such as an Amazon Echo/Dot. It gives you a count of devices as there have been reports that the Echo only supports a limited number, but has been growing as of late, YMMV. You can test each device from this page as this calls the ha-bridge just as a controller would, i.e. the Echo. This is useful to make sure your configuration for each device is correct and for trouble shooting. You can also manages your devices as well by editing and making a new device copy as well as deleting it. At the bottom of the screen is the "Bridge Device DB Backup" which can be accessed with clicking on the `+` to expand this frame. Here you can backup and restore configurations that you have saved. These configs can be named or by clicking the `Backup Device DB' button will create a backup and name it for you. You can manage these backups by restoring them or deleting them. +#### Renumber Devices +This changes the numbering of the added devices to start at 1 and goes up from there. It was originally intended for a conversion from the previous system version that used large numbers and was not necessary. This also allows the system to try and number sequentially. If you use this button, you will need to re-discover your devices as their ID's will have changed. +#### Link +If this is present, you have enabled the ue link button feature for the ha-bridge. If you want a new system to recognize the ha-bridge, you will need to press this button when you are doign a discovery. ### The Bridge Control Tab This is where all of the configuration occurs for what ports and IP's the bridge runs on. It also contains the configurations for target devices so that Helper Tabs for configuration can be added as well as the connection information to control those devices. #### Bridge server @@ -232,7 +241,7 @@ This field is used to test the bridge server with the UPNP IP Address and to mak #### Bridge Control Buttons These buttons are for managing the bridge. The Save button is enabled when there is a change to the configuration. The Bridge Reinitialize button will recycle the internal running of the bridge in the java process. The Stop button will stop the java process. The Refresh button will refresh the page and settings. #### The Security Dialog -This is where you can set the different security settings for the ha-bridge. +This is where you can set the different security settings for the ha-bridge. There are two settings, one for enabling Hue like operation to secure the Hue api with the internally generated user for the calls that are done after the link button. The other is to secure the hue api with a username/password that is created as well. The other fields are to add and delete users and to set and change passwords for those users. If there are no users in the system, the system will not require a username/password to operate. #### Configuration Path and File The default location for the configuration file to contain the settings for the bridge is the relative path from where the bridge is started in "data/habridge.config". If you would like a different filename or directory, specify `/` explicitly. #### Device DB Path and File diff --git a/pom.xml b/pom.xml index 87dae3d..a6354af 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.bwssystems.HABridge ha-bridge - 4.5.0alpha-4 + 4.5.0rc1 jar HA Bridge diff --git a/src/main/java/com/bwssystems/HABridge/BridgeSecurity.java b/src/main/java/com/bwssystems/HABridge/BridgeSecurity.java index 204643e..75a70ef 100644 --- a/src/main/java/com/bwssystems/HABridge/BridgeSecurity.java +++ b/src/main/java/com/bwssystems/HABridge/BridgeSecurity.java @@ -28,11 +28,13 @@ public class BridgeSecurity { (byte) 0xde, (byte) 0x33, (byte) 0x10, (byte) 0x12, }; private char[] habridgeKey; + private String execGarden; private BridgeSecurityDescriptor securityDescriptor; private boolean settingsChanged; - public BridgeSecurity(char[] theKey) { + public BridgeSecurity(char[] theKey, String theExecGarden) { habridgeKey = theKey; + execGarden = theExecGarden; securityDescriptor = null; settingsChanged = false; } @@ -129,13 +131,8 @@ public class BridgeSecurity { return error; } - public void setExecGarden(String theGarden) { - securityDescriptor.setExecGarden(theGarden); - settingsChanged = true; - } - public String getExecGarden() { - return securityDescriptor.getExecGarden(); + return execGarden; } public void setUseLinkButton(boolean useThis) { securityDescriptor.setUseLinkButton(useThis); @@ -151,7 +148,6 @@ public class BridgeSecurity { } public SecurityInfo getSecurityInfo() { SecurityInfo theInfo = new SecurityInfo(); - theInfo.setExecGarden(getExecGarden()); theInfo.setUseLinkButton(isUseLinkButton()); theInfo.setSecureHueApi(isSecureHueApi()); theInfo.setSecure(isSecure()); diff --git a/src/main/java/com/bwssystems/HABridge/BridgeSettings.java b/src/main/java/com/bwssystems/HABridge/BridgeSettings.java index 5785992..2c8b2e2 100644 --- a/src/main/java/com/bwssystems/HABridge/BridgeSettings.java +++ b/src/main/java/com/bwssystems/HABridge/BridgeSettings.java @@ -38,7 +38,8 @@ public class BridgeSettings extends BackupHandler { String theKey = System.getProperty("security.key"); if(theKey == null) theKey = "IWantMyPasswordsToBeAbleToBeDecodedPleaseSeeTheReadme"; - bridgeSecurity = new BridgeSecurity(theKey.toCharArray()); + String execGarden = System.getProperty("exec.garden"); + bridgeSecurity = new BridgeSecurity(theKey.toCharArray(), execGarden); String ipV6Stack = System.getProperty("ipV6Stack"); if(ipV6Stack == null || !ipV6Stack.equalsIgnoreCase("true")) { System.setProperty("java.net.preferIPv4Stack" , "true"); diff --git a/src/main/java/com/bwssystems/HABridge/SecurityInfo.java b/src/main/java/com/bwssystems/HABridge/SecurityInfo.java index 007751b..11ed72c 100644 --- a/src/main/java/com/bwssystems/HABridge/SecurityInfo.java +++ b/src/main/java/com/bwssystems/HABridge/SecurityInfo.java @@ -2,7 +2,6 @@ package com.bwssystems.HABridge; public class SecurityInfo { private boolean useLinkButton; - private String execGarden; private boolean secureHueApi; private boolean isSecure; @@ -12,12 +11,6 @@ public class SecurityInfo { public void setUseLinkButton(boolean useLinkButton) { this.useLinkButton = useLinkButton; } - public String getExecGarden() { - return execGarden; - } - public void setExecGarden(String execGarden) { - this.execGarden = execGarden; - } public boolean isSecureHueApi() { return secureHueApi; } diff --git a/src/main/java/com/bwssystems/HABridge/SystemControl.java b/src/main/java/com/bwssystems/HABridge/SystemControl.java index 9872b28..f81d977 100644 --- a/src/main/java/com/bwssystems/HABridge/SystemControl.java +++ b/src/main/java/com/bwssystems/HABridge/SystemControl.java @@ -283,8 +283,6 @@ public class SystemControl { post(SYSTEM_CONTEXT + "/changesecurityinfo", (request, response) -> { log.debug("changesecurityinfo...."); SecurityInfo theInfo = new Gson().fromJson(request.body(), SecurityInfo.class); - if(theInfo.getExecGarden() != null) - bridgeSettings.getBridgeSecurity().setExecGarden(theInfo.getExecGarden()); bridgeSettings.getBridgeSecurity().setUseLinkButton(theInfo.isUseLinkButton()); bridgeSettings.getBridgeSecurity().setSecureHueApi(theInfo.isSecureHueApi()); bridgeSettings.save(bridgeSettings.getBridgeSettingsDescriptor()); diff --git a/src/main/java/com/bwssystems/HABridge/plugins/exec/CommandHome.java b/src/main/java/com/bwssystems/HABridge/plugins/exec/CommandHome.java index 064b216..ba828ce 100644 --- a/src/main/java/com/bwssystems/HABridge/plugins/exec/CommandHome.java +++ b/src/main/java/com/bwssystems/HABridge/plugins/exec/CommandHome.java @@ -36,8 +36,7 @@ public class CommandHome implements Home { intermediate = DeviceDataDecode.replaceDeviceData(intermediate, device); intermediate = TimeDecode.replaceTimeValue(intermediate); String execGarden = theSettings.getBridgeSecurity().getExecGarden(); - execGarden = execGarden.trim(); - if(execGarden != null && !execGarden.isEmpty()) { + if(execGarden != null && !execGarden.trim().isEmpty()) { if(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) intermediate = execGarden + "\\" + intermediate; else diff --git a/src/main/resources/public/css/main.css b/src/main/resources/public/css/main.css index bc7c9d6..dd65cb9 100644 --- a/src/main/resources/public/css/main.css +++ b/src/main/resources/public/css/main.css @@ -54,13 +54,6 @@ legend.form-label { font-size: 8pt; } -.password-count { - float: right; - position: relative; - bottom: 24px; - right: 10px; -} - .msg-block { margin-top:5px; } diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js index 90f228c..69519ad 100644 --- a/src/main/resources/public/scripts/app.js +++ b/src/main/resources/public/scripts/app.js @@ -1306,6 +1306,17 @@ app.controller ('SystemController', function ($scope, $location, bridgeService, }; }); +app.directive('autofocus', ['$timeout', function($timeout) { + return { + restrict: 'A', + link : function($scope, $element) { + $timeout(function() { + $element[0].focus(); + }); + } + } + }]); + app.directive('nuCheck', [function () { return { require: 'ngModel', diff --git a/src/main/resources/public/views/login.html b/src/main/resources/public/views/login.html index 0853b14..a15b5c1 100644 --- a/src/main/resources/public/views/login.html +++ b/src/main/resources/public/views/login.html @@ -5,19 +5,19 @@
-
+ Enter Credentials
+ placeholder="someone" autofocus/>
- +
diff --git a/src/main/resources/public/views/securitydialog.html b/src/main/resources/public/views/securitydialog.html index f01e160..4d62291 100644 --- a/src/main/resources/public/views/securitydialog.html +++ b/src/main/resources/public/views/securitydialog.html @@ -6,19 +6,13 @@ {{useLinkButton}} + ng-false-value=false /> {{useLinkButton}}
{{secureHueApi}} -
-
- - + ng-false-value=false /> {{secureHueApi}}
@@ -27,7 +21,7 @@ + placeholder="someone" nu-check="new-user" />
@@ -50,7 +44,7 @@
- +