fix: make t&c changes backwards compatible

This commit is contained in:
Taranto 2020-02-24 10:29:36 +00:00 committed by Josh Harvey
parent 8f28b7aa0a
commit 7fc8ff3d1d
3 changed files with 31 additions and 4 deletions

View file

@ -6,6 +6,7 @@ const bodyParser = require('body-parser')
const _ = require('lodash/fp')
const express = require('express')
const nmd = require('nano-markdown')
const semver = require('semver')
const dbErrorCodes = require('./db-error-codes')
const options = require('./options')
@ -22,6 +23,8 @@ const customers = require('./customers')
const logs = require('./logs')
const compliance = require('./compliance')
const version = require('../package.json').version
const argv = require('minimist')(process.argv.slice(2))
const CLOCK_SKEW = 60 * 1000
@ -44,6 +47,7 @@ function checkHasLightning (settings) {
}
function poll (req, res, next) {
const machineVersion = req.query.version
const deviceId = req.deviceId
const deviceTime = req.deviceTime
const serialNumber = req.query.sn
@ -75,6 +79,7 @@ function poll (req, res, next) {
const response = {
error: null,
locale,
version,
txLimit: config.cashInTransactionLimit,
idVerificationEnabled: config.idVerificationEnabled,
smsVerificationActive: config.smsVerificationActive,
@ -108,6 +113,12 @@ function poll (req, res, next) {
}
}
// BACKWARDS_COMPATIBILITY 7.5
// machines before 7.5 expect t&c on poll
if (!machineVersion || semver.lt(machineVersion, '7.5.0-beta')) {
response.terms = config.termsScreenActive && config.termsScreenText ? createTerms(config) : null
}
if (response.idVerificationEnabled) {
response.idVerificationLimit = config.idVerificationLimit
}

23
package-lock.json generated
View file

@ -7816,6 +7816,14 @@
"is-builtin-module": "^1.0.0",
"semver": "2 || 3 || 4 || 5",
"validate-npm-package-license": "^3.0.1"
},
"dependencies": {
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
}
}
},
"normalize-path": {
@ -9991,10 +9999,9 @@
"integrity": "sha1-uztgbdaGN8okRoGhD97mxRIEkpQ="
},
"semver": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz",
"integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no=",
"dev": true
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.1.3.tgz",
"integrity": "sha512-ekM0zfiA9SCBlsKa2X1hxyxiI4L3B6EbVJkkdgQXnSEEaHlGdvyodMruTiulSRWMMB4NeIuYNMC9rTKTz97GxA=="
},
"semver-diff": {
"version": "2.1.0",
@ -10003,6 +10010,14 @@
"dev": true,
"requires": {
"semver": "^5.0.3"
},
"dependencies": {
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
}
}
},
"send": {

View file

@ -51,6 +51,7 @@
"pify": "^3.0.0",
"pretty-ms": "^2.1.0",
"promise-sequential": "^1.1.1",
"semver": "^7.1.3",
"serve-static": "^1.12.4",
"socket.io": "^2.0.3",
"socket.io-client": "^2.0.3",