diff --git a/src/controladores/controlador_Apps.js b/src/controladores/controlador_Apps.js index a0ae059..fde7516 100644 --- a/src/controladores/controlador_Apps.js +++ b/src/controladores/controlador_Apps.js @@ -24,4 +24,20 @@ controlador.user = (req, res) => { }); } +//test de velocidad html +controlador.speedtest = (req, res) => { + //res.render('speedtest'); + res.render('test_velocidad') +}; + +//videos de ayuda sigma +controlador.videos = (req, res) => { + //res.render('speedtest'); + res.render('videos') +}; +controlador.upload = (req, res) => { + //res.render('speedtest'); + res.render('video_upload') +}; + module.exports = controlador; \ No newline at end of file diff --git a/src/controladores/controlador_cloud.js b/src/controladores/controlador_cloud.js index 5be5b9b..0a11b4a 100644 --- a/src/controladores/controlador_cloud.js +++ b/src/controladores/controlador_cloud.js @@ -17,6 +17,21 @@ controlador.upload = (req, res) => { }); } }; +controlador.upload_video = (req, res) => { + if (!req.files || Object.keys(req.files).lenght === 0) { + return res.status(400).send({ message: 'archivos no cargados' }); + } else { + const file = req.files.file_toUpload; + const path = req.app.locals.dir.path_dir + '/public/videos/' + file.name; + console.log(path); + file.mv(path, (err) => { + if (err) { + return res.status(500).send(err); + } + return res.send({ status: "success", path: path }); + }); + } +}; //ruta actual const procesarPath = (path) => { diff --git a/src/public/css/app_videos.css b/src/public/css/app_videos.css new file mode 100644 index 0000000..47ab63c --- /dev/null +++ b/src/public/css/app_videos.css @@ -0,0 +1,160 @@ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #121212; + color: #e0e0e0; + } + .banner { + display: flex; + align-items: center; + justify-content: space-between; + background-color: #1f1f1f; + color: #e0e0e0; + padding: 10px 20px; + position: fixed; + width: 96%; + top: 0; + z-index: 1000; + } + .banner .logo { + font-size: 24px; + font-weight: bold; + } + .banner .logo img { + height: 40px; + } + .banner .search-bar { + flex-grow: 1; + display: flex; + align-items: center; + margin: 0 20px; + } + .banner input[type="text"] { + width: 100%; + padding: 5px; + border: none; + border-radius: 3px; + margin-right: 10px; + background-color: #333; + color: #e0e0e0; + } + .banner .search-bar button { + background: url('https://cdn.jsdelivr.net/npm/uix@1.1.0/dist/icons/search.svg') no-repeat center; + background-size: 20px; + border: none; + width: 30px; + height: 30px; + cursor: pointer; + } + .banner .menu { + position: relative; + } + .banner .menu button { + background: url('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR5nhCKmVjqZVfc19KXRTIXpeT6mweVBNeAmw&s') no-repeat center; + background-size: 30px; + border: none; + width: 40px; + height: 40px; + cursor: pointer; + color: #e0e0e0; + } + .banner .menu ul { + display: none; + position: absolute; + top: 35px; + right: 0; + background: #1f1f1f; + border: 1px solid #333; + border-radius: 5px; + list-style: none; + padding: 0; + margin: 0; + z-index: 1000; + } + .banner .menu ul li { + padding: 10px; + border-bottom: 1px solid #333; + color: #e0e0e0; + cursor: pointer; + } + .banner .menu ul li:last-child { + border-bottom: none; + } + .banner .menu ul li:hover { + background: #333; + } + .video-list { + padding: 80px 20px 20px; + } + .video-carousel { + position: relative; + } + .slick-slide { + display: flex; + justify-content: center; + } + .video-item { + width: 150px; + margin: 10px; + background: #2c2c2c; + border: 1px solid #444; + border-radius: 5px; + overflow: hidden; + box-shadow: 0 2px 5px rgba(0,0,0,0.5); + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; + } + .video-item img { + width: 100%; + height: auto; + } + .video-item .info { + padding: 10px; + background: #1f1f1f; + } + .player { + display: flex; + justify-content: center; + margin-top: 20px; + } + .player iframe, + .player video { + width: 80%; + max-width: 800px; + border: 2px solid #444; + border-radius: 5px; + } + .slick-prev, + .slick-next { + width: 40px; + height: 40px; + background: #333; + color: #e0e0e0; + border: none; + border-radius: 50%; + line-height: 40px; + text-align: center; + font-size: 20px; + cursor: pointer; + z-index: 1000; + } + .slick-prev { + left: 10px; + } + .slick-next { + right: 10px; + } + @media (max-width: 768px) { + .video-item { + width: 200px; + } + } + @media (max-width: 480px) { + .video-item { + width: 150px; + } + } \ No newline at end of file diff --git a/src/public/css/app_videos_upload.css b/src/public/css/app_videos_upload.css new file mode 100644 index 0000000..adb4e7e --- /dev/null +++ b/src/public/css/app_videos_upload.css @@ -0,0 +1,71 @@ +body { + font-family: Arial, sans-serif; + background-color: #121212; + color: #e0e0e0; + padding: 20px; +} + +.container { + max-width: 600px; + margin: 0 auto; + background-color: #1f1f1f; + padding: 20px; + border-radius: 10px; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); +} + +h2 { + text-align: center; + margin-bottom: 20px; +} + +.form-group { + margin-bottom: 15px; +} + +.form-group label { + display: block; + margin-bottom: 5px; +} + +.form-group input, +.form-group select, +.form-group textarea { + width: 100%; + padding: 10px; + border: none; + border-radius: 5px; + background-color: #333; + color: #e0e0e0; +} + +.form-group textarea { + resize: vertical; + height: 100px; +} + +.form-group button { + width: 100%; + padding: 10px; + border: none; + border-radius: 5px; + background-color: #ff5722; + color: #fff; + font-size: 16px; + cursor: pointer; +} + +.form-group button:hover { + background-color: #e64a19; +} + +.form-group img { + margin-top: 10px; + width: 100%; + height: auto; + border-radius: 5px; +} + +#urlGroup { + display: none; +} \ No newline at end of file diff --git a/src/public/css/login.css b/src/public/css/login.css new file mode 100644 index 0000000..f78243b --- /dev/null +++ b/src/public/css/login.css @@ -0,0 +1,99 @@ +@import url('https://fonts.googleapis.com/css?family=Poppins:wght@300;400;500;600;700;800;900&display=swap'); +*{ + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: 'Poppins', sans-serif,sigma_tipografia; +} +body{ + /*background: #084C6D;*/ + display: flex; + justify-content:center; + align-items: center; + min-height: 100vh; + background: #1e293b; +} +@font-face { + font-family: sigma_tipografia; + src: url(../tipografias/sigma_font.ttf) format('truetype'), url(../tipografias/sigma_font.otf) format('truetype'); + font-style: normal; +} + +.login-page{ + background-color: #0a2938; +} +.login-logo a, .register-logo a{ + color: #b5daff +} +.nom_app{ + font-family: sigma_tipografia; +} +.login-logo{ + margin-top: 5px; + font-size:32px; + font-family: sigma_tipografia; +} +.login-box-msg{ + font-family: 'SIGMA-FONT', sigma_font, sigma_tipografia; +} + +.box{ + position: relative; + width: 380px; + height: 420px; + background-color: #1c1c1c; + border-radius: 8px; + overflow: hidden; +} + +.box::before{ + content: ''; + position: absolute; + top: -50%; + left: -50%; + width: 370px; + height: 420px; + background: linear-gradient(0deg,transparent,#45f3ff,#45f3ff); + transform-origin: bottom right; + animation: animar 6s linear infinite; +} + +.box::after{ + content: ''; + position: absolute; + top: -50%; + left: -50%; + width: 370px; + height: 420px; + background: linear-gradient(0deg,transparent,#45ff74,#45f3ff); + transform-origin: bottom right; + animation: animar 6s linear infinite; + animation-delay: -3s; +} +@keyframes animar{ + 0%{ + transform: rotate(0deg); + } + 100%{ + transform: rotate(360deg); + } +} +.form-box { + position: absolute; + inset: 2px; + background: #28292d; + z-index: 10; +} +.login-box{ + position: absolute; + inset: 2px; + background: #28292d; + z-index: 10; + width: 99%; + margin-top: 0rem; + border-radius: 8px; +} + +.footer a{ + margin-left: 30px; + } \ No newline at end of file diff --git a/src/public/css/speedtest.css b/src/public/css/speedtest.css new file mode 100644 index 0000000..4e75494 --- /dev/null +++ b/src/public/css/speedtest.css @@ -0,0 +1,62 @@ +body { + font-family: Arial, sans-serif; + background: #f4f4f4; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; +} + +.container { + width: 100%; + max-width: 400px; + background: #fff; + padding: 20px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + border-radius: 8px; + text-align: center; +} + +h2 { + color: #333; + margin-bottom: 20px; +} + +.result { + margin-top: 20px; + font-size: 24px; + font-weight: bold; + color: #007bff; +} + +.btn-measure { + padding: 10px 20px; + background: #28a745; + color: #fff; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 16px; + margin-top: 20px; +} + +.btn-measure:hover { + background: #218838; +} + +.loader { + border: 4px solid #f3f3f3; + border-radius: 50%; + border-top: 4px solid #007bff; + width: 40px; + height: 40px; + animation: spin 1s linear infinite; + margin: 20px auto; + display: none; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} \ No newline at end of file diff --git a/src/public/img/sigma_cloud64.png b/src/public/img/sigma_cloud64.png new file mode 100644 index 0000000..f8689e9 Binary files /dev/null and b/src/public/img/sigma_cloud64.png differ diff --git a/src/public/img/sigma_cloud_b64.png b/src/public/img/sigma_cloud_b64.png new file mode 100644 index 0000000..61fa4c6 Binary files /dev/null and b/src/public/img/sigma_cloud_b64.png differ diff --git a/src/public/img/sigma_cloud_w64.png b/src/public/img/sigma_cloud_w64.png new file mode 100644 index 0000000..61850ac Binary files /dev/null and b/src/public/img/sigma_cloud_w64.png differ diff --git a/src/public/js/app_videos_upload.js b/src/public/js/app_videos_upload.js new file mode 100644 index 0000000..49347ea --- /dev/null +++ b/src/public/js/app_videos_upload.js @@ -0,0 +1,110 @@ +document.getElementById('origen').addEventListener('change', function () { + const origen = this.value; + const urlGroup = document.getElementById('urlGroup'); + const fileGroup = document.getElementById('fileGroup'); + const urlInput = document.getElementById('url'); + const fileInput = document.getElementById('videoUpload'); + const previewImg = document.getElementById('previewImg'); + + if (origen === 'Local') { + fileGroup.style.display = 'block'; + urlGroup.style.display = 'none'; + urlInput.required = false; + fileInput.required = true; + } else { + fileGroup.style.display = 'none'; + urlGroup.style.display = 'block'; + urlInput.required = true; + fileInput.required = false; + //previewImg.style.display = 'none'; + } +}); + +document.getElementById('getThumbnailBtn').addEventListener('click', function () { + const origen = document.getElementById('origen').value; + if (origen === 'Local') { + obtenerMiniaturaLocal(); + } else if (origen === 'YouTube') { + obtenerMiniaturaYouTube(); + } + else if (origen === 'Vimeo') { + obtenerMiniaturaVimeo(); + } +}); + +function obtenerMiniaturaLocal() { + const fileInput = document.getElementById('videoUpload'); + const file = fileInput.files[0]; + const previewImg = document.getElementById('previewImg'); + + if (file) { + const videoElement = document.createElement('video'); + videoElement.src = URL.createObjectURL(file); + videoElement.muted = true; + + videoElement.addEventListener('loadeddata', function () { + videoElement.currentTime = videoElement.duration / 2; + }); + + videoElement.addEventListener('seeked', function () { + const canvas = document.createElement('canvas'); + const ctx = canvas.getContext('2d'); + canvas.width = videoElement.videoWidth / 4; + canvas.height = videoElement.videoHeight / 4; + ctx.drawImage(videoElement, 0, 0, canvas.width, canvas.height); + + previewImg.src = canvas.toDataURL(); + previewImg.style.display = 'block'; + }); + } +} + +function obtenerMiniaturaYouTube() { + const url = document.getElementById('url').value; + const previewImg = document.getElementById('previewUrl'); + var thumbnailUrl = 'https://img.youtube.com/vi/' + extractYouTubeVideoId(url) + '/0.jpg';; // Implement this function based on the source + previewImg.src = thumbnailUrl; + previewImg.style.display = 'block'; +} +function obtenerMiniaturaVimeo() { + const url = document.getElementById('url').value; + const previewImg = document.getElementById('previewUrl'); + var thumbnailUrl = 'https://vumbnail.com/' + extractVimeoVideoId(url) + '.jpg'; // Implement this function based on the source + + previewImg.src = thumbnailUrl; + previewImg.style.display = 'block'; +} + +function extractYouTubeVideoId(url) { + var match = url.match(/(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([^&]+)/); + return match ? match[1] : ''; +} +function extractVimeoVideoId(url) { + var match = url.match(/(?:https?:\/\/)?(?:www\.)?vimeo\.com\/(\d+)/); + return match ? match[1] : ''; +} + +document.getElementById('uploadForm').addEventListener('submit', function (event) { + event.preventDefault(); + + const origen = document.getElementById('origen').value; + let urlOrFile; + if (origen === 'Local') { + urlOrFile = document.getElementById('videoUpload').files[0]; + } else { + urlOrFile = document.getElementById('url').value; + } + + const videoData = { + nombre: document.getElementById('nombre').value, + descripcion: document.getElementById('descripcion').value, + url: urlOrFile, + miniatura: origen === 'Local' ? document.getElementById('previewImg').src : document.getElementById('previewUrl').src, + tipo: document.getElementById('tipo').value, + tamano: document.getElementById('tamano').value, + origen: origen, + }; + + console.log('Video subido:', videoData); + // Aquí puedes agregar código para procesar la subida y guardado de los datos. +}); \ No newline at end of file diff --git a/src/public/plantilla_html/rep_video.html b/src/public/plantilla_html/rep_video.html new file mode 100644 index 0000000..66a2041 --- /dev/null +++ b/src/public/plantilla_html/rep_video.html @@ -0,0 +1,284 @@ + + +
+ + +
+ Subir Video