fix(fx-list): MASTERING PANEL khong hien thi VST FX da scan trong Plugin Manager (cache _fx_scan_all ket [] vinh vien)

- vst_engine: list_scan_all cache co TTL 300s (FX_SCAN_TTL) + chi cache khi
  find_fx_bridge_exe() co exe (thieu bridge -> tra [] NHUNG khong cache de
  lan sau thu lai) — truoc day ket [] vi mui gio, MASTERING PANEL rong.
- vst_engine: them invalidate_fx_scan() clear cache scan VST.
- plugins.py: POST /scan (Plugin Manager Scan) goi _invalidate_fx_scan_cache()
  -> MASTERING PANEL lan mo ke tiep quet lai voi dirs moi; response them
  fx_cache_invalidated.
- app.jsx: MasteringModal/FXRackModal load listFx() lai moi lan mo modal
  (deps [isOpen]/[track.id]) + loading state; VstPluginPicker nhan prop
  loading -> hien 'Dang quet VST FX...' thay vi 'Khong co VST FX'.
- precompiled rebuild (LF) + index.html ?v=202608220330; dist sync.
- tests: +4 test cache TTL/invalidate/no-bridge (TestFxScanCache).
This commit is contained in:
2026-08-22 03:34:33 +00:00
parent ac5a171464
commit 34d43f5018
7 changed files with 147 additions and 23 deletions
+18
View File
@@ -41,6 +41,23 @@ def _save_plugin_dirs(dirs: dict):
with open(PLUGIN_DIRS_FILE, "w", encoding="utf-8") as f:
json.dump(dirs, f, indent=2)
def _invalidate_fx_scan_cache() -> bool:
"""Clear cache scan VST FX của PluginManager singleton.
Plugins Manager bấm Scan (POST /scan) quét dirs MỚI nhưng trước đây
không clear `_fx_scan_all` của vst_engine → MASTERING PANEL / FX Rack
vẫn trả cache cũ (thường là [] kẹt từ lúc app khởi động) → VST FX đã
load trong Plugin Manager KHÔNG hiển thị. Gọi invalidate để lần mở panel
kế tiếp quét lại với dirs mới.
"""
try:
from app.core.vst_engine import get_plugin_manager
get_plugin_manager().invalidate_fx_scan()
return True
except Exception:
return False
def _effective_dirs() -> dict:
"""Env/.env (Docker) là base; user dirs (file) override nếu khai báo.
@@ -141,6 +158,7 @@ async def scan_plugin_dirs(background_tasks: BackgroundTasks = None,
"vst_count": len(vst_found),
"soundfonts": sf_found,
"soundfont_count": len(sf_found),
"fx_cache_invalidated": _invalidate_fx_scan_cache(),
}
_inspector = None