minor changes

This commit is contained in:
coderaiser 2013-02-23 16:29:00 -05:00
parent cc3a773d5d
commit eabe309557
4 changed files with 30 additions and 22 deletions

View file

@ -23,7 +23,7 @@
REQUEST = 'request',
RESPONSE = 'response',
INDEX = HTMLDIR + 'index.html',
INDEX = main.INDEX,
CONFIG_PATH = JSONDIR + 'config.json',
FS = CloudFunc.FS;
@ -197,8 +197,6 @@
if(!Config.minification)
main.config = Config = lReadedConf;
console.log(Config);
Util.tryCatchLog(function(){
Config.minification.js = lReadedConf.minification.js;
Config.cache = lReadedConf.cache;

View file

@ -25,7 +25,7 @@
OK = main.OK,
FS = CloudFunc.FS,
INDEX = null,
INDEX,
REQUEST = 'request',
RESPONSE = 'response',
@ -33,16 +33,17 @@
exports.sendContent = function(pParams){
var lRet = Util.checkObj(pParams,
['processing'],
[REQUEST, RESPONSE, 'index']);
var lRet = Util.checkObjTrue(pParams, [REQUEST, RESPONSE, 'index']);
if(lRet){
var p = pParams,
lPath = getCleanPath(p.request);
INDEX = p.index;
IndexProcessingFunc = pParams.processing;
if(!INDEX)
INDEX = p.index;
if(!IndexProcessingFunc)
IndexProcessingFunc = pParams.processing;
fs.stat(lPath, function(pError, pStat){
if(!pError)
@ -233,7 +234,7 @@
* высылаем json-структуру файлов
* с соответствующими заголовками
*/
lList = JSON.stringify(lJSON);
lList = Util.stringifyJSON(lJSON);
sendResponse({
name : lDirPath + '.json',

View file

@ -4,7 +4,7 @@
/* Global var accessible from any loaded module */
global.cloudcmd = {};
var DIR, LIBDIR, SRVDIR, JSONDIR,
var DIR, LIBDIR, SRVDIR, JSONDIR, HTMLDIR,
Util,
SLASH,
@ -23,7 +23,7 @@
/* Consts */
exports.OK = OK = 200;
exports.FILE_NOT_FOUND = 404;
exports.FILE_NOT_FOUND = FILE_NOT_FOUND = 404;
exports.REQUEST = 'request';
exports.RESPONSE = 'response';
@ -45,8 +45,9 @@
exports.SRVDIR = SRVDIR = __dirname + SLASH,
exports.LIBDIR = LIBDIR = path.normalize(SRVDIR + '../'),
exports.DIR = DIR = path.normalize(LIBDIR + '../'),
exports.HTMLDIR = DIR + 'html' + SLASH,
exports.HTMLDIR = HTMLDIR = DIR + 'html' + SLASH,
exports.JSONDIR = JSONDIR = DIR + 'json' + SLASH,
exports.INDEX = HTMLDIR + 'index.html',
/* Functions */
exports.require = mrequire,
@ -189,8 +190,6 @@
if(p.gzip)
lRet['content-encoding'] = 'gzip';
Util.log(Config);
}
return lRet;

View file

@ -87,8 +87,14 @@
lCmd = Util.removeStr(lCmd, '/');
pParams.command = lCmd;
}
if(lCmd === 'fs')
onFS(pParams);
if( Util.isContainStr(lCmd, 'fs') ){
pParams.request.url += '?json';
onFS({
request : pParams.request,
response: pParams.response,
});
}
else
switch(lMethod){
case 'GET':
@ -108,11 +114,15 @@
lMethod = pParams.method;
switch(lMethod){
case 'GET':
pParams.data = {
mesage: 'fs called'
};
send(pParams);
lResult = true;
var lINDEX = main.INDEX,
lName = main.minify.allowed.html ?
main.minify.getName(lINDEX) : lINDEX;
lResult = main.commander.sendContent({
request : pParams.request,
response : pParams.response,
index : lName
});
break;
case 'PUT':