Skip to content

A full-featured download manager.

feat: preference select sync tracker source

Dr_rOot36a27bae46f0
diff --git a/src/renderer/components/Preference/Advanced.vue b/src/renderer/components/Preference/Advanced.vue
index a58d47d6..5ad74f06 100644
--- a/src/renderer/components/Preference/Advanced.vue
+++ b/src/renderer/components/Preference/Advanced.vue
@@ -74,7 +74,55 @@
:label="`${$t('preferences.bt-tracker')}: `"
:label-width="formLabelWidth"
>
- <div class="bt-tracker">
+ <div class="form-item-sub bt-tracker">
+ <el-row :gutter="10" style="line-height: 0;">
+ <el-col :span="20">
+ <div class="track-source">
+ <el-select
+ class="select-track-source"
+ v-model="form.trackerSource"
+ multiple
+ >
+ <el-option-group
+ v-for="group in trackerSourceOptions"
+ :key="group.label"
+ :label="group.label"
+ >
+ <el-option
+ v-for="item in group.options"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value">
+ </el-option>
+ </el-option-group>
+ </el-select>
+ </div>
+ </el-col>
+ <el-col :span="3">
+ <div class="sync-tracker">
+ <el-tooltip
+ class="item"
+ effect="dark"
+ :content="$t('preferences.sync-tracker-tips')"
+ placement="bottom"
+ >
+ <el-button
+ @click="syncTrackerFromGitHub"
+ class="sync-tracker-btn"
+ >
+ <mo-icon
+ name="refresh"
+ width="12"
+ height="12"
+ :spin="true"
+ v-if="trackerSyncing"
+ />
+ <mo-icon name="sync" width="12" height="12" v-else />
+ </el-button>
+ </el-tooltip>
+ </div>
+ </el-col>
+ </el-row>
<el-input
type="textarea"
:autosize="{ minRows: 3, maxRows: 5 }"
@@ -82,35 +130,18 @@
:placeholder="`${$t('preferences.bt-tracker-input-tips')}`"
v-model="form.btTracker">
</el-input>
- <div class="sync-tracker">
- <el-tooltip
- class="item"
- effect="dark"
- :content="$t('preferences.sync-tracker-tips')"
- placement="bottom"
- >
- <el-button
- @click="syncTrackerFromGitHub"
- >
- <mo-icon
- name="refresh"
- width="12"
- height="12"
- :spin="true"
- v-if="trackerSyncing"
- />
- <mo-icon name="sync" width="12" height="12" v-else />
- </el-button>
- </el-tooltip>
+ <div class="el-form-item__info" style="margin-top: 8px;">
+ {{ $t('preferences.bt-tracker-tips') }}
+ <a target="_blank" href="https://github.com/ngosang/trackerslist" rel="noopener noreferrer">
+ ngosang/trackerslist
+ <mo-icon name="link" width="12" height="12" />
+ </a>
+ <a target="_blank" href="https://github.com/XIU2/TrackersListCollection" rel="noopener noreferrer">
+ XIU2/TrackersListCollection
+ <mo-icon name="link" width="12" height="12" />
+ </a>
</div>
</div>
- <div class="el-form-item__info" style="margin-top: 8px;">
- {{ $t('preferences.bt-tracker-tips') }}
- <a target="_blank" href="https://github.com/ngosang/trackerslist" rel="noopener noreferrer">
- https://github.com/ngosang/trackerslist
- <mo-icon name="link" width="12" height="12" />
- </a>
- </div>
</el-form-item>
<el-form-item
:label="`${$t('preferences.download-protocol')}: `"
@@ -230,6 +261,7 @@
import ShowInFolder from '@/components/Native/ShowInFolder'
import SubnavSwitcher from '@/components/Subnav/SubnavSwitcher'
import userAgentMap from '@shared/ua'
+ import { trackerSourceOptions } from '@shared/constants'
import {
buildRpcUrl,
calcFormLabelWidth,
@@ -253,6 +285,7 @@
protocols,
rpcListenPort,
rpcSecret,
+ trackerSource,
useProxy,
userAgent
} = config
@@ -268,6 +301,7 @@
},
rpcListenPort,
rpcSecret,
+ trackerSource,
useProxy,
userAgent
}
@@ -291,6 +325,7 @@
formOriginal,
hideRpcSecret: true,
rules: {},
+ trackerSourceOptions,
trackerSyncing: false
}
},
@@ -449,10 +484,14 @@
<style lang="scss">
.bt-tracker {
position: relative;
- .sync-tracker {
- position: absolute;
- top: 8px;
- right: 8px;
+ .sync-tracker-btn {
+ line-height: 0;
+ }
+ .track-source {
+ margin-bottom: 16px;
+ .select-track-source {
+ width: 100%;
+ }
}
}
.ua-group {
diff --git a/src/shared/configKeys.js b/src/shared/configKeys.js
index cf219328..24267bd6 100644
--- a/src/shared/configKeys.js
+++ b/src/shared/configKeys.js
@@ -16,6 +16,7 @@ const userKeys = [
'session-path',
'task-notification',
'theme',
+ 'tracker-source',
'use-proxy'
]
diff --git a/src/shared/constants.js b/src/shared/constants.js
index c91aea63..21a4ad9d 100644
--- a/src/shared/constants.js
+++ b/src/shared/constants.js
@@ -23,6 +23,47 @@ export const XIU2_TRACKERS_BEST_URL = 'https://raw.githubusercontent.com/XIU2/Tr
export const XIU2_TRACKERS_ALL_URL = 'https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt'
export const XIU2_TRACKERS_OTHER_URL = 'https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/other.txt'
+export const trackerSourceOptions = [
+ {
+ label: 'ngosang/trackerslist',
+ options: [
+ {
+ value: NGOSANG_TRACKERS_BEST_URL,
+ label: 'trackers_best.txt'
+ },
+ {
+ value: NGOSANG_TRACKERS_BEST_IP_URL,
+ label: 'trackers_best_ip.txt'
+ },
+ {
+ value: NGOSANG_TRACKERS_ALL_URL,
+ label: 'trackers_all.txt'
+ },
+ {
+ value: NGOSANG_TRACKERS_ALL_IP_URL,
+ label: 'trackers_all_ip.txt'
+ }
+ ]
+ },
+ {
+ label: 'XIU2/TrackersListCollection',
+ options: [
+ {
+ value: XIU2_TRACKERS_BEST_URL,
+ label: 'best.txt'
+ },
+ {
+ value: XIU2_TRACKERS_ALL_URL,
+ label: 'all.txt'
+ },
+ {
+ value: XIU2_TRACKERS_OTHER_URL,
+ label: 'other.txt'
+ }
+ ]
+ }
+]
+
// One Week
export const AUTO_CHECK_UPDATE_INTERVAL = 7 * 24 * 60 * 60 * 1000