mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
Revert "add luci-app-netspeedtest (#7947)"
This reverts commit 0088bb1601
.
Obviously the author put it up without any testing, so just
remove it. Closed: #7958, #7959
This commit is contained in:
parent
6e383a1471
commit
428c40e58c
@ -1,26 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2020-2021 sirpdboy <herboy2008@gmail.com>
|
||||
# The LuCI Network diagnosis and speed test <https://github.com/sirpdboy/NetSpeedTest>
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-netspeedtest
|
||||
PKG_VERSION:=1.6
|
||||
PKG_RELEASE:=20210928
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=sirpdboy <herboy2008@gmail.com>
|
||||
|
||||
LUCI_TITLE:=LuCI Support for netspeedtest
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+python3 +iperf3
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/netspeedtest
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
@ -1,56 +0,0 @@
|
||||
module("luci.controller.netspeedtest", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/netspeedtest") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "network", "netspeedtest"}, cbi("netspeedtest", {hideapplybtn=true, hidesavebtn=true, hideresetbtn=true}),_("Netspeedtest"),91).dependent = true
|
||||
entry({"admin", "network", "test_iperf0"}, post("test_iperf0"), nil).leaf = true
|
||||
entry({"admin", "network", "test_iperf1"}, post("test_iperf1"), nil).leaf = true
|
||||
|
||||
entry({"admin", "network", "netspeedtest", "run"}, call("run"))
|
||||
entry({"admin", "network", "netspeedtest", "realtime_log"}, call("get_log"))
|
||||
end
|
||||
|
||||
function testlan(cmd, addr)
|
||||
luci.http.prepare_content("text/plain")
|
||||
local util = io.popen(cmd)
|
||||
if util then
|
||||
while true do
|
||||
local ln = util:read("*l")
|
||||
if not ln then break end
|
||||
luci.http.write(ln)
|
||||
luci.http.write("\n")
|
||||
end
|
||||
util:close()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function testwan(cmd)
|
||||
local util = io.popen(cmd)
|
||||
util:close()
|
||||
end
|
||||
|
||||
function test_iperf0(addr)
|
||||
testlan("iperf3 -s ", addr)
|
||||
end
|
||||
|
||||
function test_iperf1(addr)
|
||||
luci.sys.call("killall iperf3")
|
||||
end
|
||||
|
||||
function get_log()
|
||||
local fs = require "nixio.fs"
|
||||
local e = {}
|
||||
e.running = luci.sys.call("busybox ps -w | grep netspeedtest | grep -v grep >/dev/null") == 0
|
||||
e.log = fs.readfile("/var/log/netspeedtest.log") or ""
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
function run()
|
||||
testwan("/etc/init.d/netspeedtest nstest ")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","network","netspeedtest"))
|
||||
end
|
@ -1,33 +0,0 @@
|
||||
-- Copyright 2018 sirpdboy (herboy2008@gmail.com)
|
||||
require("luci.util")
|
||||
local o,t,e
|
||||
|
||||
if luci.sys.call("pidof iperf3 >/dev/null") == 0 then
|
||||
status = translate("<strong><font color=\"green\">iperf3 server running</font></strong>")
|
||||
else
|
||||
status = translate("<strong><font color=\"red\">iperf3 server not running</font></strong>")
|
||||
end
|
||||
|
||||
o = Map("netspeedtest")
|
||||
o.title = translate("Netspeedtest")
|
||||
o.description = translate("Network speed diagnosis test (including intranet and extranet)")
|
||||
|
||||
t = o:section(TypedSection, "netspeedtest" translate("iperf3 lanspeedtest"))
|
||||
t.anonymous = true
|
||||
t.description = translate(string.format("%s<br />", status))
|
||||
|
||||
e = t:option(DummyValue, '', '')
|
||||
e.rawhtml = true
|
||||
e.template = 'netspeedtest/netspeedtest'
|
||||
|
||||
t=o:section(TypedSection, "netspeedtest",translate("wanspeedtest"))
|
||||
t.anonymous=true
|
||||
e = t:option(DummyValue, '', '')
|
||||
e.rawhtml = true
|
||||
e.template = 'netspeedtest/speedtest'
|
||||
|
||||
e =t:option(DummyValue, '', '')
|
||||
e.rawhtml = true
|
||||
e.template = 'netspeedtest/log'
|
||||
|
||||
return o
|
@ -1,16 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<textarea id="logview" class="cbi-input-textarea" style="width: 100%" rows="10" readonly="readonly"></textarea>
|
||||
|
||||
<script type="text/javascript">
|
||||
const LOG_URL = '<%=luci.dispatcher.build_url("admin", "network", "netspeedtest","realtime_log")%>';
|
||||
|
||||
XHR.poll(1, LOG_URL, null, (x, d) => {
|
||||
let logview = document.getElementById("logview");
|
||||
if (!d.running) {
|
||||
XHR.halt();
|
||||
}
|
||||
logview.value = d.log;
|
||||
logview.scrollTop = logview.scrollHeight;
|
||||
});
|
||||
</script>
|
||||
<%+cbi/valuefooter%>
|
@ -1,84 +0,0 @@
|
||||
|
||||
<%
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js?v=1.1"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var stxhr = new XHR();
|
||||
|
||||
function update_status(field, proto)
|
||||
{
|
||||
var tool = field.name;
|
||||
var addr = field.value;
|
||||
var protocol = proto ;
|
||||
|
||||
var legend = document.getElementById('test-rc-legend');
|
||||
var output = document.getElementById('test-rc-output');
|
||||
if (legend && output)
|
||||
{
|
||||
output.innerHTML =
|
||||
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
|
||||
'<%:Waiting for command to complete...%>'
|
||||
;
|
||||
|
||||
legend.parentNode.style.display = 'block';
|
||||
legend.style.display = 'inline';
|
||||
|
||||
stxhr.post('<%=url('admin/network')%>/test_' + tool + protocol + '/' + addr, { token: '<%=token%>' },
|
||||
function(x)
|
||||
{
|
||||
if (x.responseText)
|
||||
{
|
||||
legend.style.display = 'none';
|
||||
output.innerHTML = String.format('<pre>%h</pre>', x.responseText);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
legend.style.display = 'none';
|
||||
output.innerHTML ='</p><%:Operation execution complete%></p>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
//]]></script>
|
||||
|
||||
<form method="post" action="<%=url('admin/network/netspeedtest')%>">
|
||||
<div style="width:100%; float:left">
|
||||
<table>
|
||||
|
||||
<tr><td class="cbi-value-title" ><input style="margin: 5px 0" type="hidden" value="" name="iperf" />
|
||||
<select name="iperf_to" style="width:auto">
|
||||
<option value="0" selected="selected"><%:iperfstart%></option>
|
||||
<option value="1"><%:iperfstop%></option>
|
||||
</select></td>
|
||||
<td class="cbi-value-field" style="width:100%;" >
|
||||
<input type="button" value="<%:Perform operation%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.iperf,this.form.iperf_to.selectedIndex)" /></td>
|
||||
</tr>
|
||||
<tr><td class="cbi-value-title" ><%:iperf3 instructions%></td>
|
||||
<td class="cbi-value-field" ><%:The speed measurement terminal must be in the same LAN as the router that starts the speed measurement%><br /><%:Operation steps: start router speed measurement service download test client run speed measurement client input IP address of router speed measurement service%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cbi-value-title"><%:Iperf3 speed measurement software download%></td>
|
||||
<td class="cbi-value-field" >
|
||||
<input type="button" class="cbi-button cbi-input-reload" value="<%:Domestic download password:%>cpd6" onclick="javascript:window.open('https://sipdboy.lanzoui.com/b01c3esih','target');" />
|
||||
<input type="button" class="cbi-button cbi-input-reload" value="<%:Download from foreign official websites%>" onclick="javascript:window.open('https://iperf.fr/iperf-download.php','target');" /></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<fieldset class="cbi-section" style="display:none">
|
||||
<legend id="test-rc-legend">
|
||||
<%:Collecting data...%>
|
||||
</legend>
|
||||
<span id="test-rc-output"></span>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
@ -1,31 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<label class="cbi-value-title"> </label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-button cbi-button-apply" id="update_service" type="button" size="0" onclick="run()" value="<%= translate('Perform wanspeedtest') %>" />
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
const RUN_URL = '<%=luci.dispatcher.build_url("admin", "network", "netspeedtest","run")%>';
|
||||
const S_URL = '<%=luci.dispatcher.build_url("admin", "network", "netspeedtest")%>';
|
||||
|
||||
|
||||
function run() {
|
||||
var legend = document.getElementById('test-rc-legend');
|
||||
var output = document.getElementById('test-rc-output');
|
||||
output.innerHTML =
|
||||
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
|
||||
'<%:Network speed test, please wait for 1 minutes%>'
|
||||
;
|
||||
|
||||
legend.parentNode.style.display = 'block';
|
||||
legend.style.display = 'inline';
|
||||
XHR.get(RUN_URL, null, () => {
|
||||
setTimeout(() => { window.location = S_URL }, 3000);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
<%+cbi/valuefooter%>
|
@ -1,61 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2020-2021 sirpdboy <herboy2008@gmail.com>
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
msgid "Netspeedtest"
|
||||
msgstr "网速测试"
|
||||
|
||||
msgid "Network speed diagnosis test (including intranet and extranet)"
|
||||
msgstr "网络速度诊断测试(包括内网和外网)"
|
||||
|
||||
msgid "iperf3 lanspeedtest"
|
||||
msgstr "iperf3 内网测速"
|
||||
|
||||
msgid "iperfstart"
|
||||
msgstr "iperf服务启动"
|
||||
|
||||
msgid "iperfstop"
|
||||
msgstr "iperf服务停止"
|
||||
|
||||
msgid "Perform operation"
|
||||
msgstr "执行操作"
|
||||
|
||||
msgid "iperf3 instructions"
|
||||
msgstr "iperf3 使用说明"
|
||||
|
||||
msgid "Test speed service started"
|
||||
msgstr "测试速度服务已经启动"
|
||||
|
||||
msgid "The speed measurement terminal must be in the same LAN as the router that starts the speed measurement"
|
||||
msgstr "测速终端机必须与启动测速的路由器在同一局域网内"
|
||||
|
||||
msgid "Operation steps: start router speed measurement service download test client run speed measurement client input IP address of router speed measurement service"
|
||||
msgstr "使用步骤:A.启动路由器测速服务 B.下载测试客户端 C.运行测速客户端 D.输入路由器测速服务IP地址。 "
|
||||
|
||||
msgid "Domestic download password:"
|
||||
msgstr "国内下密码:"
|
||||
|
||||
msgid "Iperf3 speed measurement software download"
|
||||
msgstr "iperf3 测速软件下载"
|
||||
|
||||
msgid "wanspeedtest"
|
||||
msgstr "宽带速率测试"
|
||||
|
||||
msgid "Perform wanspeedtest"
|
||||
msgstr "执行宽带测速"
|
||||
|
||||
msgid "Operation execution complete"
|
||||
msgstr "操作执行完毕"
|
||||
|
||||
msgid "Network speed test, please wait for 1 minutes"
|
||||
msgstr "网速测试中,请稍等1分钟"
|
||||
|
||||
msgid "Download from foreign official websites"
|
||||
msgstr "国外官网"
|
||||
|
||||
msgid "<strong><font color=\"green\">iperf3 server running</font></strong>"
|
||||
msgstr "iperf3 服务端运行中"
|
||||
|
||||
msgid "<strong><font color=\"red\">iperf3 server not running</font></strong>"
|
||||
msgstr "iperf3 服务端未运行"
|
@ -1,7 +0,0 @@
|
||||
|
||||
config netspeedtest
|
||||
option enabled '0'
|
||||
|
||||
|
||||
config wanspeedtest
|
||||
option enabled '0'
|
@ -1,55 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright 2020 -2021 sirpdboy (herboy2008@gmail.com)
|
||||
|
||||
START=95
|
||||
STOP=10
|
||||
|
||||
. /lib/functions.sh
|
||||
EXTRA_COMMANDS="nstest"
|
||||
EXTRA_HELP=" netspeedtest"
|
||||
NS_FILE=/usr/share/netspeedtest/netspeedtest.txt
|
||||
TMP_T=/tmp/netspeedtest
|
||||
LOG="/var/log/netspeedtest.log"
|
||||
|
||||
limit_log() {
|
||||
local logf=$1
|
||||
[ ! -f "$logf" ] && return
|
||||
local sc=100
|
||||
[ -n "$2" ] && sc=$2
|
||||
local count=$(grep -c "" $logf)
|
||||
if [ $count -gt $sc ];then
|
||||
let count=count-$sc
|
||||
sed -i "1,$count d" $logf
|
||||
fi
|
||||
}
|
||||
|
||||
init_env() {
|
||||
[ ! -f "$LOG" ] && echo "netspeedtest by sirpdboy" > $LOG
|
||||
echo 1 > $NS_FILE
|
||||
|
||||
}
|
||||
|
||||
nstest() {
|
||||
init_env
|
||||
[ -f "$TMP_T" ] && return
|
||||
echo 1 > $TMP_T
|
||||
echo -ne "\n ————————————————————————————" | tee -a $LOG
|
||||
/etc/init.d/speedtest | tee -a $NS_FILE
|
||||
ns_server=`cat $NS_FILE | grep 'Hosted by' | cut -c10-`
|
||||
ns_down=`cat $NS_FILE | grep 'Download:' |awk -F: '{printf $2}' `
|
||||
ns_up=`cat $NS_FILE | grep 'Upload:' |awk -F: '{printf $2}' `
|
||||
echo -ne "\n 测服信息:${ns_server} " | tee -a $LOG
|
||||
echo -ne "\n 下行速率:${ns_down} ---- 上行速率:${ns_up} " | tee -a $LOG
|
||||
echo -ne "\n 测试时间: " | tee -a $LOG
|
||||
echo $(date +%Y-%m-%d" "%H:%M:%S) | tee -a $LOG
|
||||
rm -rf $TMP_T
|
||||
}
|
||||
|
||||
reload(){
|
||||
start
|
||||
}
|
||||
|
||||
start() {
|
||||
limit_log $LOG 200
|
||||
nstest
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@netspeedtest[-1]
|
||||
add ucitrack netspeedtest
|
||||
set ucitrack.@netspeedtest[-1].init=netspeedtest
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -rf /tmp/luci-*
|
||||
exit 0
|
@ -1 +0,0 @@
|
||||
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"luci-app-netspeedtest": {
|
||||
"description": "Grant UCI access for luci-app-netspeedtest",
|
||||
"read": {
|
||||
"uci": [ "netspeedtest" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "netspeedtest" ]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user