fix: toggle_block now sets bypass=not enabled - was leaving bypass=True, blocking FX

This commit is contained in:
2026-06-13 20:40:11 -04:00
parent 1b250cd5a3
commit c0c0ffe4f2
+3 -2
View File
@@ -818,7 +818,7 @@ class WebServer:
# ── Block toggle (UI: PATCH /api/blocks {id, enabled}) ──
@app.patch("/api/blocks")
async def toggle_block(data: dict, channel: str = "guitar"):
"""Enable/disable a block by its fx_type id."""
"""Enable/disable a block by its fx_type id — sets both enabled and bypass."""
from ..presets.types import Channel
pm, pl, nam, ir = self._channel_deps(channel)
if not pm:
@@ -834,11 +834,12 @@ class WebServer:
for b in preset.chain:
if b.fx_type.value == block_id:
b.enabled = bool(enabled)
b.bypass = not bool(enabled) # <-- added: sync bypass with enabled
pm.save(preset, channel=Channel(channel))
# Reload pipeline if needed
if pl:
pl.load_preset(preset)
return {"ok": True, "id": block_id, "enabled": b.enabled}
return {"ok": True, "id": block_id, "enabled": b.enabled, "bypass": b.bypass}
raise HTTPException(status_code=404, detail=f"Block '{block_id}' not found")
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))