feat: only refetch t&c on config change
This commit is contained in:
parent
9ccdd7d6f9
commit
f1edea4e8a
4 changed files with 19 additions and 31 deletions
|
|
@ -793,7 +793,8 @@ function plugins (settings, deviceId) {
|
||||||
buy,
|
buy,
|
||||||
sell,
|
sell,
|
||||||
notificationsEnabled,
|
notificationsEnabled,
|
||||||
notifyOperator
|
notifyOperator,
|
||||||
|
fetchCurrentConfigVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,6 @@ function poll (req, res, next) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const terms = config.termsScreenActive && config.termsScreenText ? createTerms(config) : null
|
|
||||||
|
|
||||||
const response = {
|
const response = {
|
||||||
error: null,
|
error: null,
|
||||||
locale,
|
locale,
|
||||||
|
|
@ -95,7 +93,6 @@ function poll (req, res, next) {
|
||||||
frontCameraVerificationActive: config.frontCameraVerificationActive,
|
frontCameraVerificationActive: config.frontCameraVerificationActive,
|
||||||
frontCameraVerificationThreshold: config.frontCameraVerificationThreshold,
|
frontCameraVerificationThreshold: config.frontCameraVerificationThreshold,
|
||||||
receiptPrintingActive: config.receiptPrintingActive,
|
receiptPrintingActive: config.receiptPrintingActive,
|
||||||
terms,
|
|
||||||
cassettes,
|
cassettes,
|
||||||
twoWayMode: config.cashOutEnabled,
|
twoWayMode: config.cashOutEnabled,
|
||||||
zeroConfLimit: config.zeroConfLimit,
|
zeroConfLimit: config.zeroConfLimit,
|
||||||
|
|
@ -121,6 +118,21 @@ function poll (req, res, next) {
|
||||||
.catch(next)
|
.catch(next)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTermsConditions (req, res, next) {
|
||||||
|
const deviceId = req.deviceId
|
||||||
|
const settings = req.settings
|
||||||
|
|
||||||
|
const config = configManager.unscoped(req.settings.config)
|
||||||
|
const pi = plugins(settings, deviceId)
|
||||||
|
|
||||||
|
const terms = config.termsScreenActive && config.termsScreenText ? createTerms(config) : null
|
||||||
|
|
||||||
|
return pi.fetchCurrentConfigVersion().then(version => {
|
||||||
|
return res.json({ terms, version })
|
||||||
|
})
|
||||||
|
.catch(next)
|
||||||
|
}
|
||||||
|
|
||||||
function getTx (req, res, next) {
|
function getTx (req, res, next) {
|
||||||
if (req.query.status) {
|
if (req.query.status) {
|
||||||
return helpers.fetchStatusTx(req.params.id, req.query.status)
|
return helpers.fetchStatusTx(req.params.id, req.query.status)
|
||||||
|
|
@ -357,6 +369,7 @@ const skip = (req, res) => _.includes(req.path, ['/poll', '/state', '/logs']) &&
|
||||||
|
|
||||||
const configRequiredRoutes = [
|
const configRequiredRoutes = [
|
||||||
'/poll',
|
'/poll',
|
||||||
|
'/terms_conditions',
|
||||||
'/event',
|
'/event',
|
||||||
'/phone_code',
|
'/phone_code',
|
||||||
'/customer',
|
'/customer',
|
||||||
|
|
@ -381,6 +394,7 @@ app.use(configRequiredRoutes, populateSettings)
|
||||||
app.use(filterOldRequests)
|
app.use(filterOldRequests)
|
||||||
|
|
||||||
app.get('/poll', poll)
|
app.get('/poll', poll)
|
||||||
|
app.get('/terms_conditions', getTermsConditions)
|
||||||
app.post('/state', stateChange)
|
app.post('/state', stateChange)
|
||||||
|
|
||||||
app.post('/verify_user', verifyUser)
|
app.post('/verify_user', verifyUser)
|
||||||
|
|
|
||||||
24
package-lock.json
generated
24
package-lock.json
generated
|
|
@ -5368,14 +5368,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"express-bandwidth": {
|
|
||||||
"version": "0.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/express-bandwidth/-/express-bandwidth-0.0.1.tgz",
|
|
||||||
"integrity": "sha1-kO32A65WCofzNaOmumfpDIZE240=",
|
|
||||||
"requires": {
|
|
||||||
"debug": "^2.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"express-limiter": {
|
"express-limiter": {
|
||||||
"version": "1.6.0",
|
"version": "1.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/express-limiter/-/express-limiter-1.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/express-limiter/-/express-limiter-1.6.0.tgz",
|
||||||
|
|
@ -5389,14 +5381,6 @@
|
||||||
"defaults": "^1.0.3"
|
"defaults": "^1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"express-transform": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/express-transform/-/express-transform-1.0.1.tgz",
|
|
||||||
"integrity": "sha1-RS85yBQLozDaHqKm3cWgtPWCmUc=",
|
|
||||||
"requires": {
|
|
||||||
"debug": "^2.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"express-ws": {
|
"express-ws": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/express-ws/-/express-ws-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/express-ws/-/express-ws-3.0.0.tgz",
|
||||||
|
|
@ -12395,14 +12379,6 @@
|
||||||
"punycode": "^1.4.1"
|
"punycode": "^1.4.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"transfer-rate": {
|
|
||||||
"version": "2.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/transfer-rate/-/transfer-rate-2.2.0.tgz",
|
|
||||||
"integrity": "sha512-WWIzi3tGB5WB+WriYDKKaKWDsUjCHko1UFPU6xjruGtb36l20aBVAPI4ZKcR1VUgvKlCNOhpfMBJZ2gWnlYu/w==",
|
|
||||||
"requires": {
|
|
||||||
"on-finished": "2.3.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"trim-newlines": {
|
"trim-newlines": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,8 @@
|
||||||
"ethereumjs-util": "^5.2.0",
|
"ethereumjs-util": "^5.2.0",
|
||||||
"ethereumjs-wallet": "^0.6.0",
|
"ethereumjs-wallet": "^0.6.0",
|
||||||
"express": "^4.15.4",
|
"express": "^4.15.4",
|
||||||
"express-bandwidth": "0.0.1",
|
|
||||||
"express-limiter": "^1.6.0",
|
"express-limiter": "^1.6.0",
|
||||||
"express-rate-limit": "^2.9.0",
|
"express-rate-limit": "^2.9.0",
|
||||||
"express-transform": "^1.0.1",
|
|
||||||
"express-ws": "^3.0.0",
|
"express-ws": "^3.0.0",
|
||||||
"futoin-hkdf": "^1.0.2",
|
"futoin-hkdf": "^1.0.2",
|
||||||
"got": "^7.1.0",
|
"got": "^7.1.0",
|
||||||
|
|
@ -63,7 +61,6 @@
|
||||||
"socket.io": "^2.0.3",
|
"socket.io": "^2.0.3",
|
||||||
"socket.io-client": "^2.0.3",
|
"socket.io-client": "^2.0.3",
|
||||||
"talisman": "^0.20.0",
|
"talisman": "^0.20.0",
|
||||||
"transfer-rate": "^2.2.0",
|
|
||||||
"twilio": "^3.6.1",
|
"twilio": "^3.6.1",
|
||||||
"uuid": "^3.1.0",
|
"uuid": "^3.1.0",
|
||||||
"web3": "^0.20.6",
|
"web3": "^0.20.6",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue