mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 09:24:51 +00:00
moved appcahe processing to cloudcmd.js
This commit is contained in:
parent
64d332f1ef
commit
9b304a4ee7
2 changed files with 25 additions and 21 deletions
23
cloudcmd.js
23
cloudcmd.js
|
|
@ -11,7 +11,8 @@ var DIR = process.cwd() + '/',
|
|||
CloudFunc = srvfunc.require(LIBDIR +'cloudfunc'),
|
||||
update = srvfunc.require(SRVDIR + 'update'),
|
||||
|
||||
Config = readConfig();
|
||||
srv = Server.CloudServer,
|
||||
Config = readConfig();
|
||||
|
||||
Server.start(Config, indexProcessing);
|
||||
|
||||
|
|
@ -25,7 +26,7 @@ function indexProcessing(pIndex, pList){
|
|||
* меняем в index.html обычные css на
|
||||
* минифицированый
|
||||
*/
|
||||
if(Server.CloudServer.Minify._allowed.css){
|
||||
if(srv.Minify._allowed.css){
|
||||
var lReplace_s = '<link rel=stylesheet href=';
|
||||
if(lWin32)
|
||||
lReplace_s = lReplace_s + '/css/reset.css>';
|
||||
|
|
@ -33,7 +34,7 @@ function indexProcessing(pIndex, pList){
|
|||
lReplace_s = lReplace_s + '"/css/reset.css">';
|
||||
|
||||
pIndex = pIndex.replace(lReplace_s, '');
|
||||
pIndex = pIndex.replace('/css/style.css', Server.CloudServer.Minify.MinFolder + 'all.min.css');
|
||||
pIndex = pIndex.replace('/css/style.css', srv.Minify.MinFolder + 'all.min.css');
|
||||
}
|
||||
|
||||
pIndex = pIndex.replace('<div id=fm class=no-js>',
|
||||
|
|
@ -43,7 +44,7 @@ function indexProcessing(pIndex, pList){
|
|||
pIndex = pIndex.replace('<title>Cloud Commander</title>',
|
||||
'<title>' + CloudFunc.setTitle() + '</title>');
|
||||
|
||||
if(!Server.CloudServer.Config.appcache){
|
||||
if(!srv.Config.appcache){
|
||||
if(lWin32)
|
||||
pIndex = pIndex.replace(' manifest=/cloudcmd.appcache', '');
|
||||
else
|
||||
|
|
@ -54,6 +55,20 @@ function indexProcessing(pIndex, pList){
|
|||
|
||||
}
|
||||
|
||||
function appCacheProcessing(){
|
||||
var lAppCache = srv.AppCache;
|
||||
/* создаём файл app cache */
|
||||
if(srv.Config.appcache && lAppCache && srv.Config.server){
|
||||
var lFiles = [{'//themes.googleusercontent.com/static/fonts/droidsansmono/v4/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff' : './font/DroidSansMono.woff'},
|
||||
{'//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js' : './lib/client/jquery.js'}];
|
||||
|
||||
if(srv.Minify._allowed.css)
|
||||
lFiles.push('./min/all.min.css');
|
||||
|
||||
lAppCache.addFiles(lFiles);
|
||||
lAppCache.createManifest();
|
||||
}
|
||||
}
|
||||
|
||||
function readConfig(){
|
||||
|
||||
|
|
|
|||
23
server.js
23
server.js
|
|
@ -127,7 +127,7 @@ else
|
|||
console.log('could not found one of Cloud Commander SS files');
|
||||
|
||||
/* базовая инициализация */
|
||||
CloudServer.init = (function(){
|
||||
CloudServer.init = (function(pAppCachProcessing){
|
||||
/* Переменная в которой храниться кэш*/
|
||||
this.Cache.setAllowed(CloudServer.Config.cache.allowed);
|
||||
/* Change default parameters of
|
||||
|
|
@ -138,18 +138,7 @@ CloudServer.init = (function(){
|
|||
this.Minify._allowed = this.Minify.doit();
|
||||
|
||||
|
||||
var lAppCache = CloudServer.AppCache;
|
||||
/* создаём файл app cache */
|
||||
if(this.Config.appcache && lAppCache && this.Config.server){
|
||||
var lFiles = [{'//themes.googleusercontent.com/static/fonts/droidsansmono/v4/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff' : './font/DroidSansMono.woff'},
|
||||
{'//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js' : './lib/client/jquery.js'}];
|
||||
|
||||
if(this.Minify._allowed.css)
|
||||
lFiles.push('./min/all.min.css');
|
||||
|
||||
lAppCache.addFiles(lFiles);
|
||||
lAppCache.createManifest();
|
||||
}
|
||||
Util.exec( pAppCachProcessing );
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -157,7 +146,7 @@ CloudServer.init = (function(){
|
|||
* Функция создаёт сервер
|
||||
* @param pConfig
|
||||
*/
|
||||
CloudServer.start = function (pConfig, pIndexProcessing) {
|
||||
CloudServer.start = function (pConfig, pIndexProcessing, pAppCachProcessing) {
|
||||
if(pConfig)
|
||||
this.Config = pConfig;
|
||||
else
|
||||
|
|
@ -167,7 +156,7 @@ CloudServer.start = function (pConfig, pIndexProcessing) {
|
|||
|
||||
CloudServer.indexProcessing = pIndexProcessing;
|
||||
|
||||
this.init();
|
||||
this.init(pAppCachProcessing);
|
||||
|
||||
this.Port = process.env.PORT || /* c9 */
|
||||
process.env.app_port || /* nodester */
|
||||
|
|
@ -814,7 +803,7 @@ CloudServer.sendResponse = function(pHead, pData, pName){
|
|||
}
|
||||
};
|
||||
|
||||
exports.start = function(pConfig, pIndexProcessing){
|
||||
CloudServer.start(pConfig, pIndexProcessing);
|
||||
exports.start = function(pConfig, pIndexProcessing, pAppCachProcessing){
|
||||
CloudServer.start(pConfig, pIndexProcessing, pAppCachProcessing);
|
||||
};
|
||||
exports.CloudServer = CloudServer;
|
||||
Loading…
Add table
Add a link
Reference in a new issue