mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-02-25 20:00:50 +03:00
chore: fix peers tab in vite
This commit is contained in:
parent
8a59d10483
commit
ab6ec174cb
12 changed files with 38 additions and 36 deletions
2
.github/workflows/nightly.yml
vendored
2
.github/workflows/nightly.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: Build nightly
|
name: Build nightly
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
||||||
<meta name="description" content="VueTorrent" />
|
<meta name="description" content="VueTorrent" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
|
|
|
@ -17,8 +17,8 @@ export class Torrents {
|
||||||
// update torrents
|
// update torrents
|
||||||
store.state.torrents = data.map(t => new Torrent(t))
|
store.state.torrents = data.map(t => new Torrent(t))
|
||||||
|
|
||||||
// load fake torrents if enabled
|
// load fake torrents if enabled
|
||||||
if(isProduction() && !import.meta.env.VITE_USE_FAKE_TORRENTS) return
|
if (isProduction() && !import.meta.env.VITE_USE_FAKE_TORRENTS) return
|
||||||
const count = import.meta.env.VITE_FAKE_TORRENT_COUNT
|
const count = import.meta.env.VITE_FAKE_TORRENT_COUNT
|
||||||
store.state.torrents.push(...generateMultiple(count))
|
store.state.torrents.push(...generateMultiple(count))
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,11 +46,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td :class="commonStyle">
|
<td :class="commonStyle">
|
||||||
{{ $t("torrent.timeActive") | titleCase }}
|
{{ $t('torrent.timeActive') | titleCase }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ torrent.time_active }}
|
{{ torrent.time_active }}
|
||||||
<span v-if="torrent.seeding_time">{{ `(${$t("torrent.seededFor")} ${torrent.seeding_time})` }}</span>
|
<span v-if="torrent.seeding_time">{{ `(${$t('torrent.seededFor')} ${torrent.seeding_time})` }}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Content from './Content.vue'
|
import Content from './Content.vue'
|
||||||
import Info from './Info.vue'
|
import Info from './Info.vue'
|
||||||
import Peers from './DetailPeers.vue'
|
import DetailPeers from './DetailPeers.vue'
|
||||||
import Trackers from './Trackers.vue'
|
import Trackers from './Trackers.vue'
|
||||||
import TagsAndCategories from './TorrentTagsAndCategories.vue'
|
import TagsAndCategories from './TorrentTagsAndCategories.vue'
|
||||||
|
|
||||||
export { Content, Info, Peers, Trackers, TagsAndCategories }
|
export { Content, Info, DetailPeers, Trackers, TagsAndCategories }
|
||||||
|
|
|
@ -7,6 +7,6 @@ Object.entries(components).forEach(([path, definition]) => {
|
||||||
?.split('/')
|
?.split('/')
|
||||||
?.pop()
|
?.pop()
|
||||||
?.replace(/\.\w+$/, '')
|
?.replace(/\.\w+$/, '')
|
||||||
|
|
||||||
if(componentName) Vue.component(componentName, definition)
|
if (componentName) Vue.component(componentName, definition)
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Vue from 'vue'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import VueI18n from 'vue-i18n'
|
import VueI18n from 'vue-i18n'
|
||||||
|
|
||||||
import { messages} from '../lang'
|
import { messages } from '../lang'
|
||||||
|
|
||||||
Vue.use(VueI18n)
|
Vue.use(VueI18n)
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,14 @@ import { describe, it, expect } from 'vitest'
|
||||||
import { generateMultiple, generateTorrent } from './faker'
|
import { generateMultiple, generateTorrent } from './faker'
|
||||||
|
|
||||||
describe('faker to generate fake torrents', () => {
|
describe('faker to generate fake torrents', () => {
|
||||||
it('can generate a fake torrent', () => {
|
it('can generate a fake torrent', () => {
|
||||||
const t = generateTorrent({ name: 'Test' })
|
const t = generateTorrent({ name: 'Test' })
|
||||||
expect(t.name).toBe('Test')
|
expect(t.name).toBe('Test')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can generate multile', () => {
|
it('can generate multile', () => {
|
||||||
const ts = generateMultiple(3)
|
const ts = generateMultiple(3)
|
||||||
expect(ts.length).toBe(3)
|
expect(ts.length).toBe(3)
|
||||||
expect(ts[0]?.name).toBe('Torrent - 0')
|
expect(ts[0]?.name).toBe('Torrent - 0')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -16,6 +16,7 @@ export function generateMultiple(count: number = 1): Torrent[] {
|
||||||
export function generateTorrent(data: any): Torrent {
|
export function generateTorrent(data: any): Torrent {
|
||||||
return new Torrent({
|
return new Torrent({
|
||||||
name: data.name,
|
name: data.name,
|
||||||
|
hash: faker.datatype.uuid(),
|
||||||
size: faker.datatype.number({ min: 1000000, max: 50000000000 }),
|
size: faker.datatype.number({ min: 1000000, max: 50000000000 }),
|
||||||
tags: [],
|
tags: [],
|
||||||
progress: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
progress: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
||||||
|
@ -24,9 +25,10 @@ export function generateTorrent(data: any): Torrent {
|
||||||
availability: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
availability: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
||||||
added_on: faker.date.recent(),
|
added_on: faker.date.recent(),
|
||||||
ratio: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
ratio: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
||||||
num_leechs: faker.datatype.number({ min: 0, max: 500 }),
|
num_leechs: faker.datatype.number({ min: 1, max: 20 }),
|
||||||
available_seeds: faker.datatype.number({ min: 0, max: 500 }),
|
num_complete: faker.datatype.number({ min: 1, max: 500 }),
|
||||||
num_seeds: faker.datatype.number({ min: 0, max: 500 }),
|
num_seeds: faker.datatype.number({ min: 1, max: 25 }),
|
||||||
available_peers: faker.datatype.number({ min: 0, max: 500 }),
|
num_incomplete: faker.datatype.number({ min: 1, max: 500 }),
|
||||||
|
save_path: faker.system.filePath()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export function isProduction(): boolean {
|
export function isProduction(): boolean {
|
||||||
return process.env.NODE_ENV === 'production'
|
return process.env.NODE_ENV === 'production'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDevelopment(): boolean {
|
export function isDevelopment(): boolean {
|
||||||
return process.env.NODE_ENV === 'development'
|
return process.env.NODE_ENV === 'development'
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="px-1 px-sm-5 pt-4 background noselect" @click.self="resetSelected">
|
<div class="px-1 px-sm-5 pt-4 background noselect" @click.self="resetSelected">
|
||||||
<v-row class="ma-0 pa-0" @click.self="resetSelected">
|
<v-row class="ma-0 pa-0" @click.self="resetSelected">
|
||||||
<v-col v-if="topPagination && isMobile" cols="12" class="align-center justify-center pa-0">
|
<v-col v-if="topPagination && isMobile" cols="12" class="align-center justify-center pa-0">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<v-pagination v-if="pageCount > 1 && !hasSearchFilter" v-model="pageNumber" :length="pageCount" :total-visible="7" @input="toTop" />
|
<v-pagination v-if="pageCount > 1 && !hasSearchFilter" v-model="pageNumber" :length="pageCount" :total-visible="7" @input="toTop" />
|
||||||
</div>
|
</div>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-expand-x-transition>
|
<v-expand-x-transition>
|
||||||
<v-card v-show="searchFilterEnabled" id="searchFilter" flat xs7 md3 class="ma-0 pa-0 mt-1 transparent">
|
<v-card v-show="searchFilterEnabled" id="searchFilter" flat xs7 md3 class="ma-0 pa-0 mt-1 transparent">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<Trackers :is-active="tab === 'trackers'" :hash="hash" />
|
<Trackers :is-active="tab === 'trackers'" :hash="hash" />
|
||||||
</v-tab-item>
|
</v-tab-item>
|
||||||
<v-tab-item eager value="peers">
|
<v-tab-item eager value="peers">
|
||||||
<Peers :is-active="tab === 'peers'" :hash="hash" />
|
<DetailPeers :is-active="tab === 'peers'" :hash="hash" />
|
||||||
</v-tab-item>
|
</v-tab-item>
|
||||||
<v-tab-item eager value="content">
|
<v-tab-item eager value="content">
|
||||||
<Content :is-active="tab === 'content'" :hash="hash" />
|
<Content :is-active="tab === 'content'" :hash="hash" />
|
||||||
|
@ -60,12 +60,12 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import { Content, Info, Peers, Trackers, TagsAndCategories } from '../components/TorrentDetail/Tabs'
|
import { Content, Info, DetailPeers, Trackers, TagsAndCategories } from '../components/TorrentDetail/Tabs'
|
||||||
import { mdiClose } from '@mdi/js'
|
import { mdiClose } from '@mdi/js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TorrentDetail',
|
name: 'TorrentDetail',
|
||||||
components: { Content, Info, Peers, Trackers, TagsAndCategories },
|
components: { Content, Info, DetailPeers, Trackers, TagsAndCategories },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tab: null,
|
tab: null,
|
||||||
|
|
Loading…
Add table
Reference in a new issue