dsh-plugin-core-demo 0.43.1 → 0.43.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.
Files changed (3) hide show
  1. package/dist/client.js +1919 -1851
  2. package/dist/index.js +9 -1
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1017,7 +1017,13 @@ function serveTaskSubmit(ctx, options) {
1017
1017
  kind: "exact",
1018
1018
  path: options.path,
1019
1019
  handler: async (req, res) => {
1020
- if (!await options.authorize(req)) {
1020
+ let allowed = false;
1021
+ try {
1022
+ allowed = await options.authorize(req);
1023
+ } catch (error) {
1024
+ console.error("dsh-plugin-core: task submit authorize failed", error);
1025
+ }
1026
+ if (!allowed) {
1021
1027
  res.writeHead(403, JSON_HEADERS);
1022
1028
  res.end(JSON.stringify({ error: "forbidden" }));
1023
1029
  return;
@@ -1386,6 +1392,8 @@ function serveDemoTasks(ctx) {
1386
1392
  title: String(payload.title ?? "\u540E\u53F0\u4EFB\u52A1"),
1387
1393
  state: "running",
1388
1394
  startedAt: Date.now(),
1395
+ // 发起页身份由 client 随 submit 提交:回填到记录后,服务端 notice 才能按 scope:'origin' 只在发起页弹。
1396
+ ...typeof payload.origin === "string" ? { origin: payload.origin } : {},
1389
1397
  ...typeof payload.toast === "object" && payload.toast !== null ? { toast: payload.toast } : {},
1390
1398
  ...typeof payload.notify === "object" && payload.notify !== null ? { notify: payload.notify } : {},
1391
1399
  ...typeof payload.rowButtons === "object" && payload.rowButtons !== null ? { rowButtons: payload.rowButtons } : {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-core-demo",
3
- "version": "0.43.1",
3
+ "version": "0.43.2",
4
4
  "description": "The shared UI foundation for DSH plugins, with a live component preview: design tokens, common controls, workspace browsing and notifications maintained in one place — install it to preview every component in a real host.",
5
5
  "icon": "./assets/icon-components.svg",
6
6
  "keywords": [