works with l-m again

This commit is contained in:
Josh Harvey 2016-10-16 03:13:52 +03:00
parent 5d6cc78b37
commit 03edd9c7e0
5 changed files with 62 additions and 51 deletions

View file

@ -42,7 +42,7 @@ function buildRates (deviceId) {
}
function buildBalances (deviceId) {
const cryptoCodes = plugins.getCryptoCodes()
const cryptoCodes = plugins.getCryptoCodes(deviceId)
const _balances = {}
cryptoCodes.forEach(cryptoCode => {
@ -73,19 +73,30 @@ function poll (req, res) {
const config = plugins.getConfig(deviceId)
console.log('DEBUG30')
plugins.pollQueries(deviceId)
.then(results => {
console.log('DEBUG31')
const cartridges = results.cartridges
const reboot = reboots[deviceId] === pid
const reboot = pid && reboots[deviceId] && reboots[deviceId] === pid
console.log('DEBUG2: %j, %s, %s', reboots, reboot, pid)
const langs = config.languages.machineLanguages
console.log('DEBUG33')
const locale = {
currency: config.fiat.fiatCurrency,
primaryLocale: langs[0],
primaryLocales: langs
currency: config.currencies.fiatCurrency,
localeInfo: {
primaryLocale: langs[0],
primaryLocales: langs
}
}
console.log('DEBUG34')
const response = {
err: null,
locale,
@ -98,16 +109,20 @@ function poll (req, res) {
reboot,
rates,
balances,
coins: config.cryptos.cryptos
coins: config.currencies.cryptos
}
console.log('DEBUG35')
if (response.idVerificationEnabled) {
response.idVerificationLimit = config.compliance.idVerificationLimit
}
console.log('DEBUG32')
res.json(response)
})
.catch(logger.error)
.catch(e => { console.log(e); logger.error(e) })
plugins.recordPing(deviceId, deviceTime, req.query)
.catch(logger.error)
@ -140,8 +155,6 @@ function send (req, res) {
return plugins.sendCoins(getDeviceId(req), tx)
.then(status => {
console.log('DEBUG14: %j', status)
res.json({
txHash: status && status.txHash,
txId: status && status.txId