Compare commits

...

5 Commits

Author SHA1 Message Date
925efc662d Version 2.1.4 - Modification de l'ajout des Nodes
All checks were successful
Subsonics - Web/pipeline/head This commit looks good
2024-11-17 18:23:40 +01:00
08f50f71a8 Version 2.1.3 - Ajout d'une requete CORS
All checks were successful
Subsonics - Web/pipeline/head This commit looks good
2024-08-09 18:49:47 +02:00
0cc40b443a Version 2.1.3 - Ajout de la sécurité du Bot pour se déconnecter à partir de 10 minutes
All checks were successful
Subsonics - Web/pipeline/head This commit looks good
2024-07-03 10:19:20 +02:00
30c46ba38f Version 2.1.2 - Edit du comportement d'ajout de chanson
All checks were successful
Subsonics - Web/pipeline/head This commit looks good
2024-05-29 23:01:40 +02:00
4ed76f3a31 Version 2.1.0 - Edit de valeurs
All checks were successful
Subsonics - Web/pipeline/head This commit looks good
2024-04-16 16:50:11 +02:00
16 changed files with 153 additions and 112 deletions

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -36,7 +36,7 @@ class MoonlinkPlayer {
this.playing = data.playing || false;
this.paused = data.paused || false;
this.loop = data.loop || 0;
this.volume = data.volume || 100;
this.volume = data.volume || 80;
this.ping = data.ping || 0;
this.queue = new (index_1.Structure.get("MoonlinkQueue"))(this.manager, this.guildId);
this.current = null;

21
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "subsonics-web",
"version": "2.1.0",
"version": "2.1.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "subsonics-web",
"version": "2.1.0",
"version": "2.1.3",
"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.0",
"version": "2.1.4",
"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

@ -41,6 +41,7 @@ function getConfig(dlog) {
var config_data = JSON.parse(fs.readFileSync(__glob.CONFIG))
dlog.log("Fichier de configuration trouvé : " + __glob.CONFIG)
dlog.step.end("getConfig")

View File

@ -7,6 +7,9 @@ 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");
var endTime = 0
/// <reference path="./types.d.ts" />
@ -143,14 +146,14 @@ function init(dlog, config) {
}
})
startErelaManager(dlog, config)
startManager(dlog, config)
client.login(config.token)
}
function startErelaManager(dlog, config) {
function startManager(dlog, config) {
const elog = new LogType("Lavalink-Manager")
const nodes = nodeFinder.getNodes()
@ -159,7 +162,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
@ -173,24 +176,42 @@ function startErelaManager(dlog, config) {
membersVoices.set(newMember.id, newMember.channelId)
/* SECURITY DISABLED
let player = client.manager.players.get(oldMember.guild.id)
let player = client.manager.players.get(oldMember.guild.id)
if(player) {
client.channels.fetch(player.options.voiceChannel).then(channel => {
client.channels.fetch(player.voiceChannel).then(channel => {
if(channel.members.size <= 1) {
player.destroy()
plog.log("[Automatic Task] Player supprimé dans : " + channel.name)
// If the player is alone in the channel, we will destroy it in 10 minutes
endTime = new Date().getTime() + 600000
plog.log("[Automatic Task] Player supprimé dans 10 minutess : " + channel.name)
} else {
plog.log("[Automatic Task] Player n'est pas seul dans le channel : " + channel.name)
endTime = 0
}
})
}*/
}
})
// Set Interval to check endTime is equal to the current time and destroy the player
setInterval(() => {
let player = client.manager.players.get("137291455336022018")
if(player) {
if(endTime != 0 && endTime <= new Date().getTime()) {
player.destroy()
plog.log("[Automatic Task] Player détruit automatiquement")
endTime = 0
}
}
}, 1000)
const list = new List()

View File

@ -112,6 +112,8 @@ module.exports.addNodes = function (data) {
}
}
module.exports.deleteNode = function (data) {
nlog.step.init("deleteNodes", "Supression d'un noeud dans la base de donnée de nodes : " + data.host)
try {

View File

@ -1,4 +1,3 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
const { __glob } = require("../modules/global-variables");
const { LogType } = require('loguix');
const discord = require("./discord-bot")
@ -235,8 +234,8 @@ module.exports.List = class {
previousList.unshift(song)
savePreviousFile(previousList)
}
}
__previous_remove(song) {

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

@ -5,6 +5,7 @@ const auth = require("./sub-auth");
const cook = require("cookie")
const wlog = new LogType("Web")
const subplayer = require('./sub-player');
const cors = require("cors")
const { List } = require("./sub-list")
const subplaylist = require("./sub-playlist")
@ -60,6 +61,9 @@ function init() {
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(__web.PUBLIC));
app.use(cors({
origin: 'chrome-extension://fplckpgomdhnfhhokenalnpkmifabbja'
}));
app.set('port', port);
app.use('/', indexRouter);
app.use('/login', loginRouter);
@ -479,18 +483,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

@ -67,6 +67,7 @@ class User {
var ActualDroppableMenu = null
class DroppableMenu {
options = new Array()
id = null

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")
}
@ -256,7 +256,7 @@ volume.addEventListener("click", () => {
volume.addEventListener("dblclick", () => {
post("VOLUME", 100)
post("VOLUME", 80)
})
play.addEventListener('click', () => {
@ -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) => {
// 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>
// `)
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(`<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>
// `)
loadView(`
<h1>Paroles de ""</h1>
<div class="lyrics-container">
<div class="lyrics-list">
</div>
</div>
`)
// }
// })
}
})
// }
}
volIcon.addEventListener('click', () => {
@ -373,7 +353,7 @@ volIcon.addEventListener('click', () => {
if(volume.value > 1) {
post("VOLUME", 1)
} else {
post("VOLUME", 100)
post("VOLUME", 80)
}
})

View File

@ -201,14 +201,19 @@ function loadNodesView() {
<input placeholder='Host' type='text' id="node-host" class="report-type">
<input placeholder='Port' type='number' id="node-port" class="report-type">
<input value="2333" placeholder='Port' type='number' id="node-port" class="report-type">
<input placeholder='Mot de passe' type='text' id="node-password" class="report-type">
<br>
<input value="youshallnotpass" placeholder='Mot de passe' type='text' id="node-password" class="report-type">
<div style="display: flex; align-items: center;">
<input type='checkbox' id="node-secure">
<p style='font-size: 15px;'>Connexion SSL</p>
</div>
<button id="node-send-confirm" class="report-send">Ajouter</button>
</div>
`)
modal.show()
const nodeHost = getID("node-host")
@ -216,6 +221,21 @@ function loadNodesView() {
const nodePassword = getID("node-password")
const nodeSendConfirm = getID("node-send-confirm")
const nodeContent = getID("node-content")
const nodeSecure = getID("node-secure")
nodeSecure.addEventListener("change", () => {
if(nodeSecure.checked) {
nodePort.value = 443
nodePort.disabled = true
nodePort.style.backgroundColor = "#333"
nodePort.style.color = "#717171"
} else {
nodePort.value = 2333
nodePort.disabled = false
nodePort.style.backgroundColor = "#545454"
nodePort.style.color = "white"
}
})
nodeSendConfirm.addEventListener("click", () => {
nodeContent.innerHTML = "<p><i class='fa fa-spinner fa-spin'></i> Ajout du serveur ...</p>"

View File

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

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>
@ -143,7 +143,7 @@
<!-- Scripts -->
<script src="/socket.io/socket.io.js"></script>
<script src="/javascript/IO.js"></script>
<script src="/javascript/basics.js"></script>