Skip to content

Commit 471bd68

Browse files
committed
feat(vscode-extension): include QM_APP_ORIGIN in bridge server for iframe messaging
1 parent 2282316 commit 471bd68

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/mcp/src/renderer/bridge.server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { APP_MESSAGE_TYPE } from '@lemoncode/quickmock-bridge-protocol';
22
import { createServer, type Server } from 'node:http';
33
import type { AddressInfo } from 'node:net';
4-
import { QUICKMOCK_URL } from './app-url.consts';
4+
import { QM_APP_ORIGIN, QUICKMOCK_URL } from './app-url.consts';
55

66
export interface BridgeServer {
77
server: Server;
@@ -28,6 +28,7 @@ export function startBridgeServer(): Promise<BridgeServer> {
2828
function buildBridgeHtml(): string {
2929
const READY = JSON.stringify(APP_MESSAGE_TYPE.READY);
3030
const RENDER_COMPLETE = JSON.stringify(APP_MESSAGE_TYPE.RENDER_COMPLETE);
31+
const QM_ORIGIN = JSON.stringify(QM_APP_ORIGIN);
3132

3233
return /* html */ `<!DOCTYPE html>
3334
<html lang="en">
@@ -65,7 +66,7 @@ function buildBridgeHtml(): string {
6566
6667
// Messages coming DOWN from Puppeteer (page.evaluate) → forward to iframe
6768
if (iframe.contentWindow) {
68-
iframe.contentWindow.postMessage(event.data, '*')
69+
iframe.contentWindow.postMessage(event.data, ${QM_ORIGIN})
6970
}
7071
})
7172
</script>

0 commit comments

Comments
 (0)