fix: Replace root_folder param with contentLayout & stopCondition (#665) @Larsluph

This commit is contained in:
Rémi Marseault 2023-02-19 12:17:20 +01:00 committed by GitHub
parent a56aa63ab9
commit f0ddc603bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 240 additions and 153 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "vuetorrent",
"version": "2.0.0",
"version": "1.3.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "vuetorrent",
"version": "1.2.0",
"version": "1.3.1",
"dependencies": {
"apexcharts": "^3.35.0",
"axios": "^0.26.1",

View file

@ -1,6 +1,6 @@
{
"name": "vuetorrent",
"version": "2.0.0",
"version": "1.3.1",
"private": true,
"scripts": {
"dev": "vite --host",

View file

@ -1,20 +1,20 @@
<template>
<v-dialog
v-model="dialog"
:transition="dTransition"
:content-class="phoneLayout ? 'rounded-0' : 'rounded-form'"
max-width="500px"
:fullscreen="phoneLayout"
persistent
@keydown.enter.prevent="$refs.addTorrent.click"
v-model="dialog"
:transition="dTransition"
:content-class="phoneLayout ? 'rounded-0' : 'rounded-form'"
max-width="500px"
:fullscreen="phoneLayout"
persistent
@keydown.enter.prevent="$refs.addTorrent.click"
>
<div
class="noselect"
style="position: fixed; left: 0; top: 0; width: 100%; height: 100%"
@drop.prevent="addDropFile"
@dragover.prevent="showWrapDrag = true"
@dragend.prevent="showWrapDrag = false"
@dragleave.prevent="DragLeave"
class="noselect"
style="position: fixed; left: 0; top: 0; width: 100%; height: 100%"
@drop.prevent="addDropFile"
@dragover.prevent="showWrapDrag = true"
@dragend.prevent="showWrapDrag = false"
@dragleave.prevent="DragLeave"
/>
<v-card :class="showWrapDrag ? 'wrap-drag' : ''" @drop.prevent="addDropFile" @dragover.prevent="showWrapDrag = true" @dragend.prevent="showWrapDrag = false">
<v-container :class="`pa-0 project done`">
@ -34,16 +34,16 @@
<v-row no-gutters>
<v-col ref="fileZone">
<v-file-input
v-if="!urls"
v-model="files"
color="deep-purple accent-4"
counter
:label="$t('modals.add.selectFiles')"
multiple
:prepend-icon="mdiPaperclip"
:rules="fileInputRules"
outlined
:show-size="1000"
v-if="!urls"
v-model="files"
color="deep-purple accent-4"
counter
:label="$t('modals.add.selectFiles')"
multiple
:prepend-icon="mdiPaperclip"
:rules="fileInputRules"
outlined
:show-size="1000"
>
<template #selection="{ index, text }">
<v-chip v-if="index < 2" color="deep-purple accent-4" dark label small>
@ -56,18 +56,18 @@
</template>
</v-file-input>
<v-textarea
v-if="files.length === 0"
v-model="urls"
style="max-height: 200px; overflow-x: hidden; overflow-y: auto"
:label="$t('url')"
:prepend-icon="mdiLink"
rows="1"
required
:autofocus="!phoneLayout"
auto-grow
clearable
:hint="$t('modals.add.urlHint')"
@click:prepend="paste"
v-if="files.length === 0"
v-model="urls"
style="max-height: 200px; overflow-x: hidden; overflow-y: auto"
:label="$t('url')"
:prepend-icon="mdiLink"
rows="1"
required
:autofocus="!phoneLayout"
auto-grow
clearable
:hint="$t('modals.add.urlHint')"
@click:prepend="paste"
/>
</v-col>
</v-row>
@ -76,13 +76,33 @@
<v-combobox v-model="category" :items="availableCategories" clearable :label="$t('category')" item-text="name" :prepend-icon="mdiLabel" @input="categoryChanged" />
<v-text-field
v-model="directory"
:disabled="autoTMM"
:label="$t('modals.add.downloadDirectory')"
:prepend-icon="mdiFolder"
autocomplete="download-directory"
name="download-directory"
v-model="directory"
:disabled="autoTMM"
:label="$t('modals.add.downloadDirectory')"
:prepend-icon="mdiFolder"
autocomplete="download-directory"
name="download-directory"
/>
<v-row no-gutters class="flex-gap">
<v-col>
<div class="d-flex flex-column align-center">
<p class="subtitle-1 mb-1">{{ $t('modals.add.contentLayout') }}</p>
<v-select v-model="contentLayout" :label="$t('modals.add.contentLayout')" flat solo dense
hide-details background-color="background" class="rounded-xl"
:items="contentLayoutOptions"/>
</div>
</v-col>
<v-col>
<div class="d-flex flex-column align-center">
<p class="subtitle-1 mb-1">{{ $t('modals.add.stopCondition') }}</p>
<v-select v-model="stopCondition" :label="$t('modals.add.stopCondition')" flat solo dense
hide-details background-color="background" class="rounded-xl"
:items="stopConditionOptions"/>
</div>
</v-col>
</v-row>
<v-row no-gutters>
<v-flex xs12 sm6>
<v-checkbox v-model="start" :label="$t('modals.add.starttorrent')" hide-details />
@ -90,9 +110,6 @@
<v-flex xs12 sm6>
<v-checkbox v-model="skip_checking" :label="$t('modals.add.skipHashCheck')" hide-details />
</v-flex>
<v-flex xs12 sm6>
<v-checkbox v-model="root_folder" :label="$t('modals.add.createSubfolder')" hide-details />
</v-flex>
<v-flex xs12 sm6>
<v-checkbox v-model="autoTMM" :label="$t('modals.add.automaticTorrentManagement')" hide-details />
</v-flex>
@ -121,9 +138,9 @@
</v-container>
</v-card>
<div
v-show="showWrapDrag"
class="wrap-drag noselect"
style="position: fixed; left: 0; top: 0; width: 100%; height: 100%; text-align: center; background-color: rgb(0, 0, 0, 0.5)"
v-show="showWrapDrag"
class="wrap-drag noselect"
style="position: fixed; left: 0; top: 0; width: 100%; height: 100%; text-align: center; background-color: rgb(0, 0, 0, 0.5)"
>
<div class="align white--text">
<div>
@ -140,10 +157,11 @@
</template>
<script>
import { mapGetters } from 'vuex'
import {mapGetters, mapState} from 'vuex'
import qbit from '@/services/qbit'
import { mdiCloudUpload, mdiFolder, mdiTag, mdiLabel, mdiPaperclip, mdiLink, mdiClose } from '@mdi/js'
import { FullScreenModal, Modal } from '@/mixins'
import {mdiCloudUpload, mdiFolder, mdiTag, mdiLabel, mdiPaperclip, mdiLink, mdiClose} from '@mdi/js'
import {FullScreenModal, Modal} from '@/mixins'
import {AppPreferences} from '@/enums/qbit'
export default {
name: 'AddModal',
@ -160,7 +178,18 @@ export default {
directory: '',
start: true,
skip_checking: false,
root_folder: true,
contentLayout: 'Original',
contentLayoutOptions: [
{text: this.$t('modals.add.contentLayoutOptions.original'), value: AppPreferences.ContentLayout.ORIGINAL},
{text: this.$t('modals.add.contentLayoutOptions.subfolder'), value: AppPreferences.ContentLayout.SUBFOLDER},
{text: this.$t('modals.add.contentLayoutOptions.nosubfolder'), value: AppPreferences.ContentLayout.NO_SUBFOLDER}
],
stopCondition: 'None',
stopConditionOptions: [
{text: this.$t('modals.add.stopConditionOptions.none'), value: AppPreferences.StopCondition.NONE},
{text: this.$t('modals.add.stopConditionOptions.metadataReceived'), value: AppPreferences.StopCondition.METADATA_RECEIVED},
{text: this.$t('modals.add.stopConditionOptions.filesChecked'), value: AppPreferences.StopCondition.FILES_CHECKED},
],
autoTMM: true,
sequentialDownload: false,
firstLastPiecePrio: false,
@ -175,7 +204,7 @@ export default {
}
],
loading: false,
urls: null,
urls: '',
valid: false,
mdiCloudUpload,
mdiFolder,
@ -187,15 +216,13 @@ export default {
}
},
computed: {
...mapGetters(['getSettings', 'getCategories', 'getAvailableTags']),
validFile() {
return this.Files.length > 0
},
...mapState(['settings']),
...mapGetters(['getCategories', 'getAvailableTags']),
phoneLayout() {
return this.$vuetify.breakpoint.xsOnly
},
savepath() {
let savePath = this.getSettings().save_path
let savePath = this.settings.save_path
if (this.category && this.category.savePath) {
savePath = this.category.savePath
}
@ -228,15 +255,15 @@ export default {
await this.$store.dispatch('FETCH_SETTINGS')
await this.$store.commit('FETCH_CATEGORIES')
await this.$store.commit('FETCH_TAGS')
const settings = this.getSettings()
this.start = !settings.start_paused_enabled
this.autoTMM = settings.auto_tmm_enabled
this.root_folder = settings.create_subfolder_enabled
this.start = !this.settings.start_paused_enabled
this.autoTMM = this.settings.auto_tmm_enabled
this.directory = this.savepath
this.contentLayout = this.settings.torrent_content_layout
this.stopCondition = this.settings.torrent_stop_condition
},
addDropFile(e) {
this.showWrapDrag = false
if (!this.urls) this.files.push(...Array.from(e.dataTransfer.files))
if (this.urls.length === 0) this.files.push(...Array.from(e.dataTransfer.files))
},
startDropFile() {
this.showWrapDrag = true
@ -260,41 +287,44 @@ export default {
}
this.$toast.success(this.$t('toast.pasteSuccess').toString())
},
submit() {
if (this.files.length || this.urls) {
const torrents = []
const params = {
urls: null,
paused: !this.start,
skip_checking: this.skip_checking,
root_folder: this.root_folder,
autoTMM: this.autoTMM,
sequentialDownload: this.sequentialDownload,
firstLastPiecePrio: this.firstLastPiecePrio
}
if (this.files.length) torrents.push(...this.files)
if (this.urls) params.urls = this.urls
if (this.category) params.category = this.category.name
if (this.tags) params.tags = this.tags.join(',')
if (!this.autoTMM) params.savepath = this.directory
async submit() {
if (this.files.length === 0 && this.urls.length === 0) return;
qbit.addTorrents(params, torrents)
this.resetForm()
this.$store.commit('DELETE_MODAL', this.guid)
const torrents = []
const params = {
urls: null,
paused: !this.start,
skip_checking: this.skip_checking,
autoTMM: this.autoTMM,
sequentialDownload: this.sequentialDownload,
firstLastPiecePrio: this.firstLastPiecePrio,
contentLayout: this.contentLayout,
stopCondition: this.stopCondition
}
if (this.files.length) torrents.push(...this.files)
if (this.urls) params.urls = this.urls
if (this.category) params.category = this.category.name
if (this.tags) params.tags = this.tags.join(',')
if (!this.autoTMM) params.savepath = this.directory
await qbit.addTorrents(params, torrents)
this.resetForm()
this.$store.commit('DELETE_MODAL', this.guid)
},
categoryChanged() {
this.directory = this.savepath
},
resetForm() {
this.url = null
this.url = ''
this.files = []
this.category = null
this.tags = []
this.directory = this.savepath
this.skip_checking = null
this.skip_checking = false
this.contentLayout = this.settings.torrent_content_layout
this.stopCondition = this.settings.torrent_stop_condition
},
close() {
this.dialog = false
@ -325,4 +355,8 @@ export default {
color: #fff;
padding: 0;
}
.flex-gap {
column-gap: 8px;
}
</style>

View file

@ -139,6 +139,7 @@
<script>
import { SettingsTab, FullScreenModal } from '@/mixins'
import {MaxRatioAction} from "@/enums/qbit/AppPreferences";
export default {
name: 'BitTorrent',
@ -147,19 +148,19 @@ export default {
return {
thenTypes: [
{
value: 0,
value: MaxRatioAction.PAUSE_TORRENT,
text: this.$t('modals.settings.pageBittorrent.maxRatioPauseTorrent')
},
{
value: 1,
value: MaxRatioAction.REMOVE_TORRENT,
text: this.$t('modals.settings.pageBittorrent.maxRatioRemoveTorrent')
},
{
value: 3,
value: MaxRatioAction.REMOVE_TORRENT_AND_FILES,
text: this.$t('modals.settings.pageBittorrent.maxRatioRemoveTorrentAndFiles')
},
{
value: 2,
value: MaxRatioAction.ENABLE_SUPERSEEDING,
text: this.$t('modals.settings.pageBittorrent.maxRatioTorrentSuperseeding')
}
]

View file

@ -98,6 +98,7 @@
<script>
import { SettingsTab, FullScreenModal } from '@/mixins'
import {BitTorrentProtocol, ProxyType} from "@/enums/qbit/AppPreferences";
export default {
name: 'Connection',
@ -106,41 +107,36 @@ export default {
return {
proxyTypes: [
{
value: -1,
value: ProxyType.DISABLED,
text: 'None'
},
{
value: 1,
value: ProxyType.HTTP_WITHOUT_AUTH,
text: 'HTTP proxy without authentication'
},
{
value: 2,
value: ProxyType.SOCKS5_WITHOUT_AUTH,
text: 'SOCKS5 proxy without authentication'
},
{
value: 3,
value: ProxyType.HTTP_WITH_AUTH,
text: 'HTTP proxy with authentication'
},
{
value: 4,
value: ProxyType.SOCKS5_WITH_AUTH,
text: 'SOCKS5 proxy with authentication'
},
{
value: 5,
value: ProxyType.SOCKS4_WITHOUT_AUTH,
text: 'SOCKS4 proxy without authentication'
}
],
bittorrent_protocol: [
{ value: 0, text: 'TCP and μTP' },
{ value: 1, text: 'TCP' },
{ value: 2, text: 'μTP' }
{ value: BitTorrentProtocol.TCP_uTP, text: 'TCP and μTP' },
{ value: BitTorrentProtocol.TCP, text: 'TCP' },
{ value: BitTorrentProtocol.uTP, text: 'μTP' }
]
}
},
computed: {
getProxyTypeName(value) {
return this.proxyTypes.filter(item => item.value !== value)[0]
}
}
}
</script>

View file

@ -2,11 +2,17 @@
<v-card flat>
<v-subheader>{{ $t('modals.settings.pageDownloads.subHeaderWhenAddTorrent') }}</v-subheader>
<v-list-item>
<v-checkbox v-model="settings.create_subfolder_enabled" hide-details class="ma-0 pa-0" :label="$t('modals.settings.pageDownloads.whenAddTorrent.createSubFolder')" />
<v-select v-model="settings.torrent_content_layout" :label="$t('modals.settings.pageDownloads.whenAddTorrent.contentLayout')" outlined dense small-chips :items="contentLayoutOptions" />
</v-list-item>
<v-list-item>
<v-checkbox v-model="settings.start_paused_enabled" hide-details class="ma-0 pa-0" :label="$t('modals.settings.pageDownloads.whenAddTorrent.donotAutoStart')" />
</v-list-item>
<v-list-item>
<v-select v-model="settings.torrent_stop_condition" :label="$t('modals.settings.pageDownloads.whenAddTorrent.stopCondition')" outlined dense small-chips :items="stopConditionOptions" />
</v-list-item>
<v-list-item>
<v-checkbox v-model="settings.auto_delete_mode" hide-details class="ma-0 pa-0" :label="$t('modals.settings.pageDownloads.whenAddTorrent.autoDeleteMode')" />
</v-list-item>
<v-divider insert />
<v-subheader>{{ $t('modals.settings.pageDownloads.subHeaderPublicSettings') }}</v-subheader>
<v-list-item>
@ -107,9 +113,24 @@
</template>
<script>
import { FullScreenModal, SettingsTab } from '@/mixins'
import { AppPreferences } from '@/enums/qbit'
export default {
name: 'Downloads',
mixins: [SettingsTab, FullScreenModal]
mixins: [SettingsTab, FullScreenModal],
data() {
return {
contentLayoutOptions: [
{text: this.$t('modals.add.contentLayoutOptions.original'), value: AppPreferences.ContentLayout.ORIGINAL},
{text: this.$t('modals.add.contentLayoutOptions.subfolder'), value: AppPreferences.ContentLayout.SUBFOLDER},
{text: this.$t('modals.add.contentLayoutOptions.nosubfolder'), value: AppPreferences.ContentLayout.NO_SUBFOLDER}
],
stopConditionOptions: [
{text: this.$t('modals.add.stopConditionOptions.none'), value: AppPreferences.StopCondition.NONE},
{text: this.$t('modals.add.stopConditionOptions.metadataReceived'), value: AppPreferences.StopCondition.METADATA_RECEIVED},
{text: this.$t('modals.add.stopConditionOptions.filesChecked'), value: AppPreferences.StopCondition.FILES_CHECKED},
],
}
}
}
</script>

View file

@ -217,6 +217,7 @@
import { mapState, mapGetters } from 'vuex'
import { Qbit } from '@/services/qbit'
import { LOCALES } from '@/lang/locales'
import {TitleOptions} from "@/enums/vuetorrent";
export default {
name: 'VueTorrent-General',
@ -224,7 +225,7 @@ export default {
return {
languages: LOCALES,
paginationSizes: [5, 15, 30, 50],
titleOptions: ['Default', 'Global Speed', 'First Torrent Status'],
titleOptions: [TitleOptions.DEFAULT, TitleOptions.GLOBAL_SPEED, TitleOptions.FIRST_TORRENT_STATUS],
Qbitversion: 0
}
},

View file

@ -4,6 +4,12 @@ export enum BitTorrentProtocol {
uTP
}
export enum ContentLayout {
ORIGINAL = "Original",
SUBFOLDER = "Subfolder",
NO_SUBFOLDER = "NoSubfolder"
}
export enum DynDnsService {
USE_DYNDNS,
USE_NOIP
@ -50,6 +56,12 @@ export enum SchedulerDays {
EVERY_SUNDAY
}
export enum StopCondition {
NONE = "None",
METADATA_RECEIVED = "MetadataReceived",
FILES_CHECKED = "FilesChecked"
}
export enum UploadChokingAlgorithm {
ROUND_ROBIN,
FASTEST_UPLOAD,

View file

@ -1,8 +1,8 @@
import * as AppPreferences from './AppPreferences'
import { ConnectionStatus } from './ConnectionStatus'
import { LogType } from './LogType'
import { Priority } from './Priority'
import { TrackerStatus } from './TrackerStatus'
import { ConnectionStatus } from './ConnectionStatus'
import { TorrentState } from './TorrentState'
import { TrackerStatus } from './TrackerStatus'
export { AppPreferences, ConnectionStatus, LogType, Priority, TrackerStatus, TorrentState }

View file

@ -227,8 +227,10 @@
"pageDownloads": {
"subHeaderWhenAddTorrent": "When adding a torrent",
"whenAddTorrent": {
"createSubFolder": "Create subfolder for torrents with multiple files",
"donotAutoStart": "Do not start the download automatically"
"contentLayout": "Torrent content layout",
"donotAutoStart": "Do not start the download automatically",
"stopCondition": "Torrent stop condition",
"autoDeleteMode": "Delete .torrent files afterwards"
},
"subHeaderPublicSettings": "Public Settings",
"publicSettings": {
@ -425,10 +427,21 @@
"downloadDirectory": "Download Directory",
"starttorrent": "Start torrent",
"skipHashCheck": "Skip hash check",
"createSubfolder": "Create subfolder",
"automaticTorrentManagement": "Automatic Torrent Management",
"dropHereForAdd": "Drop here for add",
"oneOrMoreFilesInvalidTorrent": "One or more files are not valid torrents"
"oneOrMoreFilesInvalidTorrent": "One or more files are not valid torrents",
"contentLayout": "Content Layout",
"contentLayoutOptions": {
"original": "Original",
"subfolder": "Create Subfolder",
"nosubfolder": "Remove Subfolder"
},
"stopCondition": "Stop Condition",
"stopConditionOptions": {
"none": "None",
"metadataReceived": "Metadata Received",
"filesChecked": "Files Checked"
}
},
"changeLocation": {
"title": "Change Location"

View file

@ -219,8 +219,10 @@
"pageDownloads": {
"subHeaderWhenAddTorrent": "Lors de l'ajout d'un torrent",
"whenAddTorrent": {
"createSubFolder": "Créer un sous-dossier pour les torrents avec plusieurs fichiers",
"donotAutoStart": "Ne pas lancer le téléchargement automatiquement"
"contentLayout": "Disposition du contenu du torrent",
"donotAutoStart": "Ne pas lancer le téléchargement automatiquement",
"stopCondition": "Condition d'arrêt du torrent",
"autoDeleteMode": "Supprimer les fichers .torrent après"
},
"subHeaderPublicSettings": "Paramètres publics",
"publicSettings": {
@ -415,10 +417,21 @@
"downloadDirectory": "Répertoire de téléchargement",
"starttorrent": "Lancer le torrent",
"skipHashCheck": "Passer la vérification du hash",
"createSubfolder": "Créer un sous-dossier",
"automaticTorrentManagement": "Gestion automatique des torrents",
"dropHereForAdd": "Déposez ici pour ajouter",
"oneOrMoreFilesInvalidTorrent": "Un ou plusieurs fichiers ne sont pas des torrents valides"
"oneOrMoreFilesInvalidTorrent": "Un ou plusieurs fichiers ne sont pas des torrents valides",
"contentLayout": "Disposition des fichiers",
"contentLayoutOptions": {
"original": "Original",
"subfolder": "Créer un sous-dossier",
"nosubfolder": "Supprimer le sous-dossier"
},
"stopCondition": "Condition d'arrêt",
"stopConditionOptions": {
"none": "Aucune",
"metadataReceived": "Metadonnées reçues",
"filesChecked": "Fichiers vérifiés"
}
},
"changeLocation": {
"title": "Changement d'emplacement"

View file

@ -341,7 +341,6 @@
"downloadDirectory": "Direktori Unduhan",
"starttorrent": "Mulai torrent",
"skipHashCheck": "Lewati cek hash",
"createSubfolder": "Buat subfolder",
"automaticTorrentManagement": "Manajemen Torrent Otomatis",
"dropHereForAdd": "Jatuhkan di sini untuk menambah",
"oneOrMoreFilesInvalidTorrent": "Satu atau lebih file bukan torrent yang valid"

View file

@ -336,7 +336,6 @@
"downloadDirectory": "ダウンロード先",
"starttorrent": "Torrentを開始",
"skipHashCheck": "ハッシュ値確認をしない",
"createSubfolder": "サブフォルダ作成",
"automaticTorrentManagement": "自動Torrent管理",
"dropHereForAdd": "ドロップして追加",
"oneOrMoreFilesInvalidTorrent": "一つまたは複数の無効なTorrentファイルが含まれています"

View file

@ -369,7 +369,6 @@
"downloadDirectory": "Скачать папку",
"starttorrent": "Запустить торрент",
"skipHashCheck": "Пропустить проверку хэша",
"createSubfolder": "Создать подпапку",
"automaticTorrentManagement": "Автоматическое управление торрентами",
"dropHereForAdd": "Перетащить сюда для добавления",
"oneOrMoreFilesInvalidTorrent": "Один или несколько файлов не являются действительным торрентом"

View file

@ -254,7 +254,7 @@
"supportParamZ": "%Z: Розмір торренту (в байтах)",
"supportParamT": "%T: Поточний трекер",
"supportParamI": "%I: Хеш інформації v1",
"supportParamI": "%I: Хеш інформації v2",
"supportParamJ": "%J: Хеш інформації v2",
"supportParamK": "%K: ID торренту"
}
},
@ -423,7 +423,6 @@
"downloadDirectory": "Завантажити теку",
"starttorrent": "Запустити торрент",
"skipHashCheck": "Пропустити перевірку хешування",
"createSubfolder": "Створити підпапку",
"automaticTorrentManagement": "Автоматичне керування торрентами",
"dropHereForAdd": "Перетягнути для додавання",
"oneOrMoreFilesInvalidTorrent": "Один або кілька файлів не є дійсним торрентом"

View file

@ -404,7 +404,6 @@
"downloadDirectory": "Thư mục tải xuống",
"starttorrent": "Bắt đầu torrent",
"skipHashCheck": "Bỏ qua kiểm tra",
"createSubfolder": "Tạo thư mục con",
"automaticTorrentManagement": "Quản lý torrent tự động",
"dropHereForAdd": "Thả vào đây để thêm",
"oneOrMoreFilesInvalidTorrent": "Một hoặc nhiều tệp không phải là torrent hợp lệ"

View file

@ -392,7 +392,6 @@
"downloadDirectory": "下载目录",
"starttorrent": "添加后立即开始",
"skipHashCheck": "跳过哈希值检查",
"createSubfolder": "建立子目录",
"automaticTorrentManagement": "自动种子管理 (ATM)",
"dropHereForAdd": "拖拽到此处即可添加",
"oneOrMoreFilesInvalidTorrent": "存在无效的种子文件"

View file

@ -396,7 +396,6 @@
"downloadDirectory": "下載目錄",
"starttorrent": "新增後開始",
"skipHashCheck": "跳過雜湊值檢",
"createSubfolder": "建立子資料夾",
"automaticTorrentManagement": "自動種子管理 (ATM)",
"dropHereForAdd": "拖拽至此處新增",
"oneOrMoreFilesInvalidTorrent": "存在無效的種子檔案"

View file

@ -1,33 +1,29 @@
import { mapGetters } from 'vuex'
import { defineComponent } from 'vue'
import qbit from '@/services/qbit'
import { Component, Vue } from 'vue-property-decorator'
import type { AppPreferences } from '@/types/qbit/models'
@Component({
computed: mapGetters(['getSettings'])
})
export default class SettingsTab extends Vue {
getSettings!: () => AppPreferences
export default defineComponent({
name: 'SettingsTab',
computed: {
...mapGetters(['getSettings']),
settings() {
return this.getSettings()
}
},
methods: {
async saveSettings() {
await qbit.setPreferences(this.settings)
this.$toast.success(this.$t('toast.settingsSaved').toString())
await this.$store.dispatch('FETCH_SETTINGS')
await this.$store.commit('SET_LANGUAGE')
this.close()
get settings() {
return this.getSettings()
}
close!: () => void
async saveSettings() {
qbit.setPreferences(this.getSettings()).then(() => {
Vue.$toast.success(this.$t('toast.settingsSaved').toString())
})
await this.$store.dispatch('FETCH_SETTINGS')
await this.$store.commit('SET_LANGUAGE')
this.close()
if (!this.settings.alternative_webui_enabled) {
navigator.serviceWorker.getRegistrations().then(function (registrations) {
if (!this.settings.alternative_webui_enabled) {
const registrations = await navigator.serviceWorker.getRegistrations()
for (const registration of registrations) {
registration.unregister()
await registration.unregister()
}
})
}
}
}
}
})

View file

@ -1,11 +1,13 @@
import type {
BitTorrentProtocol,
ContentLayout,
DynDnsService,
Encryption,
MaxRatioAction,
ProxyType,
ScanDirs,
SchedulerDays,
StopCondition,
UploadChokingAlgorithm,
UploadSlotsBehavior,
UtpTcpMixedMode
@ -33,6 +35,7 @@ export default interface AppPreferences {
anonymous_mode: boolean
/** Number of asynchronous I/O threads */
async_io_threads: number
/** Delete .torrent files afterwards */
auto_delete_mode: number
/** True if Automatic Torrent Management is enabled by default */
auto_tmm_enabled: boolean
@ -258,6 +261,10 @@ export default interface AppPreferences {
temp_path_enabled: boolean
/** True if torrent should be relocated when its Category changes */
torrent_changed_tmm_enabled: boolean
/** Default content layout to select when adding a new torrent */
torrent_content_layout: ContentLayout
/** Default stop condition to select when adding a new torrent */
torrent_stop_condition: StopCondition
/** Global upload speed limit in KiB/s; -1 means no limit is applied */
up_limit: number
/** Upload choking algorithm used (see list of possible values below) */