diff --git a/package-lock.json b/package-lock.json index 5e98bcbd..f26a7444 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2876,23 +2876,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.0.0.tgz", - "integrity": "sha512-o4q0KHlgCZTqjuaZ25nw5W57NeykZT9LiMEG4do/ovwvOcPnDO1BI5BQdCsUkjxFyrCL0cSzLjvIMfR9uo7cWg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.0.0", - "@typescript-eslint/visitor-keys": "6.0.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/type-utils": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.1.0.tgz", @@ -2977,46 +2960,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/types": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.0.0.tgz", - "integrity": "sha512-Zk9KDggyZM6tj0AJWYYKgF0yQyrcnievdhG0g5FqyU3Y2DRxJn4yWY21sJC0QKBckbsdKKjYDV2yVrrEvuTgxg==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.0.0.tgz", - "integrity": "sha512-2zq4O7P6YCQADfmJ5OTDQTP3ktajnXIRrYAtHM9ofto/CJZV3QfJ89GEaM2BNGeSr1KgmBuLhEkz5FBkS2RQhQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.0.0", - "@typescript-eslint/visitor-keys": "6.0.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.5.0", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/@typescript-eslint/utils": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.1.0.tgz", @@ -3116,23 +3059,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.0.0.tgz", - "integrity": "sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.0.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@vitejs/plugin-vue2": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue2/-/plugin-vue2-2.2.0.tgz", diff --git a/src/actions/DocumentTitle.ts b/src/actions/DocumentTitle.ts index 11ac4ff2..7e259474 100644 --- a/src/actions/DocumentTitle.ts +++ b/src/actions/DocumentTitle.ts @@ -1,5 +1,7 @@ -import { formatBytes } from '@/helpers' import store from '@/store' +import {formatSpeed} from '@/filters' +import {formatProgress} from '@/filters' +import {Torrent} from '@/models' export class DocumentTitle { private static setDefault() { @@ -8,25 +10,26 @@ export class DocumentTitle { private static setGlobalSpeed() { const status = store.getters.getStatus() - this.set(`[D: ${formatBytes(status.dlspeed)}/s, U: ${formatBytes(status.upspeed)}/s] VueTorrent`) + const useBitSpeed = store.state.webuiSettings.useBitSpeed + this.set(`[D: ${formatSpeed(status.dlspeed, useBitSpeed)}, U: ${formatSpeed(status.upspeed, useBitSpeed)}] VueTorrent`) } private static setFirstTorrentStatus() { - const torrents = store.getters.getTorrents() - if (!torrents && !torrents.length) return + const useBitSpeed = store.state.webuiSettings.useBitSpeed + const torrents: Torrent[] = store.getters.getTorrents() + if (!torrents || !torrents.length) return const torrent = torrents[0] - this.set(`[D: ${formatBytes(torrent.dlspeed)}/s, U: ${formatBytes(torrent.upspeed)}/s] ${torrent.progress}%`) + this.set(`[D: ${formatSpeed(torrent.dlspeed, useBitSpeed)}, U: ${formatSpeed(torrent.upspeed, useBitSpeed)}] ${formatProgress(torrent.progress)}`) } public static update() { const mode = store.getters.getWebuiSettings().title switch (mode) { - case 'Default': - return this.setDefault() case 'Global Speed': return this.setGlobalSpeed() case 'First Torrent Status': return this.setFirstTorrentStatus() + case 'Default': default: return this.setDefault() } diff --git a/src/components/Core/SpeedCard.vue b/src/components/Core/SpeedCard.vue index a066fb0d..74dba3fb 100644 --- a/src/components/Core/SpeedCard.vue +++ b/src/components/Core/SpeedCard.vue @@ -8,41 +8,34 @@ - - {{ value | getSpeedValue }} - + {{ value | formatSpeedValue(shouldUseBitSpeed()) }} - {{ value | getDataUnit(1) }}/s + {{ value | formatSpeedUnit(shouldUseBitSpeed()) }} -