mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 08:56:20 +00:00
a
This commit is contained in:
parent
8a75f3b21f
commit
80dcbb6098
5 changed files with 83 additions and 53 deletions
|
|
@ -218,20 +218,20 @@ a:focus { outline: thin dotted; }
|
|||
display:none;
|
||||
}
|
||||
/* текущий файл под курсором */
|
||||
.current-file{
|
||||
.current-file{
|
||||
background-color: rgba(49, 123, 249, .40);
|
||||
color:white;
|
||||
}
|
||||
/* делаем иконки под курсом белыми*/
|
||||
.current-file > .mini-icon{
|
||||
.current-file > .mini-icon{
|
||||
color:white;
|
||||
}
|
||||
.current-file > .text-file::before{
|
||||
.current-file > .text-file::before{
|
||||
color:white;
|
||||
}
|
||||
|
||||
/* меняем иконки на шрифтовые*/
|
||||
.mini-icon {
|
||||
.mini-icon {
|
||||
font: 60px 'Octicons Regular';
|
||||
width: 40%;
|
||||
height: 0;
|
||||
|
|
@ -252,9 +252,7 @@ a:focus { outline: thin dotted; }
|
|||
.text-file{
|
||||
background-image:none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* убираем заголовок*/
|
||||
.fm_header{
|
||||
display:none;
|
||||
|
|
@ -297,7 +295,7 @@ a:focus { outline: thin dotted; }
|
|||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
@media only screen and (min-width: 601px) and (max-width: 767px){
|
||||
@media only screen and (min-width: 601px) and (max-width: 785px){
|
||||
#left{
|
||||
width:90% !important;
|
||||
}
|
||||
|
|
@ -306,7 +304,7 @@ a:focus { outline: thin dotted; }
|
|||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width:767px) and (max-width: 1060px){
|
||||
@media only screen and (min-width:786px) and (max-width: 1155px){
|
||||
#left{
|
||||
width:90% !important;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,15 +134,17 @@ exports.cssStyles=function cssStyles(pImgConvertToBase64_b){
|
|||
/* if all files writed we
|
||||
* save all minimized css
|
||||
* to one file all.min.css
|
||||
*/
|
||||
/* если включена конвертация картинок в base64
|
||||
* вызываем её
|
||||
*/
|
||||
if(pImgConvertToBase64_b)
|
||||
base64_images(lAllStyle);
|
||||
else if(lStyleCssDone && lResetCssDone)
|
||||
fs.writeFile(CSSDIR+'all.min.css', lAllStyle, fileWrited('all.min.css'));
|
||||
/* записываем сжатый css файл*/
|
||||
*/
|
||||
if(lStyleCssDone && lResetCssDone){
|
||||
/* если включена конвертация картинок в base64
|
||||
* вызываем её
|
||||
*/
|
||||
if(pImgConvertToBase64_b)
|
||||
base64_images(lAllStyle);
|
||||
else
|
||||
fs.writeFile(CSSDIR+'all.min.css', lAllStyle, fileWrited('all.min.css'));
|
||||
}
|
||||
/* в другом случае - записываем сжатый css файл*/
|
||||
else fs.writeFile(minFileName, final_code, fileWrited(minFileName));
|
||||
};
|
||||
|
||||
|
|
@ -237,7 +239,8 @@ function base64_images(pFileContent_s){
|
|||
'https://github.com/Filirom1/css-base64-images');
|
||||
return false;
|
||||
}
|
||||
b64img.fromString(pFileContent_s, '.','', function(err, css){
|
||||
b64img.fromString(pFileContent_s, '.','', function(err, css){
|
||||
console.log('images converted to base64 and saved in css file');
|
||||
fs.writeFile(CSSDIR+'all.min.css', css, fileWrited('all.min.css'));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
1
node_modules/vcap
generated
vendored
Symbolic link
1
node_modules/vcap
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../local/lib/node_modules/vcap
|
||||
17
package.json
17
package.json
|
|
@ -1,7 +1,12 @@
|
|||
{
|
||||
"name": "cloudcmd",
|
||||
"version": "0.0.1-5",
|
||||
"scripts":{"test":"sh test/test.sh","start": "server.js"},
|
||||
"node": "0.6.17",
|
||||
"subdomain": "cloudcmd"
|
||||
}
|
||||
"name": "cloudcmd",
|
||||
"version": "0.0.1-11",
|
||||
"scripts": {
|
||||
"test": "sh test/test.sh",
|
||||
"start": "server.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.6.x"
|
||||
},
|
||||
"subdomain": "cloudcmd"
|
||||
}
|
||||
79
server.js
79
server.js
|
|
@ -43,10 +43,12 @@ var CloudServer={
|
|||
|
||||
/* КОНСТАНТЫ */
|
||||
/* index.html */
|
||||
INDEX :'/app/index.html',
|
||||
INDEX :'index.html',
|
||||
/* name of direcotory with libs */
|
||||
LIBDIR :'./lib',
|
||||
LIBDIRSERVER :'./lib/server'
|
||||
LIBDIRSERVER :'./lib/server',
|
||||
Port :31337, /* server port */
|
||||
IP :'127.0.0.1'
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -150,9 +152,8 @@ CloudServer.Minify={
|
|||
|
||||
var LeftDir='/';
|
||||
var RightDir=LeftDir;
|
||||
/*
|
||||
var Path = require('path');
|
||||
*/ /* модуль для работы с путями*/
|
||||
/* модуль для работы с путями*/
|
||||
var Path = require('path');
|
||||
|
||||
var Fs = require('fs'); /* модуль для работы с файловой системой*/
|
||||
|
||||
|
|
@ -160,7 +161,7 @@ var Zlib;
|
|||
/* node v0.4 not contains zlib
|
||||
*/
|
||||
try{
|
||||
Zlib = undefined; //require('zlib'); /* модуль для сжатия данных gzip-ом*/
|
||||
Zlib = require('zlib'); /* модуль для сжатия данных gzip-ом*/
|
||||
}catch(error){
|
||||
Zlib=undefined;
|
||||
console.log('to use gzip-commpression' +
|
||||
|
|
@ -173,15 +174,25 @@ var CloudFunc = require(CloudServer.LIBDIR +
|
|||
'/cloudfunc')); /* модуль с функциями */
|
||||
/* конструктор*/
|
||||
CloudServer.init=(function(){
|
||||
/* Determining server.js directory
|
||||
* and chang current process directory
|
||||
* (usually /) to it.
|
||||
* argv[1] - is always script name
|
||||
*/
|
||||
var lServerDir = Path.dirname(process.argv[1]);
|
||||
console.log('current dir: ' + process.cwd());
|
||||
console.log('server dir: ' + lServerDir);
|
||||
process.chdir(lServerDir);
|
||||
|
||||
/* Переменная в которой храниться кэш*/
|
||||
CloudServer.Cache.setAllowed(false);
|
||||
CloudServer.Cache.setAllowed(true);
|
||||
/* Change default parameters of
|
||||
* js/css/html minification
|
||||
*/
|
||||
CloudServer.Minify.setAllowed({
|
||||
js:true,
|
||||
css:true,
|
||||
html:false,
|
||||
html:true,
|
||||
img:true
|
||||
});
|
||||
/* Если нужно минимизируем скрипты */
|
||||
|
|
@ -189,19 +200,40 @@ CloudServer.init=(function(){
|
|||
});
|
||||
|
||||
|
||||
/* создаём сервер на порту 31337*/
|
||||
/* создаём сервер на порту 31337 */
|
||||
CloudServer.start=function()
|
||||
{
|
||||
CloudServer.init();
|
||||
|
||||
/* constant ports of deployng servers
|
||||
var lCloudFoundryPort = process.env.VCAP_APP_PORT;
|
||||
var lNodesterPort = process.env.app_port;
|
||||
var lC9Port = process.env.PORT;
|
||||
*/
|
||||
CloudServer.Port = process.env.PORT || /* c9 */
|
||||
process.env.app_port || /* nodester */
|
||||
process.env.VCAP_APP_PORT || /* cloudfoundry */
|
||||
CloudServer.Port;
|
||||
|
||||
CloudServer.IP = process.env.IP || /* c9 */
|
||||
CloudServer.IP;
|
||||
|
||||
var http = require('http');
|
||||
http.createServer(CloudServer._controller).listen(process.env.PORT ||
|
||||
process.env.VCAP_APP_PORT /* cloudfoundry */ ||
|
||||
process.env.app_port /* nodester */ ||
|
||||
31337,
|
||||
'0.0.0.0' || '127.0.0.1');
|
||||
console.log('Cloud Commander server running at http://127.0.0.1:'+
|
||||
(process.env.PORT===undefined?31337:process.env.PORT));
|
||||
http.createServer(CloudServer._controller).listen(
|
||||
CloudServer.Port,
|
||||
CloudServer.IP);
|
||||
|
||||
console.log('Cloud Commander server running at http://' +
|
||||
CloudServer.IP +
|
||||
':' +
|
||||
CloudServer.Port);
|
||||
/*
|
||||
(!lC9Port?
|
||||
(!lCloudFoundryPort?
|
||||
(!lNodesterPort?31337:lNodesterPort)
|
||||
:lCloudFoundryPort)
|
||||
:lC9Port));
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -390,7 +422,7 @@ CloudServer._controller=function(pReq, pRes)
|
|||
*/
|
||||
CloudServer.Responses[CloudServer.INDEX]=pRes;
|
||||
if(lStat.isDirectory())
|
||||
Fs.readdir(LeftDir,CloudServer._readDir);
|
||||
Fs.readdir(LeftDir,CloudServer._readDir);
|
||||
/* отдаём файл */
|
||||
else if(lStat.isFile()){
|
||||
CloudServer.Responses[LeftDir]=pRes;
|
||||
|
|
@ -500,7 +532,7 @@ CloudServer._readDir=function (pError, pFiles)
|
|||
*/
|
||||
|
||||
lIndex = CloudServer.Minify.done.css?
|
||||
lIndex.replace('<link rel=stylesheet href="/reset.css">','')
|
||||
lIndex.replace('<link rel=stylesheet href="/css/reset.css">','')
|
||||
.replace('style.css','all.min.css')
|
||||
:lIndex;
|
||||
|
||||
|
|
@ -635,13 +667,4 @@ CloudServer.sendResponse = function(pHead, pData,pName){
|
|||
}
|
||||
};
|
||||
|
||||
CloudServer.start();
|
||||
process.argv.forEach(function (val, index, array){
|
||||
console.log(index + ': ' + val);
|
||||
});
|
||||
|
||||
process.chdir('/app');
|
||||
|
||||
var fs=require('fs');
|
||||
console.log(fs.readdirSync('/app'));
|
||||
|
||||
CloudServer.start();
|
||||
Loading…
Add table
Add a link
Reference in a new issue