diff --git a/lib/mods.js b/lib/mods.js index 190670c..9ae5685 100644 --- a/lib/mods.js +++ b/lib/mods.js @@ -14,13 +14,6 @@ var Mods = function (config) { var self = this; }; -Mods.removeDuplicates = function (mods) { - return mods.reduce(function(a,b){ - if (a.indexOf(b) < 0 ) a.push(b); - return a; - },[]); -}; - Mods.prototype = new events.EventEmitter(); Mods.prototype.delete = function (mod, cb) { @@ -122,17 +115,6 @@ Mods.prototype.isPlayWithSixMod = function (modPath, cb) { }); }; -Mods.prototype.resolveMods = function (modsToResolve, cb) { - var self = this; - playwithsix.resolveDependencies(modsToResolve, {lite: this.liteMods}, function (err, mods) { - if (!err && mods) { - cb(null, Mods.removeDuplicates(modsToResolve.concat(mods))); - } else { - cb(err); - } - }); -}; - Mods.prototype.search = function (query, cb) { playwithsix.search(query, function (err, mods) { if (err) { diff --git a/routes/servers.js b/routes/servers.js index 9703e42..b5a028c 100644 --- a/routes/servers.js +++ b/routes/servers.js @@ -1,14 +1,4 @@ module.exports = function (manager, mods) { - var resolveMods = function(server, cb) { - mods.resolveMods(server.mods, function(err, resolvedMods) { - if (!err) { - server.mods = resolvedMods; - manager.save(); - } - cb(); - }); - }; - return { index: function (req, res){ res.send(manager.getServers()); @@ -16,13 +6,7 @@ module.exports = function (manager, mods) { create: function (req, res) { var server = manager.addServer(req.body); - if (server.mods.length > 0) { - resolveMods(server, function() { - res.send(server); - }); - } else { - res.send(server); - } + res.send(server); }, show: function (req, res){ @@ -34,14 +18,7 @@ module.exports = function (manager, mods) { var server = manager.getServer(req.params.server); server.update(req.body); manager.save(); - - if (server.mods.length > 0) { - resolveMods(server, function() { - res.send(server); - }); - } else { - res.send(server); - } + res.send(server); }, destroy: function(req, res){ diff --git a/test/lib/mods.js b/test/lib/mods.js index 0e77818..14041b1 100644 --- a/test/lib/mods.js +++ b/test/lib/mods.js @@ -3,12 +3,6 @@ var should = require('should'); var Mods = require('../../lib/mods.js'); describe('Mods', function() { - describe('removeDuplicates()', function() { - it('should remove duplicate mods', function() { - Mods.removeDuplicates(['mod1', 'mod1']).should.eql(['mod1']); - }); - }); - describe('search()', function() { it('should find mods', function(done) { var mods = new Mods();