Version 0.7.1 - Ajout des logs

This commit is contained in:
Raphix
2023-08-31 19:31:09 +02:00
parent 30a0208cf1
commit 51820268cd
12 changed files with 331 additions and 172 deletions

View File

@ -18,6 +18,7 @@ const __glob = {
NODES: root + path.sep + "data" + path.sep + "nodes.json",
README: root + path.sep + "README.md",
PLAYLIST: root + path.sep + "data" + path.sep + "playlist.json",
LOGS: root + path.sep + "src" + path.sep + "modules" + path.sep + "logs"
};
const webroot = __glob.WEB_DIR + path.sep

View File

@ -743,7 +743,7 @@ module.exports.updateMusicState = function (client, action) {
data["isOnline"] = false
}
clog.log("Actualisation de tous les clients - Titre : " + currentTitle + " - Loop : " + data.loop + " - Shuffle : " + data.shuffle + " - Playing : " + data.playing + " - Volume : " + Math.trunc(data.volume / 10) )
clog.log("Actualisation Clients - Titre : " + currentTitle + " - Loop : " + data.loop + " - Shuffle : " + data.shuffle + " - Playing : " + data.playing + " - Volume : " + Math.trunc(data.volume / 10) )
return data

View File

@ -8,7 +8,8 @@ const wlog = new LogType("Web")
const subplayer = require(__glob.SUBPLAYER);
const { List } = require("./sub-list")
const subplaylist = require("./sub-playlist")
var fs = require("fs")
var path = require("path")
module.exports.WebServer = class {
@ -213,6 +214,33 @@ function IOConnection(io) {
})
GetRequest(io, socket, "LOGS", () => {
var cookies = socket.handshake.headers.cookie
cookies = cook.parse(cookies)
var token = cookies.token
const user = auth.getUser(token)
const logs_data = new Array()
if(user.admin == true) {
const logs_folder = fs.readdirSync(__glob.LOGS)
for(var log of logs_folder) {
logs_data.push({"name":log, "value": fs.readFileSync(__glob.LOGS + path.sep + log).toString()})
}
socket.emit("ANSWER/GET/LOGS", logs_data)
}
})
@ -269,6 +297,8 @@ function IOConnection(io) {
})
GetRequest(io, socket, "SPECIAL/MJ", () => {