mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
removed auth.json
This commit is contained in:
parent
7386e954de
commit
00f6396207
4 changed files with 24 additions and 12 deletions
|
|
@ -7,9 +7,11 @@
|
|||
"html" : true,
|
||||
"img" : true
|
||||
},
|
||||
"oauth_client_id" : "891c251b925e4e967fa9",
|
||||
"oauth_client_secret" : "afe9bed1e810c5dc44c4c2a953fc6efb1e5b0545",
|
||||
"server" : true,
|
||||
"logs" : false,
|
||||
"socket" : true,
|
||||
"port" : 31337,
|
||||
"ip" : "127.0.0.1"
|
||||
"ip" : "127.0.0.1"
|
||||
}
|
||||
|
|
@ -66,12 +66,12 @@ var CloudCommander, $;
|
|||
download: {name: 'Download',callback: function(key, opt){
|
||||
Util.Images.showLoad();
|
||||
|
||||
var lCurrent = Util.getCurrentFile();
|
||||
var lLink = Util.getByTag('a', lCurrent)[0].href;
|
||||
var lCurrent = Util.getCurrentFile(),
|
||||
lLink = Util.getByTag('a', lCurrent)[0].href;
|
||||
|
||||
console.log('downloading file ' + lLink +'...');
|
||||
|
||||
lLink = lLink + '?download';
|
||||
lLink = lLink + '?download';
|
||||
var lId = Util.getIdBySrc(lLink);
|
||||
|
||||
if(!Util.getById(lId)){
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
var https = require('https'),
|
||||
qs = require('querystring'),
|
||||
|
||||
DIR = process.cwd(),
|
||||
SRVDIR = DIR + '/lib/server/',
|
||||
DIR = process.cwd() + '/',
|
||||
SRVDIR = DIR + 'lib/server/',
|
||||
|
||||
srvfunc = require(SRVDIR + 'srvfunc'),
|
||||
Config = srvfunc.require(DIR + '/auth'),
|
||||
Config = srvfunc.require(DIR + 'config'),
|
||||
|
||||
GithubAuth = {
|
||||
host: "github.com",
|
||||
|
|
|
|||
20
server.js
20
server.js
|
|
@ -218,6 +218,7 @@ CloudServer.generateHeaders = function(pName, pGzip){
|
|||
var lType = '',
|
||||
lCacheControl = 0,
|
||||
lContentEncoding = '',
|
||||
lRet,
|
||||
|
||||
lDot = pName.lastIndexOf('.'),
|
||||
lExt = pName.substr(lDot);
|
||||
|
|
@ -231,6 +232,7 @@ CloudServer.generateHeaders = function(pName, pGzip){
|
|||
lContentEncoding = '; charset=UTF-8';
|
||||
|
||||
var lQuery = CloudServer.Queries[pName];
|
||||
console.log(lQuery);
|
||||
if(lQuery){
|
||||
if( Util.strCmp(lQuery, 'download') )
|
||||
lType = 'application/octet-stream';
|
||||
|
|
@ -241,18 +243,24 @@ CloudServer.generateHeaders = function(pName, pGzip){
|
|||
if(!lCacheControl)
|
||||
lCacheControl = 31337 * 21;
|
||||
|
||||
return {
|
||||
lRet = {
|
||||
/* if type of file any, but img -
|
||||
* then we shoud specify charset
|
||||
*/
|
||||
'Content-Type': lType + lContentEncoding,
|
||||
'cache-control': 'max-age=' + lCacheControl,
|
||||
'last-modified': new Date().toString(),
|
||||
'content-encoding': pGzip? 'gzip' : '',
|
||||
'last-modified': new Date().toString(),
|
||||
/* https://developers.google.com/speed/docs/best-practices
|
||||
/caching?hl=ru#LeverageProxyCaching */
|
||||
'Vary': 'Accept-Encoding'
|
||||
};
|
||||
|
||||
if(pGzip)
|
||||
lRet['content-encoding'] = 'gzip';
|
||||
|
||||
console.log(lRet);
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -338,8 +346,8 @@ CloudServer._controller = function(pReq, pRes)
|
|||
* сжатый файл - если gzip-поддерживаеться браузером
|
||||
* не сжатый - в обратном случае
|
||||
*/
|
||||
var lFileData=CloudServer.Cache.get(
|
||||
CloudServer.Gzip?(lName+'_gzip'):lName);
|
||||
var lFileData = CloudServer.Cache.get(
|
||||
CloudServer.Gzip?(lName+'_gzip') : lName);
|
||||
|
||||
console.log(Path.basename(lName));
|
||||
|
||||
|
|
@ -458,6 +466,8 @@ CloudServer._controller = function(pReq, pRes)
|
|||
|
||||
/* saving query of current file */
|
||||
CloudServer.Queries[DirPath] = lQuery;
|
||||
console.log(lQuery);
|
||||
console.log(DirPath);
|
||||
|
||||
/* читаем основные данные о файле */
|
||||
if( lQuery && lQuery.indexOf('code=') === 0){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue