fix(native_bridge): strip query string in fx-gui HTTP path + walkthrough notes

- readRequest now trims '?t=<ms>' cache-buster so /frame?t=... matches
  /frame route (frontend VstGuiEmbed polls with timestamp → was 404, no image)
- document: jpeg62.dll manual copy, add auto-opens GUI (already_running
  expected), reopen needs bridge exit wait
This commit is contained in:
2026-08-18 08:27:35 +07:00
parent c382afe2a6
commit 569be72110
2 changed files with 19 additions and 4 deletions
+8 -2
View File
@@ -30,6 +30,8 @@ Lưu ý thay đổi mới trong phần này (so với lần build cũ):
- Script phải copy `daw_vst_bridge.exe` + DLL (fluidsynth, jpeg) sang
`src-tauri\binaries\` (chỉ các DLL cần thiết; libjpeg-turbo thường static
theo manifest, nếu build động thì copy luôn `jpeg62.dll`).
- Trên máy thật: script hiện KHÔNG copy `jpeg62.dll` (build động) — copy tay:
`copy native_bridge\build\Release\jpeg62.dll src-tauri\binaries\`.
**PASS khi**: `native_bridge\build\Release\daw_vst_bridge.exe` tồn tại và
`daw_vst_bridge.exe --help` không crash.
@@ -103,11 +105,15 @@ chết (`Get-Process daw_vst_bridge` không còn).
## 2W1 — E2E MasteringModal
1. Mở app → **Mastering Panel**.
2. Thêm VST (Ozone) vào master chain → **bấm nút GUI** trên slot.
2. Thêm VST (Ozone) vào master chain → GUI TỰ MỞ (addMasterVst gọi openMasterVstGui).
Bấm thêm nút GUI trên slot lúc này → backend trả `already_running:true` + toast
"GUI của plugin này đang mở sẵn" — đúng thiết kế, không spawn 2 GUI.
3. Kỳ vọng: GUI plugin hiện **TRONG panel** (thay vùng graph EQ/imager),
header hiện "VST GUI — nhúng (frame-capture · ~10fps)".
4. Click/scroll/kéo trong vùng GUI → plugin phản hồi (thay preset, xoay nút).
5. Bấm "✕ Đóng GUI" → về graph; bấm nút GUI lại → mở lại.
5. Bấm "✕ Đóng GUI" → về graph; chờ ~2-3s (bridge thoát hẳn) rồi bấm nút GUI lại
→ mở lại. Bấm ngay trong ~1s đầu có thể vẫn nhận `already_running` (process
chưa thoát) — không phải lỗi.
6. Xóa slot khi GUI đang mở → GUI đóng + slot xóa, không crash.
7. Tắt bridge thủ công (Task Manager kill `daw_vst_bridge`) → sau ~2s panel
toast "Bridge VST GUI đã mất kết nối" và tự trả về graph.
+11 -2
View File
@@ -22,10 +22,10 @@
#include <ws2tcpip.h>
#pragma comment(lib, "ws2_32.lib")
#include <cstdio>
#include <jpeglib.h>
#include <atomic>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
@@ -39,6 +39,12 @@
namespace {
// --- tiny JSON helpers (same API as RenderFxJob.cpp) ------------------------
const json_object_element_s* member(const json_object_s* o, const char* key) {
for (const json_object_element_s* e = o ? o->start : nullptr; e; e = e->next)
if (e->name && e->name->string && std::strcmp(e->name->string, key) == 0)
return e;
return nullptr;
}
const json_value_s* memberValue(const json_object_s* o, const char* key) {
const json_object_element_s* m = member(o, key);
return m ? m->value : nullptr;
@@ -83,6 +89,9 @@ bool readRequest(SOCKET c, HttpReq& out) {
if (sp1 == std::string::npos || sp2 == std::string::npos) return false;
out.method = head.substr(0, sp1);
out.path = head.substr(sp1 + 1, sp2 - sp1 - 1);
// strip query string: frontend cache-busts /frame?t=<ms>
const size_t q = out.path.find('?');
if (q != std::string::npos) out.path.resize(q);
long contentLength = 0;
size_t pos = 0;
@@ -285,7 +294,7 @@ void runHttpServer(HWND hwnd, std::atomic<bool>& stop) {
} else if (req.path == "/close") {
sendResponse(c, 200, "application/json", "{\"ok\":true}", 11);
stop.store(true);
PostMessageA(hwnd, WM_CLOSE); // pump exits -> process returns
PostMessageA(hwnd, WM_CLOSE, 0, 0); // pump exits -> process returns
} else {
sendResponse(c, 404, "application/json", "{\"error\":\"not found\"}", 22);
}