@nocobase/plugin-action-custom-request 2.1.0-beta.25 → 2.1.0-beta.26

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.
@@ -8,23 +8,23 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-beta.25",
11
+ "@nocobase/client": "2.1.0-beta.26",
12
12
  "react": "18.2.0",
13
13
  "react-i18next": "11.18.6",
14
14
  "@formily/react": "2.3.7",
15
- "@nocobase/logger": "2.1.0-beta.25",
16
- "@nocobase/server": "2.1.0-beta.25",
17
- "@nocobase/test": "2.1.0-beta.25",
15
+ "@nocobase/logger": "2.1.0-beta.26",
16
+ "@nocobase/server": "2.1.0-beta.26",
17
+ "@nocobase/test": "2.1.0-beta.26",
18
18
  "@formily/antd-v5": "1.2.3",
19
19
  "lodash": "4.18.1",
20
- "@nocobase/utils": "2.1.0-beta.25",
20
+ "@nocobase/utils": "2.1.0-beta.26",
21
21
  "antd": "5.24.2",
22
22
  "file-saver": "2.0.5",
23
23
  "@formily/shared": "2.3.7",
24
- "@nocobase/flow-engine": "2.1.0-beta.25",
24
+ "@nocobase/flow-engine": "2.1.0-beta.26",
25
25
  "@emotion/css": "11.13.0",
26
- "@nocobase/actions": "2.1.0-beta.25",
27
- "@nocobase/evaluators": "2.1.0-beta.25",
26
+ "@nocobase/actions": "2.1.0-beta.26",
27
+ "@nocobase/evaluators": "2.1.0-beta.26",
28
28
  "axios": "1.7.7",
29
- "@nocobase/database": "2.1.0-beta.25"
29
+ "@nocobase/database": "2.1.0-beta.26"
30
30
  };
@@ -109,6 +109,15 @@ const getParsedValue = (value, variables) => {
109
109
  });
110
110
  return template(variables);
111
111
  };
112
+ const getRequestBaseURL = (ctx) => {
113
+ if (ctx.protocol && ctx.host) {
114
+ return `${ctx.protocol}://${ctx.host}`;
115
+ }
116
+ if (ctx.href) {
117
+ return new URL(ctx.href).origin;
118
+ }
119
+ return void 0;
120
+ };
112
121
  async function send(ctx, next) {
113
122
  var _a, _b, _c, _d;
114
123
  const resourceName = ctx.action.resourceName;
@@ -200,7 +209,7 @@ async function send(ctx, next) {
200
209
  };
201
210
  applyVarsToVariables(variables, vars);
202
211
  const axiosRequestConfig = {
203
- baseURL: ctx.origin,
212
+ baseURL: getRequestBaseURL(ctx),
204
213
  ...options,
205
214
  // safeRequest checks this url value (before baseURL combination) so that
206
215
  // relative paths pointing to the same server are not subject to the whitelist.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-action-custom-request",
3
- "version": "2.1.0-beta.25",
3
+ "version": "2.1.0-beta.26",
4
4
  "main": "dist/server/index.js",
5
5
  "homepage": "https://docs.nocobase.com/handbook/action-custom-request",
6
6
  "homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/action-custom-request",
@@ -31,7 +31,7 @@
31
31
  "@nocobase/server": "2.x",
32
32
  "@nocobase/test": "2.x"
33
33
  },
34
- "gitHead": "824f8b8200e9fe086135768934d3ef427b212446",
34
+ "gitHead": "b17e1a72057813fa27d8435bf0f2af67ea4b059f",
35
35
  "keywords": [
36
36
  "Actions"
37
37
  ]