diff --git a/lib/server/socket.js b/lib/server/socket.js index 28ef5d4f..c29329eb 100644 --- a/lib/server/socket.js +++ b/lib/server/socket.js @@ -41,6 +41,25 @@ function onMessage(pConnNum, pSocket){ return function(pCommand) { console.log(pCommand); + if( pCommand.indexOf('cloudcmd') === 0 ){ + pCommand = pCommand.replace('cloudcmd', ''); + + if(pCommand.indexOf(' exit') === 0){ + pCommand = 'kill -9 ' + process.pid; + } + else { + var lMsg = { + stdout : 'cloudcmd exit - for shutdown cloudcmd', + stderr : null + }; + + lMsg = JSON.stringify(lMsg); + pSocket.send(lMsg); + + return; + } + } + /* change code page to unicode */ if(Win32_b) pCommand = 'chcp 65001 |' + pCommand; diff --git a/server.js b/server.js index 9e9e48be..c725eb66 100644 --- a/server.js +++ b/server.js @@ -656,13 +656,14 @@ CloudServer.indexReaded = function(pList){ if(pError){ return console.log(pError); } - - var lWin32 = process.platform === 'win32'; + /* и сохраняем в кэш */ CloudServer.Cache.set(CloudServer.INDEX, pIndex); pIndex = pIndex.toString(); + var lWin32 = process.platform === 'win32'; + /* если выбрана опция минифизировать скрпиты * меняем в index.html обычные css на * минифицированый @@ -672,7 +673,7 @@ CloudServer.indexReaded = function(pList){ if(lWin32) lReplace_s = lReplace_s + '/css/reset.css>'; else - lReplace_s = lReplace_s + '"/css/reset.css>"'; + lReplace_s = lReplace_s + '"/css/reset.css">'; pIndex = pIndex.replace(lReplace_s, ''); pIndex = pIndex.replace('/css/style.css', CloudServer.Minify.MinFolder + 'all.min.css'); @@ -686,7 +687,7 @@ CloudServer.indexReaded = function(pList){ '' + CloudFunc.setTitle() + ''); if(!CloudServer.Config.appcache){ - if(!lWin32) + if(lWin32) pIndex = pIndex.replace(' manifest=/cloudcmd.appcache', ''); else pIndex = pIndex.replace(' manifest="/cloudcmd.appcache"', '');