mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
fixed bug with reading folder with no access
This commit is contained in:
parent
c3b231a8c5
commit
fd3838f5ec
8 changed files with 93 additions and 64 deletions
|
|
@ -2,12 +2,12 @@
|
|||
"api_url" : "/api/v1",
|
||||
"appcache" : false,
|
||||
"minification" : {
|
||||
"js" : false,
|
||||
"js" : true,
|
||||
"css" : true,
|
||||
"html" : true,
|
||||
"img" : true
|
||||
},
|
||||
"cache" : false,
|
||||
"cache" : true,
|
||||
"logs" : false,
|
||||
"show_keys_panel" : true,
|
||||
"server" : true,
|
||||
|
|
|
|||
|
|
@ -1,35 +1,40 @@
|
|||
[
|
||||
"editor/_codemirror",
|
||||
"menu",
|
||||
"viewer",
|
||||
"terminal", {
|
||||
"name": "storage",
|
||||
"data": [{
|
||||
"name": "DropBox",
|
||||
"data":{
|
||||
"key" : "0nd3ssnp5fp7tqs",
|
||||
"secret" : "r61lxpchmk8l06o",
|
||||
"encodedKey": "DkMz4FYHQTA=|GW6pf2dONkrGvckMwBsl1V1vysrCPktPiUWN7UpDjw==",
|
||||
"chooserKey": "o7d6llji052vijk"
|
||||
}
|
||||
}, {
|
||||
"name": "GitHub",
|
||||
"data": {
|
||||
"key" : "891c251b925e4e967fa9",
|
||||
"secret" : "afe9bed1e810c5dc44c4c2a953fc6efb1e5b0545"
|
||||
}
|
||||
}, {
|
||||
"name": "GDrive",
|
||||
"data": {
|
||||
"id" : "255175681917"
|
||||
}
|
||||
}, {
|
||||
"name": "VK",
|
||||
"data": {
|
||||
"id" : "3336188"
|
||||
}
|
||||
},
|
||||
"SkyDrive"
|
||||
]
|
||||
}
|
||||
[
|
||||
"editor/_codemirror",
|
||||
"menu",
|
||||
"viewer",
|
||||
"terminal", {
|
||||
"name": "storage",
|
||||
"data": [{
|
||||
"name": "DropBox",
|
||||
"data":{
|
||||
"key" : "0nd3ssnp5fp7tqs",
|
||||
"secret" : "r61lxpchmk8l06o",
|
||||
"encodedKey": "DkMz4FYHQTA=|GW6pf2dONkrGvckMwBsl1V1vysrCPktPiUWN7UpDjw==",
|
||||
"chooserKey": "o7d6llji052vijk"
|
||||
}
|
||||
}, {
|
||||
"name": "GitHub",
|
||||
"data": {
|
||||
"key" : "891c251b925e4e967fa9",
|
||||
"secret" : "afe9bed1e810c5dc44c4c2a953fc6efb1e5b0545"
|
||||
}
|
||||
}, {
|
||||
"name": "GDrive",
|
||||
"data": {
|
||||
"id" : "255175681917"
|
||||
}
|
||||
}, {
|
||||
"name": "VK",
|
||||
"data": {
|
||||
"id" : "3336188"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "SkyDrive",
|
||||
"data": {
|
||||
"id" : "00000000440E696F"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
@ -46,7 +46,7 @@ var CloudCommander, Util,
|
|||
DOM.Images.showLoad();
|
||||
sendRequest({
|
||||
method : 'DELETE',
|
||||
url : pUrl,
|
||||
url : CloudFunc.FS + pUrl,
|
||||
callback : pCallBack
|
||||
});
|
||||
};
|
||||
|
|
@ -54,12 +54,20 @@ var CloudCommander, Util,
|
|||
this.save = function(pUrl, pData, pCallBack){
|
||||
sendRequest({
|
||||
method : 'PUT',
|
||||
url : pUrl,
|
||||
url : CloudFunc.FS + pUrl,
|
||||
data : pData,
|
||||
callback : pCallBack
|
||||
});
|
||||
};
|
||||
|
||||
this.read = function(pUrl, pCallBack){
|
||||
sendRequest({
|
||||
method : 'GET',
|
||||
url : CloudFunc.FS + pUrl,
|
||||
callback : pCallBack
|
||||
});
|
||||
};
|
||||
|
||||
this.mv = function(pData, pCallBack){
|
||||
sendRequest({
|
||||
method : 'PUT',
|
||||
|
|
@ -79,8 +87,10 @@ var CloudCommander, Util,
|
|||
if( Util.isString(p.url) )
|
||||
p.url = decodeURI(p.url);
|
||||
|
||||
if(p.data)
|
||||
if( p.data && !Util.isString(p.data))
|
||||
lData = Util.stringifyJSON(p.data);
|
||||
else
|
||||
lData = p.data;
|
||||
|
||||
p.url = pConfig && pConfig.api_url + p.url,
|
||||
DOM.ajax({
|
||||
|
|
@ -91,7 +101,7 @@ var CloudCommander, Util,
|
|||
success : function(pData){
|
||||
DOM.Images.hideLoad();
|
||||
Util.log(pData);
|
||||
Util.exec(p.callback);
|
||||
Util.exec(p.callback, pData);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -1002,7 +1012,7 @@ var CloudCommander, Util,
|
|||
lPath += '?json';
|
||||
|
||||
if(!lParams.url)
|
||||
lParams.url = lPath;
|
||||
lParams.url = CloudFunc.FS + lPath;
|
||||
|
||||
lRet = DOM.ajax(lParams);
|
||||
|
||||
|
|
@ -1186,7 +1196,7 @@ var CloudCommander, Util,
|
|||
var lCurrent = pCurrentFile || DOM.getCurrentFile(),
|
||||
lPath = DOM.getCurrentLink( lCurrent ).href;
|
||||
/* убираем адрес хоста*/
|
||||
lPath = Util.removeStr(lPath, CloudCommander.HOST);
|
||||
lPath = Util.removeStr( lPath, [CloudCommander.HOST, CloudFunc.FS] );
|
||||
|
||||
return lPath;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -159,7 +159,9 @@ var CloudCommander, Util, DOM, $;
|
|||
lMenuItems = {
|
||||
'View' : Util.retExec(showEditor, true),
|
||||
'Edit' : Util.retExec(showEditor, false),
|
||||
'Rename' : DOM.renameCurrentFile,
|
||||
'Rename' : function(){
|
||||
setTimeout( Util.retExec(DOM.renameCurrentFile), 100);
|
||||
},
|
||||
'Delete' : Util.retExec(DOM.promptDeleteCurrent),
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
c = pParams.params,
|
||||
lFiles = p.data,
|
||||
lDirPath = getDirPath(c.path);
|
||||
|
||||
|
||||
if(!p.error && lFiles){
|
||||
lFiles.data = lFiles.sort();
|
||||
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
fillJSON(lFilesData);
|
||||
}
|
||||
else
|
||||
Util.exec(p.callback, p.error.toString());
|
||||
Util.exec(c.callback, p.error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,6 @@
|
|||
lRes = pParams.response;
|
||||
lGziped = pParams.gziped;
|
||||
}
|
||||
|
||||
if(lName && lRes && lReq){
|
||||
var lGzip = isGZIP(lReq),
|
||||
|
||||
|
|
|
|||
|
|
@ -69,22 +69,23 @@
|
|||
lRet = Util.isContainStr(p.name, CloudFunc.FS);
|
||||
if( lRet)
|
||||
onFS(pParams);
|
||||
|
||||
if(p.name[0] === '/')
|
||||
p.command = Util.removeStr(p.name, '/');
|
||||
|
||||
switch(p.request.method){
|
||||
case 'GET':
|
||||
lRet = onGET(pParams);
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
getBody(pParams.request, function(pBody){
|
||||
pParams.body = pBody;
|
||||
onPUT(pParams);
|
||||
});
|
||||
break;
|
||||
}
|
||||
else{
|
||||
if(p.name[0] === '/')
|
||||
p.command = Util.removeStr(p.name, '/');
|
||||
|
||||
switch(p.request.method){
|
||||
case 'GET':
|
||||
lRet = onGET(pParams);
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
getBody(pParams.request, function(pBody){
|
||||
pParams.body = pBody;
|
||||
onPUT(pParams);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return lRet;
|
||||
}
|
||||
|
|
@ -95,7 +96,7 @@
|
|||
var p = pParams,
|
||||
lQuery = main.getQuery(p.request);
|
||||
|
||||
p.name = Util.removeStr(p.name, [CloudFunc.FS, '?dir']) || '/';
|
||||
p.name = Util.removeStrOneTime(p.name, [CloudFunc.FS, '?dir']) || '/';
|
||||
switch(p.request.method){
|
||||
case 'GET':
|
||||
fs.stat(p.name, function(pError, pStat){
|
||||
|
|
|
|||
14
lib/util.js
14
lib/util.js
|
|
@ -361,12 +361,24 @@ Util = exports || {};
|
|||
Util.replaceStr = function(pStr, pFrom, pTo){
|
||||
var lRet = pStr;
|
||||
|
||||
if(pStr && pFrom)
|
||||
if(pStr && pFrom){
|
||||
pFrom = Util.escapeRegExp(pFrom);
|
||||
lRet = pStr.replace(new RegExp(pFrom, 'g'), pTo);
|
||||
}
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
|
||||
Util.escapeRegExp = function(pStr) {
|
||||
var lRet = pStr;
|
||||
|
||||
if( Util.isString(pStr) )
|
||||
lRet = pStr.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
/**
|
||||
* function render template with view
|
||||
* @pTempl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue