|
| 1 | +const querystring = require('querystring'); |
| 2 | + |
1 | 3 | // Packages
|
2 | 4 | const { send } = require('micro')
|
3 | 5 | const { valid, compare } = require('semver')
|
@@ -35,10 +37,15 @@ module.exports = ({ cache, config }) => {
|
35 | 37 |
|
36 | 38 | exports.download = async (req, res) => {
|
37 | 39 | const userAgent = parse(req.headers['user-agent'])
|
| 40 | + const queryParams = req.url.split('?')[1] |
| 41 | + const params = queryParams ? querystring.parse(queryParams) : null |
| 42 | + const isUpdate = params && params.update |
38 | 43 | let platform
|
39 | 44 |
|
40 |
| - if (userAgent.isMac) { |
| 45 | + if (userAgent.isMac && isUpdate) { |
41 | 46 | platform = 'darwin'
|
| 47 | + } else if (userAgent.isMac && !isUpdate) { |
| 48 | + platform = 'dmg' |
42 | 49 | } else if (userAgent.isWindows) {
|
43 | 50 | platform = 'exe'
|
44 | 51 | }
|
@@ -145,7 +152,7 @@ module.exports = ({ cache, config }) => {
|
145 | 152 | notes,
|
146 | 153 | pub_date,
|
147 | 154 | url: shouldProxyPrivateDownload
|
148 |
| - ? `${url}/download/${platformName}` |
| 155 | + ? `${url}/download/${platformName}?update=true` |
149 | 156 | : latest.platforms[platform].url
|
150 | 157 | })
|
151 | 158 |
|
@@ -180,14 +187,6 @@ module.exports = ({ cache, config }) => {
|
180 | 187 | exports.overview = async (req, res) => {
|
181 | 188 | const latest = await loadCache()
|
182 | 189 |
|
183 |
| - // Filter out special platforms that should not |
184 |
| - // be shown on the overview page |
185 |
| - Object.keys(latest.platforms).forEach(platform => { |
186 |
| - if (platform === 'dmg') { |
187 |
| - delete latest.platforms[platform] |
188 |
| - } |
189 |
| - }) |
190 |
| - |
191 | 190 | try {
|
192 | 191 | const render = await prepareView()
|
193 | 192 |
|
|
0 commit comments