Browse Source
use new production api (temporary url) for commands
master
Valentin D. Pinkman
7 years ago
No known key found for this signature in database
GPG Key ID: E7D110669FFB8D3E
6 changed files with
19 additions and
20 deletions
-
src/commands/listApps.js
-
src/components/ManagerPage/AppsList.js
-
src/helpers/apps/listApps.js
-
src/helpers/constants.js
-
src/helpers/devices/getFirmwareInfo.js
-
src/helpers/devices/getLatestFirmwareForDevice.js
|
@ -5,15 +5,14 @@ import { fromPromise } from 'rxjs/observable/fromPromise' |
|
|
|
|
|
|
|
|
import listApps from 'helpers/apps/listApps' |
|
|
import listApps from 'helpers/apps/listApps' |
|
|
|
|
|
|
|
|
// type Input = {
|
|
|
type Input = { |
|
|
// targetId: string | number,
|
|
|
targetId: string | number, |
|
|
// }
|
|
|
} |
|
|
|
|
|
|
|
|
type Input = * |
|
|
|
|
|
type Result = * |
|
|
type Result = * |
|
|
|
|
|
|
|
|
const cmd: Command<Input, Result> = createCommand('listApps', () => |
|
|
const cmd: Command<Input, Result> = createCommand('listApps', ({ targetId }) => |
|
|
/* { targetId } */ fromPromise(listApps(/* targetId */)), |
|
|
fromPromise(listApps(targetId)), |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
export default cmd |
|
|
export default cmd |
|
|
|
@ -46,7 +46,7 @@ type LedgerApp = { |
|
|
|
|
|
|
|
|
type Props = { |
|
|
type Props = { |
|
|
device: Device, |
|
|
device: Device, |
|
|
// targetId: string | number,
|
|
|
targetId: string | number, |
|
|
t: T, |
|
|
t: T, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -75,8 +75,8 @@ class AppsList extends PureComponent<Props, State> { |
|
|
|
|
|
|
|
|
async fetchAppList() { |
|
|
async fetchAppList() { |
|
|
try { |
|
|
try { |
|
|
// const { targetId } = this.props // TODO: REUSE THIS WHEN SERVER IS UP
|
|
|
const { targetId } = this.props |
|
|
const appsList = CACHED_APPS || (await listApps.send().toPromise()) |
|
|
const appsList = CACHED_APPS || (await listApps.send({ targetId }).toPromise()) |
|
|
CACHED_APPS = appsList |
|
|
CACHED_APPS = appsList |
|
|
if (!this._unmounted) { |
|
|
if (!this._unmounted) { |
|
|
this.setState({ appsList, status: 'idle' }) |
|
|
this.setState({ appsList, status: 'idle' }) |
|
|
|
@ -1,18 +1,18 @@ |
|
|
// @flow
|
|
|
// @flow
|
|
|
import axios from 'axios' |
|
|
import axios from 'axios' |
|
|
|
|
|
|
|
|
// const { API_BASE_URL } = process.env
|
|
|
import { API_BASE_URL } from 'helpers/constants' |
|
|
|
|
|
|
|
|
export default async (/* targetId: string | number */) => { |
|
|
export default async (targetId: string | number) => { |
|
|
try { |
|
|
try { |
|
|
// const { data: deviceData } = await axios.get(
|
|
|
const { data: deviceData } = await axios.get( |
|
|
// `${API_BASE_URL}/device_versions_target_id/${targetId}`,
|
|
|
`${API_BASE_URL}/device_versions_target_id/${targetId}`, |
|
|
// )
|
|
|
) |
|
|
const { data } = await axios.get('https://api.ledgerwallet.com/update/applications') |
|
|
const { data } = await axios.get('https://api.ledgerwallet.com/update/applications') |
|
|
|
|
|
|
|
|
// if (deviceData.name in data) {
|
|
|
if (deviceData.name in data) { |
|
|
// return data[deviceData.name]
|
|
|
return data[deviceData.name] |
|
|
// }
|
|
|
} |
|
|
|
|
|
|
|
|
return data['nanos-1.4'] |
|
|
return data['nanos-1.4'] |
|
|
} catch (err) { |
|
|
} catch (err) { |
|
|
|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
|
export const BASE_SOCKET_URL = 'ws://api.ledgerwallet.com' |
|
|
export const BASE_SOCKET_URL = 'ws://api.ledgerwallet.com' |
|
|
export const BASE_SOCKET_URL_TEMP = 'ws://manager.ledger.fr:3500' |
|
|
export const BASE_SOCKET_URL_TEMP = 'ws://manager.ledger.fr:3500' |
|
|
|
|
|
export const API_BASE_URL = process.env.API_BASE_URL || 'https://beta.manager.live.ledger.fr/api' |
|
|
// If you want to test locally with https://github.com/LedgerHQ/ledger-update-python-api
|
|
|
// If you want to test locally with https://github.com/LedgerHQ/ledger-update-python-api
|
|
|
// export const BASE_SOCKET_URL = 'ws://localhost:3001/update'
|
|
|
// export const BASE_SOCKET_URL = 'ws://localhost:3001/update'
|
|
|
|
|
|
|
|
|
|
@ -2,7 +2,7 @@ |
|
|
import axios from 'axios' |
|
|
import axios from 'axios' |
|
|
import isEmpty from 'lodash/isEmpty' |
|
|
import isEmpty from 'lodash/isEmpty' |
|
|
|
|
|
|
|
|
const { API_BASE_URL } = process.env |
|
|
import { API_BASE_URL } from 'helpers/constants' |
|
|
|
|
|
|
|
|
type Input = { |
|
|
type Input = { |
|
|
version: string, |
|
|
version: string, |
|
|
|
@ -1,11 +1,10 @@ |
|
|
// @flow
|
|
|
// @flow
|
|
|
import axios from 'axios' |
|
|
import axios from 'axios' |
|
|
import isEmpty from 'lodash/isEmpty' |
|
|
import isEmpty from 'lodash/isEmpty' |
|
|
|
|
|
import { API_BASE_URL } from 'helpers/constants' |
|
|
|
|
|
|
|
|
import getFirmwareInfo from './getFirmwareInfo' |
|
|
import getFirmwareInfo from './getFirmwareInfo' |
|
|
|
|
|
|
|
|
const { API_BASE_URL } = process.env |
|
|
|
|
|
|
|
|
|
|
|
type Input = { |
|
|
type Input = { |
|
|
targetId: string | number, |
|
|
targetId: string | number, |
|
|
version: string, |
|
|
version: string, |
|
|