2017-08-24 09:15:06 +00:00
|
|
|
var express = require('express')
|
2017-04-01 09:19:30 +00:00
|
|
|
|
2015-01-21 03:00:09 +00:00
|
|
|
module.exports = function (modsManager) {
|
2017-08-24 09:15:06 +00:00
|
|
|
var router = express.Router()
|
2017-04-01 09:19:30 +00:00
|
|
|
|
|
|
|
router.get('/', function (req, res) {
|
2017-08-24 09:15:06 +00:00
|
|
|
res.send(modsManager.mods)
|
|
|
|
})
|
2017-04-01 09:19:30 +00:00
|
|
|
|
|
|
|
router.delete('/:mod', function (req, res) {
|
|
|
|
modsManager.delete(req.params.mod, function (err) {
|
|
|
|
if (err) {
|
2017-08-24 09:15:06 +00:00
|
|
|
res.status(500).send(err)
|
2017-04-01 09:19:30 +00:00
|
|
|
} else {
|
2018-01-20 20:59:41 +00:00
|
|
|
res.status(204).send()
|
2017-04-01 09:19:30 +00:00
|
|
|
}
|
2017-08-24 09:15:06 +00:00
|
|
|
})
|
|
|
|
})
|
2017-04-01 09:19:30 +00:00
|
|
|
|
|
|
|
router.post('/refresh', function (req, res) {
|
2017-08-24 09:15:06 +00:00
|
|
|
modsManager.updateMods()
|
2018-01-20 20:59:41 +00:00
|
|
|
res.status(204).send()
|
2017-08-24 09:15:06 +00:00
|
|
|
})
|
2017-04-01 09:19:30 +00:00
|
|
|
|
2017-08-24 09:15:06 +00:00
|
|
|
return router
|
|
|
|
}
|