Version 0.5.0 - Ajout de la recherche
This commit is contained in:
parent
7d7de3f358
commit
e34134537e
65
README.md
65
README.md
@ -1,2 +1,65 @@
|
||||
# web
|
||||
# Subsonics Web
|
||||
|
||||
<div style="font-size: 20px">
|
||||
|
||||
|
||||
## Instruction
|
||||
|
||||
* En cas de bug, n'hésitez pas à faire un **report** sur votre profil.
|
||||
* Vous pouvez utiliser la commande **/restart** sur Discord pour redémarrer l'intégralité du programme !
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div style="font-size: 14px;">
|
||||
|
||||
## Changelog
|
||||
|
||||
### Subsonics - Web - 0.5.0
|
||||
- **Adds :** *Web features : Search & Play*
|
||||
#### Details
|
||||
**Web Player Features**
|
||||
> - Search & Play
|
||||
>> - SEND/ SEARCH_SONGS
|
||||
>> - SEND/ PLAY_SONG
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
### Subsonics - Web - 0.6.0
|
||||
- **Adds :** *Web features : Playlist | Pipeline Deploy V2 | Search Ellipis*
|
||||
#### Details
|
||||
**Web Player Features**
|
||||
> - Playlist
|
||||
>> - SEND/ SEARCH_SONGS
|
||||
>> - SEND/ ADD_SONGS
|
||||
> - Make a popup
|
||||
>> - Lire maintenant
|
||||
>> - Ajouter à une playlist
|
||||
**Pipeline Deploy V2**
|
||||
>> - Copy /data/ except "betas.json"
|
||||
>> - Reinject /data/
|
||||
|
||||
<hr>
|
||||
|
||||
### Subsonics - Web - 0.7.0
|
||||
- **Adds :** *Settings : Web Page Change, Logs, Connexions, Gestion d'accès, Beta | Users V2 | Handle CLP & Banned account*
|
||||
#### Details
|
||||
-- TO DO
|
||||
|
||||
<hr>
|
||||
|
||||
### Subsonics - Web - 0.8.0
|
||||
- **Adds :** *Alerts, Playlist Share, See Who is Online*
|
||||
#### Details
|
||||
-- TO DO
|
||||
|
||||
<hr>
|
||||
|
||||
### Subsonics - Web - 1.0.0
|
||||
- **Adds :** *Bugs Fixes & Trailer*
|
||||
#### Details
|
||||
-- TO DO
|
||||
|
||||
</div>
|
96
package-lock.json
generated
96
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "subsonics-web",
|
||||
"version": "0.4.1",
|
||||
"version": "0.5.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "subsonics-web",
|
||||
"version": "0.4.1",
|
||||
"version": "0.5.0",
|
||||
"dependencies": {
|
||||
"cookie": "^0.5.0",
|
||||
"cookie-parser": "^1.4.6",
|
||||
@ -15,6 +15,7 @@
|
||||
"erela.js": "^2.4.0",
|
||||
"express": "^4.18.2",
|
||||
"express-favicon": "^2.0.4",
|
||||
"markdown-it": "^13.0.1",
|
||||
"nodemon": "^2.0.22",
|
||||
"pm2": "^5.3.0",
|
||||
"socket.io": "^4.6.1",
|
||||
@ -1224,6 +1225,17 @@
|
||||
"node": ">=8.6"
|
||||
}
|
||||
},
|
||||
"node_modules/entities": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz",
|
||||
"integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==",
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/erela.js": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/erela.js/-/erela.js-2.4.0.tgz",
|
||||
@ -1903,6 +1915,14 @@
|
||||
"node": ">=0.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/linkify-it": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz",
|
||||
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==",
|
||||
"dependencies": {
|
||||
"uc.micro": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
@ -1929,6 +1949,31 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/markdown-it": {
|
||||
"version": "13.0.1",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.1.tgz",
|
||||
"integrity": "sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1",
|
||||
"entities": "~3.0.1",
|
||||
"linkify-it": "^4.0.1",
|
||||
"mdurl": "^1.0.1",
|
||||
"uc.micro": "^1.0.5"
|
||||
},
|
||||
"bin": {
|
||||
"markdown-it": "bin/markdown-it.js"
|
||||
}
|
||||
},
|
||||
"node_modules/markdown-it/node_modules/argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||
},
|
||||
"node_modules/mdurl": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
|
||||
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
|
||||
},
|
||||
"node_modules/media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
@ -3258,6 +3303,11 @@
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/uc.micro": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
|
||||
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
|
||||
},
|
||||
"node_modules/undefsafe": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
|
||||
@ -4304,6 +4354,11 @@
|
||||
"ansi-colors": "^4.1.1"
|
||||
}
|
||||
},
|
||||
"entities": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz",
|
||||
"integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q=="
|
||||
},
|
||||
"erela.js": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/erela.js/-/erela.js-2.4.0.tgz",
|
||||
@ -4796,6 +4851,14 @@
|
||||
"resolved": "https://registry.npmjs.org/lazy/-/lazy-1.0.11.tgz",
|
||||
"integrity": "sha512-Y+CjUfLmIpoUCCRl0ub4smrYtGGr5AOa2AKOaWelGHOGz33X/Y/KizefGqbkwfz44+cnq/+9habclf8vOmu2LA=="
|
||||
},
|
||||
"linkify-it": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz",
|
||||
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==",
|
||||
"requires": {
|
||||
"uc.micro": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
@ -4816,6 +4879,30 @@
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
|
||||
"integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA=="
|
||||
},
|
||||
"markdown-it": {
|
||||
"version": "13.0.1",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.1.tgz",
|
||||
"integrity": "sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==",
|
||||
"requires": {
|
||||
"argparse": "^2.0.1",
|
||||
"entities": "~3.0.1",
|
||||
"linkify-it": "^4.0.1",
|
||||
"mdurl": "^1.0.1",
|
||||
"uc.micro": "^1.0.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"mdurl": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
|
||||
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
|
||||
},
|
||||
"media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
@ -5773,6 +5860,11 @@
|
||||
"mime-types": "~2.1.24"
|
||||
}
|
||||
},
|
||||
"uc.micro": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
|
||||
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
|
||||
},
|
||||
"undefsafe": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "subsonics-web",
|
||||
"author": "Raphix",
|
||||
"version": "0.4.2",
|
||||
"version": "0.5.0",
|
||||
"nodemonConfig": {
|
||||
"ext": "js, html",
|
||||
"ignore": [
|
||||
@ -19,6 +19,7 @@
|
||||
"erela.js": "^2.4.0",
|
||||
"express": "^4.18.2",
|
||||
"express-favicon": "^2.0.4",
|
||||
"markdown-it": "^13.0.1",
|
||||
"nodemon": "^2.0.22",
|
||||
"pm2": "^5.3.0",
|
||||
"socket.io": "^4.6.1",
|
||||
|
@ -12,13 +12,20 @@ const client = new Client({
|
||||
intents:[GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMembers],
|
||||
})
|
||||
|
||||
const membersVoices = new Map()
|
||||
var membersVoices = new Map()
|
||||
|
||||
module.exports.getClient = function () {
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
module.exports.getMemberVoices = function () {
|
||||
|
||||
return membersVoices
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports.DiscordBot = class {
|
||||
|
||||
constructor(config, dlog) {
|
||||
@ -258,3 +265,4 @@ function startErelaManager(dlog, config) {
|
||||
// THIS IS REQUIRED. Send raw events to Erela.js
|
||||
client.on("raw", d => client.manager.updateVoiceState(d));
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ const __glob = {
|
||||
PACKAGE: root + path.sep + "package.json",
|
||||
DATA: root + path.sep + "data" + path.sep,
|
||||
NODES: root + path.sep + "data" + path.sep + "nodes.json",
|
||||
README: root + path.sep + "README.md"
|
||||
};
|
||||
|
||||
const webroot = __glob.WEB_DIR + path.sep
|
||||
|
@ -4,6 +4,7 @@ const { LogType } = require("./sub-log");
|
||||
var { List } = require("./sub-list")
|
||||
const discord = require("./discord-bot")
|
||||
var ytfps = require("ytfps");
|
||||
const { use } = require("../web/routes/login");
|
||||
const packageJson = require(__glob.PACKAGE);
|
||||
|
||||
|
||||
@ -177,7 +178,7 @@ module.exports.getState = function(client, interaction) {
|
||||
|
||||
}
|
||||
|
||||
module.exports.SPECIAL_MJ = async function (client) {
|
||||
module.exports.SPECIAL_MJ = async function (client, userId) {
|
||||
|
||||
if(!client) {
|
||||
|
||||
@ -186,12 +187,13 @@ module.exports.SPECIAL_MJ = async function (client) {
|
||||
|
||||
let player = client.manager.players.get("137291455336022018")
|
||||
|
||||
var memberVoices = discord.getMemberVoices()
|
||||
|
||||
if(!player) {
|
||||
|
||||
player = client.manager.create({
|
||||
guild: "137291455336022018",
|
||||
voiceChannel: "664355734288465920",
|
||||
voiceChannel: memberVoices.get(userId),
|
||||
textChannel: "664355637685256203",
|
||||
});
|
||||
|
||||
@ -221,6 +223,61 @@ module.exports.SPECIAL_MJ = async function (client) {
|
||||
|
||||
}
|
||||
|
||||
module.exports.addSong = async function (data, client, userId, quick) {
|
||||
|
||||
if(!client) {
|
||||
|
||||
client = discord.getClient()
|
||||
}
|
||||
|
||||
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: channelId,
|
||||
textChannel: "664355637685256203",
|
||||
});
|
||||
|
||||
|
||||
player.connect();
|
||||
}
|
||||
|
||||
|
||||
const songs = await client.manager.search(data.uri)
|
||||
|
||||
if(quick) {
|
||||
|
||||
player.play(songs.tracks[0])
|
||||
|
||||
} else {
|
||||
|
||||
if(!player.playing && player.paused == false) {
|
||||
|
||||
player.play(songs.tracks[0])
|
||||
|
||||
} else {
|
||||
|
||||
list.add(songs.tracks[0])
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
}
|
||||
|
||||
module.exports.skip = function (client, interaction) {
|
||||
|
||||
if(interaction) {
|
||||
@ -371,6 +428,25 @@ module.exports.changeShuffle = function (client) {
|
||||
}
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
}
|
||||
|
||||
const slog = new LogType("Search")
|
||||
|
||||
module.exports.search = async function (data, client) {
|
||||
|
||||
|
||||
if(!client) {
|
||||
|
||||
client = discord.getClient()
|
||||
}
|
||||
|
||||
slog.log("Recherche avec les mots clés : " + data)
|
||||
|
||||
const songs = await client.manager.search(data)
|
||||
return songs
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -246,7 +246,15 @@ function IOConnection(io) {
|
||||
|
||||
GetRequest(io, socket, "SPECIAL/MJ", () => {
|
||||
|
||||
subplayer.SPECIAL_MJ()
|
||||
var cookiesA = socket.handshake.headers.cookie
|
||||
cookiesA = cook.parse(cookiesA)
|
||||
var tokenA = cookiesA.token
|
||||
|
||||
var userA = auth.getUser(tokenA)
|
||||
var userId = userA.user.id
|
||||
|
||||
|
||||
subplayer.SPECIAL_MJ(null, userId)
|
||||
io.emit("ANSWER/GET/SPECIAL/MJ", "OK")
|
||||
|
||||
})
|
||||
@ -392,6 +400,110 @@ function IOConnection(io) {
|
||||
|
||||
})
|
||||
|
||||
socket.on("SEND/SEARCH", async (data) => {
|
||||
|
||||
|
||||
var cookies = socket.handshake.headers.cookie
|
||||
|
||||
if(cookies) {
|
||||
|
||||
cookies = cook.parse(cookies)
|
||||
var token = cookies.token
|
||||
|
||||
if(auth.checkUser(token)) {
|
||||
|
||||
|
||||
const results = await subplayer.search(data)
|
||||
|
||||
|
||||
io.emit("ANSWER/SEND/SEARCH", results)
|
||||
|
||||
} else {
|
||||
|
||||
io.emit("ANSWER/SEND/SEARCH", {"error":"USER_DONT_EXIST"})
|
||||
}
|
||||
} else {
|
||||
io.emit("ANSWER/SEND/SEARCH", {"error":"TOKEN_NOT_FINDED"})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
socket.on("SEND/ADD_SONG", async (data) => {
|
||||
|
||||
|
||||
var cookies = socket.handshake.headers.cookie
|
||||
|
||||
if(cookies) {
|
||||
|
||||
cookies = cook.parse(cookies)
|
||||
var token = cookies.token
|
||||
|
||||
if(auth.checkUser(token)) {
|
||||
|
||||
|
||||
|
||||
var user = auth.getUser(token)
|
||||
var userId = user.user.id
|
||||
|
||||
|
||||
subplayer.addSong(data, null, userId)
|
||||
|
||||
|
||||
io.emit("ANSWER/SEND/ADD_SONG/OK")
|
||||
|
||||
} else {
|
||||
|
||||
io.emit("ANSWER/SEND/ADD_SONG", {"error":"USER_DONT_EXIST"})
|
||||
}
|
||||
} else {
|
||||
io.emit("ANSWER/SEND/ADD_SONG", {"error":"TOKEN_NOT_FINDED"})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
socket.on("SEND/ADD_SONG_NOW", async (data) => {
|
||||
|
||||
|
||||
var cookies = socket.handshake.headers.cookie
|
||||
|
||||
if(cookies) {
|
||||
|
||||
cookies = cook.parse(cookies)
|
||||
var token = cookies.token
|
||||
|
||||
if(auth.checkUser(token)) {
|
||||
|
||||
|
||||
|
||||
var user = auth.getUser(token)
|
||||
var userId = user.user.id
|
||||
|
||||
|
||||
subplayer.addSong(data, null, userId, true)
|
||||
|
||||
|
||||
io.emit("ANSWER/SEND/ADD_SONG_NOW/OK")
|
||||
|
||||
} else {
|
||||
|
||||
io.emit("ANSWER/SEND/ADD_SONG_NOW", {"error":"USER_DONT_EXIST"})
|
||||
}
|
||||
} else {
|
||||
io.emit("ANSWER/SEND/ADD_SONG_NOW", {"error":"TOKEN_NOT_FINDED"})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
@ -43,6 +43,132 @@ const report_level = document.getElementById("report_level")
|
||||
const report_desc = document.getElementById("report_desc")
|
||||
const report_send = document.getElementById("report_send")
|
||||
|
||||
const searchBar = document.getElementById("searchBar")
|
||||
const searchcontent = document.getElementById("search_content")
|
||||
|
||||
const WelcomeContent = searchcontent.outerHTML
|
||||
|
||||
var xMousePos = 0;
|
||||
var yMousePos = 0;
|
||||
document.onmousemove = function(e)
|
||||
{
|
||||
xMousePos = e.clientX + window.pageXOffset;
|
||||
yMousePos = e.clientY + window.pageYOffset;
|
||||
};
|
||||
|
||||
|
||||
|
||||
searchBar.addEventListener("change", () => {
|
||||
|
||||
if(searchBar.value == "") {
|
||||
|
||||
searchcontent.innerHTML = WelcomeContent
|
||||
} else {
|
||||
|
||||
send("SEARCH", searchBar.value).then(results => {
|
||||
|
||||
if(results.tracks != null) {
|
||||
const data = results.tracks
|
||||
|
||||
console.log(data)
|
||||
var contentToPush = new Array()
|
||||
|
||||
for(var title of data) {
|
||||
|
||||
var Formatduration = null
|
||||
durationAll = title.duration
|
||||
|
||||
const maxhours = Math.floor(durationAll / 3600000);
|
||||
|
||||
var maxmin = Math.trunc(durationAll / 60000) - (Math.floor(durationAll / 60000 / 60) * 60);
|
||||
var maxsec = Math.floor(durationAll / 1000) - (Math.floor(durationAll / 1000 / 60) * 60);
|
||||
|
||||
|
||||
if (maxsec < 10) {
|
||||
maxsec = `0${maxsec}`;
|
||||
}
|
||||
|
||||
|
||||
if(maxhours != 0) {
|
||||
|
||||
if (maxmin < 10) {
|
||||
maxmin = `0${maxmin}`;
|
||||
}
|
||||
|
||||
|
||||
max = maxhours + ":" + maxmin + ":" + maxsec
|
||||
} else {
|
||||
max = maxmin + ":" + maxsec
|
||||
|
||||
}
|
||||
|
||||
Formatduration = max
|
||||
contentToPush.push(' <div class="search_song"> <img class="search_thumbnail" src="' + title.thumbnail + '"><div class="search_titleSong"> <p class="search_title">' + title.title + '</p></div> <p>' + title.author + '</p><p>' + Formatduration + '</p> <div class="search_buttons"><button id="' + data.indexOf(title) + '_ladd" class="search_add"><i class="fa fa-plus"></i></button> <div class="searchMoreDiv"><button id="' + data.indexOf(title) + '_lmore" class="search_lmore"><i class="fa-solid fa-ellipsis"></i></button></div><div class="searchPopup" id="' + data.indexOf(title) + '_popup"><div id="' + data.indexOf(title) + '_playNow" class="INDEX_line"><i class="fa-solid fa-play"></i> Lire maintenant</div><!--<div id="' + data.indexOf(title) +'_addlater" class="INDEX_line"><i class="fa-solid fa-list-ul"></i> Ajouter à une playlist</div>--></div></div></div>')
|
||||
}
|
||||
|
||||
if(contentToPush.join("") == "") {
|
||||
|
||||
searchcontent.innerHTML = '<p class="error">Aucun morceau trouvé !</p>'
|
||||
|
||||
} else {
|
||||
|
||||
searchcontent.innerHTML = contentToPush.join("")
|
||||
}
|
||||
|
||||
for(var title of data) {
|
||||
|
||||
const add_to = document.getElementById(data.indexOf(title) + "_ladd")
|
||||
const test_lmore = document.getElementById(data.indexOf(title) + "_lmore")
|
||||
const testPopup = document.getElementById(data.indexOf(title) + "_popup")
|
||||
const playNow = document.getElementById(data.indexOf(title) + "_playNow")
|
||||
|
||||
testPopup.style.display = "none"
|
||||
|
||||
add_to.addEventListener("click", () => {
|
||||
|
||||
send("ADD_SONG", data[add_to.id.replace("_ladd", "")])
|
||||
})
|
||||
|
||||
test_lmore.addEventListener("click",( ) => {
|
||||
|
||||
|
||||
testPopup.style.display = "flex"
|
||||
testPopup.style.top = yMousePos + "px"
|
||||
|
||||
document.getElementById("test").show()
|
||||
console.log()
|
||||
|
||||
|
||||
})
|
||||
|
||||
testPopup.addEventListener("mouseleave", () => {
|
||||
|
||||
testPopup.style.display = "none"
|
||||
|
||||
})
|
||||
|
||||
playNow.addEventListener("click", () => {
|
||||
|
||||
send("ADD_SONG_NOW", data[add_to.id.replace("_ladd", "")])
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
searchcontent.innerHTML = '<p class="error">Aucun morceau trouvé !</p>'
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
volBox.classList.add("invisible")
|
||||
@ -61,6 +187,8 @@ list.addEventListener("click" , () => {
|
||||
}
|
||||
})
|
||||
|
||||
// Apply the width of element1 to element2
|
||||
|
||||
|
||||
vol.addEventListener("click", () => {
|
||||
|
||||
@ -157,18 +285,26 @@ userInfo.then(user => {
|
||||
userInfoDiv.innerHTML = "<div class='INDEX_userInfo_name'><p class='INDEX_gbname'>" + user.user.global_name + "</p><p class='INDEX_usrname'>" + user.user.username + "</p></div><div class='INDEX_picture'><img src='https://cdn.discordapp.com/avatars/" + user.user.id + "/" + user.user.avatar + "'>" + betastar + "</div>"
|
||||
})
|
||||
|
||||
|
||||
userInfoDiv.addEventListener("click", () => {
|
||||
|
||||
if(userInfoPopup.classList.contains("invisible")) {
|
||||
|
||||
userInfoPopup.classList.add("INDEX_userPopup_Visible")
|
||||
userInfoPopup.classList.remove("INDEX_userPopup")
|
||||
userInfoPopup.classList.remove("invisible")
|
||||
userInfoPopup.style.left = (xMousePos - 110) + "px"
|
||||
userInfoPopup.style.top = yMousePos + "px"
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
userInfoPopup.classList.add("invisible")
|
||||
|
||||
userInfoPopup.addEventListener("mouseleave", () => {
|
||||
|
||||
userInfoPopup.classList.add("invisible")
|
||||
})
|
||||
|
||||
userInfoglobal.addEventListener("mouseleave", () => {
|
||||
|
||||
userInfoPopup.classList.add("INDEX_userPopup")
|
||||
userInfoPopup.classList.remove("INDEX_userPopup_Visible")
|
||||
})
|
||||
|
||||
get("MUSIC_STATE").then(data => {
|
||||
console.log(data)
|
||||
@ -230,6 +366,10 @@ socket.on("/ALWAYS/MUSIC_STATE", (data) => {
|
||||
volRange.value = Math.trunc(data.volume / 10)
|
||||
volTxt.innerHTML = Math.trunc(data.volume / 10) + "%"
|
||||
|
||||
var volNum = Math.trunc(data.volume / 10)
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
volRange.classList.add("disabled")
|
||||
@ -354,7 +494,7 @@ socket.on("/ALWAYS/MUSIC_STATE", (data) => {
|
||||
|
||||
} else {
|
||||
|
||||
listBox.innerHTML = '<p class="list_error">Lancez un titre et ajouter vos morceaux ici !</p>'
|
||||
listBox.innerHTML = '<p class="list_error">Lancez un titre et ajoutez vos morceaux ici !</p>'
|
||||
listNumber.classList.add("invisible")
|
||||
}
|
||||
|
||||
@ -445,3 +585,5 @@ function setTime() {
|
||||
durationTextAct.innerHTML = now
|
||||
durationTextTotal.innerHTML = max
|
||||
}
|
||||
|
||||
|
||||
|
@ -139,13 +139,10 @@ body {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.INDEX_userPopup {
|
||||
|
||||
display: none;
|
||||
}
|
||||
|
||||
.INDEX_userPopup_Visible {
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #2e2e2e;
|
||||
@ -153,7 +150,9 @@ body {
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
color: white;
|
||||
|
||||
position: absolute;
|
||||
width: 130px;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#userInfoglobal {
|
||||
@ -208,6 +207,7 @@ body {
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 15vh;
|
||||
bottom: 0;
|
||||
color: white;
|
||||
|
||||
@ -764,3 +764,141 @@ p {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*INDEX Search & Play*/
|
||||
|
||||
.INDEX_playlist {
|
||||
|
||||
background-color: #2e2e2e86;
|
||||
width: 0%;
|
||||
height: 68vh;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.INDEX_search {
|
||||
|
||||
background-color: #2e2e2e86;
|
||||
width: 100%;
|
||||
height: 68vh;
|
||||
margin-left: 1%;
|
||||
border-radius: 12px;
|
||||
overflow-y: auto;
|
||||
padding: 1%;
|
||||
|
||||
}
|
||||
|
||||
.INDEX_subcontent {
|
||||
|
||||
display: flex;
|
||||
margin-top: 2%;
|
||||
height: 70vh;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#searchBar {
|
||||
border: none;
|
||||
border-radius: 20px ;
|
||||
background-color: #ffffff;
|
||||
color: rgb(0, 0, 0);
|
||||
width: 30%;
|
||||
padding: 0.3%;
|
||||
padding-left: 1%;
|
||||
outline: none;
|
||||
user-select: none;
|
||||
font-size: 14px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.findbar {
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: white;
|
||||
margin-bottom: 1%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
.search_song {
|
||||
|
||||
display: grid;
|
||||
align-items: start;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
margin-bottom: 5px;
|
||||
grid-template-columns: 0.5fr 3fr 1fr 1fr 0.1fr;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
|
||||
.search_thumbnail {
|
||||
width: 100px;
|
||||
height: 75px;
|
||||
|
||||
}
|
||||
|
||||
.search_middle {
|
||||
|
||||
margin-bottom: 4%;
|
||||
}
|
||||
|
||||
|
||||
.search_add {
|
||||
|
||||
background-color: transparent;
|
||||
|
||||
color: #ffffff;
|
||||
border: none;
|
||||
font-size: 20px;
|
||||
transition: 0.1s;
|
||||
}
|
||||
|
||||
.search_add:hover {
|
||||
|
||||
color: #00bfff;
|
||||
}
|
||||
|
||||
.search_lmore {
|
||||
|
||||
color: rgb(255, 255, 255);
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
font-size: 20px;
|
||||
transition: 0.1s;
|
||||
text-align: center;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.search_lmore:hover {
|
||||
|
||||
color: #51ff00;
|
||||
}
|
||||
|
||||
|
||||
.search_buttons {
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 10px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.searchMoreDiv {
|
||||
|
||||
display: flex;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.searchPopup {
|
||||
background-color: #2d2d2d;
|
||||
position: absolute;
|
||||
flex-direction: column;
|
||||
width: 200px;
|
||||
right: 3%;
|
||||
text-align: center;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,36 @@ var router = express.Router();
|
||||
var path = require("path")
|
||||
var auth = require("../../modules/sub-auth")
|
||||
var log = require("../../modules/sub-log")
|
||||
var { __glob } = require("../../modules/global-variables")
|
||||
var uuid = require("uuid")
|
||||
var fs = require("fs")
|
||||
|
||||
var md = require('markdown-it')({
|
||||
html: true, // Enable HTML tags in source
|
||||
xhtmlOut: true, // Use '/' to close single tags (<br />).
|
||||
// This is only for full CommonMark compatibility.
|
||||
breaks: true, // Convert '\n' in paragraphs into <br>
|
||||
langPrefix: 'language-', // CSS language prefix for fenced blocks. Can be
|
||||
// useful for external highlighters.
|
||||
linkify: true, // Autoconvert URL-like text to links
|
||||
|
||||
// Enable some language-neutral replacement + quotes beautification
|
||||
// For the full list of replacements, see https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js
|
||||
typographer: true,
|
||||
|
||||
// Double + single quotes replacement pairs, when typographer enabled,
|
||||
// and smartquotes on. Could be either a String or an Array.
|
||||
//
|
||||
// For example, you can use '«»„“' for Russian, '„“‚‘' for German,
|
||||
// and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
|
||||
quotes: '“”‘’',
|
||||
|
||||
// Highlighter function. Should return escaped HTML,
|
||||
// or '' if the source string is not changed and should be escaped externally.
|
||||
// If result starts with <pre... internal wrapper is skipped.
|
||||
highlight: function (/*str, lang*/) { return ''; }
|
||||
});
|
||||
|
||||
|
||||
|
||||
router.get('/', function(req, res, next) {
|
||||
@ -12,7 +41,8 @@ router.get('/', function(req, res, next) {
|
||||
res.redirect("/login")
|
||||
} else {
|
||||
|
||||
res.render("index")
|
||||
var fileMd = md.render(fs.readFileSync(__glob.README).toString())
|
||||
res.render("index", {welcome: fileMd})
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,15 +17,43 @@
|
||||
<div class="INDEX_userInfo" id="userInfo"></div>
|
||||
<div class="INDEX_userPopup" id="userPopup">
|
||||
<!--div id="settingsBtn" class="INDEX_line"><i class="fa-solid fa-wrench"></i> Paramètres</div>-->
|
||||
<div id="SPECIAL" class="INDEX_line"><i class="fa-solid fa-gears"></i> Debug</div>
|
||||
<div id="reportBtn" class="INDEX_line"><i class="fa-solid fa-bug"></i> Rapport</div>
|
||||
<a class="INDEX_signout" href="/internal/logout"><i class="fa fa-sign-out " aria-hidden="true"></i> Déconnexion</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="INDEX_subcontent">
|
||||
<div class="INDEX_playlist">
|
||||
|
||||
</div>
|
||||
<div class="INDEX_search">
|
||||
<div class="findbar">
|
||||
<i class="fa fa-search"></i>
|
||||
<input id="searchBar" placeholder="Insérez des mots-clés ou un lien" type="text">
|
||||
</div>
|
||||
<div class="search_middle"></div>
|
||||
|
||||
<div id="search_content">
|
||||
<div style="color: white">
|
||||
|
||||
<%- welcome %>
|
||||
|
||||
</div>
|
||||
|
||||
<button id="SPECIAL">LAUNCH MJ MUSIC</button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="PLAYER_box">
|
||||
<div class="PLAYER_title">
|
||||
@ -55,7 +83,7 @@
|
||||
<p id="volumeTxt">100%</p>
|
||||
</div>
|
||||
</div>
|
||||
<button id="loop" class="third"><i class="fa fa-retweet"></i></button>
|
||||
<button id="loop" class="third"><i class="fa-solid fa-repeat"></i></button>
|
||||
<button id="shuffle" class="third"><i class="fa fa-shuffle"></i></button>
|
||||
<div id="listDiv" class="volDiv">
|
||||
<button id="list" class="list third"><i class="fa fa-list-ol"></i><p class="number" id="listNumber"></p></button>
|
||||
|
Loading…
Reference in New Issue
Block a user