mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-19 08:28:46 +00:00
Updated whitelist handling to save users when created. Also, added
default test user for habridge UI. Made change state to be validated against whitelist.
This commit is contained in:
@@ -57,6 +57,7 @@ app.config (function ($locationProvider, $routeProvider) {
|
||||
app.run( function (bridgeService) {
|
||||
bridgeService.loadBridgeSettings();
|
||||
bridgeService.getHABridgeVersion();
|
||||
bridgeService.getTestUser();
|
||||
bridgeService.viewMapTypes();
|
||||
});
|
||||
|
||||
@@ -160,6 +161,17 @@ app.service ('bridgeService', function ($http, $window, ngToast) {
|
||||
);
|
||||
};
|
||||
|
||||
this.getTestUser = function () {
|
||||
return $http.get(this.state.systemsbase + "/habridge/testuser").then(
|
||||
function (response) {
|
||||
self.state.testuser = response.data.user;
|
||||
},
|
||||
function (error) {
|
||||
self.displayWarn("Cannot get testuser: ", error);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
this.aContainsB = function (a, b) {
|
||||
return a.indexOf(b) >= 0;
|
||||
}
|
||||
@@ -774,7 +786,7 @@ app.service ('bridgeService', function ($http, $window, ngToast) {
|
||||
|
||||
this.testUrl = function (device, type, value) {
|
||||
var msgDescription = "unknown";
|
||||
var testUrl = this.state.huebase + "/test/lights/" + device.id + "/state";
|
||||
var testUrl = this.state.huebase + "/" + this.state.testuser + "/lights/" + device.id + "/state";
|
||||
var testBody = "{\"on\":";
|
||||
if (type === "off") {
|
||||
testBody = testBody + "false";
|
||||
|
||||
Reference in New Issue
Block a user