Commit 6cd19a9c944a38c94a13aba9136c64eb7107379d
1 parent
3f614b14ac
Exists in
master
Typo
Showing 2 changed files with 4 additions and 1 deletions Side-by-side Diff
lib/apiserver/index.js
... | ... | @@ -28,7 +28,7 @@ const app = express(); |
28 | 28 | messagingService.setTransport(transport); |
29 | 29 | |
30 | 30 | function apikeyChecker(req, res, next) { |
31 | - res.locals.has_valid_apikey = req.params.apikey === (config.apiserver.apikey || config.handler_callback_server.apikey); | |
31 | + res.locals.has_valid_apikey = req.params.apikey === ((config.apiserver && config.apiserver.apikey ? config.apiserver.apikey : null) || config.handler_callback_server.apikey); | |
32 | 32 | if (res.locals.has_valid_apikey) { |
33 | 33 | next(); |
34 | 34 | } |
lib/transport.js
... | ... | @@ -16,6 +16,7 @@ const modemSelect = require('./modemSelect'); |
16 | 16 | const modems = require('./modems2'); |
17 | 17 | const partnerLastSeen = require('./partner-last-seen'); |
18 | 18 | const history = require('./history'); |
19 | +const prefixes = require('./prefixes'); | |
19 | 20 | |
20 | 21 | function _send(destinationNumber, msg, handlerIMSI) { |
21 | 22 | |
... | ... | @@ -114,6 +115,8 @@ async function send(partner, msg) { |
114 | 115 | if (!msg) return; |
115 | 116 | |
116 | 117 | const destinationNumber = modemSelect.removeSuffixFromNumber(partner, config); |
118 | + const prefixName = await prefixes(destinationNumber); | |
119 | + logger.verbose('Destination number prefix lookup', {partner: destinationNumber, prefix: prefixName}); | |
117 | 120 | |
118 | 121 | // logger.verbose('Choosing handler name', { partner, destinationNumber, msg, origin }); |
119 | 122 | const handlerIMSI = await partnerLastSeen.get(destinationNumber) ; |