mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-08-04 21:53:14 +00:00
added SSL suport
This commit is contained in:
parent
7b6371fd50
commit
75c67fd1d1
10 changed files with 108 additions and 15 deletions
|
|
@ -399,6 +399,19 @@ CloudCmd.getModules = function(pCallBack){
|
|||
});
|
||||
};
|
||||
|
||||
CloudCmd.execFromModule = function(pModuleName, pFuncName, pParams){
|
||||
var lObject = CloudCmd[pModuleName];
|
||||
Util.ifExec('init' in lObject,
|
||||
function(){
|
||||
var lObj = CloudCmd[pModuleName];
|
||||
Util.exec( lObj[pFuncName], pParams);
|
||||
},
|
||||
|
||||
function(pCallBack){
|
||||
Util.exec(lObject, pCallBack);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/* функция меняет ссыки на ajax-овые */
|
||||
CloudCmd._changeLinks = function(pPanelID){
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ var CloudCommander, Util, DOM, CloudFunc, $;
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* function get menu item object for Upload To
|
||||
*/
|
||||
|
|
@ -62,16 +63,7 @@ var CloudCommander, Util, DOM, CloudFunc, $;
|
|||
else if( Util.isString(pObjectName) ){
|
||||
lObj = function(key, opt){
|
||||
DOM.getCurrentData(function(pParams){
|
||||
var lObject = CloudCmd[pObjectName];
|
||||
|
||||
Util.ifExec('init' in lObject,
|
||||
function(){
|
||||
CloudCmd[pObjectName].uploadFile(pParams);
|
||||
},
|
||||
|
||||
function(pCallBack){
|
||||
Util.exec(lObject, pCallBack);
|
||||
});
|
||||
CloudCmd.execFromModule(pObjectName, 'uploadFile', pParams);
|
||||
});
|
||||
|
||||
Util.log('Uploading to ' + pObjectName+ '...');
|
||||
|
|
@ -179,7 +171,15 @@ var CloudCommander, Util, DOM, CloudFunc, $;
|
|||
Util.log('New->File');
|
||||
},
|
||||
|
||||
'Dir' : DOM.promptNewFolder
|
||||
'Dir' : DOM.promptNewFolder,
|
||||
|
||||
'From cloud...' : function(){
|
||||
CloudCmd.execFromModule('FilePicker', 'saveFile', function(pName, pData){
|
||||
var lPath = DOM.getCurrentDirPath() + pName;
|
||||
|
||||
DOM.RESTfull.save(lPath, pData, CloudCmd.refresh);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
lRet = {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,20 @@ var CloudCommander, Util, DOM, $, filepicker;
|
|||
};
|
||||
|
||||
|
||||
this.uploadFile = function(pCallBack){
|
||||
this.uploadFile = function(pParams, pCallBack){
|
||||
var lContent = pParams.data,
|
||||
lName = pParams.name;
|
||||
|
||||
filepicker.store(lContent, {filename: lName},
|
||||
function(new_fpfile){
|
||||
console.log(JSON.stringify(new_fpfile));
|
||||
filepicker.exportFile(
|
||||
'https://drpyjw32lhcoa.cloudfront.net/0d6afe9/img/success.png',
|
||||
function(FPFile){
|
||||
console.log(FPFile.url);
|
||||
});
|
||||
}
|
||||
);
|
||||
filepicker.pick(function(FPFile){
|
||||
console.log(FPFile.url);
|
||||
|
||||
|
|
@ -21,6 +34,19 @@ var CloudCommander, Util, DOM, $, filepicker;
|
|||
});
|
||||
};
|
||||
|
||||
this.saveFile = function(pCallBack){
|
||||
filepicker.pick(function(FPFile){
|
||||
console.log(FPFile);
|
||||
|
||||
DOM.ajax({
|
||||
url : FPFile.url,
|
||||
success : function(pData){
|
||||
Util.exec(pCallBack, FPFile.filename, pData);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function load(pCallBack){
|
||||
console.time('filepicker load');
|
||||
var lHTTP = "https:"===document.location.protocol? "https:" : "http:";
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
Socket = main.socket,
|
||||
|
||||
http = main.http,
|
||||
https = main.https,
|
||||
Util = main.util,
|
||||
|
||||
Server, Rest, Route, Minimize, Port, IP;
|
||||
|
|
@ -62,6 +63,8 @@
|
|||
Route = pProcessing.route;
|
||||
Minimize = pProcessing.minimize;
|
||||
|
||||
var lSSL = pProcessing.ssl;
|
||||
|
||||
init(pProcessing.appcache);
|
||||
|
||||
Port = process.env.PORT || /* c9 */
|
||||
|
|
@ -76,7 +79,10 @@
|
|||
/* server mode or testing mode */
|
||||
if (lConfig.server) {
|
||||
var lError = Util.tryCatchLog(function(){
|
||||
Server = http.createServer( controller );
|
||||
if(!lSSL)
|
||||
Server = http.createServer( controller );
|
||||
else
|
||||
Server = https.createServer( lSSL, controller );
|
||||
Server.listen(Port, IP);
|
||||
|
||||
var lListen;
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@
|
|||
|
||||
|
||||
lRet = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Content-Type': lType + lContentEncoding,
|
||||
'last-modified': new Date().toString(),
|
||||
'Vary': 'Accept-Encoding'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue