-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
luci-app-speedtest: Add packages #6951
Closed
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
01d3791
luci-app-speedtest: Add packages
animegasan 5ca3312
luci-mod-network: Add clarifying note to wireless join dialog
hnyman 33c6c9e
luci-mod-status: fix sporadic logical interfaces resolve failures
jow- 905a030
luci-app-ntpc: remove app
dannil 258b0cf
luci-base: docs house-keeping
systemcrash 7fd26e4
rpcd-mod-luci: use standard POSIX header for basename()
guidosarducci c4fae8b
Translated using Weblate (Lithuanian)
weblate ac648d8
irqbalance: Add option for new 'debug' setting
schuettecarsten e8f5ede
luci-base: use correct regex for time validation
dannil 1838356
luci-app-statistics: Add UI to configure Mqtt
McGiverGim cef7d35
Translated using Weblate (Polish)
weblate 00df19e
luci-app-upnp: remove obsolete translation
stokito 0827230
luci-app-upnp: revise wording to include PCP
stokito a26f5b2
luci-app-p910nd: convert to JS
systemcrash f1c13b3
luci-theme-bootstrap: Realtime Graphs dark mode
JimMatthew 4355c4a
Translated using Weblate (Italian)
weblate adf9b3a
luci-mod-network: drop trailing whitespace
dannil 2a5c802
luci-app-statistics: add users plugin support
mrjoel 0c9bf5f
luci-theme-bootstrap: Allways show scrollbar
thomasschroeder cf300d1
Merge branch 'openwrt:master' into luci-app-speedtest
animegasan afa63bd
Merge remote-tracking branch 'upstream/master' into luci-app-speedtest
animegasan 6aac964
Merge branch 'luci-app-speedtest' of https://github.com/animegasan/lu…
animegasan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This is free software, licensed under the Apache License, Version 2.0 | ||
# | ||
# Copyright (C) 2024 Hilman Maulana <[email protected]> | ||
|
||
include $(TOPDIR)/rules.mk | ||
|
||
LUCI_TITLE:=LuCI for speedtestcpp | ||
LUCI_DEPENDS:=+speedtestcpp | ||
|
||
PKG_MAINTAINER:=Hilman Maulana <[email protected]> | ||
PKG_VERSION:=1.0 | ||
PKG_LICENSE:=Apache-2.0 | ||
|
||
include ../../luci.mk | ||
|
||
# call BuildPackage - OpenWrt buildroot signature |
141 changes: 141 additions & 0 deletions
141
applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
/* This is free software, licensed under the Apache License, Version 2.0 | ||
* | ||
* Copyright (C) 2024 Hilman Maulana <[email protected]> | ||
*/ | ||
|
||
'use strict'; | ||
'require view'; | ||
'require fs'; | ||
|
||
return view.extend({ | ||
handleSaveApply: null, | ||
handleSave: null, | ||
handleReset: null, | ||
render: function() { | ||
var header = [ | ||
E('h2', {'class': 'section-title'}, _('Speedtest')), | ||
E('div', {'class': 'cbi-map-descr'}, _('Here you can perform a speed test to measure the basic aspects of your network connection.')) | ||
]; | ||
var select = [ | ||
E('label', { 'class': 'cbi-input-label', 'for': 'speedtest-type', 'style': 'margin-right: 8px;'}, _('Test')), | ||
E('select', { 'id': 'speedtest-type', 'style': 'width:80%;'}, [ | ||
E('option', { 'value': 'all', 'selected': 'selected'}, _('All')), | ||
E('option', { 'value': 'latency' }, _('Latency')), | ||
E('option', { 'value': 'download' }, _('Download')), | ||
E('option', { 'value': 'upload' }, _('Upload')) | ||
]) | ||
]; | ||
var status = [ | ||
E('label', { 'class': 'cbi-input-label', 'style': 'margin-right: 8px;'}, _('Status')), | ||
E('em', { 'id': 'speedtest-status'}, _('Available')) | ||
]; | ||
var table = [ | ||
E('h3', {'class': 'section-title'}, _('Results')), | ||
E('table', {'class': 'table cbi-section-table'}, [ | ||
E('tr', {'class': 'tr table-title'}, [ | ||
E('th', {'class': 'th ', 'style': 'display: none;'}) | ||
]), | ||
E('tr', {'class': 'tr cbi-rowstyle-1'},[ | ||
E('td', {'class': 'td left', 'width': '50%'}, _('IP Address')), | ||
E('td', {'class': 'td', 'id': 'client-ip'}, '-') | ||
]), | ||
E('tr', {'class': 'tr cbi-rowstyle-2'},[ | ||
E('td', {'class': 'td left', 'width': '50%'}, _('Provider')), | ||
E('td', {'class': 'td', 'id': 'client-isp'}, '-') | ||
]), | ||
E('tr', {'class': 'tr cbi-rowstyle-1'},[ | ||
E('td', {'class': 'td left', 'width': '50%'}, _('Server')), | ||
E('td', {'class': 'td', 'id': 'server-name'}, '-') | ||
]), | ||
E('tr', {'class': 'tr cbi-rowstyle-2'},[ | ||
E('td', {'class': 'td left', 'width': '50%'}, _('ID')), | ||
E('td', {'class': 'td', 'id': 'server-id'}, '-') | ||
]), | ||
E('tr', {'class': 'tr cbi-rowstyle-1'},[ | ||
E('td', {'class': 'td left', 'width': '50%'}, _('Location')), | ||
E('td', {'class': 'td', 'id': 'server-location'}, '-') | ||
]), | ||
E('tr', {'class': 'tr cbi-rowstyle-2'},[ | ||
E('td', {'class': 'td left', 'width': '50%'}, _('Server Host')), | ||
E('td', {'class': 'td', 'id': 'server-host'}, '-') | ||
]), | ||
E('tr', {'class': 'tr cbi-rowstyle-1'},[ | ||
E('td', {'class': 'td left', 'width': '50%'}, _('Ping')), | ||
E('td', {'class': 'td', 'id': 'ping'}, '-') | ||
]), | ||
E('tr', {'class': 'tr cbi-rowstyle-2'},[ | ||
E('td', {'class': 'td left', 'width': '50%'}, _('Jitter')), | ||
E('td', {'class': 'td', 'id': 'jitter'}, '-') | ||
]), | ||
E('tr', {'class': 'tr cbi-rowstyle-1'},[ | ||
E('td', {'class': 'td left', 'width': '50%'}, _('Download Speed')), | ||
E('td', {'class': 'td', 'id': 'download'}, '-') | ||
]), | ||
E('tr', {'class': 'tr cbi-rowstyle-2'},[ | ||
E('td', {'class': 'td left', 'width': '50%'}, _('Upload Speed')), | ||
E('td', {'class': 'td', 'id': 'upload'}, '-') | ||
]) | ||
]) | ||
]; | ||
var running = false; | ||
var button = [ | ||
E('button', { | ||
'class': 'btn cbi-button cbi-button-action', | ||
'click': function() { | ||
if (!running) { | ||
running = true; | ||
var dropdown = document.getElementById('speedtest-type'); | ||
var value = dropdown.options[dropdown.selectedIndex].value; | ||
var command = ['--output', 'json']; | ||
if (value !== 'all') { | ||
command.push('--' + value); | ||
} | ||
|
||
var status = document.getElementById('speedtest-status'); | ||
status.textContent = _('Running'); | ||
|
||
fs.exec_direct('speedtest', command) | ||
.then(function(response) { | ||
var result = JSON.parse(response); | ||
document.getElementById('client-ip').textContent = result.client.ip; | ||
document.getElementById('client-isp').textContent = result.client.isp + ' [' + result.client.lat + ', ' + result.client.lon + ']'; | ||
document.getElementById('server-name').textContent = result.server.sponsor; | ||
document.getElementById('server-id').textContent = result.server.id; | ||
document.getElementById('server-location').textContent = result.server.name + ' (' + result.server.distance + ' km)'; | ||
document.getElementById('server-host').textContent = result.server.host; | ||
document.getElementById('ping').textContent = result.ping + ' ms'; | ||
document.getElementById('jitter').textContent = result.jitter + ' ms'; | ||
document.getElementById('download').textContent = result.download_mbit ? result.download_mbit + ' Mbit/s' : '-'; | ||
document.getElementById('upload').textContent = result.upload_mbit ? result.upload_mbit + ' Mbit/s' : '-'; | ||
status.textContent = _('Finished'); | ||
running = false; | ||
}) | ||
.catch(function(err) { | ||
if (!err.response) { | ||
status.textContent = _('No response received, please check your internet connection or try again later.'); | ||
} else if (err.response.data && err.response.data.error === 'unable to retrieve your ip info') { | ||
status.textContent = _('Unable to retrieve IP information, please check your internet connection.'); | ||
} else { | ||
status.textContent = err; | ||
} | ||
running = false; | ||
}); | ||
} | ||
} | ||
}, _('Start')) | ||
]; | ||
return E('div', {'class': 'cbi-map'}, [ | ||
E(header), | ||
E('table', {'class': 'table'}, [ | ||
E('tr', {'class': 'tr'}, [ | ||
E('td', {'class': 'td', 'style': 'overflow:initial;'}, select), | ||
E('td', {'class': 'td', 'style': 'overflow:initial;'}, button), | ||
E('td', {'class': 'td'}, status) | ||
]) | ||
]), | ||
E('div', {'class': 'cbi-section'}, [ | ||
E('div', {'class': 'speedtest-info'}, table) | ||
]) | ||
]) | ||
} | ||
}) |
107 changes: 107 additions & 0 deletions
107
applications/luci-app-speedtest/po/templates/speedtest.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
msgid "" | ||
msgstr "Content-Type: text/plain; charset=UTF-8" | ||
|
||
#: applications/luci-app-speedtest/root/usr/share/rpcd/acl.d/luci-app-speedtest.json:3 | ||
msgid "Grant access to speedtest" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/root/usr/share/luci/menu.d/luci-app-speedtest.json:3 | ||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:16 | ||
msgid "Speedtest" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:17 | ||
msgid "Here you can perform a speed test to measure the basic aspects of your network connection." | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:20 | ||
msgid "Test" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:22 | ||
msgid "All" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:23 | ||
msgid "Latency" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:24 | ||
msgid "Download" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:25 | ||
msgid "Upload" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:29 | ||
msgid "Status" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:30 | ||
msgid "Available" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:33 | ||
msgid "Results" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:39 | ||
msgid "IP Address" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:43 | ||
msgid "Provider" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:47 | ||
msgid "Server" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:51 | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:55 | ||
msgid "Location" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:59 | ||
msgid "Server Host" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:63 | ||
msgid "Ping" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:67 | ||
msgid "Jitter" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:71 | ||
msgid "Download Speed" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:75 | ||
msgid "Upload Speed" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:95 | ||
msgid "Running" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:110 | ||
msgid "Finished" | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:115 | ||
msgid "No response received, please check your internet connection or try again later." | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:117 | ||
msgid "Unable to retrieve IP information, please check your internet connection." | ||
msgstr "" | ||
|
||
#: applications/luci-app-speedtest/htdocs/luci-static/resources/view/speedtest.js:125 | ||
msgid "Start" | ||
msgstr "" |
13 changes: 13 additions & 0 deletions
13
applications/luci-app-speedtest/root/usr/share/luci/menu.d/luci-app-speedtest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"admin/network/speedtest": { | ||
"title": "Speedtest", | ||
"order": 50, | ||
"action": { | ||
"type": "view", | ||
"path": "speedtest" | ||
}, | ||
"depends": { | ||
"acl": [ "luci-app-speedtest" ] | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
applications/luci-app-speedtest/root/usr/share/rpcd/acl.d/luci-app-speedtest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"luci-app-speedtest": { | ||
"description": "Grant access to speedtest", | ||
"write": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it a problem to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't tried it yet, but I'll give it a shot. Perhaps it'll work out. |
||
"file": { | ||
"/usr/bin/speedtest": [ "exec" ] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the app assumes that the speedtest binary is available. Let's say that the binary was deleted, or some sysupgrade went bad (even tho this app depends on it), what happens when the binary is absent? Is the error message misleading or must we perform a separate check at init?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The action has been handled here.