diff --git a/src/views/network.js b/src/views/network.js index a1b15a337..20df8d518 100644 --- a/src/views/network.js +++ b/src/views/network.js @@ -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;