Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pi-hole/pi-hole.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryubiuser <ckoenig@posteo.de>2022-02-19 23:19:57 +0300
committerGitHub <noreply@github.com>2022-02-19 23:19:57 +0300
commit9db19c5e965fb83fc94c9408e237f20937ff33b5 (patch)
tree9082d187bfcd08dc9550971d3f9daf11d7801609
parent0b905c28c172e0457cad898b16d827313183839a (diff)
parent91b4233d3a66a48a68659acfc60b1827a1fa9c61 (diff)
Merge pull request #4621 from pi-hole/new/set_rate_limit
Add backend option to set rate-limit from the dashboard
-rwxr-xr-xadvanced/Scripts/webpage.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh
index aa4795dd..0f88c463 100755
--- a/advanced/Scripts/webpage.sh
+++ b/advanced/Scripts/webpage.sh
@@ -808,6 +808,23 @@ RemoveCustomCNAMERecord() {
fi
}
+SetRateLimit() {
+ local rate_limit_count rate_limit_interval reload
+ rate_limit_count="${args[2]}"
+ rate_limit_interval="${args[3]}"
+ reload="${args[4]}"
+
+ # Set rate-limit setting inf valid
+ if [ "${rate_limit_count}" -ge 0 ] && [ "${rate_limit_interval}" -ge 0 ]; then
+ changeFTLsetting "RATE_LIMIT" "${rate_limit_count}/${rate_limit_interval}"
+ fi
+
+ # Restart FTL to update rate-limit settings only if $reload not false
+ if [[ ! $reload == "false" ]]; then
+ RestartDNS
+ fi
+}
+
main() {
args=("$@")
@@ -841,6 +858,7 @@ main() {
"removecustomdns" ) RemoveCustomDNSAddress;;
"addcustomcname" ) AddCustomCNAMERecord;;
"removecustomcname" ) RemoveCustomCNAMERecord;;
+ "ratelimit" ) SetRateLimit;;
* ) helpFunc;;
esac