From: Mike Lowis Date: Thu, 6 Feb 2025 19:59:30 +0000 (-0500) Subject: attempted to rework UI to fix path bug in the control page X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=HEAD;p=proto%2Fatv.git attempted to rework UI to fix path bug in the control page --- 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 });