Skip to content

Commit

Permalink
v4.4.1
Browse files Browse the repository at this point in the history
FIXED: WebUI progress for speedtests using built-in binary were missing
  • Loading branch information
jackyaz authored Aug 5, 2021
2 parents 7c8991e + 07f7817 commit c708ae2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1e0da6475e3047d59b35e258a18b78fc)](https://www.codacy.com/app/jackyaz/spdMerlin?utm_source=github.com&utm_medium=referral&utm_content=jackyaz/spdMerlin&utm_campaign=Badge_Grade)
![Shellcheck](https://github.com/jackyaz/spdMerlin/actions/workflows/shellcheck.yml/badge.svg)

## v4.4.0
### Updated on 2021-08-04
## v4.4.1
### Updated on 2021-08-05
## About
spdMerlin is an internet speedtest and monitoring tool for AsusWRT Merlin with charts for daily, weekly and monthly summaries. It tracks download/upload bandwidth as well as latency, jitter and packet loss.

Expand Down
4 changes: 3 additions & 1 deletion spdmerlin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
### Start of script variables ###
readonly SCRIPT_NAME="spdMerlin"
readonly SCRIPT_NAME_LOWER=$(echo $SCRIPT_NAME | tr 'A-Z' 'a-z')
readonly SCRIPT_VERSION="v4.4.0"
readonly SCRIPT_VERSION="v4.4.1"
SCRIPT_BRANCH="master"
SCRIPT_REPO="https://raw.githubusercontent.com/jackyaz/$SCRIPT_NAME/$SCRIPT_BRANCH"
readonly SCRIPT_DIR="/jffs/addons/$SCRIPT_NAME_LOWER.d"
Expand All @@ -49,6 +49,7 @@ readonly OOKLA_HOME_DIR="$HOME_DIR/.config/ookla"
[ -z "$(nvram get odmpid)" ] && ROUTER_MODEL=$(nvram get productid) || ROUTER_MODEL=$(nvram get odmpid)
[ -f /opt/bin/sqlite3 ] && SQLITE3_PATH=/opt/bin/sqlite3 || SQLITE3_PATH=/usr/sbin/sqlite3
[ -f /usr/sbin/ookla ] && SPEEDTEST_BINARY=/usr/sbin/ookla || SPEEDTEST_BINARY="$OOKLA_DIR/speedtest"
printf "%s" "$SPEEDTEST_BINARY" > /tmp/spdmerlin-binary

[ "$(uname -m)" = "aarch64" ] && ARCH="aarch64" || ARCH="arm"
### End of script variables ###
Expand Down Expand Up @@ -402,6 +403,7 @@ Create_Symlinks(){
ln -s /tmp/spd-stats.txt "$SCRIPT_WEB_DIR/spd-stats.htm" 2>/dev/null
ln -s /tmp/spd-result.txt "$SCRIPT_WEB_DIR/spd-result.htm" 2>/dev/null
ln -s /tmp/detect_spdtest.js "$SCRIPT_WEB_DIR/detect_spdtest.js" 2>/dev/null
ln -s /tmp/spdmerlin-binary "$SCRIPT_WEB_DIR/spd-binary.htm" 2>/dev/null
ln -s "$SCRIPT_STORAGE_DIR/.autobwoutfile" "$SCRIPT_WEB_DIR/autobwoutfile.htm" 2>/dev/null

ln -s "$SCRIPT_CONF" "$SCRIPT_WEB_DIR/config.htm" 2>/dev/null
Expand Down
2 changes: 1 addition & 1 deletion spdstats_www.asp

Large diffs are not rendered by default.

29 changes: 27 additions & 2 deletions spdstats_www.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ var arraysortlistlinesVPNC5 = [];
var sortnameVPNC5 = 'Time';
var sortdirVPNC5 = 'desc';

var speedtestbinary = "built-in";

var ShowLines = GetCookie('ShowLines','string');
var ShowFill = GetCookie('ShowFill','string');
if(ShowFill == ''){
Expand Down Expand Up @@ -863,6 +865,7 @@ function initial(){
show_menu();
$j('#Time_Format').val(GetCookie('Time_Format','number'));
ScriptUpdateLayout();
get_spdtestbinary_file();
get_statstitle_file();
get_interfaces_file();
}
Expand Down Expand Up @@ -1138,7 +1141,7 @@ function get_spdtestresult_file(){
url: '/ext/spdmerlin/spd-result.htm',
dataType: 'text',
error: function(xhr){
setTimeout(get_spdtestresult_file,500);
setTimeout(get_spdtestresult_file,1000);
},
success: function(data){
var lines = data.trim().split('\n');
Expand All @@ -1149,6 +1152,24 @@ function get_spdtestresult_file(){
});
}

function get_spdtestbinary_file(){
$j.ajax({
url: '/ext/spdmerlin/spd-binary.htm',
dataType: 'text',
error: function(xhr){
setTimeout(get_spdtestbinary_file,1000);
},
success: function(data){
if(data == "/usr/sbin/ookla"){
speedtestbinary = "built-in";
}
else{
speedtestbinary = "external";
}
}
});
}

function get_spdtest_file(){
$j.ajax({
url: '/ext/spdmerlin/spd-stats.htm',
Expand All @@ -1160,6 +1181,10 @@ function get_spdtest_file(){
var lines = data.trim().split('\n');
var arrlastLine = lines.slice(-1)[0].split('%').filter(Boolean);

if(speedtestbinary == "built-in"){
lines.unshift("");
lines.unshift("Speedtest by Ookla")
}
if(lines.length > 5){
$j('#spdtest_output').html(lines[0]+'\n'+lines[1]+'\n'+lines[2]+'\n'+lines[3]+'\n'+lines[4]+'\n'+arrlastLine[arrlastLine.length-1]+'%');
}
Expand Down Expand Up @@ -1278,7 +1303,7 @@ var myinterval;
var intervalclear = false;
function StartSpeedTestInterval(){
intervalclear = false;
myinterval = setInterval(update_spdtest,500);
myinterval = setInterval(update_spdtest,1000);
}

function SaveConfig(){
Expand Down

0 comments on commit c708ae2

Please sign in to comment.