Prettify peer metrics
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jack Hadrill 2021-01-04 06:27:55 +00:00
parent 3211828695
commit 0407b2acc6
3 changed files with 21 additions and 2 deletions

17
package-lock.json generated
View File

@ -10,6 +10,7 @@
"dependencies": { "dependencies": {
"core-js": "^3.6.5", "core-js": "^3.6.5",
"mitt": "^2.1.0", "mitt": "^2.1.0",
"pretty-bytes": "^5.5.0",
"primeflex": "^2.0.0", "primeflex": "^2.0.0",
"primeicons": "^4.1.0", "primeicons": "^4.1.0",
"primevue": "^3.1.1", "primevue": "^3.1.1",
@ -12943,6 +12944,17 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/pretty-bytes": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.5.0.tgz",
"integrity": "sha512-p+T744ZyjjiaFlMUZZv6YPC5JrkNj8maRmPaQCWFJFplUAzpIUTRaTcS+7wmZtUoFXHtESJb23ISliaWyz3SHA==",
"engines": {
"node": ">=6"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/pretty-error": { "node_modules/pretty-error": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.2.tgz", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.2.tgz",
@ -28611,6 +28623,11 @@
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"pretty-bytes": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.5.0.tgz",
"integrity": "sha512-p+T744ZyjjiaFlMUZZv6YPC5JrkNj8maRmPaQCWFJFplUAzpIUTRaTcS+7wmZtUoFXHtESJb23ISliaWyz3SHA=="
},
"pretty-error": { "pretty-error": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.2.tgz", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.2.tgz",

View File

@ -10,6 +10,7 @@
"dependencies": { "dependencies": {
"core-js": "^3.6.5", "core-js": "^3.6.5",
"mitt": "^2.1.0", "mitt": "^2.1.0",
"pretty-bytes": "^5.5.0",
"primeflex": "^2.0.0", "primeflex": "^2.0.0",
"primeicons": "^4.1.0", "primeicons": "^4.1.0",
"primevue": "^3.1.1", "primevue": "^3.1.1",

View File

@ -19,6 +19,7 @@
<script> <script>
import { inject, reactive } from 'vue' import { inject, reactive } from 'vue'
import { useToast } from 'primevue/usetoast' import { useToast } from 'primevue/usetoast'
import prettyBytes from 'pretty-bytes'
import WebTorrent from 'webtorrent/webtorrent.min.js' import WebTorrent from 'webtorrent/webtorrent.min.js'
export default { export default {
@ -38,8 +39,8 @@ export default {
setInterval(() => { setInterval(() => {
const newWires = state.wires.map((wire) => ({ const newWires = state.wires.map((wire) => ({
ip: wire.remoteAddress, ip: wire.remoteAddress,
downloadSpeed: wire.uploadSpeed(), downloadSpeed: prettyBytes(wire.uploadSpeed()) + 'ps',
downloaded: wire.uploaded downloaded: prettyBytes(wire.uploaded)
})) }))
wires.splice.apply(wires, [0, newWires.length].concat(newWires)) wires.splice.apply(wires, [0, newWires.length].concat(newWires))
}, 500) }, 500)