feat(webui): Add IP limiter clean button to settings page
This commit is contained in:
@ -27,6 +27,7 @@ $(document).ready(function () {
|
||||
restore: contentSection.dataset.restoreUrl,
|
||||
startIpLimit: contentSection.dataset.startIpLimitUrl,
|
||||
stopIpLimit: contentSection.dataset.stopIpLimitUrl,
|
||||
cleanIpLimit: contentSection.dataset.cleanIpLimitUrl,
|
||||
configIpLimit: contentSection.dataset.configIpLimitUrl,
|
||||
statusWarp: contentSection.dataset.statusWarpUrl,
|
||||
installWarp: contentSection.dataset.installWarpUrl,
|
||||
@ -493,6 +494,7 @@ $(document).ready(function () {
|
||||
if (isRunning) {
|
||||
$("#ip_limit_start").hide();
|
||||
$("#ip_limit_stop").show();
|
||||
$("#ip_limit_clean").show();
|
||||
$configTabLi.show();
|
||||
fetchIpLimitConfig();
|
||||
if ($ipLimitServiceForm.find(".alert-info").length === 0) {
|
||||
@ -501,6 +503,7 @@ $(document).ready(function () {
|
||||
} else {
|
||||
$("#ip_limit_start").show();
|
||||
$("#ip_limit_stop").hide();
|
||||
$("#ip_limit_clean").hide();
|
||||
$configTabLi.hide();
|
||||
if ($('#ip-limit-config-tab').hasClass('active')) {
|
||||
$('#ip-limit-service-tab').tab('show');
|
||||
@ -876,6 +879,19 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
|
||||
function cleanIPLimit() {
|
||||
confirmAction("clean the IP Limit database and unblock all IPs", function () {
|
||||
sendRequest(
|
||||
API_URLS.cleanIpLimit,
|
||||
"POST",
|
||||
null,
|
||||
"IP Limit database cleaned successfully!",
|
||||
"#ip_limit_clean",
|
||||
true
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function configIPLimit() {
|
||||
if (!validateForm('ip_limit_config_form')) return;
|
||||
const blockDuration = $("#block_duration").val();
|
||||
@ -987,6 +1003,7 @@ $(document).ready(function () {
|
||||
$("#upload_backup").on("click", uploadBackup);
|
||||
$("#ip_limit_start").on("click", startIPLimit);
|
||||
$("#ip_limit_stop").on("click", stopIPLimit);
|
||||
$("#ip_limit_clean").on("click", cleanIPLimit);
|
||||
$("#ip_limit_change_config").on("click", configIPLimit);
|
||||
$("#decoy_setup").on("click", setupDecoy);
|
||||
$("#decoy_stop").on("click", stopDecoy);
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
data-restore-url="{{ url_for('restore_api') }}"
|
||||
data-start-ip-limit-url="{{ url_for('start_ip_limit_api') }}"
|
||||
data-stop-ip-limit-url="{{ url_for('stop_ip_limit_api') }}"
|
||||
data-clean-ip-limit-url="{{ url_for('clean_ip_limit_api') }}"
|
||||
data-config-ip-limit-url="{{ url_for('config_ip_limit_api') }}"
|
||||
data-status-warp-url="{{ url_for('status_warp') }}"
|
||||
data-install-warp-url="{{ url_for('install_warp') }}"
|
||||
@ -404,6 +405,7 @@
|
||||
Start
|
||||
</button>
|
||||
<button id="ip_limit_stop" type='button' class='btn btn-danger' style="display: none;">Stop</button>
|
||||
<button id="ip_limit_clean" type='button' class='btn btn-warning' style="display: none; margin-left: 5px;">Clean Database</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user