blocklist is now a text file in the backend
This commit is contained in:
+3
-10
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user