2015-01-21 03:00:09 +00:00
|
|
|
module.exports = function (modsManager) {
|
|
|
|
return {
|
|
|
|
index: function(req, res){
|
2015-02-01 04:27:12 +00:00
|
|
|
res.send(modsManager.mods);
|
2015-01-21 03:00:09 +00:00
|
|
|
},
|
2014-04-06 01:10:09 +00:00
|
|
|
|
2015-01-21 03:00:09 +00:00
|
|
|
create: function(req, res){
|
2015-12-29 15:19:55 +00:00
|
|
|
modsManager.download(req.body.name);
|
|
|
|
res.send(204, {});
|
2015-01-21 03:00:09 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
update: function(req, res){
|
2015-12-29 15:19:55 +00:00
|
|
|
modsManager.download(req.params.mod);
|
|
|
|
res.send(204, {});
|
2015-01-21 03:00:09 +00:00
|
|
|
},
|
2014-04-04 08:37:43 +00:00
|
|
|
|
2015-01-21 03:00:09 +00:00
|
|
|
destroy: function(req, res){
|
2015-07-22 18:16:30 +00:00
|
|
|
modsManager.delete(req.params.mod, function (err) {
|
|
|
|
if (err) {
|
|
|
|
res.send(500, err);
|
|
|
|
} else {
|
|
|
|
res.send(204, {});
|
|
|
|
}
|
|
|
|
});
|
2015-01-21 03:00:09 +00:00
|
|
|
},
|
2015-02-01 04:01:50 +00:00
|
|
|
|
2015-05-29 23:30:53 +00:00
|
|
|
refresh: function(req, res){
|
|
|
|
modsManager.updateMods();
|
|
|
|
res.send(200, {});
|
|
|
|
},
|
|
|
|
|
2015-02-01 04:01:50 +00:00
|
|
|
search: function(req, res){
|
|
|
|
var query = req.body.query || "";
|
|
|
|
modsManager.search(query, function (err, mods) {
|
|
|
|
if (err || !mods) {
|
|
|
|
res.send(500, err);
|
|
|
|
} else {
|
|
|
|
res.send(mods);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2015-01-21 03:00:09 +00:00
|
|
|
};
|
2014-04-06 01:10:09 +00:00
|
|
|
};
|