fix: multiple bug fixes found during comprehensive test plan sweep
CI / test (push) Has been cancelled

- Fix #5: Preset state lost on service restart — call restore_state()
  in PresetManager.__init__() so last active preset is tracked after boot
- Fix #14: Block bypass/toggle WS sync — add WebSocket connection
  in SPA with block_toggled handler that calls loadState()
- Fix #15: IR file naming — add display_name property to IRFile
  dataclass that strips common IR prefixes/suffixes
- Fix: block_id regeneration on every preset load — pass block_id
  from stored JSON data to FXBlock constructor in _preset_from_dict
  (both preset chain and snapshot chain)
This commit is contained in:
2026-06-18 19:14:01 -04:00
parent d152ecd1fc
commit 47bb535b08
3 changed files with 72 additions and 1 deletions
+18 -1
View File
@@ -945,6 +945,22 @@ async function pollTuner(){
function startPolling(){stopPolling();loadState();pollTimer=setInterval(loadState,2000);}
function stopPolling(){if(pollTimer){clearInterval(pollTimer);pollTimer=null;}}
// ═══ WebSocket — real-time updates ═══
let ws=null;
function setupWebSocket(){
if(ws)try{ws.close()}catch(e){}
const proto=location.protocol==='https:'?'wss:':'ws:';
ws=new WebSocket(proto+'//'+location.host+'/ws');
ws.onmessage=(ev)=>{
try{
const msg=JSON.parse(ev.data);
if(msg.type==='block_toggled'){loadState();}
}catch(e){}
};
ws.onclose=()=>{setTimeout(setupWebSocket,3000);};
ws.onerror=()=>{};
}
// ═══ Init! ═══
function init(){
// Restore saved channel
@@ -1243,8 +1259,9 @@ function init(){
document.getElementById('dlSearchBtn').onclick=doDlSearch;
document.getElementById('dlSearch').onkeydown=(e)=>{if(e.key==='Enter')doDlSearch();};
// Start polling
// Start polling + WebSocket
startPolling();
setupWebSocket();
loadPresets();
loadSnapshots();
}