2015-01-21 03:00:09 +00:00
|
|
|
module.exports = function (modsManager) {
|
|
|
|
return {
|
|
|
|
index: function(req, res){
|
|
|
|
modsManager.getMods(function (err, mods) {
|
|
|
|
if (err) {
|
|
|
|
res.send(500, err);
|
|
|
|
} else {
|
|
|
|
res.send(mods);
|
|
|
|
}
|
2014-04-06 01:10:09 +00:00
|
|
|
});
|
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){
|
|
|
|
modsManager.download(req.body.name, function (err, mods) {
|
|
|
|
if (err || !mods) {
|
|
|
|
res.send(500, err);
|
|
|
|
} else {
|
|
|
|
res.send(mods);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
show: function(req, res){
|
|
|
|
modsManager.traverse(req.params.mod, function (err, files) {
|
|
|
|
if (err || !files) {
|
|
|
|
console.error(err.stack || err);
|
|
|
|
res.send(500, err);
|
|
|
|
} else {
|
|
|
|
res.json(files);
|
|
|
|
}
|
2014-04-04 08:37:43 +00:00
|
|
|
});
|
2015-01-21 03:00:09 +00:00
|
|
|
},
|
2014-04-21 13:24:47 +00:00
|
|
|
|
2015-01-21 03:00:09 +00:00
|
|
|
update: function(req, res){
|
|
|
|
modsManager.download(req.params.mod, function (err, mods) {
|
|
|
|
if (err || !mods) {
|
|
|
|
res.send(500, err);
|
|
|
|
} else {
|
2014-07-28 17:46:01 +00:00
|
|
|
res.send(mods);
|
2015-01-21 03:00:09 +00:00
|
|
|
}
|
2014-04-21 13:24:47 +00:00
|
|
|
});
|
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){
|
|
|
|
res.send('destroy mod ' + req.params.mod);
|
|
|
|
},
|
|
|
|
};
|
2014-04-06 01:10:09 +00:00
|
|
|
};
|