fix: toggle_block now sets bypass=not enabled - was leaving bypass=True, blocking FX
This commit is contained in:
+3
-2
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user