feat: add downloader suffix toggles

This commit is contained in:
jxxghp
2026-06-13 08:43:37 +08:00
parent 951d76481b
commit d7562ea506
4 changed files with 41 additions and 0 deletions

View File

@@ -117,9 +117,20 @@ function generateId() {
return Math.random().toString(36).substring(2, 9)
}
/** 初始化下载器新增配置项的兼容默认值。 */
function initializeDownloaderConfigDefaults() {
if (!['qbittorrent', 'transmission'].includes(downloaderInfo.value.type)) return
if (!downloaderInfo.value.config) downloaderInfo.value.config = {}
if (downloaderInfo.value.type === 'qbittorrent' && downloaderInfo.value.config.incomplete_files_ext === undefined)
downloaderInfo.value.config.incomplete_files_ext = true
if (downloaderInfo.value.type === 'transmission' && downloaderInfo.value.config.rename_partial_files === undefined)
downloaderInfo.value.config.rename_partial_files = true
}
/** 初始化下载器编辑表单数据。 */
function initializeDownloaderInfo() {
downloaderInfo.value = cloneDeep(props.downloader)
initializeDownloaderConfigDefaults()
pathMappingRows.value = (downloaderInfo.value.path_mapping || []).map(item => ({
id: generateId(),
storage: item[0],
@@ -299,6 +310,15 @@ onMounted(() => {
active
/>
</VCol>
<VCol cols="12" md="6">
<VSwitch
v-model="downloaderInfo.config.incomplete_files_ext"
:label="t('downloader.incomplete_files_ext')"
:hint="t('downloader.incomplete_files_extHint')"
persistent-hint
active
/>
</VCol>
</VRow>
<VRow v-else-if="downloaderInfo.type == 'transmission'">
<VCol cols="12" md="6">
@@ -344,6 +364,15 @@ onMounted(() => {
prepend-inner-icon="mdi-lock"
/>
</VCol>
<VCol cols="12" md="6">
<VSwitch
v-model="downloaderInfo.config.rename_partial_files"
:label="t('downloader.rename_partial_files')"
:hint="t('downloader.rename_partial_filesHint')"
persistent-hint
active
/>
</VCol>
</VRow>
<VRow v-else-if="downloaderInfo.type == 'rtorrent'">
<VCol cols="12" md="6">

View File

@@ -3267,6 +3267,10 @@ export default {
sequentail: 'Sequential Download',
force_resume: 'Force Resume',
first_last_piece: 'First/Last Piece Priority',
incomplete_files_ext: 'Incomplete File Suffix',
incomplete_files_extHint: 'Append .!qB while downloading and remove it after completion',
rename_partial_files: 'Incomplete File Suffix',
rename_partial_filesHint: 'Append .part while downloading and remove it after completion',
saveSuccess: 'Downloader settings saved successfully',
saveFailed: 'Failed to save downloader settings',
nameRequired: 'Name cannot be empty',

View File

@@ -3210,6 +3210,10 @@ export default {
sequentail: '顺序下载',
force_resume: '强制继续',
first_last_piece: '优先首尾文件',
incomplete_files_ext: '未完成文件后缀',
incomplete_files_extHint: '下载未完成时追加 .!qB 后缀,完成后自动移除',
rename_partial_files: '未完成文件后缀',
rename_partial_filesHint: '下载未完成时追加 .part 后缀,完成后自动移除',
saveSuccess: '下载器设置保存成功',
saveFailed: '下载器设置保存失败',
nameRequired: '不能为空,且不能重名',

View File

@@ -3209,6 +3209,10 @@ export default {
sequentail: '順序下載',
force_resume: '強制繼續',
first_last_piece: '優先首尾文件',
incomplete_files_ext: '未完成文件後綴',
incomplete_files_extHint: '下載未完成時追加 .!qB 後綴,完成後自動移除',
rename_partial_files: '未完成文件後綴',
rename_partial_filesHint: '下載未完成時追加 .part 後綴,完成後自動移除',
saveSuccess: '下載器設置保存成功',
saveFailed: '下載器設置保存失敗',
nameRequired: '名稱不能為空',