diff --git a/app.js b/app.js index c7aa9d6..096e822 100644 --- a/app.js +++ b/app.js @@ -12,6 +12,7 @@ import { } from "./libs/Format"; let currentSongId = ""; +let currentSong = {}; const pino = new Pino({ prettyPrint: true, @@ -41,6 +42,7 @@ app.post("/post", function (req, res, next) { const newSongId = req.body.now_playing.song.id; if (newSongId !== currentSongId) { currentSongId = newSongId; + currentSong = req.body.now_playing.song; fs.writeFile("./currentSongId", currentSongId, (err) => { if (err) { req.log.error(err); @@ -58,6 +60,10 @@ app.post("/post", function (req, res, next) { } }); +app.get("/current", function (req, res, next) { + formatResponse(req, res, next, null, currentSong); +}); + // Gestion des erreurs app.use((err, req, res, next) => { res.error = err;