@easyai-canvas/canvas-plugin-sdk 0.1.1 → 0.1.2

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.
@@ -82,7 +82,8 @@ async function studioCatalog() {
82
82
  const server = createServer(async (request, response) => {
83
83
  try {
84
84
  const method = request.method ?? 'GET';
85
- const path = new URL(request.url ?? '/', `http://localhost:${port}`).pathname;
85
+ const requestUrl = new URL(request.url ?? '/', `http://localhost:${port}`);
86
+ const path = requestUrl.pathname;
86
87
  const allowedOrigins = (process.env.PLUGIN_ALLOWED_ORIGINS ?? (process.env.NODE_ENV === 'production'
87
88
  ? '' : 'http://localhost:3000,http://127.0.0.1:3000')).split(',').map(s => s.trim()).filter(Boolean);
88
89
  if (request.headers.origin && allowedOrigins.includes(request.headers.origin)) {
@@ -177,6 +178,10 @@ const server = createServer(async (request, response) => {
177
178
  }
178
179
  if (path.startsWith('/studio')) {
179
180
  localStudio(request);
181
+ if (method === 'GET' && path === '/studio/') {
182
+ redirect(response, `/studio${requestUrl.search}`);
183
+ return;
184
+ }
180
185
  if (method === 'GET' && path === '/studio') {
181
186
  if (request.headers.host?.startsWith('127.0.0.1:')) {
182
187
  redirect(response, `http://localhost:${port}/studio`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyai-canvas/canvas-plugin-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "EasyAI 画布插件开发工具与运行时",
5
5
  "type": "module",
6
6
  "engines": {