From 4b8ef84059e772ef7636c451356680ec5b0983c4 Mon Sep 17 00:00:00 2001 From: Physick <96335032+DegustatorPonos@users.noreply.github.com> Date: Sat, 6 Dec 2025 12:53:43 +0500 Subject: Random song endpoint --- static/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'static/index.js') diff --git a/static/index.js b/static/index.js index 9f5070b..b7056b1 100644 --- a/static/index.js +++ b/static/index.js @@ -1,5 +1,16 @@ + function GetSongs() { fetch("/api/getSongs").then(r => r.json().then(body => { console.log(body); })); } + +function SetRandomSong() { + fetch("/api/randomSong").then(r => r.json().then(body => { + const player = document.getElementById("mainAudio"); + console.log(player); + console.log(body); + player.src = "/api/getSong?name=" + encodeURI(body.Name); + player.play(); + })); +} -- cgit v1.3