mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Updates PlayWithSix module and fixes resolve ignored mods not on PWS. Fixes ACRE being calculated for Arma 2.
This commit is contained in:
parent
997bb5e9f3
commit
8b893cb93c
@ -10,6 +10,6 @@
|
||||
"when": "~3.1.0",
|
||||
"gamedig": "^0.2.4",
|
||||
"ip": "^0.3.0",
|
||||
"playwithsix": "0.0.4"
|
||||
"playwithsix": "0.0.5"
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,18 @@ var Manager = require('./../manager');
|
||||
|
||||
var manager = new Manager();
|
||||
|
||||
function isPlayWithSixIgnoredMod(mod) {
|
||||
var ignoredMods = ["@acre"];
|
||||
return ignoredMods.indexOf(mod.toLowerCase()) != -1;
|
||||
}
|
||||
|
||||
function removeDuplicates(mods) {
|
||||
return mods.reduce(function(a,b){
|
||||
if (a.indexOf(b) < 0 ) a.push(b);
|
||||
return a;
|
||||
},[]);
|
||||
}
|
||||
|
||||
exports.index = function (req, res){
|
||||
var servers = [];
|
||||
|
||||
@ -45,9 +57,13 @@ exports.update = function(req, res){
|
||||
server.mods = req.body.mods;
|
||||
manager.save();
|
||||
|
||||
playwithsix.resolveDependencies(server.mods, function (err, mods) {
|
||||
var modsToResolve = server.mods.filter(function(mod) {
|
||||
return !isPlayWithSixIgnoredMod(mod);
|
||||
});
|
||||
|
||||
playwithsix.resolveDependencies(modsToResolve, function (err, mods) {
|
||||
if (!err && mods) {
|
||||
server.mods = mods;
|
||||
server.mods = removeDuplicates(server.mods.concat(mods));
|
||||
}
|
||||
|
||||
manager.save();
|
||||
|
Loading…
Reference in New Issue
Block a user