fix(bridge): load dung VSTi theo track (V9) - bo early-return mui theo flag, load qua Tauri invoke khi co path, guard path sai (WaveObserver vs Nexus), chi mo GUI khi load OK; sync 6 ban JS + index.html ?v; kem cac fix bridge truoc (bugs 1-4, GUI restore)
This commit is contained in:
@@ -131,6 +131,21 @@ void sendResponse(SOCKET c, int code, const char* contentType,
|
||||
if (len > 0) send(c, (const char*)data, (int)len, 0);
|
||||
}
|
||||
|
||||
// CORS preflight reply: the embed page (origin 127.0.0.1:8000) POSTs JSON to
|
||||
// this server (a different port), so the browser sends an OPTIONS request
|
||||
// first. Without this handler the preflight fell into the /input JSON parser
|
||||
// and failed with 400, so the embedded GUI looked frozen: frames streamed but
|
||||
// clicks never reached the plugin.
|
||||
void sendOptions(SOCKET c) {
|
||||
const char* r =
|
||||
"HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
"Access-Control-Allow-Methods: GET, POST, OPTIONS\r\n"
|
||||
"Access-Control-Allow-Headers: Content-Type\r\n"
|
||||
"Content-Length: 0\r\nConnection: close\r\n\r\n";
|
||||
send(c, r, (int)std::strlen(r), 0);
|
||||
}
|
||||
|
||||
// --- frame capture -----------------------------------------------------------
|
||||
// Capture the window client rect twice — BitBlt (GDI view) and PrintWindow
|
||||
// with PW_RENDERFULLCONTENT (DWM composition, includes DirectX/GPU surfaces
|
||||
@@ -288,7 +303,9 @@ void runHttpServer(HWND hwnd, std::atomic<bool>& stop) {
|
||||
|
||||
HttpReq req;
|
||||
if (!readRequest(c, req)) { closesocket(c); continue; }
|
||||
if (req.path == "/ping") {
|
||||
if (req.method == "OPTIONS") {
|
||||
sendOptions(c);
|
||||
} else if (req.path == "/ping") {
|
||||
sendResponse(c, 200, "application/json", "{\"ok\":true}", 11);
|
||||
} else if (req.path == "/frame") {
|
||||
std::vector<unsigned char> jpg;
|
||||
|
||||
Reference in New Issue
Block a user