diff --git a/README.md b/README.md index 80f0805..5eb83b7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # APP-SIGMA-WEB -`APP-SIGMA` es una APP con multiples API's Rest como: consulta de usuario = API-SRI, APP-PEDIDOS, APP-RESTAURANT, etc. +`APP-SIGMA` es una APLICACION-REST con multiples API's Rest como: consulta de usuario = API-SRI, APP-PEDIDOS, APP-RESTAURANT, etc. -[Sistema Inteligente Gestion,Modular, Administrativo](https://sigmac.app/). El proyecto ha sido desarrollado a través de una aplicación [NODE JS](https://nodejs.org/es V18.16.1LTS). Adicionalmente, `APP-SIGMA` usa ejs para renderizar las vistas y almacena los datos en una base de datos MYSQL lo cual le permite realizar posteriores consultas y renderizado de WEBS-APP'S como por ejemplo: consultas = clientes, documentos, clientes, items, etc. +[Sistema Inteligente Gestion Modular Administrativo](https://sigmac.app/). El proyecto ha sido desarrollado a través de una aplicación [NODE JS](https://nodejs.org/es V18.16.1LTS). Adicionalmente, `APP-SIGMA` usa ejs para renderizar las vistas y almacena los datos en una base de datos MYSQL lo cual le permite realizar posteriores consultas y renderizado de WEBS-APP'S como por ejemplo: consultas = clientes, documentos, clientes, items, etc. ### Modulos Requeridos para el funcionamiento ejs @@ -10,10 +10,11 @@ mysql express-myconnection express morgan -telegraf +telegraf: agrega entradas y salidas, con muchas integraciones a una variedad de métricas, eventos y registros de contenedores y sistemas populares. nodemon express-fileupload cors +jsonwebtoken ### recomendaciones previas npm install -s //-s para guardar los datos @@ -21,7 +22,7 @@ npm install -s //-s para guardar los datos ### instalacion de modulos ```bash -npm install -s mysql express-myconnection express morgan telegraf nodemon ejs express-fileupload axios +npm install -s mysql express-myconnection express morgan telegraf nodemon ejs express-fileupload axios jsonwebtoken ``` ### Modulo control de origenes diff --git a/package-lock.json b/package-lock.json index 3f59100..fedfe4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,8 +15,10 @@ "express": "^4.17.1", "express-fileupload": "^1.3.1", "express-myconnection": "^1.0.4", + "jsonwebtoken": "^9.0.2", "morgan": "^1.10.0", "mysql": "^2.18.1", + "nodejs-base64": "^2.0.0", "telegraf": "^3.37.0" }, "devDependencies": { @@ -174,6 +176,11 @@ "node": ">=8" } }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, "node_modules/busboy": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", @@ -361,6 +368,14 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -773,6 +788,111 @@ "node": ">=10" } }, + "node_modules/jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jsonwebtoken/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/jsonwebtoken/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -909,6 +1029,11 @@ } } }, + "node_modules/nodejs-base64": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nodejs-base64/-/nodejs-base64-2.0.0.tgz", + "integrity": "sha512-rf83teAz8f251P+HQW0nZyIhIIKrTs8wz11n5+Dp1b+/oWCYSeCfNfbUqda5B0DhspBVXwJ7SPk8aghv/TFsjQ==" + }, "node_modules/nodemon": { "version": "2.0.22", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", @@ -1438,6 +1563,11 @@ "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } }, "dependencies": { @@ -1563,6 +1693,11 @@ "fill-range": "^7.0.1" } }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, "busboy": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", @@ -1690,6 +1825,14 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -1989,6 +2132,100 @@ "minimatch": "^3.0.4" } }, + "jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "requires": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "dependencies": { + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "requires": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" + }, + "lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" + }, + "lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" + }, + "lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + }, + "lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -2081,6 +2318,11 @@ "whatwg-url": "^5.0.0" } }, + "nodejs-base64": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nodejs-base64/-/nodejs-base64-2.0.0.tgz", + "integrity": "sha512-rf83teAz8f251P+HQW0nZyIhIIKrTs8wz11n5+Dp1b+/oWCYSeCfNfbUqda5B0DhspBVXwJ7SPk8aghv/TFsjQ==" + }, "nodemon": { "version": "2.0.22", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", @@ -2491,6 +2733,11 @@ "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } } } diff --git a/package.json b/package.json index e250faa..4376c50 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,10 @@ "express": "^4.17.1", "express-fileupload": "^1.3.1", "express-myconnection": "^1.0.4", + "jsonwebtoken": "^9.0.2", "morgan": "^1.10.0", "mysql": "^2.18.1", + "nodejs-base64": "^2.0.0", "telegraf": "^3.37.0" } } diff --git a/src/app.js b/src/app.js index ea12737..96edce6 100644 --- a/src/app.js +++ b/src/app.js @@ -8,8 +8,8 @@ const cors_origins = require('cors'); //const jwt = require('jwt'); //const pool = require('./db.js'); -var puerto = 3001; global.config = require('./config.js'); +var puerto = global.config.server.port; const app = express(); //importando rutas diff --git a/src/config.js b/src/config.js index a960241..916742b 100644 --- a/src/config.js +++ b/src/config.js @@ -24,5 +24,12 @@ const config = { whiteList : ['https://factura-e.net','https://app.factura-e.net'], any:{}, }, + secret:{ + key:"Microbot&" + }, + server:{ + port:8086 + } + } module.exports = config; \ No newline at end of file diff --git a/src/controladores/controlador_Auth.js b/src/controladores/controlador_Auth.js new file mode 100644 index 0000000..4ea68ee --- /dev/null +++ b/src/controladores/controlador_Auth.js @@ -0,0 +1 @@ +const controlador={}; \ No newline at end of file diff --git a/src/controladores/controlador_General.js b/src/controladores/controlador_General.js index c9f403f..d325895 100644 --- a/src/controladores/controlador_General.js +++ b/src/controladores/controlador_General.js @@ -1,5 +1,8 @@ const controlador = {}; const axios = require('axios').default; +const jwt = require('jsonwebtoken'); +const config = require('../config'); +const { base64encode, base64decode } = require('nodejs-base64'); controlador.verVentasJson = (req, res) => { req.getConnection((err, conn) => { @@ -61,10 +64,44 @@ function stringTo_md5(data_string) { controlador.login_test = (req, res) => { res.render('login_test'); }; + + +function keyGen() { + var id = sql.consulta_valorCampoString("empresa_datos", "RUC", "idEmpresa", "1"); + //String key = ; + return base64encode(id); +} //************* GENERA TOKENS ****************// -controlador.genera_tokens = (req, res) => { - res.render('login_test'); +controlador.auth_keygen = (req, res) => { + var b64 = base64decode(req.body.data); + console.log(b64); + const datUsr={id,n_sesion,inf,dvc,app,usr, pwd, mail,key} = base64decode(req.body.data); + const token = jwt.sign(datUsr, config.secret.key); + //res.render(token); + res.json({token:token}); }; +controlador.init_app = (req, res) => { + console.log(req.body); + //const datUsr={usr, pwd, mail} = req.body; + //const token = jwt.sign(datUsr, config.secret.key); + //res.render(token); + res.json({token:token}); +}; +//************* LOGIN APP ****************// +controlador.login_appTK = (req, res) => { + const token = req.headers['x-access-token']; + console.log("token: ",token); + if(!token){ + return res.status(401).json({auth:false, message:'No token provided'}); + } + jwt.verify(token, config.secret, (err,decoded) => { + if(err){ + return res.status(401).json({auth:false, message:'Unauthorized'}); + } + res.json({auth:true, message:'Authorized'}); + }); +}; + //************* LOGIN APP ****************// controlador.login_app = (req, res) => { res.render('login_test'); @@ -213,7 +250,11 @@ function reg_DB() { return fecha; } - +//********* APP VIDEO Y TV ********// +controlador.app_tv = (req, res) => { + console.log(req.body); + res.render('app-tv'); +}; //********* PRUEBA Y RECECION DE DATOS ********// controlador.recibe_datos = (req, res) => { console.log(req.body); diff --git a/src/controladores/controlador_cloud.js b/src/controladores/controlador_cloud.js index d64d303..5be5b9b 100644 --- a/src/controladores/controlador_cloud.js +++ b/src/controladores/controlador_cloud.js @@ -62,7 +62,7 @@ controlador.cloud_panel = (req, res) => { }); console.log(rows); - res.render('app_pedidos'); + //res.render('app_pedidos'); } } catch (e) { res.render('login_cloud',{msg:e.toString()}); diff --git a/src/public/css/app_tv.css b/src/public/css/app_tv.css new file mode 100644 index 0000000..73ce35c --- /dev/null +++ b/src/public/css/app_tv.css @@ -0,0 +1,255 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; + } + +@font-face { + font-family: sigma_tipografia; + src: url(../tipografias/sigma_font.ttf) format('truetype'), url(../tipografias/sigma_font.otf) format('truetype'); + font-style: normal; +} + + body { + font-family: "ROBOTO", sans-serif,sigma_tipografia; + } + + .nav, + .slider { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + height: 100vh; + position: relative; + background-color: #1e1f26; + text-align: center; + padding: 0 2em; + } + + .nav h1, + .slider h1 { + font-family: "Josefin Sans", sans-serif; + font-size: 5vw; + margin: 0; + padding-bottom: 0.5rem; + letter-spacing: 0.5rem; + color: #03dac6; + transition: all 0.3s ease; + z-index: 3; + } + h1:hover { + transform: translate3d(0, -10px, 22px); + color: #ff0266; + } + + .slider h2 { + font-size: 2vw; + letter-spacing: 0.3rem; + font-family: "ROBOTO", sans-serif; + font-weight: 300; + color: #faebd7; + z-index: 4; + } + h3.span { + font-size: 2vw; + letter-spacing: 0.7em; + font-family: "ROBOTO", sans-serif; + font-weight: 300; + color: #faebd7; + z-index: 4; + } + span:hover { + color: #ff0266; + font-weight: 500; + font-size: 2.2vw; + } + + a { + text-decoration: none; + } + + .nav-container { + display: flex; + flex-direction: row; + position: absolute; + bottom: 0; + width: 100%; + height: 75px; + box-shadow: 20px 20px 50px rgba(0, 0, 0, 0.5); + background: #1e1f26; + z-index: 10; + transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1); + } + + .nav-container--top-first { + position: fixed; + top: 75px; + transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1); + } + + .nav-container--top-second { + position: fixed; + top: 0; + } + .nav-tab { + display: flex; + justify-content: center; + align-items: center; + flex: 1; + color: #03dac6; + letter-spacing: 0.1rem; + transition: all 0.5s ease; + font-size: 2vw; + } + + .nav-tab:hover { + color: #1e1f26; + background: #03dac6; + transition: all 0.5s ease; + } + + .nav-tab-slider { + position: absolute; + bottom: 0; + width: 0; + height: 2px; + background: #03dac6; + transition: left 0.3s ease; + } + .background { + position: absolute; + height: 90vh; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: auto; + } + @media (min-width: 800px) { + .nav h1, + .slider h1 { + font-size: 5vw; + } + + .nav h2, + .slider h2 { + font-size: 3vw; + } + + .nav-tab { + font-size: 3vw; + } + } + + @media screen only (min-width: 360px) { + .nav h1, + .slider h1 { + font-size: 8vw; + } + + .nav h2, + .slider h2 { + font-size: 2vw; + letter-spacing: 0.2vw; + } + + .nav-tab { + font-size: 1.2vw; + } + } + .background { + position: absolute; + height: 100vh; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 0; + } + .loader span { + color: #faebd7; + text-shadow: 0 0 0 #faebd7; + -webkit-animation: loading 1s ease-in-out infinite alternate; + } + + @-webkit-keyframes loading { + to { + text-shadow: 20px 0 70px #ff0266; + color: #ff0266; + } + } + .loader span:nth-child(2) { + -webkit-animation-delay: 0.1s; + } + .loader span:nth-child(3) { + -webkit-animation-delay: 0.2s; + } + .loader span:nth-child(4) { + -webkit-animation-delay: 0.3s; + } + .loader span:nth-child(5) { + -webkit-animation-delay: 0.4s; + } + .loader span:nth-child(6) { + -webkit-animation-delay: 0.5s; + } + .loader span:nth-child(7) { + -webkit-animation-delay: 0.6s; + } + .loader span:nth-child(8) { + -webkit-animation-delay: 0.7s; + } + .loader span:nth-child(9) { + -webkit-animation-delay: 0.8s; + } + + .loader span:nth-child(10) { + -webkit-animation-delay: 0.9s; + } + .loader span:nth-child(11) { + -webkit-animation-delay: 1s; + } + .loader span:nth-child(12) { + -webkit-animation-delay: 1.1s; + } + .loader span:nth-child(13) { + -webkit-animation-delay: 1.2s; + } + .loader span:nth-child(14) { + -webkit-animation-delay: 1.3s; + } + .loader span:nth-child(15) { + -webkit-animation-delay: 1.4s; + } + .loader span:nth-child(16) { + -webkit-animation-delay: 1.5s; + } + .loader span:nth-child(17) { + -webkit-animation-delay: 1.6s; + } + .loader span:nth-child(18) { + -webkit-animation-delay: 1.7s; + } + .loader span:nth-child(19) { + -webkit-animation-delay: 1.8s; + } + .loader span:nth-child(20) { + -webkit-animation-delay: 1.9s; + } + .loader span:nth-child(21) { + -webkit-animation-delay: 2s; + } + .loader span:nth-child(22) { + -webkit-animation-delay: 2.1s; + } + + .logo_txt{ + font-family: 'Poppins', sans-serif,sigma_tipografia; + } + .logo_img{ + background: url(../img/favicon_sigma/android-chrome-192x192.png); + background-repeat: repeat; + width: 100px; + height: 100px; + } \ No newline at end of file diff --git a/src/public/css/cloud.css b/src/public/css/cloud.css index b0637a3..a382702 100644 --- a/src/public/css/cloud.css +++ b/src/public/css/cloud.css @@ -23,7 +23,84 @@ body{ width: 600; height:400; } -#ctrl_audio{ +#ctr.l_audio{ margin-top: -60px; } +/* MENU USUARIO DESPLEGABLE */ +.dropdown-menu { + position: absolute; + left: 5%; + left: auto; + border: 1px solid #ddd; + background: #fff; + padding: 0px; +} +.dropdown-menu ul{ + list-style-type: none; + color: aliceblue; + padding: 0px; +} +.dropdown-menu ul li{ + list-style-type: none; + color: aliceblue; +} +.dropdown-menu ul li img{ + z-index: 5; + height: 90px; + width: 90px; + border: 3px solid; + border-color: transparent; + border-color: rgba(255,255,255,0.2); +} +.img-circle { + border-radius: 50%; +} +.dropdown-menu ul li.user-header { + height: 175px; + padding: 10px; + text-align: center; +} +.user-header{ + background-color: #255977; + color: white +} + +.user-body { + padding: 15px; + border-bottom: 1px solid #f4f4f4; + border-top: 1px solid #dddddd; + background-color: #255977; +} +.user-footer { + display: flex; + background-color: #8d8d8d; + padding: 10px; +} +.pull-left{ + box-sizing: border-box; + width: 50%; +} +.pull-right{ + box-sizing: border-box; + width: 50%; +} +#id_usuario{ + +} +/*#TEST_COLORS{ + #98BFDA +#FEDE58 +#98D8A5 +#FE9898 +#FE98FE +#FFFFFF + +#FFEEEC +#FEFDED +#EAFFE5 +#ECFDFF +#F0F1FE +#FFEBFA + +}*/ \ No newline at end of file diff --git a/src/public/etiquetas/color_testMYSQL_WRK b/src/public/etiquetas/color_testMYSQL_WRK new file mode 100644 index 0000000..e69de29 diff --git a/src/public/js/app_tv.js b/src/public/js/app_tv.js new file mode 100644 index 0000000..d64f1a5 --- /dev/null +++ b/src/public/js/app_tv.js @@ -0,0 +1,142 @@ +/* Credit and Thanks: +Matrix - Particles.js; +SliderJS - Ettrics; +Design - Sara Mazal Web; +Fonts - Google Fonts +*/ + +window.onload = function () { + Particles.init({ + selector: ".background" + }); + }; + const particles = Particles.init({ + selector: ".background", + color: ["#03dac6", "#ff0266", "#000000"], + connectParticles: true, + responsive: [ + { + breakpoint: 768, + options: { + color: ["#faebd7", "#03dac6", "#ff0266"], + maxParticles: 43, + connectParticles: false + } + } + ] + }); + + class NavigationPage { + constructor() { + this.currentId = null; + this.currentTab = null; + this.tabContainerHeight = 70; + this.lastScroll = 0; + let self = this; + $(".nav-tab").click(function () { + self.onTabClick(event, $(this)); + }); + $(window).scroll(() => { + this.onScroll(); + }); + $(window).resize(() => { + this.onResize(); + }); + } + + onTabClick(event, element) { + event.preventDefault(); + let scrollTop = + $(element.attr("href")).offset().top - this.tabContainerHeight + 1; + $("html, body").animate({ scrollTop: scrollTop }, 600); + } + + onScroll() { + this.checkHeaderPosition(); + this.findCurrentTabSelector(); + this.lastScroll = $(window).scrollTop(); + } + + onResize() { + if (this.currentId) { + this.setSliderCss(); + } + } + + checkHeaderPosition() { + const headerHeight = 75; + if ($(window).scrollTop() > headerHeight) { + $(".nav-container").addClass("nav-container--scrolled"); + } else { + $(".nav-container").removeClass("nav-container--scrolled"); + } + let offset = + $(".nav").offset().top + + $(".nav").height() - + this.tabContainerHeight - + headerHeight; + if ( + $(window).scrollTop() > this.lastScroll && + $(window).scrollTop() > offset + ) { + $(".nav-container").addClass("nav-container--move-up"); + $(".nav-container").removeClass("nav-container--top-first"); + $(".nav-container").addClass("nav-container--top-second"); + } else if ( + $(window).scrollTop() < this.lastScroll && + $(window).scrollTop() > offset + ) { + $(".nav-container").removeClass("nav-container--move-up"); + $(".nav-container").removeClass("nav-container--top-second"); + $(".nav-container-container").addClass("nav-container--top-first"); + } else { + $(".nav-container").removeClass("nav-container--move-up"); + $(".nav-container").removeClass("nav-container--top-first"); + $(".nav-container").removeClass("nav-container--top-second"); + } + } + + findCurrentTabSelector(element) { + let newCurrentId; + let newCurrentTab; + let self = this; + $(".nav-tab").each(function () { + let id = $(this).attr("href"); + let offsetTop = $(id).offset().top - self.tabContainerHeight; + let offsetBottom = + $(id).offset().top + $(id).height() - self.tabContainerHeight; + if ( + $(window).scrollTop() > offsetTop && + $(window).scrollTop() < offsetBottom + ) { + newCurrentId = id; + newCurrentTab = $(this); + } + }); + if (this.currentId != newCurrentId || this.currentId === null) { + this.currentId = newCurrentId; + this.currentTab = newCurrentTab; + this.setSliderCss(); + } + } + + setSliderCss() { + let width = 0; + let left = 0; + if (this.currentTab) { + width = this.currentTab.css("width"); + left = this.currentTab.offset().left; + } + $(".nav-tab-slider").css("width", width); + $(".nav-tab-slider").css("left", left); + } + } + + new NavigationPage(); + /* Credit and Thanks: + Matrix - Particles.js; + SliderJS - Ettrics; + Design - Sara Mazal Web; + Fonts - Google Fonts + */ + \ No newline at end of file diff --git a/src/public/tareas/tareas.html b/src/public/tareas/tareas.html new file mode 100644 index 0000000..92b575e --- /dev/null +++ b/src/public/tareas/tareas.html @@ -0,0 +1,66 @@ + + + + + + Tareas + + + + +
+ +
+ +
+ +
+ + \ No newline at end of file diff --git a/src/public/testing/audio.html b/src/public/testing/audio.html new file mode 100644 index 0000000..16f1acf --- /dev/null +++ b/src/public/testing/audio.html @@ -0,0 +1,55 @@ + + + + + + +
+ + diff --git a/src/public/tipografias/Anonymice Powerline Bold Italic.ttf b/src/public/tipografias/Anonymice Powerline Bold Italic.ttf new file mode 100644 index 0000000..b5cbbd5 Binary files /dev/null and b/src/public/tipografias/Anonymice Powerline Bold Italic.ttf differ diff --git a/src/public/tipografias/Anonymice Powerline Bold.ttf b/src/public/tipografias/Anonymice Powerline Bold.ttf new file mode 100644 index 0000000..0b56226 Binary files /dev/null and b/src/public/tipografias/Anonymice Powerline Bold.ttf differ diff --git a/src/public/tipografias/Anonymice Powerline Italic.ttf b/src/public/tipografias/Anonymice Powerline Italic.ttf new file mode 100644 index 0000000..5d5debc Binary files /dev/null and b/src/public/tipografias/Anonymice Powerline Italic.ttf differ diff --git a/src/public/tipografias/Anonymice Powerline.ttf b/src/public/tipografias/Anonymice Powerline.ttf new file mode 100644 index 0000000..5edacec Binary files /dev/null and b/src/public/tipografias/Anonymice Powerline.ttf differ diff --git a/src/rutas/rt_Generales.js b/src/rutas/rt_Generales.js index a5c6ef7..ad896ef 100644 --- a/src/rutas/rt_Generales.js +++ b/src/rutas/rt_Generales.js @@ -16,9 +16,13 @@ rutas.get('/', controlador_init.app_login);//FORM LOGIN DE LA APP rutas.post('/login', controlador_init.auth);//Authenticacion de Web APP rutas.get('/login_test', controlador_init.login_test);//login testing css / dev -rutas.get('/init-app', controlador_init.genera_tokens);//genera TOKENS / dev -rutas.get('/login_app', controlador_init.genera_tokens);//login APP / dev +rutas.get('/init-app', controlador_init.init_app);//init app / dev +rutas.post('/auth-keygen', controlador_init.auth_keygen);//genera TOKENS / dev +rutas.post('/login_app', controlador_init.login_appTK);//login APP / dev rutas.post('/operaciones/', controlador_init.recibe_datos);//testing json reccepcion server +rutas.get('/app-tv/', controlador_init.app_tv);//app de tv y video json reccepcion server +rutas.get('/tv-online/', controlador_init.app_tv);//app de tv y video json reccepcion server + module.exports = rutas; diff --git a/src/views/app-tv.ejs b/src/views/app-tv.ejs new file mode 100644 index 0000000..7070234 --- /dev/null +++ b/src/views/app-tv.ejs @@ -0,0 +1,65 @@ + + + + + + Document + + + + + +

