diff --git a/src/views/system/NetTestView.vue b/src/views/system/NetTestView.vue index c69874c5..0fdda6fb 100644 --- a/src/views/system/NetTestView.vue +++ b/src/views/system/NetTestView.vue @@ -14,164 +14,28 @@ interface Status { Doing?: string } +interface TargetItem { + id: string + icon: string + name: string +} + interface Address { + id: string image: string name: string - url: string - proxy: boolean status: keyof Status time: string message: string btndisable: boolean - include?: string } -// 测试集 -const targets = ref
([ - { - image: getLogoUrl('tmdb'), - name: 'api.themoviedb.org', - url: 'https://api.themoviedb.org/3/movie/550?api_key={TMDBAPIKEY}', - proxy: true, - status: 'Normal', - time: '', - message: '', - btndisable: false, - }, - { - image: getLogoUrl('tmdb'), - name: 'api.tmdb.org', - url: 'https://api.tmdb.org/3/movie/550?api_key={TMDBAPIKEY}', - proxy: true, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - }, - { - image: getLogoUrl('tmdb'), - name: 'www.themoviedb.org', - url: 'https://www.themoviedb.org', - proxy: true, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - }, - { - image: tvdb, - name: 'api.thetvdb.com', - url: 'https://api.thetvdb.com/series/81189', - proxy: true, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - }, - { - image: getLogoUrl('fanart'), - name: 'webservice.fanart.tv', - url: 'https://webservice.fanart.tv', - proxy: true, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - }, - { - image: getLogoUrl('telegram'), - name: 'api.telegram.org', - url: 'https://api.telegram.org', - proxy: true, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - }, - { - image: getLogoUrl('wechat'), - name: 'qyapi.weixin.qq.com', - url: 'https://qyapi.weixin.qq.com/cgi-bin/gettoken', - proxy: false, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - }, - { - image: getLogoUrl('douban'), - name: 'frodo.douban.com', - url: 'https://frodo.douban.com', - proxy: false, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - }, - { - image: getLogoUrl('slack'), - name: 'slack.com', - url: 'https://slack.com', - proxy: false, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - }, - { - image: getLogoUrl('python'), - name: 'pypi.org', - url: '{PIP_PROXY}rsa/', - proxy: true, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - include: 'pypi:repository-version', - }, - { - image: getLogoUrl('github'), - name: 'github.com', - url: '{GITHUB_PROXY}https://github.com/jxxghp/MoviePilot/blob/v2/README.md', - proxy: true, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - include: 'MoviePilot', - }, - { - image: getLogoUrl('github'), - name: 'codeload.github.com', - url: 'https://codeload.github.com', - proxy: true, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - }, - { - image: getLogoUrl('github'), - name: 'api.github.com', - url: 'https://api.github.com', - proxy: true, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - }, - { - image: getLogoUrl('github'), - name: 'raw.githubusercontent.com', - url: '{GITHUB_PROXY}https://raw.githubusercontent.com/jxxghp/MoviePilot/v2/README.md', - proxy: true, - status: 'Normal', - time: '', - message: t('netTest.notTested'), - btndisable: false, - include: 'MoviePilot', - }, -]) +function resolveTargetImage(icon: string) { + if (icon === 'tvdb') return tvdb + return getLogoUrl(icon) +} + +const targets = ref([]) const resolveStatusColor: Status = { OK: 'success', @@ -183,13 +47,34 @@ const resolveStatusColor: Status = { const abortControllers = new Set