mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
60 lines
1.3 KiB
JavaScript
60 lines
1.3 KiB
JavaScript
module.exports = function (modsManager) {
|
|
return {
|
|
index: function(req, res){
|
|
modsManager.getMods(function (err, mods) {
|
|
if (err) {
|
|
res.send(500, err);
|
|
} else {
|
|
res.send(mods);
|
|
}
|
|
});
|
|
},
|
|
|
|
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);
|
|
}
|
|
});
|
|
},
|
|
|
|
update: function(req, res){
|
|
modsManager.download(req.params.mod, function (err, mods) {
|
|
if (err || !mods) {
|
|
res.send(500, err);
|
|
} else {
|
|
res.send(mods);
|
|
}
|
|
});
|
|
},
|
|
|
|
destroy: function(req, res){
|
|
res.send('destroy mod ' + req.params.mod);
|
|
},
|
|
|
|
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);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
};
|