diff --git a/client/operation.js b/client/operation.js index 942ca275..55e61e96 100644 --- a/client/operation.js +++ b/client/operation.js @@ -7,6 +7,7 @@ /* global remedy */ /* global ishtar */ /* global salam */ +/* global omnes */ (function(CloudCmd, Util, DOM, rendy) { 'use strict'; @@ -115,17 +116,11 @@ setListeners(packer, {noContinue: true}, callback); packer.pack(data.from, data.to, data.names); }; - - extractFn = function(data, callback) { - setListeners(packer, {noContinue: true}, callback); - packer.extract(data.from, data.to); - }; }); }); packer.on('disconnect', function() { packFn = RESTful.pack; - extractFn = RESTful.extract; }); }); } @@ -137,15 +132,35 @@ _setPacker(prefix, 'ishtar', ishtar, fn); } + function _initExtractor(prefix, fn) { + omnes(prefix + '/omnes', prefix, function(packer) { + fn(); + packer.on('connect', function() { + authCheck(packer, function() { + extractFn = function(data, callback) { + setListeners(packer, {noContinue: true}, callback); + packer.extract(data.from, data.to); + }; + }); + }); + + packer.on('disconnect', function() { + extractFn = RESTful.extract; + }); + }); + } + function create(prefix) { var initSpero = currify(_initSpero); var initRemedy = currify(_initRemedy); var initPacker = currify(_initPacker); + var initExtractor = currify(_initExtractor); exec.parallel([ initSpero(prefix), initRemedy(prefix), - initPacker(prefix) + initPacker(prefix), + initExtractor(prefix) ], exec.ret); } @@ -536,7 +551,8 @@ '/spero/spero.js', '/remedy/remedy.js', '/ishtar/ishtar.js', - '/salam/salam.js' + '/salam/salam.js', + '/omnes/omnes.js' ].map(function(name) { return prefix + name; }); diff --git a/package.json b/package.json index 64619e09..86afb131 100644 --- a/package.json +++ b/package.json @@ -112,6 +112,7 @@ "flop": "^1.4.0", "format-io": "^0.9.6", "http-auth": "^2.3.1", + "inly": "^1.0.2", "ishtar": "^1.5.0", "jaguar": "^3.0.0", "jju": "^1.3.0", @@ -123,6 +124,7 @@ "minimist": "^1.2.0", "mollify": "^1.0.0", "nomine": "^1.0.1", + "omnes": "^1.0.3", "onezip": "^1.0.5", "opn": "^4.0.1", "os-homedir": "^1.0.0", diff --git a/server/cloudcmd.js b/server/cloudcmd.js index dcb82e2c..034b36cf 100644 --- a/server/cloudcmd.js +++ b/server/cloudcmd.js @@ -28,6 +28,7 @@ const spero = require('spero'); const remedy = require('remedy'); const ishtar = require('ishtar'); const salam = require('salam/legacy'); +const omnes = require('omnes/legacy'); const criton = require('criton'); const root = () => config('root'); @@ -163,6 +164,12 @@ function listen(prefix, socket) { prefix: prefix + '/salam', }); + omnes.listen(socket, { + root, + authCheck, + prefix: prefix + '/omnes', + }); + config('console') && konsole.listen(socket, { authCheck, prefix: prefix + '/console', @@ -235,6 +242,10 @@ function cloudcmd(prefix, plugins) { prefix: prefix + '/salam', }), + omnes({ + prefix: prefix + '/omnes', + }), + nomine({ prefix: prefix + '/rename', }), diff --git a/server/rest.js b/server/rest.js index 463b0772..85a4321e 100644 --- a/server/rest.js +++ b/server/rest.js @@ -11,6 +11,7 @@ const markdown = require(DIR + 'markdown'); const jaguar = require('jaguar/legacy'); const onezip = require('onezip/legacy'); +const inly = require('inly/legacy'); const flop = require('flop'); const pullout = require('pullout/legacy'); const ponse = require('ponse'); @@ -253,11 +254,14 @@ function extract(from, to, fn) { operation('extract', from, to, fn); } -function getPacker() { - if (config('packer') === 'zip') - return onezip; +function getPacker(operation) { + if (operation === 'extract') + return inly; - return jaguar; + if (config('packer') === 'zip') + return onezip.pack; + + return jaguar.pack; } function operation(op, from, to, names, fn) { @@ -268,13 +272,14 @@ function operation(op, from, to, names, fn) { ]; } - const packer = getPacker()[op](from, to, names); + const packer = getPacker(op); + const pack = packer(from, to, names); - packer.on('error', error => { + pack.on('error', error => { fn(error); }); - packer.on('progress', (count) => { + pack.on('progress', (count) => { process.stdout.write(rendy('\r{{ operation }} "{{ name }}": {{ count }}%', { operation : op, name : names[0], @@ -282,7 +287,7 @@ function operation(op, from, to, names, fn) { })); }); - packer.on('end', () => { + pack.on('end', () => { process.stdout.write('\n'); const name = path.basename(from);