mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-02-18 00:02:02 +03:00
0.5.6 (#134)
This commit is contained in:
parent
5b9aa79d74
commit
34ef51c69b
14 changed files with 93 additions and 42 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "vuetorrent",
|
||||
"version": "0.5.5",
|
||||
"version": "0.5.6",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
|
|
@ -183,7 +183,7 @@
|
|||
Download Limit
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.dl_limit | getDataValue }} {{ torrent.dl_limit | getDataUnit }}/s
|
||||
{{ torrent.dl_limit | getDataValue }} {{ torrent.dl_limit | getDataUnit }}<span v-if="torrent.dl_limit !== -1"> /s </span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -191,7 +191,15 @@
|
|||
Upload Limit
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.up_limit | getDataValue }} {{ torrent.up_limit | getDataUnit }}/s
|
||||
{{ torrent.up_limit | getDataValue }} {{ torrent.up_limit | getDataUnit }}<span v-if="torrent.up_limit !== -1"> /s </span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="grey--text">
|
||||
Availability
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.availability }}%
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
25
src/components/Torrent/DashboardItems/Availability.vue
Normal file
25
src/components/Torrent/DashboardItems/Availability.vue
Normal file
|
@ -0,0 +1,25 @@
|
|||
<template>
|
||||
<v-flex xs6 sm1 md1>
|
||||
<div class="caption grey--text">
|
||||
Availability
|
||||
</div>
|
||||
<div>
|
||||
{{ availability }}
|
||||
</div>
|
||||
</v-flex>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'Availability',
|
||||
props: ['torrent'],
|
||||
computed: {
|
||||
availability() {
|
||||
if (this.torrent.availability !== -1) {
|
||||
return `${this.torrent.availability}%`
|
||||
}
|
||||
|
||||
return 'N/A'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -13,7 +13,7 @@
|
|||
class="caption white--text px-2"
|
||||
:class="state"
|
||||
>
|
||||
{{ torrent.state }}
|
||||
{{ stateString }}
|
||||
</v-chip>
|
||||
</v-flex>
|
||||
</template>
|
||||
|
@ -22,6 +22,15 @@ import { TorrentDashboardItem } from '@/mixins'
|
|||
export default {
|
||||
name: 'Status',
|
||||
mixins: [TorrentDashboardItem],
|
||||
props: ['torrent']
|
||||
props: ['torrent'],
|
||||
computed: {
|
||||
stateString() {
|
||||
if (this.torrent.forced) {
|
||||
return `[F] ${this.torrent.state}`
|
||||
}
|
||||
|
||||
return this.torrent.state
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -13,6 +13,7 @@ import Tags from './Tags'
|
|||
import AddedOn from './AddedOn'
|
||||
import Uploaded from './Uploaded'
|
||||
import UploadedSession from './UploadedSession'
|
||||
import Availability from './Availability'
|
||||
|
||||
export {
|
||||
Size,
|
||||
|
@ -29,5 +30,6 @@ export {
|
|||
AddedOn,
|
||||
Uploaded,
|
||||
UploadedSession,
|
||||
Downloaded
|
||||
Downloaded,
|
||||
Availability
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
flat
|
||||
class="pointer noselect"
|
||||
:class="{ selected: isSelected}"
|
||||
@click.native.exact.prevent="showInfo(torrent.hash)"
|
||||
@dblclick.prevent="showInfo(torrent.hash)"
|
||||
@click.ctrl.exact.prevent="selectTorrent(torrent.hash)"
|
||||
@click.shift.exact.prevent="selectUntil(torrent.hash, index)"
|
||||
>
|
||||
|
|
|
@ -85,6 +85,7 @@ export function networkSize(size) {
|
|||
Vue.filter('networkSize', networkSize)
|
||||
|
||||
function getDataUnit(a, b) {
|
||||
if (a === -1) return null
|
||||
if (!a) return 'B'
|
||||
const c = 1024
|
||||
const e = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
|
@ -96,7 +97,8 @@ function getDataUnit(a, b) {
|
|||
Vue.filter('getDataUnit', getDataUnit)
|
||||
|
||||
function getDataValue(a, b) {
|
||||
if (a == 0) return '0'
|
||||
if (a === -1) return 'None'
|
||||
if (!a) return '0'
|
||||
const c = 1024
|
||||
const d = b || 2
|
||||
const f = Math.floor(Math.log(a) / Math.log(c))
|
||||
|
|
|
@ -29,13 +29,15 @@ export default class Torrent {
|
|||
this.dl_limit = data.dl_limit
|
||||
this.up_limit = data.up_limit
|
||||
this.ratio_limit = data.ratio_limit
|
||||
this.availability = Math.round(data.availability * 100) / 100
|
||||
this.forced = data.state.includes('forced')
|
||||
|
||||
Object.freeze(this)
|
||||
}
|
||||
|
||||
formatState(state) {
|
||||
switch (state) {
|
||||
case 'forceDL':
|
||||
case 'forcedDL':
|
||||
case 'downloading':
|
||||
return 'Downloading'
|
||||
case 'metaDL':
|
||||
|
|
|
@ -2,6 +2,7 @@ import Vue from 'vue'
|
|||
import Router from 'vue-router'
|
||||
import Dashboard from '@/views/Dashboard.vue'
|
||||
import Login from '@/views/Login.vue'
|
||||
import MagnetHandler from '@/views/MagnetHandler'
|
||||
import { isAuthenticated } from '@/services/auth.js'
|
||||
|
||||
Vue.use(Router)
|
||||
|
@ -14,6 +15,11 @@ const router = new Router({
|
|||
name: 'dashboard',
|
||||
component: Dashboard
|
||||
},
|
||||
{ path: '/download=:magnet',
|
||||
name: 'MagnetHandler',
|
||||
component: MagnetHandler,
|
||||
props: true
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
|
@ -23,6 +29,7 @@ const router = new Router({
|
|||
onlyWhenLoggedOut: true
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
})
|
||||
|
||||
|
|
|
@ -73,7 +73,8 @@ export default new Vuex.Store({
|
|||
{ name: 'Ratio', active: true },
|
||||
{ name: 'Category', active: true },
|
||||
{ name: 'Tags', active: true },
|
||||
{ name: 'AddedOn', active: true }
|
||||
{ name: 'AddedOn', active: true },
|
||||
{ name: 'Availability', active: true }
|
||||
],
|
||||
doneTorrentProperties: [
|
||||
{ name: 'Size', active: true },
|
||||
|
@ -88,7 +89,8 @@ export default new Vuex.Store({
|
|||
{ name: 'Ratio', active: true },
|
||||
{ name: 'Category', active: true },
|
||||
{ name: 'Tags', active: true },
|
||||
{ name: 'AddedOn', active: true }
|
||||
{ name: 'AddedOn', active: true },
|
||||
{ name: 'Availability', active: true }
|
||||
]
|
||||
},
|
||||
categories: [],
|
||||
|
|
|
@ -92,20 +92,16 @@ export default {
|
|||
const { data } = await qbit.getAppPreferences()
|
||||
state.settings = data
|
||||
},
|
||||
UPDATE_SORT_OPTIONS: (state, {
|
||||
reverse = false,
|
||||
UPDATE_SORT_OPTIONS: (state, {
|
||||
hashes = [],
|
||||
filter = null,
|
||||
category = null,
|
||||
tracker = null,
|
||||
sort = null
|
||||
tracker = null
|
||||
}) => {
|
||||
state.sort_options.reverse = reverse
|
||||
state.sort_options.hashes = hashes
|
||||
state.sort_options.filter = filter
|
||||
state.sort_options.category = category
|
||||
state.sort_options.tracker = tracker
|
||||
state.sort_options.sort = sort
|
||||
},
|
||||
FETCH_CATEGORIES: async state => state.categories = Object.values(await (qbit.getCategories())),
|
||||
FETCH_SEARCH_PLUGINS: async state => state.searchPlugins = await qbit.getSearchPlugins(),
|
||||
|
|
|
@ -84,14 +84,7 @@ $sideborder-margin: 5px;
|
|||
user-select: none; /* Non-prefixed version, currently
|
||||
supported by Chrome and Opera */
|
||||
}
|
||||
.noselect {
|
||||
-webkit-touch-callout: none; /* iOS Safari */
|
||||
-webkit-user-select: none; /* Safari */
|
||||
-moz-user-select: none; /* Firefox */
|
||||
-ms-user-select: none; /* Internet Explorer/Edge */
|
||||
user-select: none; /* Non-prefixed version, currently
|
||||
supported by Chrome and Opera */
|
||||
}
|
||||
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -106,6 +99,11 @@ $sideborder-margin: 5px;
|
|||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.transparent {
|
||||
background-color: transparent!important;
|
||||
border-color: transparent!important;
|
||||
}
|
||||
|
||||
body {
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
|
|
|
@ -309,21 +309,4 @@ export default {
|
|||
padding: 0;
|
||||
}
|
||||
}
|
||||
.topBorderRadius {
|
||||
border-top-left-radius: 3px !important;
|
||||
border-top-right-radius: 3px !important;
|
||||
border-bottom-right-radius: 0px !important;
|
||||
}
|
||||
.noBorderRadius {
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
.bottomBorderRadius {
|
||||
border-bottom-left-radius: 3px !important;
|
||||
border-bottom-right-radius: 3px !important;
|
||||
}
|
||||
|
||||
.transparent {
|
||||
background-color: transparent!important;
|
||||
border-color: transparent!important;
|
||||
}
|
||||
</style>
|
17
src/views/MagnetHandler.vue
Normal file
17
src/views/MagnetHandler.vue
Normal file
|
@ -0,0 +1,17 @@
|
|||
<template>
|
||||
<h1 class="text-center mt-5">
|
||||
MagnetHandler
|
||||
</h1>
|
||||
</template>
|
||||
<script>
|
||||
import { General } from '@/mixins'
|
||||
export default {
|
||||
name: 'MagnetHandler',
|
||||
mixins: [General],
|
||||
props: ['magnet'],
|
||||
created() {
|
||||
this.createModal('AddModal', { initialMagnet: this.magnet })
|
||||
this.$router.push('/')
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Add table
Reference in a new issue