blocklist is now a text file in the backend

This commit is contained in:
Girish Ramakrishnan
2020-09-14 10:34:04 -07:00
parent d9d1f13bf9
commit 5fca372ddf
+3 -10
View File
@@ -60,7 +60,7 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat
busy: false,
error: {},
blocklist: '',
currentBlocklist: [],
currentBlocklist: '',
refresh: function () {
Client.getBlocklist(function (error, result) {
@@ -70,10 +70,9 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat
});
},
show: function () {
$scope.blocklist.error = {};
$scope.blocklist.blocklist = $scope.blocklist.currentBlocklist.join('\n');
$scope.blocklist.blocklist = $scope.blocklist.currentBlocklist;
$('#blocklistModal').modal('show');
},
@@ -82,13 +81,7 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat
$scope.blocklist.error = {};
$scope.blocklist.busy = true;
// remove empty and dedupe array
var blocklist = $scope.blocklist.blocklist.split('\n')
.map(function (ip) { return ip.trim(); })
.filter(function (ip) { return ip !== ''; })
.filter(function(item, pos, self) { return self.indexOf(item) == pos; });
Client.setBlocklist(blocklist, function (error) {
Client.setBlocklist($scope.blocklist.blocklist, function (error) {
$scope.blocklist.busy = false;
if (error) {
$scope.blocklist.error.blocklist = error.message;