diff --git a/package-lock.json b/package-lock.json index 5b4a70f..f8b62b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,12 +9,13 @@ "version": "0.1.0", "dependencies": { "core-js": "^3.6.5", - "crypto-js": "^4.0.0", "mitt": "^2.1.0", "pretty-bytes": "^5.5.0", + "pretty-ms": "^7.0.1", "primeflex": "^2.0.0", "primeicons": "^4.1.0", "primevue": "^3.1.1", + "sha-1": "^1.0.0", "vue": "^3.0.0", "vue-router": "^4.0.2", "webtorrent": "^0.112.0" @@ -5192,11 +5193,6 @@ "node": "*" } }, - "node_modules/crypto-js": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.0.0.tgz", - "integrity": "sha512-bzHZN8Pn+gS7DQA6n+iUmBfl0hO5DJq++QP3U6uTucDtk/0iGpXd/Gg7CGR0p8tJhofJyaKoWBuJI4eAO00BBg==" - }, "node_modules/css-color-names": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", @@ -11956,6 +11952,14 @@ "node": ">=4" } }, + "node_modules/parse-ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz", + "integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==", + "engines": { + "node": ">=6" + } + }, "node_modules/parse-torrent": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/parse-torrent/-/parse-torrent-9.1.0.tgz", @@ -12971,6 +12975,20 @@ "renderkid": "^2.0.4" } }, + "node_modules/pretty-ms": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz", + "integrity": "sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==", + "dependencies": { + "parse-ms": "^2.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/primeflex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/primeflex/-/primeflex-2.0.0.tgz", @@ -14530,6 +14548,11 @@ "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", "dev": true }, + "node_modules/sha-1": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/sha-1/-/sha-1-1.0.0.tgz", + "integrity": "sha512-qjFA/+LdT0Gvu/JcmYTGZMvVy6WXJOWv1KQuY7HvSr2oBrMxA8PnZu2mc1/ZS2EvLMokj7lIeQsNPjkRzXrImw==" + }, "node_modules/sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -22489,11 +22512,6 @@ "randomfill": "^1.0.3" } }, - "crypto-js": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.0.0.tgz", - "integrity": "sha512-bzHZN8Pn+gS7DQA6n+iUmBfl0hO5DJq++QP3U6uTucDtk/0iGpXd/Gg7CGR0p8tJhofJyaKoWBuJI4eAO00BBg==" - }, "css-color-names": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", @@ -27797,6 +27815,11 @@ "json-parse-better-errors": "^1.0.1" } }, + "parse-ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz", + "integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==" + }, "parse-torrent": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/parse-torrent/-/parse-torrent-9.1.0.tgz", @@ -28649,6 +28672,14 @@ "renderkid": "^2.0.4" } }, + "pretty-ms": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz", + "integrity": "sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==", + "requires": { + "parse-ms": "^2.1.0" + } + }, "primeflex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/primeflex/-/primeflex-2.0.0.tgz", @@ -29883,6 +29914,11 @@ "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", "dev": true }, + "sha-1": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/sha-1/-/sha-1-1.0.0.tgz", + "integrity": "sha512-qjFA/+LdT0Gvu/JcmYTGZMvVy6WXJOWv1KQuY7HvSr2oBrMxA8PnZu2mc1/ZS2EvLMokj7lIeQsNPjkRzXrImw==" + }, "sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", diff --git a/package.json b/package.json index edb4bbe..6b4be81 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,13 @@ }, "dependencies": { "core-js": "^3.6.5", - "crypto-js": "^4.0.0", "mitt": "^2.1.0", "pretty-bytes": "^5.5.0", + "pretty-ms": "^7.0.1", "primeflex": "^2.0.0", "primeicons": "^4.1.0", "primevue": "^3.1.1", + "sha-1": "^1.0.0", "vue": "^3.0.0", "vue-router": "^4.0.2", "webtorrent": "^0.112.0" diff --git a/src/App.vue b/src/App.vue index 50da4ab..5175723 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,8 +1,9 @@ - - diff --git a/src/helpers/wire-statistics.js b/src/helpers/wire-statistics.js new file mode 100644 index 0000000..ee246fe --- /dev/null +++ b/src/helpers/wire-statistics.js @@ -0,0 +1,15 @@ +import sha1 from 'sha-1' +import prettyBytes from 'pretty-bytes' + +const generateWireStatistics = (wires) => { + return wires.map(wire => ({ + peerId: sha1(wire.peerId).toString().substring(0, 100), + remoteAddress: wire.remoteAddress, + uploadSpeed: prettyBytes(wire.uploadSpeed()) + 'ps', + uploaded: prettyBytes(wire.uploaded), + downloadSpeed: prettyBytes(wire.downloadSpeed()) + 'ps', + downloaded: prettyBytes(wire.downloaded) + })) +} + +export default generateWireStatistics diff --git a/src/main.js b/src/main.js index 42c1e9f..98f16a6 100644 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,7 @@ import Router from './router' // Import global components. import FileSelect from '@/components/FileSelect.vue' -import HostWires from '@/components/HostWires.vue' +import WireStatistics from '@/components/WireStatistics.vue' // Import PrimeVue dependencies. import PrimeVue from 'primevue/config' @@ -42,9 +42,12 @@ app.component('Toast', Toast) // Register VCinemaApp components. app.component('FileSelect', FileSelect) -app.component('HostWires', HostWires) +app.component('WireStatistics', WireStatistics) app.provide('trackers', [ + 'wss://tracker.btorrent.xyz', + 'wss://tracker.openwebtorrent.com', + 'wss://tracker.fastcast.nz', 'wss://tracker.sloppyta.co:443/announce', 'wss://tracker.files.fm:7073/announce', 'wss://open.tube:443/tracker/socket', diff --git a/src/views/Home.vue b/src/views/Home.vue index b2fed93..bc6c7ce 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,12 +1,12 @@ - - diff --git a/src/views/Join.vue b/src/views/Join.vue index 93ab210..01dc771 100644 --- a/src/views/Join.vue +++ b/src/views/Join.vue @@ -1,19 +1,17 @@