From 3b29f1011712c845a5fc4a9ff84fb5e840c4d099 Mon Sep 17 00:00:00 2001 From: Mike Lowis Date: Thu, 6 Feb 2025 14:59:30 -0500 Subject: [PATCH] attempted to rework UI to fix path bug in the control page --- atv/assets/client.js | 1 + atv/assets/control.html | 6 +++++- atv/assets/ui.js | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/atv/assets/client.js b/atv/assets/client.js index 6522cd6..265c4ca 100644 --- a/atv/assets/client.js +++ b/atv/assets/client.js @@ -9,6 +9,7 @@ const Client = ((self = {})=>{ "ws://" + window.location.host + ":3000"); ws.onopen = (event)=>{ + onmsg({cmd: "connect"}) self.send("get_items", {}); self.send("get_queue", {}); } diff --git a/atv/assets/control.html b/atv/assets/control.html index 73e6cf9..7fb733f 100644 --- a/atv/assets/control.html +++ b/atv/assets/control.html @@ -59,7 +59,11 @@ (()=>{ Client.connect((data)=>{ console.log(data); - if (cmd.cmd === "items") + if (cmd.cmd === "connect") + { + UI.reset(); + } + else if (cmd.cmd === "items") { UI.set_items( data.items ); } diff --git a/atv/assets/ui.js b/atv/assets/ui.js index 01b5049..15e78a9 100644 --- a/atv/assets/ui.js +++ b/atv/assets/ui.js @@ -23,6 +23,10 @@ const UI = (()=>{ self.select_file = ()=>{ showBrowser(); }; self.cancel = ()=>{ showMain(); }; + self.reset = ()=>{ + path = []; + }; + self.enqueue = (path)=>{ console.log(path); Client.send("enqueue", { path: path }); -- 2.54.0