Fixed enable rooms for Alexa. Removed huemulator redirect for Spark.

Added Link management as links are now stored with IP.
This commit is contained in:
Admin
2017-12-12 15:21:45 -06:00
parent 4c86e42776
commit 4ecbad6558
9 changed files with 165 additions and 37 deletions

View File

@@ -277,6 +277,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
return $http.post(this.state.huebase, "{\"devicetype\":\"test_ha_bridge\"}").then(
function (response) {
self.state.testuser = response.data[0].success.username;
self.getWhitelist();
},
function (error) {
if (error.status === 401)
@@ -318,7 +319,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
if (error.status === 401)
$rootScope.$broadcast('securityReinit', 'done');
else
self.displayWarn("Update ecurity settings Error: ", error);
self.displayWarn("Update security settings Error: ", error);
}
);
};
@@ -410,6 +411,29 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
);
};
this.getWhitelist = function () {
return $http.get(this.state.systemsbase + "/whitelist").then(
function (response) {
self.state.whitelist = response.data;
},
function (error) {
self.displayWarn("Cannot get swhitelist: ", error);
}
);
};
this.setWhitelist = function (whitelist) {
return $http.post(this.state.systemsbase + "/setwhitelist", whitelist ).then(
function (response) {
self.state.whitelist = response.data;
self.displaySuccess("Updated whitelist.")
},
function (error) {
self.displayWarn("Update whitelist Error: ", error);
}
);
};
this.aContainsB = function (a, b) {
return a.indexOf(b) >= 0;
}
@@ -1141,6 +1165,18 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
};
this.saveSettingsNoReinit = function () {
return $http.put(this.state.systemsbase + "/settings", this.state.settings).then(
function (response) {
self.displaySuccess("Save Settings completed.");
},
function (error) {
self.displayWarn("Save Settings Error: ", error);
}
);
};
this.backupSettings = function (afilename) {
return $http.put(this.state.systemsbase + "/backup/create", {
filename: afilename
@@ -1699,6 +1735,40 @@ app.controller('SecurityDialogCtrl', function ($scope, bridgeService, ngDialog)
};
});
app.controller('ManageLinksDialogCtrl', function ($scope, bridgeService, ngDialog) {
bridgeService.getWhitelist();
$scope.whitelist = bridgeService.state.whitelist;
$scope.setWhitelist = function () {
bridgeService.setWhitelist($scope.whitelist);
ngDialog.close('ngdialog1');
};
$scope.delEntry = function (anEntry) {
for(var key in $scope.whitelist) {
if ($scope.whitelist.hasOwnProperty(key)) {
var theEntry = $scope.whitelist[key];
if(theEntry.name === anEntry) {
delete $scope.whitelist[key];
}
}
}
};
$scope.refresh = function () {
bridgeService.getWhitelist();
$scope.whitelist = bridgeService.state.whitelist;
}
$scope.delAll = function () {
$scope.whitelist = null;
};
$scope.dismissDialog = function () {
ngDialog.close('ngdialog1');
};
});
app.controller('LogsController', function ($scope, $location, bridgeService) {
bridgeService.viewLogs();
$scope.bridge = bridgeService.state;
@@ -1807,6 +1877,13 @@ app.controller('ViewingController', function ($scope, $location, bridgeService,
$scope.pushLinkButton = function() {
bridgeService.pushLinkButton();
};
$scope.manageLinksButton = function() {
ngDialog.open({
template: 'views/managelinksdialog.html',
controller: 'ManageLinksDialogCtrl',
className: 'ngdialog-theme-default'
});
};
$scope.backupDeviceDb = function (optionalbackupname) {
bridgeService.backupDeviceDb(optionalbackupname);
};