diff --git a/src/config.js b/src/config.js index df2f34f..2cd912d 100644 --- a/src/config.js +++ b/src/config.js @@ -1,3 +1,4 @@ +const path = require('path'); const config = { db:{ host: '192.168.10.150', @@ -9,8 +10,9 @@ const config = { sock: '/' }, dir:{ - root_dir: '/home/pablinux/Projects/Node/APP-SIGMA-WEB/src/public/files/', - path_dir: process.cwd(), // usa el path del ejecutable real + //root_dir: '/home/pablinux/Projects/Node/APP-SIGMA-WEB/src/public/files/', + //path_dir: process.cwd(), // usa el path del ejecutable real + path_dir: path.join(__dirname, 'public', 'files'), }, sesion:{ id:"", diff --git a/src/controladores/controlador_Cont_PagosTransacciones b/src/controladores/controlador_Cont_PagosTransacciones.js similarity index 100% rename from src/controladores/controlador_Cont_PagosTransacciones rename to src/controladores/controlador_Cont_PagosTransacciones.js diff --git a/src/controladores/controlador_cloud.js b/src/controladores/controlador_cloud.js index 1748ef2..95f78eb 100644 --- a/src/controladores/controlador_cloud.js +++ b/src/controladores/controlador_cloud.js @@ -2,21 +2,25 @@ const controlador = {}; //const dirPath = "/home/pablinux/Projects/Node/APP-SIGMA-WEB/src/public/files/"; //const var_locals = ; //********* APP-panel control ********// +const path = require('path'); controlador.upload = (req, res) => { - if (!req.files || Object.keys(req.files).lenght === 0) { - return res.status(400).send({ message: 'archivos no cargados' }); + if (!req.files || Object.keys(req.files).length === 0) { + return res.status(400).json({ status: 'error', message: 'Archivos no cargados' }); } else { const file = req.files.file_toUpload; - const path = req.app.locals.dir.path_dir + '/public/files/' + file.name; - console.log(path); - file.mv(path, (err) => { + const destinationPath = path.join(req.app.locals.dir.path_dir, file.name); + + file.mv(destinationPath, (err) => { if (err) { - return res.status(500).send(err); + console.error("Error al mover el archivo:", err); + return res.status(500).json({ status: 'error', message: 'Error al subir el archivo', error: err.message }); } - return res.send({ status: "success", path: path }); + // *** Mantener la respuesta JSON *** + return res.json({ status: "success", message: `Archivo '${file.name}' subido exitosamente.` }); }); } }; + controlador.upload_video = (req, res) => { if (!req.files || Object.keys(req.files).lenght === 0) { return res.status(400).send({ message: 'archivos no cargados' }); @@ -34,18 +38,16 @@ controlador.upload_video = (req, res) => { }; //ruta actual -const procesarPath = (path) => { - return path ? path.replace(/-/g, '/') : '/'; -} - -const fs = require('fs'); +const fs = require('fs'); // Asegúrate de que esta línea esté al principio del archivo si no lo está function leer_dir(dir) { var json = []; - var files = fs.readdirSync(dir + '/public/files/', { withFileTypes: true }); + // ¡CORRECCIÓN AQUÍ! Usa 'dir' directamente, sin añadir '/public/files/' + var files = fs.readdirSync(dir, { withFileTypes: true }); + files.forEach(function (arch, idx) { - json.push({ "indice": idx, "archivo": arch.name, "link": "files/" + arch }); - //console.log(arch.name); - //console.log(req); + // Si el link para la interfaz web debe ser relativo a 'files/', esto es correcto. + json.push({ "indice": idx, "archivo": arch.name, "link": "files/" + arch.name }); + // Nota: 'arch' es un objeto dirent, necesitas 'arch.name' para el nombre del archivo. }); return json; } @@ -69,8 +71,8 @@ controlador.cloud_panel = (req, res, next) => { } else { try { if (rows.length > 0) { - let dir = procesarPath(req.params.path); - console.log(req.app.locals.dir); + //let dir = procesarPath(req.params.path); + //console.log(req.app.locals.dir); var files = leer_dir(req.app.locals.dir.path_dir); res.render('cloud', { data: files @@ -83,7 +85,7 @@ controlador.cloud_panel = (req, res, next) => { } } catch (e) { res.render('login_cloud',{msg:e.toString()}); - //next(e); + next(e); } } }); diff --git a/src/public/css/cloud.css b/src/public/css/cloud.css index a382702..965942a 100644 --- a/src/public/css/cloud.css +++ b/src/public/css/cloud.css @@ -1,106 +1,402 @@ -body{ - background:rgb(10, 10, 10); - color: rgb(255, 255, 255); -} -.files{ -} -.info{ - font-family: sigma_font; - font-size: 20px; -} -.upload{ +/* Cloud SIGMA - Estilos Personalizados */ +:root { + --primary-gradient: linear-gradient(135deg, #4a5897 0%, #001833 100%); + --secondary-gradient: linear-gradient(135deg, #486ccf 0%, #f5576c 100%); + --dark-gradient: linear-gradient(135deg, #2c3e50 0%, #3498db 100%); + --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); + --glass-bg: rgba(255, 255, 255, 0.1); + --glass-border: rgba(255, 255, 255, 0.2); } -.icon { - width: 2em; - height: 2em; -} -#titulo{ - color: rgb(0, 0, 0); -} -#rep-video{ - width: 600; - height:400; -} -#ctr.l_audio{ - margin-top: -60px; +body { + background: linear-gradient(135deg, #667eea 0%, #4b58a2 50%, #93bdfb 100%); + min-height: 100vh; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } -/* MENU USUARIO DESPLEGABLE */ -.dropdown-menu { - position: absolute; - left: 5%; - left: auto; - border: 1px solid #ddd; - background: #fff; - padding: 0px; +/* Navbar Improvements */ +.navbar-custom { + background: rgba(0, 0, 0, 0.9) !important; + backdrop-filter: blur(10px); + border-bottom: 1px solid rgba(104, 101, 158, 0.1); + box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); + + /* --- CAMBIO CLAVE AQUÍ --- */ + position: relative; /* O 'fixed', o 'sticky' dependiendo de tu necesidad, pero debe ser no-static */ + z-index: 1060; /* Un z-index más alto que el dropdown para que el dropdown esté dentro de su contexto */ + /* --- FIN CAMBIO CLAVE --- */ } -.dropdown-menu ul{ - list-style-type: none; - color: aliceblue; - padding: 0px; + +.navbar-brand { + transition: all 0.3s ease; } -.dropdown-menu ul li{ - list-style-type: none; - color: aliceblue; + +.navbar-brand:hover { + transform: scale(1.1); } -.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 { + +.navbar-brand img { border-radius: 50%; + box-shadow: 0 0 20px rgba(102, 126, 234, 0.5); + transition: all 0.3s ease; } -.dropdown-menu ul li.user-header { - height: 175px; - padding: 10px; + +.navbar-brand img:hover { + box-shadow: 0 0 30px rgba(102, 126, 234, 0.8); +} + +/* Search Bar */ +.search-container { + position: relative; +} + +.form-control { + background: rgba(255, 255, 255, 0.1); + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 25px; + color: white; + backdrop-filter: blur(10px); + transition: all 0.3s ease; +} + +.form-control:focus { + background: rgba(255, 255, 255, 0.2); + border-color: #667eea; + box-shadow: 0 0 20px rgba(102, 126, 234, 0.3); + color: white; +} + +.form-control::placeholder { + color: rgba(255, 255, 255, 0.7); +} + +.btn-search { + background: var(--primary-gradient); + border: none; + border-radius: 25px; + color: white; + font-weight: 600; + transition: all 0.3s ease; +} + +.btn-search:hover { + transform: translateY(-2px); + box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4); + color: white; +} + +/* Container Improvements */ +.main-container { + margin-top: 30px; + padding: 0 20px; +} + +/* Upload Section */ +.upload-card { + background: rgba(255, 255, 255, 0.1); + backdrop-filter: blur(15px); + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 20px; + padding: 30px; + margin-bottom: 30px; + box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); + transition: all 0.3s ease; + /* --- CONSIDERACIÓN: Si estas tarjetas siguen por encima, podrías darles un z-index más bajo + Pero primero prueba el cambio en navbar-custom */ + /* z-index: 1; */ +} + +.upload-card:hover { + transform: translateY(-5px); + box-shadow: 0 15px 40px 0 rgba(31, 38, 135, 0.5); +} + +.upload-title { + color: white; + font-size: 2.5rem; + font-weight: 700; + margin-bottom: 25px; + text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); + background: linear-gradient(45deg, #fff, #667eea); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; +} + +.file-input-container { + position: relative; + overflow: hidden; + display: inline-block; + width: 100%; +} + +.file-input { + background: rgba(255, 255, 255, 0.1); + border: 2px dashed rgba(255, 255, 255, 0.3); + border-radius: 15px; + padding: 20px; + transition: all 0.3s ease; + color: white; +} + +.file-input:hover { + border-color: #667eea; + background: rgba(255, 255, 255, 0.2); +} + +.btn-upload { + background: var(--success-gradient); + border: none; + border-radius: 15px; + color: white; + font-weight: 600; + padding: 12px 30px; + transition: all 0.3s ease; + text-transform: uppercase; + letter-spacing: 1px; +} + +.btn-upload:hover { + transform: translateY(-3px); + box-shadow: 0 10px 25px rgba(56, 239, 125, 0.4); + color: white; +} + +/* Files Table */ +.files-card { + background: rgba(255, 255, 255, 0.1); + backdrop-filter: blur(15px); + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 20px; + padding: 30px; + box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); + transition: all 0.3s ease; + /* --- CONSIDERACIÓN: Si estas tarjetas siguen por encima, podrías darles un z-index más bajo + Pero primero prueba el cambio en navbar-custom */ + /* z-index: 1; */ +} + +.table-custom { + background: rgba(0, 0, 0, 0.3); + border-radius: 15px; + overflow: hidden; + box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2); +} + +.table-custom th { + background: rgba(0, 0, 0, 0.6); + color: white; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 1px; + padding: 20px 15px; + border: none; +} + +.table-custom td { + background: rgba(255, 255, 255, 0.05); + color: white; + padding: 15px; + border: 1px solid rgba(255, 255, 255, 0.1); + transition: all 0.3s ease; +} + +.table-custom tr:hover td { + background: rgba(255, 255, 255, 0.1); + transform: scale(1.02); +} + +/* Action Button */ +.btn-action { + background: var(--secondary-gradient); + border: none; + border-radius: 50%; + color: white; + width: 45px; + height: 45px; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.3s ease; + cursor: pointer; +} + +.btn-action:hover { + transform: scale(1.2) rotate(360deg); + box-shadow: 0 8px 20px rgba(147, 189, 251, 0.4); +} + +/* Modal Improvements */ +.modal-content { + background: rgba(255, 255, 255, 0.1); + backdrop-filter: blur(20px); + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 20px; + box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); +} + +.modal-header { + border-bottom: 1px solid rgba(255, 255, 255, 0.2); + padding: 25px 30px; +} + +.modal-title { + color: white; + font-weight: 600; +} + +.modal-body { + padding: 30px; +} + +.modal-footer { + border-top: 1px solid rgba(255, 255, 255, 0.2); + padding: 20px 30px; + gap: 10px; +} + +.modal-footer .btn { + border-radius: 50%; + width: 50px; + height: 50px; + display: flex; + align-items: center; + justify-content: center; + border: none; + transition: all 0.3s ease; + color: white; +} + +.modal-footer .btn:nth-child(1) { + background: linear-gradient(135deg, #6bff72, #52ee6c); +} + +.modal-footer .btn:nth-child(2) { + background: linear-gradient(135deg, #4ecdc4, #44a08d); +} + +.modal-footer .btn:nth-child(3) { + background: linear-gradient(135deg, #45b7d1, #96c93d); +} + +.modal-footer .btn:nth-child(4) { + background: linear-gradient(135deg, #79a3ff, #ff0022); + border-radius: 25px; + width: auto; + padding: 10px 25px; +} + +.modal-footer .btn:hover { + transform: translateY(-3px) scale(1.1); + box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3); +} + +/* --- CAMBIO CLAVE AQUÍ --- */ +/* Dropdown Menu */ +.dropdown-menu { + /* Asegúrate de que position no sea 'static' */ + position: absolute; + /* Necesita ser un z-index mayor que la navbar si el dropdown está fuera del flujo normal de la navbar (Bootstrap lo suele manejar), + o si el navbar tiene un z-index. Un valor como 1050 es un buen punto de partida, pero podemos subirlo. */ + z-index: 1070; /* Mayor que el z-index de la navbar-custom */ + + background: rgba(0, 0, 0, 0.9); + backdrop-filter: blur(15px); + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 15px; + box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); + color: white; + padding: 20px; + min-width: 300px; +} +/* --- FIN CAMBIO CLAVE --- */ + + +.user-header { text-align: center; + padding: 20px; + border-bottom: 1px solid rgba(255, 255, 255, 0.2); + margin-bottom: 15px; } -.user-header{ - background-color: #255977; - color: white + +.user-header img { + width: 80px; + height: 80px; + border-radius: 50%; + border: 3px solid #667eea; + box-shadow: 0 0 20px rgba(102, 126, 234, 0.5); +} + +.user-header p { + margin-top: 15px; + color: white; } .user-body { - padding: 15px; - border-bottom: 1px solid #f4f4f4; - border-top: 1px solid #dddddd; - background-color: #255977; + margin: 15px 0; } + +.user-body a { + color: #667eea; + text-decoration: none; + transition: all 0.3s ease; +} + +.user-body a:hover { + color: #75acff; +} + .user-footer { display: flex; - background-color: #8d8d8d; - padding: 10px; + justify-content: space-between; + margin-top: 20px; + padding-top: 15px; + border-top: 1px solid rgba(255, 255, 255, 0.2); } -.pull-left{ - box-sizing: border-box; - width: 50%; + +.user-footer .btn { + background: var(--primary-gradient); + border: none; + border-radius: 20px; + color: white; + padding: 8px 20px; + font-size: 14px; + transition: all 0.3s ease; } -.pull-right{ - box-sizing: border-box; - width: 50%; + +.user-footer .btn:hover { + transform: translateY(-2px); + box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4); } -#id_usuario{ + +/* Animations */ +@keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(30px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +.animate-fadeInUp { + animation: fadeInUp 0.6s ease-out; +} + +/* Responsive */ +@media (max-width: 768px) { + .upload-title { + font-size: 2rem; + } -} -/*#TEST_COLORS{ - #98BFDA -#FEDE58 -#98D8A5 -#FE9898 -#FE98FE -#FFFFFF - -#FFEEEC -#FEFDED -#EAFFE5 -#ECFDFF -#F0F1FE -#FFEBFA - -}*/ \ No newline at end of file + .upload-card, .files-card { + padding: 20px; + } + + .main-container { + padding: 0 10px; + } +} \ No newline at end of file diff --git a/src/views/cloud.ejs b/src/views/cloud.ejs index 0e3ad8b..efb94c7 100644 --- a/src/views/cloud.ejs +++ b/src/views/cloud.ejs @@ -29,11 +29,11 @@ function modal(url) { var array = url.split("."); var tipo = array.pop(); + var contentHTML = ''; // Variable para almacenar el HTML a inyectar + if (modo_img(tipo)) { - //$("#img").attr("src","files/"+url); - document.getElementById("data").innerHTML = ``; + contentHTML = ``; } else if (modo_video(tipo)) { - //var alto = window.innerHeight; var anch = window.innerWidth; var porc = 10; if (anch > 1400) { @@ -47,192 +47,301 @@ } else if (anch > 576) { porc = 35; } - //console.log("Ancho Original: "+anch+", Alto Original: "+alto); - //console.log("Ancho -10%: "+(anch-(anch * porc/100))+", Alto: "+alto); - var ctrl_video = ` -