SIGMA TV-ONLINE

+

+ T + o + d + o + s +   + l + o + s +   + T + E + C + H + N + O + L + O + G + I + E + S +

+ +
+
+
+

SVELTE

+

another frontend JS framework

+
+
+

ESBUILD

+

an extremely fast JavaScript bundler

+
+
+

NEXT.JS

+

framework for Production

+
+
+

TYPESCRIPT

+

giving you better tooling at any scale

+
+
+

VITE

+

a frontend build tool

+
+
+ + + + + \ No newline at end of file diff --git a/src/views/cloud.ejs b/src/views/cloud.ejs index e6f1dbf..e546033 100644 --- a/src/views/cloud.ejs +++ b/src/views/cloud.ejs @@ -1,184 +1,238 @@ - - - - - Cloud SIGMA - - + + + + - - + Cloud SIGMA + + - - - + + - + + + + - - - - - - -
-
-
- -
-
- - -
-
-
- -
-
- + +
+
+
+ + + + + + + <% for (i in data) { %> - - - - + + + + - <% for (i in data) { %> - - - - - - <% } %> -
IDNombreFechaAccion
IDNombreFechaAccion + <%= data[i].indice%> + + + + <%= data[i].archivo %> + + fecha + +
<%= data[i].indice%> - - <%= data[i].archivo %> - fecha - -
+