diff --git a/.env.development b/.env.development deleted file mode 100644 index 09c46958..00000000 --- a/.env.development +++ /dev/null @@ -1,2 +0,0 @@ -VITE_USE_FAKE_TORRENTS=false -VITE_FAKE_TORRENT_COUNT=30 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4eeea82c..253f3fd9 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,5 @@ yarn-error.log* vuetorrent/** config -Downloads \ No newline at end of file +Downloads +.env.development diff --git a/README.md b/README.md index 3f3855c6..34b60d87 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,37 @@ -# VueTorrent +
+ VueTorrent +

VueTorrent

+

The sleekest looking WebUI for qBittorrent made with Vue.js!

+
-

- +![Vue](https://img.shields.io/badge/Vue-%5E2.7.14-brightgreen) +![qBittorrent](https://img.shields.io/badge/qBittorrent-4.4%2B-brightgreen) +![Vuetify](https://img.shields.io/badge/Vuetify-%5E2.6.10-brightgreen) -

 

-The sleekest looking WebUI for qBittorrent made with Vue.js! -> Vue, qBittorrent, Vuetify +![stars](https://img.shields.io/github/stars/WDaan/VueTorrent) +![Forks](https://img.shields.io/github/forks/WDaan/VueTorrent) +![Issues](https://img.shields.io/github/issues/WDaan/VueTorrent) +![Closed](https://img.shields.io/github/issues-closed/WDaan/VueTorrent) +![Closed PR](https://img.shields.io/github/issues-pr-closed/WDaan/VueTorrent) +![Version](https://img.shields.io/github/v/release/wdaan/vuetorrent) +![Test Status](https://img.shields.io/github/workflow/status/wdaan/vuetorrent/Test%20Core%20Components) +![Downloads](https://img.shields.io/github/downloads/WDaan/VueTorrent/total) -

-

 

-

 

-

- - - - - - - - - - - - - - Test Status - - Downloads -

## Screenshots -![Desktop screenshot](https://imgur.com/IUkaDnI.png) ++ Destop +![](readme_assets/screenshot-desktop.png) -| | | | -| :--------------------------------: | :--------------------------------: | :--------------------------------: | -| ![](https://imgur.com/Zcm98H3.png) | ![](https://imgur.com/OujrH0f.png) | ![](https://imgur.com/3FZTXPL.png) | -| ![](https://imgur.com/QYpNCXs.png) | ![](https://imgur.com/6j5wxhl.png) | ![](https://imgur.com/jnzDKjW.png) | -

-Mobile screenshot -

++ Desktop Dark Mode +![](readme_assets/screenshot-desktop-dark-mode.png) + + ++ Mobile Dark Mode +![](readme_assets/screenshot-mobile-dark-mode.png) + ## Installation diff --git a/readme_assets/screenshot-desktop-dark-mode.png b/readme_assets/screenshot-desktop-dark-mode.png new file mode 100644 index 00000000..32feb72b Binary files /dev/null and b/readme_assets/screenshot-desktop-dark-mode.png differ diff --git a/readme_assets/screenshot-desktop.png b/readme_assets/screenshot-desktop.png new file mode 100644 index 00000000..5a0a7a37 Binary files /dev/null and b/readme_assets/screenshot-desktop.png differ diff --git a/readme_assets/screenshot-mobile-dark-mode.png b/readme_assets/screenshot-mobile-dark-mode.png new file mode 100644 index 00000000..5f66f72f Binary files /dev/null and b/readme_assets/screenshot-mobile-dark-mode.png differ diff --git a/src/components/TorrentDetail/Tabs/Content.vue b/src/components/TorrentDetail/Tabs/Content.vue index b4f53e4e..d41ddef4 100644 --- a/src/components/TorrentDetail/Tabs/Content.vue +++ b/src/components/TorrentDetail/Tabs/Content.vue @@ -90,6 +90,7 @@ export default { }, data() { return { + inited: false, opened: null, selected: [], treeData: null, @@ -115,7 +116,12 @@ export default { watch: { isActive(active) { if (active) { - this.getTorrentFiles() + if (this.inited) { + this.getTorrentFiles() + } else { + this.initFiles() + this.inited = true + } } }, selected(newValue, oldValue) { @@ -123,12 +129,11 @@ export default { } }, created() { - this.initFiles() }, methods: { initFiles() { this.getTorrentFiles().then(() => { - this.opened = [].concat(...this.treeData.map(file => file.name.split('/')).filter(f => f.splice(-1, 1))).filter((f, index, self) => index === self.indexOf(f)) + this.opened = [] this.selected = this.treeData.filter(file => file.priority !== 0).map(file => file.name) }) }, @@ -141,7 +146,7 @@ export default { this.treeData = data }, async changeFilePriorities(newValue, oldValue) { - if (newValue.length == oldValue.length) return + if (newValue.length === oldValue.length) return const filesToExclude = oldValue .filter(f => !newValue.includes(f)) diff --git a/src/components/TorrentDetail/Tabs/DetailPeers.vue b/src/components/TorrentDetail/Tabs/DetailPeers.vue index fe21562f..982cebd1 100644 --- a/src/components/TorrentDetail/Tabs/DetailPeers.vue +++ b/src/components/TorrentDetail/Tabs/DetailPeers.vue @@ -80,20 +80,20 @@ export default { isActive(active) { if (active) { this.getTorrentPeers() + this.refreshTimer = setInterval( + function () { + this.getTorrentPeers() + }.bind(this), + 2000 + ) + } else { + clearTimeout(this.refreshTimer) } } }, created() { - this.getTorrentPeers() - this.refreshTimer = setInterval( - function () { - this.getTorrentPeers() - }.bind(this), - 2000 - ) }, beforeDestroy() { - clearTimeout(this.refreshTimer) }, methods: { codeToFlag(val) { diff --git a/vite.config.js b/vite.config.js index 871b86b0..936a5fdb 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,5 +1,5 @@ import { resolve, dirname } from 'path' -import { defineConfig } from 'vite' +import { defineConfig, loadEnv } from 'vite' import vue from '@vitejs/plugin-vue2' import { VitePWA } from 'vite-plugin-pwa' import Components from 'unplugin-vue-components/vite' @@ -9,117 +9,122 @@ import { fileURLToPath, URL } from 'node:url' const version = process.env.NODE_ENV === 'production' ? process.env.npm_package_version : JSON.stringify(process.env.npm_package_version) -const qBittorrentPort = process.env['QBITTORRENT_PORT'] ?? 8080 -const proxyTarget = process.env['QBITTORRENT_TARGET'] ?? 'http://127.0.0.1' -export default defineConfig({ - resolve: { - alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), - '~': fileURLToPath(new URL('./node_modules', import.meta.url)) - } - }, - plugins: [ - vue(), - Components({ - dts: false, - directives: false, - resolvers: [VuetifyResolver()], - types: [ - { - from: 'vue-router', - names: ['RouterLink', 'RouterView'] - } - ] - }), - VitePWA({ - includeAssets: [ - 'favicon.ico', - 'robots.txt', - './icons/android-chrome-192x192.png', - './icons/android-chrome-512x512.png', - './icons/android-chrome-maskable-192x192.png', - './icons/android-chrome-maskable-512x512.png', - './icons/apple-touch-icon.png', - './icons/safari-pinned-tab.svg', - './icons/msapplication-icon-144x144.png' - ], - manifest: { - name: 'VueTorrent', - short_name: 'VueTorrent', - theme_color: '#597566', - start_url: '.', - background_color: '#000', - icons: [ - { - src: './icons/android-chrome-192x192.png', - sizes: '192x192', - type: 'image/png' - }, - { - src: './icons/android-chrome-512x512.png', - sizes: '512x512', - type: 'image/png' - }, - { - src: './icons/android-chrome-maskable-192x192.png', - sizes: '192x192', - type: 'image/png', - purpose: 'maskable' - }, - { - src: './icons/android-chrome-maskable-512x512.png', - sizes: '512x512', - type: 'image/png', - purpose: 'maskable' - }, - { - src: './icons/apple-touch-icon.png', - sizes: '180x180', - type: 'image/png' - }, - { - src: './icons/safari-pinned-tab.svg', - sizes: '683x683', - type: 'image/svg+xml' - }, - { - src: './icons/msapplication-icon-144x144.png', - sizes: '144x144', - type: 'image/png' - } - ] - }, - // Other options - registerType: 'autoUpdate', - base: './', - useCredentials: true, - workbox: { - skipWaiting: true, - globPatterns: ['**/*.{js,css,html,ico,png,svg}'] - } - }) - ], - build: { - target: 'esnext', - rollupOptions: { - output: { - manualChunks: { - vue: ['vue', 'vue-router', 'vue-router/composables', 'vuex', 'vuex-persist'] - } +export default defineConfig(({ command, mode }) => { + const theEnv = loadEnv(mode, process.cwd()) + const qBittorrentPort = theEnv.VITE_QBITTORRENT_PORT ?? 8080 + const proxyTarget = theEnv.VITE_QBITTORRENT_TARGET ?? 'http://127.0.0.1' + + return { + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)), + '~': fileURLToPath(new URL('./node_modules', import.meta.url)) } }, - outDir: './vuetorrent/public' - }, - define: { - 'import.meta.env.VITE_PACKAGE_VERSION': version - }, - base: './', - publicDir: './public', - server: { - proxy: { - '/api': `${proxyTarget}:${qBittorrentPort}` + plugins: [ + vue(), + Components({ + dts: false, + directives: false, + resolvers: [VuetifyResolver()], + types: [ + { + from: 'vue-router', + names: ['RouterLink', 'RouterView'] + } + ] + }), + VitePWA({ + includeAssets: [ + 'favicon.ico', + 'robots.txt', + './icons/android-chrome-192x192.png', + './icons/android-chrome-512x512.png', + './icons/android-chrome-maskable-192x192.png', + './icons/android-chrome-maskable-512x512.png', + './icons/apple-touch-icon.png', + './icons/safari-pinned-tab.svg', + './icons/msapplication-icon-144x144.png' + ], + manifest: { + name: 'VueTorrent', + short_name: 'VueTorrent', + theme_color: '#597566', + start_url: '.', + background_color: '#000', + icons: [ + { + src: './icons/android-chrome-192x192.png', + sizes: '192x192', + type: 'image/png' + }, + { + src: './icons/android-chrome-512x512.png', + sizes: '512x512', + type: 'image/png' + }, + { + src: './icons/android-chrome-maskable-192x192.png', + sizes: '192x192', + type: 'image/png', + purpose: 'maskable' + }, + { + src: './icons/android-chrome-maskable-512x512.png', + sizes: '512x512', + type: 'image/png', + purpose: 'maskable' + }, + + { + src: './icons/apple-touch-icon.png', + sizes: '180x180', + type: 'image/png' + }, + { + src: './icons/safari-pinned-tab.svg', + sizes: '683x683', + type: 'image/svg+xml' + }, + { + src: './icons/msapplication-icon-144x144.png', + sizes: '144x144', + type: 'image/png' + } + ] + }, + // Other options + registerType: 'autoUpdate', + base: './', + useCredentials: true, + workbox: { + skipWaiting: true, + globPatterns: ['**/*.{js,css,html,ico,png,svg}'] + } + }) + ], + build: { + target: 'esnext', + rollupOptions: { + output: { + manualChunks: { + vue: ['vue', 'vue-router', 'vue-router/composables', 'vuex', 'vuex-persist'] + } + } + }, + outDir: './vuetorrent/public' + }, + define: { + 'import.meta.env.VITE_PACKAGE_VERSION': version + }, + base: './', + publicDir: './public', + server: { + proxy: { + '/api': `${proxyTarget}:${qBittorrentPort}` + } } } })