Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(improvement) Actualize app download link generation #890

Open
wants to merge 4 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/AppDownload/AppDownload.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const getDownloadLink = (version) => {

switch (platform) {
case PLATFORMS.mac:
return getElectronReleaseLink({ version, platform, ext: 'zip' })
return getElectronReleaseLink({ version, platform, ext: 'dmg' })
case PLATFORMS.windows:
return getElectronReleaseLink({ version, platform, ext: 'exe' })
case PLATFORMS.linux:
Expand Down
26 changes: 20 additions & 6 deletions src/var/electronVersion.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
import _replace from 'lodash/replace'
import { isEqual } from '@bitfinex/lib-js-util-base'

const DEFAULT_ELECTRON_VERSION = '3.0.1'
import { PLATFORMS } from 'utils/getOS'

const DEFAULT_ELECTRON_VERSION = '4.17.0'

const APP_RELEASES_URL = 'https://github.com/bitfinexcom/bfx-report-electron/releases/download/'

const getDefaultExt = (platform) => {
if (isEqual(platform, PLATFORMS.windows)) {
return 'exe'
}
if (isEqual(platform, PLATFORMS.linux)) {
return 'AppImage.zip'
}

return 'zip'
}

const config = {
GITHUB_LINK: 'https://github.com/bitfinexcom/bfx-report-electron',
LATEST_ELECTRON_RELEASE_LINK: 'https://api.github.com/repos/bitfinexcom/bfx-report-electron/releases/latest',
DEFAULT_ELECTRON_VERSION,
getElectronReleaseLink: ({ version, platform, ext = 'zip' }) => {
const currExt = version === DEFAULT_ELECTRON_VERSION
? 'zip'
getElectronReleaseLink: ({ version, platform, ext = getDefaultExt(platform) }) => {
const normVersion = version.replace('v', '')
const currExt = isEqual(normVersion, DEFAULT_ELECTRON_VERSION)
? getDefaultExt(platform)
: ext

return `${APP_RELEASES_URL}/${version}/BitfinexReport-${_replace(version, 'v', '')}-x64-${platform}.${currExt}`
return `${APP_RELEASES_URL}/${version}/BitfinexReport-${normVersion}-x64-${platform}.${currExt}`
},
}

Expand Down