Speedtest within Glinet UI

Just for expiramentarion.

If you want to add a speedtest under applications in glinet ui.

ssh in your terminal and run this:

mkdir -p /www/views &&
cat > /usr/share/oui/menu.d/zz-speedtest.json <<'EOF'
{
"index": 120,
"view": "speedtest",
"title": "Speed Test",
"level": 2,
"parent": "applications",
"parent_icon": "application",
"parent_index": 50,
"show_mode": \["router"\]
}
EOF

cat > /tmp/speedtest.js <<'EOF'
module.exports = {
name: "speedtest",
render(h) {
return h("div", {
style: {
width: "100%",
height: "100vh",
background: "#000"
}
}, \[
h("iframe", {
attrs: {
src: "https://fast.com",
style: "width:100%;height:100%;border:none;"
}
})
\])
}
}
EOF

gzip -c /tmp/speedtest.js > /www/views/gl-sdk4-ui-speedtest.common.js.gz &&
rm /tmp/speedtest.js &&
rm -rf /tmp/luci-\* /tmp/nginx\* &&
/etc/init.d/nginx restart &&
echo "SpeedTest installed safely."

If you want to remove it

rm -f /usr/share/oui/menu.d/zz-speedtest.json
/www/views/gl-sdk4-ui-speedtest.common.js.gz &&
rm -rf /tmp/luci-\* &&
/etc/init.d/nginx restart
2 Likes

This would be easier to read if you set the code blocks off beginning and ending with three back ticks

Code goes here
1 Like

Hi

Thanks for sharing your script!

P.S. For better readability and formatting, I’ve edited the original post to wrap the code in code blocks.

This breaks the login I can no longer login to the admin page after I’ve pasted these commands.. delete this or fix it please

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.