Version 2.1.2 - Edit du comportement d'ajout de chanson
All checks were successful
Subsonics - Web/pipeline/head This commit looks good

This commit is contained in:
Raphael 2024-05-29 23:01:40 +02:00
parent 4ed76f3a31
commit 30c46ba38f
9 changed files with 89 additions and 94 deletions

View File

@ -1,6 +1,6 @@
[ [
{ {
"host": "localhost", "host": "omega.raphix.fr",
"port": 2333, "port": 2333,
"password": "youshallnotpass", "password": "youshallnotpass",
"retryAmount": 5 "retryAmount": 5

21
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "subsonics-web", "name": "subsonics-web",
"version": "2.1.0", "version": "2.1.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "subsonics-web", "name": "subsonics-web",
"version": "2.1.0", "version": "2.1.1",
"dependencies": { "dependencies": {
"cookie": "^0.5.0", "cookie": "^0.5.0",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
@ -17,6 +17,7 @@
"loguix": "^1.4.2", "loguix": "^1.4.2",
"markdown-it": "^13.0.1", "markdown-it": "^13.0.1",
"moonlink.js": "^3.6.4", "moonlink.js": "^3.6.4",
"moonlink.js-lyrics": "^1.0.1-2",
"nodemon": "^2.0.22", "nodemon": "^2.0.22",
"pm2": "^5.3.0", "pm2": "^5.3.0",
"request": "^2.88.2", "request": "^2.88.2",
@ -2278,6 +2279,14 @@
"node": ">=16.6.0" "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": { "node_modules/ms": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "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", "resolved": "https://registry.npmjs.org/moonlink.js/-/moonlink.js-3.6.4.tgz",
"integrity": "sha512-qaL/FxrWtwLLJmUHyFIh+kQauM1TUEb1qeK1oeoPxQ175SXPFgGySCV01h/RGc0Ki4Erke5rKAERt/aP1xVA4w==" "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": { "ms": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",

View File

@ -1,7 +1,7 @@
{ {
"name": "subsonics-web", "name": "subsonics-web",
"author": "Raphix", "author": "Raphix",
"version": "2.1.1", "version": "2.1.2",
"nodemonConfig": { "nodemonConfig": {
"ext": "js, html", "ext": "js, html",
"ignore": [ "ignore": [
@ -21,6 +21,7 @@
"loguix": "^1.4.2", "loguix": "^1.4.2",
"markdown-it": "^13.0.1", "markdown-it": "^13.0.1",
"moonlink.js": "^3.6.4", "moonlink.js": "^3.6.4",
"moonlink.js-lyrics": "^1.0.1-2",
"nodemon": "^2.0.22", "nodemon": "^2.0.22",
"pm2": "^5.3.0", "pm2": "^5.3.0",
"request": "^2.88.2", "request": "^2.88.2",

View File

@ -7,6 +7,7 @@ const { List } = require("./sub-list")
const nodeFinder = require("./nodes-finder") const nodeFinder = require("./nodes-finder")
const metric = require("webmetrik") const metric = require("webmetrik")
const { MoonlinkManager } = require("moonlink.js") const { MoonlinkManager } = require("moonlink.js")
const { Lyrics } = require("moonlink.js-lyrics");
/// <reference path="./types.d.ts" /> /// <reference path="./types.d.ts" />
@ -159,7 +160,7 @@ function startErelaManager(dlog, config) {
// The nodes to connect to, optional if using default lavalink options // The nodes to connect to, optional if using default lavalink options
nodes, nodes,
{ {
/* Options */ plugins: [new Lyrics()]
}, },
(guild, sPayload) => { (guild, sPayload) => {
// Sending payload information to the server // Sending payload information to the server

View File

@ -259,7 +259,7 @@ module.exports.addSong = async function (data, userId, quick, playlist) {
} }
} else { } else {
if(!player.playing && player.paused == false) { if(!player.current && player.paused == false) {
player.play(songs.tracks[0]) player.play(songs.tracks[0])

View File

@ -13,6 +13,7 @@ const { Server } = require("socket.io")
var fs = require("fs") var fs = require("fs")
var path = require("path") var path = require("path")
const { Metric } = require("webmetrik"); const { Metric } = require("webmetrik");
const { type } = require("os");
const markdownit = require("markdown-it")({ const markdownit = require("markdown-it")({
html: true, html: true,
linkify: true, linkify: true,
@ -479,18 +480,12 @@ function IOConnection(io) {
PostRequest("LYRICS", async (data) => { PostRequest("LYRICS", async (data) => {
let url = `https://paxsenixofc.my.id/server/getLyricsMusix.php?q=${data}&type=default`; if(typeof data == "string") {
data = {"url": data}
fetch(url, { } else {
method: 'GET', let player = require("./discord-bot").getClient().manager.players.get("137291455336022018")
}) PostAnswer("LYRICS", player.lyrics())
.then(response => response.text()) }
.then(data => {
PostAnswer("LYRICS", data)
})
.catch((error) => {
console.error('Erreur:', error);
});
}) })

View File

@ -17,7 +17,7 @@ const volume = getID("volume")
const volIcon = getID("volIcon") const volIcon = getID("volIcon")
const volTxt = getID("volTxt") const volTxt = getID("volTxt")
// const lyrics = getID("lyrics") const lyrics = getID("lyrics")
const disconnect = getID("disconnect") const disconnect = getID("disconnect")
const moveout = getID("moveout") const moveout = getID("moveout")
@ -55,7 +55,7 @@ AlwaysRequest("MUSIC_STATE", async (data) => {
volume.classList.remove("invisible") volume.classList.remove("invisible")
volTxt.classList.remove("invisible") volTxt.classList.remove("invisible")
volIcon.classList.remove("invisible") volIcon.classList.remove("invisible")
// lyrics.classList.remove("invisible") lyrics.classList.remove("invisible")
} else { } else {
@ -72,7 +72,7 @@ AlwaysRequest("MUSIC_STATE", async (data) => {
time_act.innerHTML = "&nbsp" time_act.innerHTML = "&nbsp"
time_total.innerHTML = "&nbsp" time_total.innerHTML = "&nbsp"
durationBar.classList.add("invisible") durationBar.classList.add("invisible")
// lyrics.classList.add("invisible") lyrics.classList.add("invisible")
} }
@ -279,93 +279,73 @@ moveout.addEventListener('click', () => {
get("MOVEOUT") 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) { if(e.ctrlKey) {
// const modal = new ModalComponent({"title": "Rechercher des paroles" , "width": "25%", "closable": true}) const modal = new ModalComponent({"title": "Rechercher des paroles" , "width": "25%", "closable": true})
// modal.setContent(` modal.setContent(`
// <div class='lyrics-finder'> <div class='lyrics-finder'>
// <input id="lyrics_search" type="text" placeholder="Rechercher des paroles"> <input id="lyrics_search" type="text" placeholder="Rechercher des paroles">
// <button id="lyrics_search_btn">Rechercher</button> <button id="lyrics_search_btn">Rechercher</button>
// </div> </div>
// `) `)
// modal.show() modal.show()
// const lyricsSearch = getID("lyrics_search") const lyricsSearch = getID("lyrics_search")
// const lyricsSearchBtn = getID("lyrics_search_btn") const lyricsSearchBtn = getID("lyrics_search_btn")
// lyricsSearchBtn.addEventListener('click', () => { lyricsSearchBtn.addEventListener('click', () => {
// showLyrics(lyricsSearch.value) showLyrics(lyricsSearch.value)
// modal.hide() modal.hide()
// }) })
// } else { } else {
// if(currentTitle) { if(currentTitle) {
// showLyrics(currentTitle) showLyrics(0)
// } else { } else {
// const modal = new ModalComponent({"title": "Paroles" , "width": "20%", "closable": true}) const modal = new ModalComponent({"title": "Paroles" , "width": "20%", "closable": true})
// modal.setContent(` modal.setContent(`
// <p class="lyrics">Lancez une musique pour rechercher les paroles ou faites Ctrl + Click !</p> <p class="lyrics">Lancez une musique pour rechercher les paroles ou faites Ctrl + Click !</p>
// `) `)
// modal.show() modal.show()
// } }
// } }
// }) })
// function showLyrics(title) { function showLyrics(title) {
// title = title.replace(/\(.*?\)/g, "").replace(/\[.*?\]/g, "").trim()
// post("LYRICS", title).then((res) => { post("LYRICS", title).then((res) => {
console.log(res)
if(res.lyrics) {
// if(res.startsWith("<br />")) {
// const modal = new ModalComponent({"title": "Paroles" , "width": "50%", "closable": true})
// modal.setContent(`
// <p class="lyrics">Aucune paroles trouvées pour cette musique !</p>
// `)
// modal.show()
// } else { setTileActive(null)
// const lyricsArray = new Array() loadView(`
<h1>Paroles de ""</h1>
// // Split res by line when a new [ appears <div class="lyrics-container">
<div class="lyrics-list">
// res.split("[").forEach((line) => {
// if(line.includes("]")) { </div>
// const time = line.split("]")[0].trim() </div>
// const lyrics = line.split("]")[1].trim() `)
// lyricsArray.push(`<p class="lyrics">${lyrics}</p>`)
// }
// })
// setTileActive(null)
// loadView(`
// <h1>Paroles de "${title}"</h1>
// <div class="lyrics-container">
// <div class="lyrics-list">
// ${lyricsArray.join("")}
// </div>
// </div>
// `)
// } }
// }) })
// } }
volIcon.addEventListener('click', () => { volIcon.addEventListener('click', () => {

View File

@ -225,7 +225,7 @@ button:hover {
} }
@keyframes scroll { @keyframes scroll {
from { from {
transform: translateX(0%); /* Départ de l'animation */ transform: translateX(0%); /* Départ de l'animation */
} }
to { to {
@ -458,7 +458,8 @@ hr {
flex: 1 0 0; flex: 1 0 0;
align-self: stretch; align-self: stretch;
border-radius: 5px; border-radius: 5px;
margin-top: 22px;
margin-bottom: 22px;
} }
@ -841,7 +842,7 @@ hr {
display: flex; display: flex;
overflow-y: auto; overflow-y: auto;
flex: 1; flex: 1;
overflow-x: hidden;
gap: 10px; gap: 10px;
width: 100%; width: 100%;
position: relative; position: relative;

View File

@ -28,7 +28,7 @@
<span class="homeselector_text">Soundboard</span> <span class="homeselector_text">Soundboard</span>
</div> --> </div> -->
</div> </div>
<hr>
<div class="playlist"> <div class="playlist">
<div class="wintitle"> <div class="wintitle">
<p>Playlists</p> <p>Playlists</p>
@ -43,7 +43,7 @@
</div> </div>
<button class="playlist-add-btn" id="playlist-add"><i class="fa fa-plus"></i> Ajouter une playlist</button> <button class="playlist-add-btn" id="playlist-add"><i class="fa fa-plus"></i> Ajouter une playlist</button>
</div> </div>
<hr>
<div class="usercard"> <div class="usercard">
<div class="usercard_div"> <div class="usercard_div">
<img id="user-img" class="usercard_image" src="/images/default.jpg"></img> <img id="user-img" class="usercard_image" src="/images/default.jpg"></img>
@ -122,7 +122,7 @@
</div> </div>
<div class="actionbar"> <div class="actionbar">
<div> <div>
<!-- <span id="lyrics" class="wh"><i class="fa fa-microphone-lines icon"></i></span> --> <span id="lyrics" class="wh"><i class="fa fa-microphone-lines icon"></i></span>
<span id="disconnect" class="wh"><i class="fa fa-phone-slash icon"></i></span> <span id="disconnect" class="wh"><i class="fa fa-phone-slash icon"></i></span>
<span id="moveout" class="wh"><i class="fa fa-hand icon"></i></span> <span id="moveout" class="wh"><i class="fa fa-hand icon"></i></span>
</div> </div>