mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
luci-app-netspeedtest: rewrite makefile (#7953)
Signed-off-by: Beginner-Go <70857188+Beginner-Go@users.noreply.github.com>
This commit is contained in:
parent
0088bb1601
commit
5e0ba68c3e
@ -8,41 +8,19 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-netspeedtest
|
||||
PKG_VERSION:=1.6
|
||||
PKG_RELEASE:=20210511
|
||||
PKG_RELEASE:=20210928
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=sirpdboy
|
||||
PKG_MAINTAINER:=sirpdboy <herboy2008@gmail.com>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=LuCI Support for netspeedtest
|
||||
DEPENDS:=+python3 +iperf3
|
||||
DESCRIPTION:=LuCI support Network speed test intranet and Extranet
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Luci Support for netspeedtest.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
LUCI_TITLE:=LuCI Support for netspeedtest
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+python3 +iperf3
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/netspeedtest
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
|
||||
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci
|
||||
$(INSTALL_DIR) $(1)/
|
||||
cp -pR ./root/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
po2lmo ./po/zh-cn/netspeedtest.po $(1)/usr/lib/lua/luci/i18n/netspeedtest.lmo
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
@ -1,121 +0,0 @@
|
||||
[](#解决-github-网页上图片显示失败的问题) [](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ)
|
||||
<a href="#readme">
|
||||
<img src="https://img.vim-cn.com/a1/8713845a4aa922ac96619b0d2fb3d6919d37fc.png" alt="图飞了😂" title="NetSpeedTest" align="right" height="180" />
|
||||
</a>
|
||||
|
||||
欢迎来到sirpdboy的源码仓库!
|
||||
=
|
||||
Welcome to sirpdboy's git source of packages
|
||||
-
|
||||
[luci-app-NetSpeedTest — 网络速度测试1.5完整版](https://github.com/sirpdboy/NetSpeedTest)
|
||||
======================
|
||||
|
||||
[](#readme) [](#写在前面-) [](#编译说明-) [](#说明-) [](#捐助-)
|
||||
|
||||
请 **认真阅读完毕** 本页面,本页面包含注意事项和如何使用。
|
||||
|
||||
a new NetSpeedTest luci app bese luci-app-NetSpeedTest
|
||||
-
|
||||
|
||||
## 写在前面:[](#写在前面-)
|
||||
|
||||
一直在找OPENWRT上测试速度的插件,苦寻不到,于是有了它!
|
||||
此插件可进行内外和外网网络速度测试。
|
||||
|
||||
1.内网测速基于iperf3 插件,服务端路由器如果没有安装请先安装此ipk插件。
|
||||
|
||||
2.测速的终端使用机器必须和测速服务器在同一个局域网络中!
|
||||
|
||||
3.客户端使用步骤:
|
||||
启动测速服务器端-->下载测试客户端-->运行测速客户端-->输入服务端IP地址-->查看结果。
|
||||
|
||||
5.客户端运行,国内端下载中有“iperf3测速客户端”,运行它输入服务器IP即可。
|
||||
国外原版,需要手动进入 CMD命令模式,再输入命令:iperf3.exe -c 服务器IP
|
||||
|
||||
6.网络测速iperf3客户端下载地址:https://sipdboy.lanzoui.com/b01c3esih 密码:cpd6
|
||||
|
||||
8.外网测速使用speedtest.net测速内核,需要依赖speedtest,另外感谢superspeed和user1121114685因为借用了你们的灵感!
|
||||
|
||||
9.外网测速最后测试阶段感谢佐大:佐须之男 测试查问题!
|
||||
|
||||
10.新插件难免有bug 请不要大惊小怪。欢迎提交bug。
|
||||
|
||||
## 编译说明 [](#编译说明-)
|
||||
|
||||
将NetSpeedTest 主题添加至 LEDE/OpenWRT 源码的方法。
|
||||
|
||||
## 下载源码方法一:
|
||||
编辑源码文件夹根目录feeds.conf.default并加入如下内容:
|
||||
|
||||
```Brach
|
||||
# feeds获取源码:
|
||||
src-git NetSpeedTest https://github.com/sirpdboy/NetSpeedTest
|
||||
```
|
||||
```Brach
|
||||
# 更新feeds,并安装主题:
|
||||
scripts/feeds update NetSpeedTest
|
||||
scripts/feeds install luci-app-NetSpeedTest
|
||||
```
|
||||
|
||||
## 下载源码方法二:
|
||||
```Brach
|
||||
# 下载源码
|
||||
|
||||
git clone https://github.com/sirpdboy/NetSpeedTest package/NetSpeedTest
|
||||
|
||||
make menuconfig
|
||||
```
|
||||
## 配置菜单
|
||||
```Brach
|
||||
make menuconfig
|
||||
# 找到 LuCI -> Applications, 选择 luci-app-NetSpeedTest, 保存后退出。
|
||||
```
|
||||
## 编译
|
||||
```Brach
|
||||
# 编译固件
|
||||
make package/NetSpeedTest/luci-app-NetSpeedTest/{clean,compile} V=s
|
||||
```
|
||||
|
||||
## 说明 [](#说明-)
|
||||
|
||||
源码来源:https://github.com/sirpdboy/NetSpeedTest/luci-app-NetSpeedTest
|
||||
|
||||
|
||||
你可以随意使用其中的源码,但请注明出处。
|
||||
============================
|
||||
|
||||
# My other project
|
||||
网络速度测试 :https://github.com/sirpdboy/NetSpeedTest
|
||||
|
||||
定时关机重启 : https://github.com/sirpdboy/luci-app-autopoweroff
|
||||
|
||||
关机功能插件 : https://github.com/sirpdboy/luci-app-poweroffdevice
|
||||
|
||||
opentopd主题 : https://github.com/sirpdboy/luci-theme-opentopd
|
||||
|
||||
opentoks 主题: https://github.com/sirpdboy/luci-theme-opentoks [仿KOOLSAHRE主题]
|
||||
|
||||
btmob 主题: https://github.com/sirpdboy/luci-theme-btmob
|
||||
|
||||
系统高级设置 : https://github.com/sirpdboy/luci-app-advanced
|
||||
|
||||
## 捐助 [](#捐助-)
|
||||
|
||||
**如果你觉得此项目对你有帮助,请捐助我们,以使项目能持续发展,更加完善。··请作者喝杯咖啡~~~**
|
||||
|
||||
**你们的支持就是我的动力!**
|
||||
|
||||
### 捐助方式
|
||||
|
||||
| <img src="https://img.shields.io/badge/-支付宝-F5F5F5.svg" href="#赞助支持本项目-" height="25" alt="图飞了😂"/> | <img src="https://img.shields.io/badge/-微信-F5F5F5.svg" height="25" alt="图飞了😂" href="#赞助支持本项目-"/> |
|
||||
| :-----------------: | :-------------: |
|
||||
|<img src="https://img.vim-cn.com/fd/8e2793362ac3510094961b04407beec569b2b4.png" width="150" height="150" alt="图飞了😂" href="#赞助支持本项目-"/>|<img src="https://img.vim-cn.com/c7/675730a88accebf37a97d9e84e33529322b6e9.png" width="150" height="150" alt="图飞了😂" href="#赞助支持本项目-"/>|
|
||||
|
||||
<a href="#readme">
|
||||
<img src="https://img.shields.io/badge/-返回顶部-orange.svg" alt="图飞了😂" title="返回顶部" align="right"/>
|
||||
</a>
|
||||
|
||||
###### [解决 Github 网页上图片显示失败的问题](https://blog.csdn.net/qq_38232598/article/details/91346392)
|
||||
|
||||
[](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ)
|
||||
|
@ -1,21 +1,18 @@
|
||||
|
||||
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"},cbi("netspeedtest/netspeedtest", {hideapplybtn=true, hidesavebtn=true, hideresetbtn=true}),_("网速测试"),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", "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)
|
||||
@ -45,15 +42,15 @@ function test_iperf1(addr)
|
||||
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 ""
|
||||
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 ")
|
||||
testwan("/etc/init.d/netspeedtest nstest ")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","network","netspeedtest"))
|
||||
end
|
||||
|
@ -0,0 +1,33 @@
|
||||
-- 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,32 +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 服务端运行中</font></strong>")
|
||||
else
|
||||
status = translate("<strong><font color=\"red\">iperf3 服务端已停止</font></strong>")
|
||||
end
|
||||
|
||||
o = Map("netspeedtest", "<font color='green'>" .. translate("netspeedtest") .."</font>",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,19 +1,9 @@
|
||||
#
|
||||
# Copyright (C) 2020-2021 sirpdboy herboy2008@gmail.com
|
||||
# Copyright (C) 2020-2021 sirpdboy <herboy2008@gmail.com>
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: LuCi Chinese Translation\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Language: zh_CN\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Pootle 2.0.6\n"
|
||||
|
||||
msgid "netspeedtest"
|
||||
msgid "Netspeedtest"
|
||||
msgstr "网速测试"
|
||||
|
||||
msgid "Network speed diagnosis test (including intranet and extranet)"
|
||||
@ -47,7 +37,7 @@ msgid "Domestic download password:"
|
||||
msgstr "国内下密码:"
|
||||
|
||||
msgid "Iperf3 speed measurement software download"
|
||||
msgstr "iperf3测速软件下载"
|
||||
msgstr "iperf3 测速软件下载"
|
||||
|
||||
msgid "wanspeedtest"
|
||||
msgstr "宽带速率测试"
|
||||
@ -64,3 +54,8 @@ 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 服务端未运行"
|
||||
|
@ -5,4 +5,3 @@ config netspeedtest
|
||||
|
||||
config wanspeedtest
|
||||
option enabled '0'
|
||||
|
||||
|
0
package/lean/luci-app-netspeedtest/root/etc/init.d/netspeedtest
Normal file → Executable file
0
package/lean/luci-app-netspeedtest/root/etc/init.d/netspeedtest
Normal file → Executable file
0
package/lean/luci-app-netspeedtest/root/etc/init.d/speedtest
Normal file → Executable file
0
package/lean/luci-app-netspeedtest/root/etc/init.d/speedtest
Normal file → Executable file
@ -1,10 +1,11 @@
|
||||
#!/bin/sh
|
||||
chmod 755 /etc/init.d/netspeedtest /etc/init.d/speedtest >/dev/null 2>&1
|
||||
|
||||
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-modulecache /tmp/luci-indexcache*
|
||||
|
||||
rm -rf /tmp/luci-*
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user