Ensure blocked ips are deduped and empty strings removed
This commit is contained in:
@@ -82,7 +82,11 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat
|
||||
$scope.blocklist.error = {};
|
||||
$scope.blocklist.busy = true;
|
||||
|
||||
var blocklist = $scope.blocklist.blocklist.split('\n').filter(function (x) { return x !== ''; });
|
||||
// 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) {
|
||||
$scope.blocklist.busy = false;
|
||||
|
||||
Reference in New Issue
Block a user