@xcanwin/manyoyo 5.2.15 → 5.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/plugin/playwright.js +6 -1
- package/lib/web/server.js +7 -8
- package/package.json +1 -1
package/lib/plugin/playwright.js
CHANGED
|
@@ -1339,13 +1339,18 @@ class PlaywrightPlugin {
|
|
|
1339
1339
|
const scenes = this.resolveTargets('all');
|
|
1340
1340
|
for (const sceneName of scenes) {
|
|
1341
1341
|
const url = `http://${host}:${this.scenePort(sceneName)}/mcp`;
|
|
1342
|
-
this.writeStdout(`claude mcp add
|
|
1342
|
+
this.writeStdout(`claude mcp add -t http -s user playwright-${sceneName} ${url}`);
|
|
1343
1343
|
}
|
|
1344
1344
|
this.writeStdout('');
|
|
1345
1345
|
for (const sceneName of scenes) {
|
|
1346
1346
|
const url = `http://${host}:${this.scenePort(sceneName)}/mcp`;
|
|
1347
1347
|
this.writeStdout(`codex mcp add playwright-${sceneName} --url ${url}`);
|
|
1348
1348
|
}
|
|
1349
|
+
this.writeStdout('');
|
|
1350
|
+
for (const sceneName of scenes) {
|
|
1351
|
+
const url = `http://${host}:${this.scenePort(sceneName)}/mcp`;
|
|
1352
|
+
this.writeStdout(`gemini mcp add -t http -s user playwright-${sceneName} ${url}`);
|
|
1353
|
+
}
|
|
1349
1354
|
|
|
1350
1355
|
return 0;
|
|
1351
1356
|
}
|
package/lib/web/server.js
CHANGED
|
@@ -1898,14 +1898,13 @@ async function startWebServer(options) {
|
|
|
1898
1898
|
const requestOrigin = req.headers.origin;
|
|
1899
1899
|
if (requestOrigin) {
|
|
1900
1900
|
const allowedOrigins = new Set();
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
} else {
|
|
1901
|
+
// 始终以请求的 Host 头构造允许来源,兼容 nginx 等反向代理场景
|
|
1902
|
+
const hostHeader = req.headers.host || '';
|
|
1903
|
+
if (hostHeader) {
|
|
1904
|
+
allowedOrigins.add(`http://${hostHeader}`);
|
|
1905
|
+
allowedOrigins.add(`https://${hostHeader}`);
|
|
1906
|
+
}
|
|
1907
|
+
if (ctx.serverHost !== '0.0.0.0') {
|
|
1909
1908
|
allowedOrigins.add(`http://${formatUrlHost(ctx.serverHost)}:${listenPort}`);
|
|
1910
1909
|
if (ctx.serverHost === '127.0.0.1') {
|
|
1911
1910
|
allowedOrigins.add(`http://localhost:${listenPort}`);
|