diff --git a/package-lock.json b/package-lock.json index 5ede05b..7a33f04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -992,6 +992,11 @@ "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", "dev": true }, + "bignumber.js": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-4.1.0.tgz", + "integrity": "sha512-eJzYkFYy9L4JzXsbymsFn3p54D+llV27oTQ+ziJG7WFRheJcNZilgVXMG0LoZtlQSKBsJdWtLFqOD0u+U0jZKA==" + }, "binary-extensions": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.12.0.tgz", @@ -1869,8 +1874,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cosmiconfig": { "version": "5.0.6", @@ -5002,8 +5006,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isemail": { "version": "3.1.3", @@ -5803,6 +5806,17 @@ "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", "dev": true }, + "mysql": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.16.0.tgz", + "integrity": "sha512-dPbN2LHonQp7D5ja5DJXNbCLe/HRdu+f3v61aguzNRQIrmZLOeRoymBYyeThrR6ug+FqzDL95Gc9maqZUJS+Gw==", + "requires": { + "bignumber.js": "4.1.0", + "readable-stream": "2.3.6", + "safe-buffer": "5.1.2", + "sqlstring": "2.3.1" + } + }, "nan": { "version": "2.11.1", "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz", @@ -7165,8 +7179,7 @@ "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" }, "promise-inflight": { "version": "1.0.1", @@ -7410,7 +7423,6 @@ "version": "2.3.6", "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, "requires": { "core-util-is": "1.0.2", "inherits": "2.0.3", @@ -8491,6 +8503,11 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "sqlstring": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", + "integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A=" + }, "sshpk": { "version": "1.15.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", @@ -8655,7 +8672,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, "requires": { "safe-buffer": "5.1.2" } @@ -9456,8 +9472,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "util.promisify": { "version": "1.0.0", diff --git a/package.json b/package.json index e97b87e..f6535c2 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@types/express": "^4.16.0", "@types/node": "^10.12.5", "express": "^4.16.4", + "mysql": "^2.16.0", "vue": "^2.5.17", "vue-class-component": "^6.0.0", "vue-property-decorator": "^7.0.0", diff --git a/src/components/AnimeView/Contenido.vue b/src/components/AnimeView/Contenido.vue index 667d964..a350d17 100644 --- a/src/components/AnimeView/Contenido.vue +++ b/src/components/AnimeView/Contenido.vue @@ -42,7 +42,7 @@
- + diff --git a/src/components/AnimeView/irozuku.json b/src/components/AnimeView/irozuku.json index 27c294f..9300d16 100644 --- a/src/components/AnimeView/irozuku.json +++ b/src/components/AnimeView/irozuku.json @@ -4,7 +4,7 @@ "opciones": [ { "formato": "ligero", - "res": "720p", + "res": "@60fps", "servidor": "MEGA", "color": "red", "eps": { diff --git a/src/components/AnimeView/panelDeDescarga.vue b/src/components/AnimeView/panelDeDescarga.vue index eb8dd37..b728603 100644 --- a/src/components/AnimeView/panelDeDescarga.vue +++ b/src/components/AnimeView/panelDeDescarga.vue @@ -4,20 +4,28 @@ Descarga aquí.
-
- Ligero
MEGA -
-
- MP4 720p
MEGA -
+
- Códec: H265, Resolución: 1280x720p, Framerate: 60fps, Contenedor: MP4, Subtitulos: Quemados
-
Links
- o + + +
@@ -26,11 +34,54 @@ export default { name: "panelDeDescarga", + data: function () { + return { + datos: {}, + posActual: '0' + } + }, props: { color: { type: String, default: '#23bf87' + }, + nombre: { + type: String, + required: true } + }, + methods: { + cambiarDescripcionDescarga (idDestino: string) { + const elemAnterior = document.getElementById(`tarjeta${this.posActual}`); + const elemNuevo = document.getElementById(`tarjeta${idDestino}`); + + if (elemNuevo && elemAnterior) { + this.posActual = idDestino; + + elemAnterior.style.display = "none"; + elemNuevo.style.display = "block"; + + console.log(":3 " + idDestino); + } else { + console.log(":c"); + } + } + }, + created: function () { + const xhr = new XMLHttpRequest(); + + xhr.open("POST","/links"); + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + const vm = this; + xhr.onload = () => { + + const data = JSON.parse(xhr.responseText); + if (data.exito) { + vm.datos = data.payload; + } + + }; + xhr.send(`nombre=${ this.nombre }`); } } diff --git a/src/views/AnimeView.vue b/src/views/AnimeView.vue index fb7a2f4..f0a54b3 100644 --- a/src/views/AnimeView.vue +++ b/src/views/AnimeView.vue @@ -5,13 +5,13 @@ :anio="parseInt(this.$route.params.anio)" :temporada="this.$route.params.temp" :nombre="this.$route.params.anime" - :color="this.datos.data.color" + :color="color" />
+ :color="color"/>
@@ -39,6 +39,7 @@ data: function () { return { datos: {}, + color: '#23bf87', existe: false } }, @@ -49,9 +50,10 @@ for (const animeI in window.indiceAnimes) { const anime = window.indiceAnimes[animeI]; if (anime.link === link) { - console.log("Lo encontre we :D"); + this.datos = anime; this.existe = true; + this.color = anime.data.color; break; } } diff --git a/srv/LinksAnimes/obtenerLinks.ts b/srv/LinksAnimes/obtenerLinks.ts new file mode 100644 index 0000000..a576b23 --- /dev/null +++ b/srv/LinksAnimes/obtenerLinks.ts @@ -0,0 +1,36 @@ +const obtenerLinks = (req: any, res: any) => { + + const con = require('../mysql').obtenerConexionMySql(); + const nombre = req.body.nombre; + + con.connect((err: any) => { + if (!err && nombre !== undefined) { + con.query( + `SELECT data FROM links WHERE nombre='${nombre}'`, + (err: any, response: any) => { + if (!err && response[0] ) { + + const objecto = JSON.parse(response[0]["data"]); + + res.send(`{ "exito": true, "payload": ${JSON.stringify(objecto)} }`); + + } else { + console.log("Error al ejecutar Query.\n" + err); + res.send(`{ "exito": false }`); + } + + con.end(); + } + ); + + } else { + console.log("Hubo un error al conectarse a la base de datos :c"); + res.send(`{ "exito": false }`); + + con.end(); + } + }); + +}; + +module.exports.obtenerLinks = obtenerLinks; \ No newline at end of file diff --git a/srv/index.ts b/srv/index.ts index 06e1b81..2c4af48 100644 --- a/srv/index.ts +++ b/srv/index.ts @@ -1,7 +1,9 @@ import express from 'express'; export default (app:any) => { - // app.use(express.json()); + + app.use(express.json()); + app.use(express.urlencoded()); // // app.get('/foo', (req, res) => { // res.json({msg: 'foo'}); @@ -12,4 +14,7 @@ export default (app:any) => { // }); app.get("/"); + + app.post('/links', require('./LinksAnimes/obtenerLinks').obtenerLinks); + }