From 32d0876aae3b3415fb6b301e8efe6a35fd15443d Mon Sep 17 00:00:00 2001 From: George Shaw Date: Thu, 30 Nov 2017 16:13:34 -0600 Subject: [PATCH] cleaning up ip filtering --- .../assets/js/panelHandlers/security/filter_ip.js | 2 +- account/assets/js/panelHandlers/security/ip_list.js | 12 ++++++------ account/gPanel.html | 4 ++-- pkg/api/ip/filter.go | 2 +- pkg/api/ip/list.go | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/account/assets/js/panelHandlers/security/filter_ip.js b/account/assets/js/panelHandlers/security/filter_ip.js index 9ae04bb..1424596 100644 --- a/account/assets/js/panelHandlers/security/filter_ip.js +++ b/account/assets/js/panelHandlers/security/filter_ip.js @@ -13,7 +13,7 @@ jQuery('._js_ip-filter-form').on('submit', function(e){ xhr.onloadend = function() { if (xhr.status == 204) { - ipModal.find('._js_currently-filtered-ips').append('
  • '+requestData["ip"]+'
  • '); + listFilteredIPs(requestData["type"]); } else { alert("Something went wrong trying to filter that IP, please contact your administrator if problem persists."); diff --git a/account/assets/js/panelHandlers/security/ip_list.js b/account/assets/js/panelHandlers/security/ip_list.js index 47a93bd..3505ed5 100644 --- a/account/assets/js/panelHandlers/security/ip_list.js +++ b/account/assets/js/panelHandlers/security/ip_list.js @@ -5,13 +5,13 @@ jQuery('._js_ip-filtering-open').on('click', function(e){ var title; switch(jQuery(this).attr('data')) { - case "general": - title = "General"; - ipModal.find('input[name="type"]').attr('value', 'general'); - ipModal.find('#filterIPHelp').html("Filtering this IP under the general filter type will disallow access to the website for all modes."); + case "block": + title = "Block"; + ipModal.find('input[name="type"]').attr('value', 'block'); + ipModal.find('#filterIPHelp').html("Filtering this IP under the block filter type will disallow access to the website for all modes."); break; case "maintenance": - title = "Maintenance Mode"; + title = "Maintenance"; ipModal.find('input[name="type"]').attr('value', 'maintenance'); ipModal.find('#filterIPHelp').html("Whitelisting this IP under the maintenance filter type will allow access to the website during maintenance mode."); break; @@ -19,7 +19,7 @@ jQuery('._js_ip-filtering-open').on('click', function(e){ alert("Error, refresh and try again. If problem persists contact server administrator."); return; } - title += " IP Filtering"; + title = "IP Filtering - " + title; ipModal.find('.modal-title').html(title); diff --git a/account/gPanel.html b/account/gPanel.html index f789d19..a665aeb 100644 --- a/account/gPanel.html +++ b/account/gPanel.html @@ -144,8 +144,8 @@ IP Filtering diff --git a/pkg/api/ip/filter.go b/pkg/api/ip/filter.go index c46e7b8..d3370cb 100644 --- a/pkg/api/ip/filter.go +++ b/pkg/api/ip/filter.go @@ -29,7 +29,7 @@ func Filter(res http.ResponseWriter, req *http.Request, logger *log.Logger, dir return false } - if blockIPRequestData.Type != "maintenance" && blockIPRequestData.Type != "general" { + if blockIPRequestData.Type != "maintenance" && blockIPRequestData.Type != "block" { logger.Println(req.URL.Path + "::" + " filtered IP type is invalid") http.Error(res, err.Error(), http.StatusBadRequest) return false diff --git a/pkg/api/ip/list.go b/pkg/api/ip/list.go index c9429b1..2993a82 100644 --- a/pkg/api/ip/list.go +++ b/pkg/api/ip/list.go @@ -27,7 +27,7 @@ func List(res http.ResponseWriter, req *http.Request, logger *log.Logger, dir st return false } - if listIPRequestData.Type != "maintenance" && listIPRequestData.Type != "general" { + if listIPRequestData.Type != "maintenance" && listIPRequestData.Type != "block" { logger.Println(req.URL.Path + "::" + " filtered IP type is invalid") http.Error(res, err.Error(), http.StatusBadRequest) return false