From 47c5608cf48c79e24944244453cdafbc27d1d612 Mon Sep 17 00:00:00 2001 From: Raphix Date: Wed, 30 Aug 2023 15:22:13 +0200 Subject: [PATCH] Version 0.7.0 - Add Improvements --- data/nodes.json | 26 ++------ data/playlist.json | 11 +++ data/users.json | 74 +++++++++++++++++++++ package.json | 2 +- src/modules/sub-player.js | 9 ++- src/web/public/javascript/__index_script.js | 59 +++++++++++++--- src/web/templates/index.ejs | 2 +- 7 files changed, 149 insertions(+), 34 deletions(-) diff --git a/data/nodes.json b/data/nodes.json index 3debf94..c51a570 100644 --- a/data/nodes.json +++ b/data/nodes.json @@ -1,26 +1,8 @@ [ { - "host": "lavalink.devamop.in", - "password": "DevamOP", - "port": 443, - "secure": true - }, - { - "host": "suki.nathan.to", - "password": "adowbongmanacc", - "port": 443, - "secure": true - }, - { - "host": "ssl.horizxon.studio", + "host": "lava2.horizxon.studio", "password": "horizxon.studio", - "port": 443, - "secure": true - }, - { - "host": "eu-lavalink.lexnet.cc", - "password": "lexn3tl@val!nk", - "port": 443, - "secure": true + "port": 80, + "secure": false } -] \ No newline at end of file +] diff --git a/data/playlist.json b/data/playlist.json index a3bcadd..a6f82b2 100644 --- a/data/playlist.json +++ b/data/playlist.json @@ -77,6 +77,17 @@ "isStream": false, "uri": "https://www.youtube.com/watch?v=U-RyWK2DFS8", "thumbnail": "https://img.youtube.com/vi/U-RyWK2DFS8/default.jpg" + }, + { + "track": "QAAA5QIAC1RvdXQgQ2hhbmdlABBqdWxpZW5sYW1hc3Nvbm5lAAAAAAADBqkAcFU6aHR0cHM6Ly9hcGktdjIuc291bmRjbG91ZC5jb20vbWVkaWEvc291bmRjbG91ZDp0cmFja3M6ODM3ODEzNDYvMWVjYTY3ZmEtZjg3ZS00MjFkLWExYzctNTVhY2M4ZTdkODIyL3N0cmVhbS9obHMAAQAzaHR0cHM6Ly9zb3VuZGNsb3VkLmNvbS9qdWxpZW5sYW1hc3Nvbm5lL3RvdXQtY2hhbmdlAApzb3VuZGNsb3VkAAAAAAAAAAA=", + "title": "Tout Change", + "identifier": "U:https://api-v2.soundcloud.com/media/soundcloud:tracks:83781346/1eca67fa-f87e-421d-a1c7-55acc8e7d822/stream/hls", + "author": "julienlamassonne", + "duration": 198313, + "isSeekable": true, + "isStream": false, + "uri": "https://soundcloud.com/julienlamassonne/tout-change", + "thumbnail": null } ] } diff --git a/data/users.json b/data/users.json index c5a8995..7a34387 100644 --- a/data/users.json +++ b/data/users.json @@ -35,5 +35,79 @@ "bio": "", "banner": null, "token": "bbc2f9a1-a52c-4548-895b-2c3b9095e2d4" + }, + { + "auth": { + "token_type": "Bearer", + "access_token": "jY17lCWaOpTdPQCnz50kfNm7ABpsGz", + "expires_in": 604800, + "refresh_token": "3TronknZ7j5kVSDBjI3OechmCYF8ck", + "scope": "identify guilds guilds.members.read" + }, + "avatar": null, + "communication_disabled_until": null, + "flags": 0, + "joined_at": "2023-03-06T18:20:23.413000+00:00", + "nick": "Raphix", + "pending": false, + "premium_since": null, + "roles": [ + "397725552968204288" + ], + "user": { + "id": "486943594893017119", + "username": "raphixscrap", + "avatar": "7129e80c23aa3ba3d2d45814dd352a29", + "discriminator": "0", + "public_flags": 4194368, + "flags": 4194368, + "banner": null, + "accent_color": 10712214, + "global_name": "Raphix", + "avatar_decoration_data": null, + "banner_color": "#a37496" + }, + "mute": false, + "deaf": false, + "bio": "", + "banner": null, + "token": "56a35d77-427f-4ac3-9db8-170f08fac724" + }, + { + "auth": { + "token_type": "Bearer", + "access_token": "jY17lCWaOpTdPQCnz50kfNm7ABpsGz", + "expires_in": 604800, + "refresh_token": "3TronknZ7j5kVSDBjI3OechmCYF8ck", + "scope": "guilds.members.read identify guilds" + }, + "avatar": null, + "communication_disabled_until": null, + "flags": 0, + "joined_at": "2023-03-06T18:20:23.413000+00:00", + "nick": "Raphix", + "pending": false, + "premium_since": null, + "roles": [ + "397725552968204288" + ], + "user": { + "id": "486943594893017119", + "username": "raphixscrap", + "avatar": "7129e80c23aa3ba3d2d45814dd352a29", + "discriminator": "0", + "public_flags": 4194368, + "flags": 4194368, + "banner": null, + "accent_color": 10712214, + "global_name": "Raphix", + "avatar_decoration_data": null, + "banner_color": "#a37496" + }, + "mute": false, + "deaf": false, + "bio": "", + "banner": null, + "token": "d026da49-07d0-48cf-bfdb-9807ad9765ce" } ] \ No newline at end of file diff --git a/package.json b/package.json index 72a2edc..52dcee6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "subsonics-web", "author": "Raphix", - "version": "0.6.5", + "version": "0.7.0", "nodemonConfig": { "ext": "js, html", "ignore": [ diff --git a/src/modules/sub-player.js b/src/modules/sub-player.js index 457bdef..f81aa36 100644 --- a/src/modules/sub-player.js +++ b/src/modules/sub-player.js @@ -197,12 +197,19 @@ module.exports.SPECIAL_MJ = async function (client, userId) { let player = client.manager.players.get("137291455336022018") var memberVoices = discord.getMemberVoices() + var channelId = memberVoices.get(userId) + + + if(!channelId) { + + channelId = "664355808250953739" + } if(!player) { player = client.manager.create({ guild: "137291455336022018", - voiceChannel: memberVoices.get(userId), + voiceChannel: channelId, textChannel: "664355637685256203", }); diff --git a/src/web/public/javascript/__index_script.js b/src/web/public/javascript/__index_script.js index 06ba9a6..0e83618 100644 --- a/src/web/public/javascript/__index_script.js +++ b/src/web/public/javascript/__index_script.js @@ -118,14 +118,15 @@ socket.on("ANSWER/GET/PLAYLIST", (data) => { var selectionData = new Array() + contentToPush.push('
Créer une playlist
') + + for (const [key, value] of Object.entries(data)) { contentToPush.push('

' + key + '

') selectionData.push('') } - contentToPush.push('
Debug
') - contentToPush.push('
Créer une playlist
') @@ -245,7 +246,14 @@ function loadPlaylist(key, value) { PFormatduration = pmax - playlist_songs.push('

' + title.title + '

' + title.author + '

' + PFormatduration + '

') + var thumbnail = title.thumbnail + + if(!thumbnail) { + + thumbnail = "/images/black-image.svg" + } + + playlist_songs.push('

' + title.title + '

' + title.author + '

' + PFormatduration + '

') } @@ -346,8 +354,15 @@ searchBtn.addEventListener("click", () => { } + var thumbnail = title.thumbnail + + if(!thumbnail) { + + thumbnail = "/images/black-image.svg" + } + PFormatduration = pmax - contentToPush.push('

' + title.title + '

' + title.author + '

' + PFormatduration + '

Lire maintenant
Ajouter à une playlist

Ajouter à une playlist

Selectionner la playlist

') + contentToPush.push('

' + title.title + '

' + title.author + '

' + PFormatduration + '

Lire maintenant
Ajouter à une playlist

Ajouter à une playlist

Selectionner la playlist

') } if(contentToPush.join("") == "") { @@ -374,8 +389,12 @@ searchBtn.addEventListener("click", () => { const playlist_add_img = document.getElementById(data.indexOf(title) + "playlist_add_img") const playlistAddSong = document.getElementById(data.indexOf(title) + "playlistAddSong") - - + var thumbnail = data[add_to.id.replace("_ladd", "")].thumbnail + + if(!thumbnail) { + + thumbnail = "/images/black-image.svg" + } testPopup.style.display = "none" @@ -388,7 +407,7 @@ searchBtn.addEventListener("click", () => { PlaylistManager.showModal() playlist_add_music.innerHTML = data[add_to.id.replace("_ladd", "")].title - playlist_add_img.src = data[add_to.id.replace("_ladd", "")].thumbnail + playlist_add_img.src = thumbnail playlistSelection.innerHTML = playlistAvailable }) @@ -542,9 +561,17 @@ const cplaylistAddSong = document.getElementById("current_playlistAddSong") takeCurrent.addEventListener("click", () => { if(currentSong != null) { + + var thumbnail = currentSong.thumbnail + + if(!thumbnail) { + + thumbnail = "/images/black-image.svg" + } + cPlaylistManager.showModal() cplaylist_add_music.innerHTML = currentSong.title - cplaylist_add_img.src = currentSong.thumbnail + cplaylist_add_img.src = thumbnail cplaylistSelection.innerHTML = playlistAvailable } @@ -602,10 +629,17 @@ vol.addEventListener("click", () => { }) volRange.addEventListener("click", () => { + send("VOLUME", volRange.value) }) +volRange.addEventListener("input", () => { + + + volTxt.innerHTML = volRange.value + "%" +}) + disconnect.addEventListener("click", () => { @@ -800,7 +834,14 @@ socket.on("/ALWAYS/MUSIC_STATE", (data) => { takeCurrent.classList.add("invisible") } else { - musicURL.innerHTML = '' + var thumbnail = data.current.thumbnail + + if(!thumbnail) { + + thumbnail = "/images/black-image.svg" + } + + musicURL.innerHTML = '' musicTitle.innerHTML = "

" + data.current.title + "

" currentSong = data.current takeCurrent.classList.remove("invisible") diff --git a/src/web/templates/index.ejs b/src/web/templates/index.ejs index ff14f0c..36cd447 100644 --- a/src/web/templates/index.ejs +++ b/src/web/templates/index.ejs @@ -41,7 +41,7 @@
-

Ajouter une playlist

+

Créer une playlist