From f43dd7be61dd527e2bb320636976ce35c68a3137 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 26 Oct 2012 06:18:09 -0400 Subject: [PATCH] added ability to disable web sockets --- ChangeLog | 2 ++ client.js | 12 ++++++------ config.json | 1 + lib/cloudfunc.js | 31 ------------------------------- server.js | 14 ++++++++++---- 5 files changed, 19 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0910cd21..991a0681 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,8 @@ new module. * Fixed bug with context menu hiding (on Esc). Keys was unbinded. +* Added ability to disable web sockets. + 2012.10.01, Version 0.1.7 diff --git a/client.js b/client.js index 261ff1d5..5bf0f2fa 100644 --- a/client.js +++ b/client.js @@ -1243,10 +1243,10 @@ CloudClient.init = function(){ this.OLD_BROWSER = true; Util.jsload(CloudClient.LIBDIRCLIENT + 'ie.js', function(){ - Util.jqueryLoad( initModules ); + Util.jqueryLoad( baseInit ); }); } - else initModules(); + else baseInit(); }; function initModules(){ @@ -1264,9 +1264,7 @@ function initModules(){ success: function(pModules){ if( Util.isArray(pModules) ) for(var i = 0, n = pModules.length; i < n ; i++) - loadModule(pModules[i]); - - baseInit(); + loadModule(pModules[i]); }, error: baseInit @@ -1340,7 +1338,9 @@ function baseInit(){ '.panel{' + 'height:' + lHeight +'px;' + '}' - }); + }); + + initModules(); } /* функция меняет ссыки на ajax-овые */ diff --git a/config.json b/config.json index 75bcf6c6..b8613f7d 100644 --- a/config.json +++ b/config.json @@ -9,6 +9,7 @@ }, "server" : true, "logs" : false, + "socket" : true, "port" : 31337, "ip" : "127.0.0.1" } \ No newline at end of file diff --git a/lib/cloudfunc.js b/lib/cloudfunc.js index d4454ecd..0f1119e9 100644 --- a/lib/cloudfunc.js +++ b/lib/cloudfunc.js @@ -26,37 +26,6 @@ var CloudFunc = { }; -/* STRINGS */ - -/** - * function check is strings are equal - * @param pStr1 - * @param pStr2 - */ -CloudFunc.strCmp = function (pStr1, pStr2){ - return this.isContainStr(pStr1, pStr2) && - pStr1.length == pStr2.length; -}; - -/** - * function returns is pStr1 contains pStr2 - * @param pStr1 - * @param pStr2 - */ -CloudFunc.isContainStr = function(pStr1, pStr2){ - return pStr1 && - pStr2 && - pStr1.indexOf(pStr2) >= 0; -}; - -/** - * function remove substring from string - * @param pStr - * @param pSubStr - */ -CloudFunc.removeStr = function(pStr, pSubStr){ - return pStr.replace(pSubStr,''); -}; /* * Функция убирает последний слеш, * если он - последний символ строки diff --git a/server.js b/server.js index 6b479741..03cb3326 100644 --- a/server.js +++ b/server.js @@ -21,6 +21,7 @@ var CloudServer = { }, server : true, logs : false, + socket : true, port : 31337, ip : '127.0.0.1' }, @@ -188,9 +189,13 @@ CloudServer.start = function (pConfig) { this.Server = http.createServer(this._controller); this.Server.listen(this.Port, this.IP); - if(CloudServer.Socket) + if(this.Config.socket && CloudServer.Socket){ CloudServer.Socket.listen(this.Server); - + console.log('sockets running'); + } + else + console.log('sockets disabled'); + console.log('Cloud Commander server running at http://' + this.IP + ':' + this.Port); }catch(pError){ @@ -296,7 +301,8 @@ CloudServer._controller = function(pReq, pRes) var lNoJS_s = CloudFunc.NOJS; var lFS_s = CloudFunc.FS; console.log("request for " + pathname + " received..."); - + + /* если в пути нет информации ни о ФС, * ни об отсутствии js, * ни о том, что это корневой @@ -450,7 +456,7 @@ CloudServer._controller = function(pReq, pRes) CloudServer.Queries[DirPath] = lQuery; /* Проверяем с папкой ли мы имеем дело */ - + /* читаем основные данные о файле */ Fs.stat(DirPath, CloudServer._stated);