WIP
This commit is contained in:
parent
f91992e20d
commit
11b5958c60
4 changed files with 77 additions and 19 deletions
|
|
@ -234,8 +234,31 @@ function updatePhone (req, res) {
|
|||
}
|
||||
|
||||
function fetchPhoneTx (req, res) {
|
||||
return plugins.updatePhone(req.query.phone)
|
||||
.then(code => res.send(200))
|
||||
return plugins.fetchPhoneTx(req.query.phone)
|
||||
.then(r => res.json(r))
|
||||
.catch(err => {
|
||||
logger.error(err)
|
||||
res.send(500)
|
||||
})
|
||||
}
|
||||
|
||||
function waitForDispense (req, res) {
|
||||
return plugins.fetchTx(session(req), req.query.status)
|
||||
.then(r => {
|
||||
if (!r) return res.send(404)
|
||||
if (r.status === req.query.status) return res.send(304)
|
||||
res.json(r)
|
||||
})
|
||||
.catch(err => {
|
||||
logger.error(err)
|
||||
res.send(500)
|
||||
})
|
||||
}
|
||||
|
||||
function dispense (req, res) {
|
||||
const originalSessionId = req.query['original-session-id']
|
||||
return plugins.addDispense(session(req).fingerprint, originalSessionId)
|
||||
.then(() => res.send(200))
|
||||
.catch(err => {
|
||||
logger.error(err)
|
||||
res.send(500)
|
||||
|
|
@ -268,6 +291,8 @@ function init (localConfig) {
|
|||
app.post('/phone_code', authMiddleware, phoneCode)
|
||||
app.post('/update-phone', authMiddleware, updatePhone)
|
||||
app.get('/phone-tx', authMiddleware, fetchPhoneTx)
|
||||
app.get('/await-dispense', authMiddleware, waitForDispense)
|
||||
app.post('/dispense', authMiddleware, dispense)
|
||||
|
||||
localApp.get('/pid', function (req, res) {
|
||||
var machineFingerprint = req.query.fingerprint
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue