diff --git a/index.js b/index.js index 67ba10a..6f1a56f 100644 --- a/index.js +++ b/index.js @@ -407,14 +407,14 @@ app.put('/api/v1/admin/route/:id', (req, res) => { // Update a route // Update route const server = req.body.server || row.server; const port = req.body.port || row.port; - const auth = req.body.apiKey || row.auth; + const auth = req.body.auth || row.auth; const secret = req.body.secret || row.secret; const block_start = req.body.block_start || row.block_start; const block_length = req.body.block_length || row.block_length; const contact = req.body.contact || row.contact; console.log(`Updating ${req.params.id} to ${server}:${port} with ${auth}:${secret} for ${block_start} - ${block_start + block_length}. Contact: ${contact}`); - conn.query('UPDATE routes SET server = ?, port = ?, auth = ?, secret = ?, block_start = ?, block_length = ?, contact = ? WHERE id = ?', - [server, port, auth, secret, block_start, block_length, contact, req.params.id]).then(async () => { + conn.query('UPDATE routes SET server = ?, port = ?, auth = ?, secret = ?, block_start = ?, block_length = ?, contact = ?, apiKey = ? WHERE id = ?', + [server, port, auth, secret, block_start, block_length, contact, req.body.apiKey, req.params.id]).then(async () => { res.json({ message: 'Updated' }); }).catch(err => { console.error('Error updating route:', err);