|
2 | 2 | <p>{{ t('download.version') }}:</p> |
3 | 3 | <div class="filter-buttons"> |
4 | 4 | <button :class="{ active: selectedVersion === 'latest' }" @click="selectedVersion = 'latest'"> |
5 | | - Latest |
| 5 | + {{ t('download.latest') }} |
6 | 6 | </button> |
7 | 7 | <button :class="{ active: selectedVersion === 'beta' }" @click="selectedVersion = 'beta'"> |
8 | | - Beta |
| 8 | + {{ t('download.beta') }} |
9 | 9 | </button> |
10 | 10 | </div> |
11 | 11 |
|
12 | 12 | <p>{{ t('download.os') }}:</p> |
13 | 13 | <div class="filter-buttons"> |
14 | | - <button :class="{ active: selectedOS === '' }" @click="selectedOS = ''">All</button> |
| 14 | + <button :class="{ active: selectedOS === '' }" @click="selectedOS = ''"> |
| 15 | + {{ t('download.all') }} |
| 16 | + </button> |
15 | 17 | <button |
16 | 18 | v-for="os in availableOS" |
17 | 19 | :key="os" |
|
24 | 26 |
|
25 | 27 | <p>{{ t('download.cpu') }}:</p> |
26 | 28 | <div class="filter-buttons"> |
27 | | - <button :class="{ active: selectedCPU === '' }" @click="selectedCPU = ''">All CPU</button> |
| 29 | + <button :class="{ active: selectedCPU === '' }" @click="selectedCPU = ''"> |
| 30 | + {{ t('download.all') }} |
| 31 | + </button> |
28 | 32 | <button |
29 | 33 | v-for="cpu in availableCPU" |
30 | 34 | :key="cpu" |
|
35 | 39 | </button> |
36 | 40 | </div> |
37 | 41 |
|
| 42 | + <p v-if="locale == 'zh-CN'">{{ t('download.down_source') }}:</p> |
| 43 | + <div class="filter-buttons"> |
| 44 | + <button |
| 45 | + v-if="locale == 'zh-CN'" |
| 46 | + v-for="source in sources" |
| 47 | + :key="source.name" |
| 48 | + :class="{ active: selectedDownSource.name === source.name }" |
| 49 | + @click="selectedDownSource = source" |
| 50 | + > |
| 51 | + {{ source.name }} |
| 52 | + </button> |
| 53 | + </div> |
| 54 | + |
38 | 55 | <div class="file-list"> |
39 | 56 | <div v-for="download in filteredDownloads" :key="download.filename" class="file-item"> |
40 | 57 | <div class="file-content"> |
|
51 | 68 | </div> |
52 | 69 | <div class="downloads"> |
53 | 70 | <a |
54 | | - v-if="locale === 'zh-CN'" |
55 | | - :href="getGhProxyUrl(download.filename)" |
56 | | - class="download-button" |
57 | | - :download="download.filename" |
58 | | - target="_blank" |
59 | | - > |
60 | | - {{ t('download.gh_proxy') }} |
61 | | - </a> |
62 | | - <a |
63 | | - :href="getDirectUrl(download.filename)" |
| 71 | + :href="getDownloadUrl(download.filename)" |
64 | 72 | class="download-button" |
65 | 73 | :download="download.filename" |
66 | 74 | target="_blank" |
67 | 75 | > |
68 | | - {{ t('download.download') }} |
| 76 | + {{ t('download.download') }} ({{ selectedDownSource.name }}) |
69 | 77 | </a> |
70 | 78 | </div> |
71 | 79 | </div> |
|
83 | 91 | import releases from './openlist_releases_db.json' |
84 | 92 |
|
85 | 93 | type VersionType = 'latest' | 'beta' |
| 94 | + type Source = { |
| 95 | + name: string |
| 96 | + prefix: string |
| 97 | + } |
| 98 | +
|
| 99 | + const sources: Source[] = [ |
| 100 | + { name: 'GitHub', prefix: 'https://github.com/OpenListTeam/OpenList' }, |
| 101 | + { name: 'ghfast.top', prefix: 'https://ghfast.top/https://github.com/OpenListTeam/OpenList' }, |
| 102 | + { |
| 103 | + name: 'v6.gh-proxy.org', |
| 104 | + prefix: 'https://v6.gh-proxy.org/https://github.com/OpenListTeam/OpenList', |
| 105 | + }, |
| 106 | + { |
| 107 | + name: 'hk.gh-proxy.org', |
| 108 | + prefix: 'https://hk.gh-proxy.org/https://github.com/OpenListTeam/OpenList', |
| 109 | + }, |
| 110 | + { |
| 111 | + name: 'cdn.gh-proxy.org', |
| 112 | + prefix: 'https://cdn.gh-proxy.org/https://github.com/OpenListTeam/OpenList', |
| 113 | + }, |
| 114 | + { |
| 115 | + name: 'edgeone.gh-proxy.org', |
| 116 | + prefix: 'https://edgeone.gh-proxy.org/https://github.com/OpenListTeam/OpenList', |
| 117 | + }, |
| 118 | + ] |
86 | 119 |
|
87 | 120 | const { t, locale } = useI18n() |
88 | 121 |
|
89 | 122 | const selectedVersion = ref<VersionType>('latest') |
90 | 123 | const selectedOS = ref<string>('') |
91 | 124 | const selectedCPU = ref<string>('') |
| 125 | + const selectedDownSource = ref<Source>(sources[0]) |
92 | 126 |
|
93 | 127 | const availableOS = computed((): string[] => { |
94 | 128 | const osSet = new Set(releases.map(d => d.os).filter(os => os)) |
|
125 | 159 | return filtered |
126 | 160 | }) |
127 | 161 |
|
128 | | - const getDirectUrl = (filename: string): string => { |
129 | | - const basePath = |
130 | | - selectedVersion.value === 'latest' ? 'releases/latest/download' : 'releases/download/beta' |
131 | | - return `https://github.com/OpenListTeam/OpenList/${basePath}/${filename}` |
132 | | - } |
133 | | -
|
134 | | - const getGhProxyUrl = (filename: string): string => { |
| 162 | + const getDownloadUrl = (filename: string): string => { |
135 | 163 | const basePath = |
136 | 164 | selectedVersion.value === 'latest' ? 'releases/latest/download' : 'releases/download/beta' |
137 | | - return `https://ghproxy.cn/https://github.com/OpenListTeam/OpenList/${basePath}/${filename}` |
| 165 | + return `${selectedDownSource.value.prefix}/${basePath}/${filename}` |
138 | 166 | } |
139 | 167 | </script> |
140 | 168 |
|
|
0 commit comments