|
@@ -2,11 +2,20 @@
|
|
|
<h3><i class="ui ban icon"></i> Blacklist</h3>
|
|
|
<p>Setup blacklist based on estimated IP geographic location or IP address</p>
|
|
|
<div class="ui divider"></div>
|
|
|
-<h4>Country Blacklist</h4>
|
|
|
-<div class="ui yellow message">
|
|
|
- <i class="yellow exclamation triangle icon"></i>
|
|
|
- This will block all requests from the selected country. The requester's location is estimated from their IP address and may not be 100% accurate.
|
|
|
+<div class="ui toggle checkbox">
|
|
|
+ <input type="checkbox" id="enableBlacklist">
|
|
|
+ <label>Enable Blacklist</label>
|
|
|
+</div>
|
|
|
+<div id="toggleSucc" style="float: right; display:none; color: #2abd4d;" >
|
|
|
+ <i class="ui green checkmark icon"></i> Setting Saved
|
|
|
+</div>
|
|
|
+<div class="ui message">
|
|
|
+ <i class="info circle icon"></i> Blacklist function require complex checking logic to validate each incoming request. Not recommend enabling this feature on servers with low end hardware.
|
|
|
</div>
|
|
|
+<div class="ui divider"></div>
|
|
|
+<h4>Country Blacklist</h4>
|
|
|
+ <p><i class="yellow exclamation triangle icon"></i>
|
|
|
+ This will block all requests from the selected country. The requester's location is estimated from their IP address and may not be 100% accurate.</p>
|
|
|
|
|
|
<div class="ui form">
|
|
|
<div class="field">
|
|
@@ -263,7 +272,7 @@
|
|
|
</div>
|
|
|
<button class="ui basic red button" id="ban-btn" onclick="addCountryToBlacklist();"><i class="ui red ban icon"></i> Blacklist Country</button>
|
|
|
</div>
|
|
|
-<table class="ui celled table">
|
|
|
+<table class="ui unstackable basic celled table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th>ISO Code</th>
|
|
@@ -288,7 +297,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- <table class="ui celled table">
|
|
|
+ <table class="ui unstackable basic celled table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th>IP Address</th>
|
|
@@ -550,4 +559,34 @@
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //function to check for blacklist enable
|
|
|
+ function enableBlacklist() {
|
|
|
+ var isChecked = $('#enableBlacklist').is(':checked');
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: '/api/blacklist/enable',
|
|
|
+ data: { enable: isChecked },
|
|
|
+ success: function(data){
|
|
|
+ $("#toggleSucc").stop().finish().fadeIn("fast").delay(3000).fadeOut("fast");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function initBlacklistEnableState(){
|
|
|
+ $.get('/api/blacklist/enable', function(data){
|
|
|
+ if (data == true){
|
|
|
+ $('#enableBlacklist').parent().checkbox("set checked");
|
|
|
+ }
|
|
|
+
|
|
|
+ //Register on change event
|
|
|
+ $("#enableBlacklist").on("change", function(){
|
|
|
+ enableBlacklist();
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
+ initBlacklistEnableState();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
</script>
|