diff --git a/config.json b/config.json index b8613f7d..f76c728a 100644 --- a/config.json +++ b/config.json @@ -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" } \ No newline at end of file diff --git a/lib/client/menu.js b/lib/client/menu.js index dd8259b8..a0733a3e 100644 --- a/lib/client/menu.js +++ b/lib/client/menu.js @@ -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)){ diff --git a/lib/server/auth.js b/lib/server/auth.js index 87457c9a..7af9fde2 100644 --- a/lib/server/auth.js +++ b/lib/server/auth.js @@ -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", diff --git a/server.js b/server.js index 8d97504b..b7e01ed0 100644 --- a/server.js +++ b/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){