diff --git a/data/nodes.json b/data/nodes.json index 56832d1..a0f078d 100644 --- a/data/nodes.json +++ b/data/nodes.json @@ -1,6 +1,6 @@ [ { - "host": "localhost", + "host": "omega.raphix.fr", "port": 2333, "password": "youshallnotpass", "retryAmount": 5 diff --git a/package-lock.json b/package-lock.json index c93d937..7981a06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "subsonics-web", - "version": "2.1.0", + "version": "2.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "subsonics-web", - "version": "2.1.0", + "version": "2.1.1", "dependencies": { "cookie": "^0.5.0", "cookie-parser": "^1.4.6", @@ -17,6 +17,7 @@ "loguix": "^1.4.2", "markdown-it": "^13.0.1", "moonlink.js": "^3.6.4", + "moonlink.js-lyrics": "^1.0.1-2", "nodemon": "^2.0.22", "pm2": "^5.3.0", "request": "^2.88.2", @@ -2278,6 +2279,14 @@ "node": ">=16.6.0" } }, + "node_modules/moonlink.js-lyrics": { + "version": "1.0.1-2", + "resolved": "https://registry.npmjs.org/moonlink.js-lyrics/-/moonlink.js-lyrics-1.0.1-2.tgz", + "integrity": "sha512-ZW5SFPxlVSpP4k87bSPH9bZwKMBrBLz9g5wWWIvUOeEC2btyAi3fhVTDXyaNH5Ub5a13EVhdXxmunKPle5oh/g==", + "dependencies": { + "moonlink.js": "latest" + } + }, "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -5540,6 +5549,14 @@ "resolved": "https://registry.npmjs.org/moonlink.js/-/moonlink.js-3.6.4.tgz", "integrity": "sha512-qaL/FxrWtwLLJmUHyFIh+kQauM1TUEb1qeK1oeoPxQ175SXPFgGySCV01h/RGc0Ki4Erke5rKAERt/aP1xVA4w==" }, + "moonlink.js-lyrics": { + "version": "1.0.1-2", + "resolved": "https://registry.npmjs.org/moonlink.js-lyrics/-/moonlink.js-lyrics-1.0.1-2.tgz", + "integrity": "sha512-ZW5SFPxlVSpP4k87bSPH9bZwKMBrBLz9g5wWWIvUOeEC2btyAi3fhVTDXyaNH5Ub5a13EVhdXxmunKPle5oh/g==", + "requires": { + "moonlink.js": "latest" + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", diff --git a/package.json b/package.json index dd1ee2d..c907207 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "subsonics-web", "author": "Raphix", - "version": "2.1.1", + "version": "2.1.2", "nodemonConfig": { "ext": "js, html", "ignore": [ @@ -21,6 +21,7 @@ "loguix": "^1.4.2", "markdown-it": "^13.0.1", "moonlink.js": "^3.6.4", + "moonlink.js-lyrics": "^1.0.1-2", "nodemon": "^2.0.22", "pm2": "^5.3.0", "request": "^2.88.2", diff --git a/src/modules/discord-bot.js b/src/modules/discord-bot.js index d63d07a..dfb355b 100644 --- a/src/modules/discord-bot.js +++ b/src/modules/discord-bot.js @@ -7,6 +7,7 @@ const { List } = require("./sub-list") const nodeFinder = require("./nodes-finder") const metric = require("webmetrik") const { MoonlinkManager } = require("moonlink.js") +const { Lyrics } = require("moonlink.js-lyrics"); /// @@ -159,7 +160,7 @@ function startErelaManager(dlog, config) { // The nodes to connect to, optional if using default lavalink options nodes, { - /* Options */ + plugins: [new Lyrics()] }, (guild, sPayload) => { // Sending payload information to the server diff --git a/src/modules/sub-player.js b/src/modules/sub-player.js index 41ec0d3..aaac093 100644 --- a/src/modules/sub-player.js +++ b/src/modules/sub-player.js @@ -259,7 +259,7 @@ module.exports.addSong = async function (data, userId, quick, playlist) { } } else { - if(!player.playing && player.paused == false) { + if(!player.current && player.paused == false) { player.play(songs.tracks[0]) diff --git a/src/modules/sub-web.js b/src/modules/sub-web.js index 1a8346a..59bbb94 100644 --- a/src/modules/sub-web.js +++ b/src/modules/sub-web.js @@ -13,6 +13,7 @@ const { Server } = require("socket.io") var fs = require("fs") var path = require("path") const { Metric } = require("webmetrik"); +const { type } = require("os"); const markdownit = require("markdown-it")({ html: true, linkify: true, @@ -479,18 +480,12 @@ function IOConnection(io) { PostRequest("LYRICS", async (data) => { - let url = `https://paxsenixofc.my.id/server/getLyricsMusix.php?q=${data}&type=default`; - - fetch(url, { - method: 'GET', - }) - .then(response => response.text()) - .then(data => { - PostAnswer("LYRICS", data) - }) - .catch((error) => { - console.error('Erreur:', error); - }); + if(typeof data == "string") { + data = {"url": data} + } else { + let player = require("./discord-bot").getClient().manager.players.get("137291455336022018") + PostAnswer("LYRICS", player.lyrics()) + } }) diff --git a/src/web/public/javascript/player.js b/src/web/public/javascript/player.js index dddc6e8..c1fff64 100644 --- a/src/web/public/javascript/player.js +++ b/src/web/public/javascript/player.js @@ -17,7 +17,7 @@ const volume = getID("volume") const volIcon = getID("volIcon") const volTxt = getID("volTxt") -// const lyrics = getID("lyrics") +const lyrics = getID("lyrics") const disconnect = getID("disconnect") const moveout = getID("moveout") @@ -55,7 +55,7 @@ AlwaysRequest("MUSIC_STATE", async (data) => { volume.classList.remove("invisible") volTxt.classList.remove("invisible") volIcon.classList.remove("invisible") - // lyrics.classList.remove("invisible") + lyrics.classList.remove("invisible") } else { @@ -72,7 +72,7 @@ AlwaysRequest("MUSIC_STATE", async (data) => { time_act.innerHTML = " " time_total.innerHTML = " " durationBar.classList.add("invisible") - // lyrics.classList.add("invisible") + lyrics.classList.add("invisible") } @@ -279,93 +279,73 @@ moveout.addEventListener('click', () => { get("MOVEOUT") }) -// lyrics.addEventListener('click', (e) => { +lyrics.addEventListener('click', (e) => { -// currentTitle = currentTitle.replace(/\(.*?\)/g, "").replace(/\[.*?\]/g, "").trim() + currentTitle = currentTitle.replace(/\(.*?\)/g, "").replace(/\[.*?\]/g, "").trim() -// if(e.ctrlKey) { -// const modal = new ModalComponent({"title": "Rechercher des paroles" , "width": "25%", "closable": true}) + if(e.ctrlKey) { + const modal = new ModalComponent({"title": "Rechercher des paroles" , "width": "25%", "closable": true}) -// modal.setContent(` -//
-// -// -//
-// `) + modal.setContent(` +
+ + +
+ `) -// modal.show() + modal.show() -// const lyricsSearch = getID("lyrics_search") -// const lyricsSearchBtn = getID("lyrics_search_btn") + const lyricsSearch = getID("lyrics_search") + const lyricsSearchBtn = getID("lyrics_search_btn") -// lyricsSearchBtn.addEventListener('click', () => { -// showLyrics(lyricsSearch.value) -// modal.hide() -// }) + lyricsSearchBtn.addEventListener('click', () => { + showLyrics(lyricsSearch.value) + modal.hide() + }) -// } else { + } else { -// if(currentTitle) { -// showLyrics(currentTitle) + if(currentTitle) { + showLyrics(0) -// } else { -// const modal = new ModalComponent({"title": "Paroles" , "width": "20%", "closable": true}) -// modal.setContent(` + } else { + const modal = new ModalComponent({"title": "Paroles" , "width": "20%", "closable": true}) + modal.setContent(` -//

Lancez une musique pour rechercher les paroles ou faites Ctrl + Click !

-// `) +

Lancez une musique pour rechercher les paroles ou faites Ctrl + Click !

+ `) -// modal.show() -// } -// } + modal.show() + } + } -// }) +}) -// function showLyrics(title) { -// title = title.replace(/\(.*?\)/g, "").replace(/\[.*?\]/g, "").trim() -// post("LYRICS", title).then((res) => { - - -// if(res.startsWith("
")) { -// const modal = new ModalComponent({"title": "Paroles" , "width": "50%", "closable": true}) -// modal.setContent(` -//

Aucune paroles trouvées pour cette musique !

-// `) +function showLyrics(title) { + + post("LYRICS", title).then((res) => { + console.log(res) + if(res.lyrics) { -// modal.show() -// } else { + + setTileActive(null) -// const lyricsArray = new Array() - -// // Split res by line when a new [ appears - -// res.split("[").forEach((line) => { -// if(line.includes("]")) { -// const time = line.split("]")[0].trim() -// const lyrics = line.split("]")[1].trim() -// lyricsArray.push(`

${lyrics}

`) -// } -// }) - - -// setTileActive(null) - -// loadView(` -//

Paroles de "${title}"

-//
-//
-// ${lyricsArray.join("")} -//
-//
-// `) + loadView(` +

Paroles de ""

+
+
+ +
+
+ `) -// } -// }) + } + }) -// } +} volIcon.addEventListener('click', () => { diff --git a/src/web/public/stylesheets/style.css b/src/web/public/stylesheets/style.css index f049e8e..8879a5f 100644 --- a/src/web/public/stylesheets/style.css +++ b/src/web/public/stylesheets/style.css @@ -225,7 +225,7 @@ button:hover { } @keyframes scroll { - from { + from { transform: translateX(0%); /* Départ de l'animation */ } to { @@ -458,7 +458,8 @@ hr { flex: 1 0 0; align-self: stretch; border-radius: 5px; - + margin-top: 22px; + margin-bottom: 22px; } @@ -841,7 +842,7 @@ hr { display: flex; overflow-y: auto; flex: 1; - + overflow-x: hidden; gap: 10px; width: 100%; position: relative; diff --git a/src/web/templates/index.ejs b/src/web/templates/index.ejs index 5b9c766..b3f8364 100644 --- a/src/web/templates/index.ejs +++ b/src/web/templates/index.ejs @@ -28,7 +28,7 @@ Soundboard --> -
+

Playlists

@@ -43,7 +43,7 @@
-
+
@@ -122,7 +122,7 @@
- +