This commit is contained in:
XenGi 2024-07-15 20:00:18 +02:00
parent 5474934cea
commit ab01f8f329
Signed by: xengi
SSH key fingerprint: SHA256:FGp51kRvGOcWnTHiOI39ImwVO4A3fpvR30nPX3LpV7g
5 changed files with 10 additions and 7 deletions

View file

@ -1,4 +1,4 @@
FROM docker.io/golang:1.20 as builder FROM docker.io/golang:1.22 as builder
WORKDIR /app WORKDIR /app

View file

@ -39,4 +39,3 @@
} }
); );
} }

2
go.mod
View file

@ -1,6 +1,6 @@
module gitlab.com/XenGi/sanic module gitlab.com/XenGi/sanic
go 1.21 go 1.22
require ( require (
github.com/fhs/gompd/v2 v2.3.0 github.com/fhs/gompd/v2 v2.3.0

View file

@ -200,7 +200,8 @@
<option value="1">basedrive</option><!-- TODO: Remove this line --> <option value="1">basedrive</option><!-- TODO: Remove this line -->
</select><!--/#control-playlist-list--> </select><!--/#control-playlist-list-->
<div> <div>
<button id="control-replace-playlist">&#x1F504; Replace</button><!-- 🔄 Counterclockwise Arrows Button --> <button id="control-refresh-playlists">&#x1F504; Refresh</button><!-- 🔄 Counterclockwise Arrows Button -->
<button id="control-replace-playlist">&#x2934;&#xFE0F; Replace</button><!-- ⤴️ Arrow Pointing Rightwards Then Curving Upwards -->
<button id="control-attach-playlist">&#x2B06; Attach</button><!-- ⬆️ Up Arrow --> <button id="control-attach-playlist">&#x2B06; Attach</button><!-- ⬆️ Up Arrow -->
<button id="control-save-playlist">&#x1F4BE; Save</button><!-- 💾 Floppy Disk --> <button id="control-save-playlist">&#x1F4BE; Save</button><!-- 💾 Floppy Disk -->
<button id="control-delete-playlist">&#x1F5D1;&#xFE0F; Delete</button><!-- 🗑️ Wastebasket --> <button id="control-delete-playlist">&#x1F5D1;&#xFE0F; Delete</button><!-- 🗑️ Wastebasket -->

View file

@ -33,6 +33,7 @@ const tab_browser = document.getElementById("tab-browser");
const tab_search = document.getElementById("tab-search"); const tab_search = document.getElementById("tab-search");
const tab_playlists = document.getElementById("tab-playlists"); const tab_playlists = document.getElementById("tab-playlists");
const control_playlist_list = document.getElementById("control-playlist-list"); const control_playlist_list = document.getElementById("control-playlist-list");
const control_refresh_playlists = document.getElementById("control-refresh-playlists");
const control_replace_playlist = document.getElementById("control-replace-playlist"); const control_replace_playlist = document.getElementById("control-replace-playlist");
const control_attach_playlist = document.getElementById("control-attach-playlist"); const control_attach_playlist = document.getElementById("control-attach-playlist");
const control_save_playlist = document.getElementById("control-save-playlist"); const control_save_playlist = document.getElementById("control-save-playlist");
@ -83,9 +84,7 @@ refreshPlaylists = () => {
option.value = p["playlist"]; option.value = p["playlist"];
option.addEventListener("click", () => { option.addEventListener("click", () => {
fetch(`${API_URL}/playlists/${p["playlist"]}`).then(async r => { fetch(`${API_URL}/playlists/${p["playlist"]}`).then(async r => {
if (r.status === 200) { if (r.status === 200) fillResultTable(await r.json());
fillResultTable(await r.json());
}
}) })
}); });
control_playlist_list.appendChild(option) control_playlist_list.appendChild(option)
@ -172,6 +171,10 @@ control_search_submit.addEventListener("click", event => {
}) })
}); });
control_refresh_playlists.addEventListener("click", () => {
refreshPlaylists();
});
control_replace_playlist.addEventListener("click", () => { control_replace_playlist.addEventListener("click", () => {
fetch(`${API_URL}/queue/replace/${control_playlist_list.value}`).then(async r => { fetch(`${API_URL}/queue/replace/${control_playlist_list.value}`).then(async r => {
if (r.status !== 200) { if (r.status !== 200) {