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,
"password": "youshallnotpass",
"retryAmount": 5

21
package-lock.json generated
View File

@ -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",

View File

@ -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",

View File

@ -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");
/// <reference path="./types.d.ts" />
@ -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

View File

@ -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])

View File

@ -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())
}
})

View File

@ -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 = "&nbsp"
time_total.innerHTML = "&nbsp"
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(`
// <div class='lyrics-finder'>
// <input id="lyrics_search" type="text" placeholder="Rechercher des paroles">
// <button id="lyrics_search_btn">Rechercher</button>
// </div>
// `)
modal.setContent(`
<div class='lyrics-finder'>
<input id="lyrics_search" type="text" placeholder="Rechercher des paroles">
<button id="lyrics_search_btn">Rechercher</button>
</div>
`)
// 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(`
// <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) {
// title = title.replace(/\(.*?\)/g, "").replace(/\[.*?\]/g, "").trim()
// post("LYRICS", title).then((res) => {
function showLyrics(title) {
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>
// `)
setTileActive(null)
// modal.show()
// } else {
loadView(`
<h1>Paroles de ""</h1>
<div class="lyrics-container">
<div class="lyrics-list">
// 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(`<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>
// `)
</div>
</div>
`)
// }
// })
}
})
// }
}
volIcon.addEventListener('click', () => {

View File

@ -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;

View File

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