diff --git a/README.md b/README.md index 88e392610c..9169b10609 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,13 @@ -## This project is part of +# Pihole Speedtest Mod -https://github.com/arevindh/pihole-speedtest +[![Join the chat at https://gitter.im/pihole-speedtest/community](https://badges.gitter.im/pihole-speedtest/community.svg)](https://gitter.im/pihole-speedtest/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/TW9TfyM) -## About the project +Test your connection speed directly in the Pi-hole web interface! -This project is just another fun project integrating speedtest to PiHole Web UI. +Please go to the [main repository](https://github.com/arevindh/pihole-speedtest) for more information, including installation instructions, pull requests, and issues. -It will be using speedtest.net on background for testing. More frequent the speed tests more data will used. - -What does this mod have in extra ? - -1. Speedtest results of 1/2/4/7/30 days as graph. -2. Custom speed test server selection. -3. Detailed speedtest results page. -4. Ability to schedule speedtest interval. - -## Wiki - -Wiki is available here https://github.com/arevindh/pihole-speedtest/wiki +[Uninstall Instructions](https://github.com/arevindh/pihole-speedtest/wiki/Uninstalling-Speedtest-Mod) ## Disclaimer -We are not affiliated or endorced by [Pi-hole](https://github.com/pi-hole/AdminLTE) - -## Use Official CLI Mode for best results. - -[Uninstall Instructions](https://github.com/arevindh/pihole-speedtest/wiki/Uninstalling-Speedtest-Mod) +We are not affiliated or endorsed by [Pi-hole](https://github.com/pi-hole/AdminLTE) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index aefbcecbe2..efeefe217d 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -54,7 +54,7 @@ Options: -i, interface Specify dnsmasq's interface listening behavior -s, speedtest Set speedtest interval, user 0 to disable Speedtests, use -sn to prevent logging to results list -in Reinstall Speedtest Mod - -up [un] [db] Update Pi-hole (and | but uninstall) the Mod (and flush the database) + -up [un] [db] Update Pi-hole and (uninstall) the Mod (and flush the database) -un [db] Uninstall Speedtest Mod without updating Pi-hole (and delete the database) -db Flush the database -sd Set speedtest display range @@ -545,9 +545,18 @@ SetWebUILayout() { addOrEditKeyValPair "${setupVars}" "WEBUIBOXEDLAYOUT" "${args[2]}" } +hashFile() { + md5sum "$1" | cut -d ' ' -f 1 +} + ClearSpeedtestData() { - mv $speedtestdb $speedtestdb.old - cp /var/www/html/admin/scripts/pi-hole/speedtest/speedtest.db $speedtestdb + init_db=/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.db + if [[ -f $speedtestdb.old ]] && [[ $(hashFile $init_db) == $(hashFile $speedtestdb) ]]; then + mv -f $speedtestdb.old $speedtestdb + else + mv -f $speedtestdb $speedtestdb.old + cp $init_db $speedtestdb + fi } ChangeSpeedTestSchedule() {