Version 2.1.1 - modification d'une certaine UI
This commit is contained in:
1 parent
dcc350241e
commit
fc71b10294
10 files changed
+1208
-139
No files matched your search
+20
-20
@@ -28,7 +28,6 @@ const googleApis = require("../playlists/Google/OAuth2")
|
||||
const configuration = require("../utils/Database/Configuration")
|
||||
const { List } = require('../player/List')
|
||||
const Admin = require("./Admin")
|
||||
const { isAudioFile } = require('../utils/AudioBufferCheck')
|
||||
const { Song } = require('../player/Song')
|
||||
const { getMediaInformationFromUrl } = require('../media/MediaInformation')
|
||||
|
||||
@@ -793,31 +792,32 @@ function init() {
|
||||
|
||||
// UPLOAD
|
||||
|
||||
// CHECKED : 29/05/2025
|
||||
// Fichiers convertis en Ogg/Opus puis stockés dans le salon Discord multimédia (voir MediaBase)
|
||||
// Réponses par ack (ou même nom d'événement) : {ok:true, ...} | {ok:false, error, message}
|
||||
|
||||
IORequest("/UPLOAD/FILE", async (data) => {
|
||||
if(!data) return IOAnswer("/UPLOAD/FILE", false)
|
||||
if(!data.name) return IOAnswer("/UPLOAD/FILE", false)
|
||||
const file = data.file
|
||||
// Check wav or mp3
|
||||
if(isAudioFile(file) == false) {
|
||||
wlog.warn("Le fichier envoyé n'est pas un fichier audio valide (MP3/WAV)")
|
||||
return IOAnswer("/UPLOAD/FILE", false)
|
||||
IORequest("/UPLOAD/INFO", (_, ack) => {
|
||||
answer("/UPLOAD/INFO", { ok: true, ...mediaBase.getInfo() }, ack, true)
|
||||
}, true)
|
||||
|
||||
IORequest("/UPLOAD/FILE", async (data, ack) => {
|
||||
const reply = (value) => answer("/UPLOAD/FILE", value, ack)
|
||||
if(!data || typeof data !== "object" || typeof data.name !== "string" || !data.name.trim()) {
|
||||
return reply({ ok: false, error: "INVALID_PARAMS", message: "Fichier manquant." })
|
||||
}
|
||||
const url = await mediaBase.postMedia(data, socketUser.identity.id)
|
||||
if(!url) return IOAnswer("/UPLOAD/FILE", "TOOHIGH")
|
||||
IOAnswer("/UPLOAD/FILE", {"url": url, "name": data.name})
|
||||
// Le contenu est vérifié par ffprobe pendant la conversion (piste audio lisible)
|
||||
reply(await mediaBase.postMedia({ name: data.name, file: data.file }, {
|
||||
id: socketUser.identity.id,
|
||||
username: socketUser.identity.username
|
||||
}))
|
||||
})
|
||||
|
||||
IORequest("/UPLOAD/FILES", async () => {
|
||||
const files = await mediaBase.getAllMedia(socketUser.identity.id)
|
||||
IOAnswer("/UPLOAD/FILES", files)
|
||||
IORequest("/UPLOAD/FILES", async (_, ack) => {
|
||||
answer("/UPLOAD/FILES", await mediaBase.getAllMedia(socketUser.identity.id), ack)
|
||||
})
|
||||
|
||||
IORequest("/UPLOAD/FILE/DELETE", (data) => {
|
||||
if(!data) return IOAnswer("/UPLOAD/FILE/DELETE", false)
|
||||
mediaBase.deleteMedia(data, socketUser.identity.id)
|
||||
IOAnswer("/UPLOAD/FILE/DELETE", true)
|
||||
IORequest("/UPLOAD/FILE/DELETE", async (data, ack) => {
|
||||
if(!data) return answer("/UPLOAD/FILE/DELETE", false, ack)
|
||||
answer("/UPLOAD/FILE/DELETE", await mediaBase.deleteMedia(data, socketUser.identity.id), ack)
|
||||
})
|
||||
|
||||
// GOOGLE API (compte YouTube lié : import et synchronisation des playlists)
|
||||
|
||||
Reference in new issue
Block a user