@nocobase/server 0.20.0-alpha.10 → 0.20.0-alpha.12
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/gateway/index.js
CHANGED
|
@@ -153,23 +153,25 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
|
|
|
153
153
|
}
|
|
154
154
|
async requestHandler(req, res) {
|
|
155
155
|
const { pathname } = (0, import_url.parse)(req.url);
|
|
156
|
-
|
|
156
|
+
const { PLUGIN_STATICS_PATH, APP_PUBLIC_PATH } = process.env;
|
|
157
|
+
if (pathname.endsWith("/__umi/api/bundle-status")) {
|
|
157
158
|
res.statusCode = 200;
|
|
158
159
|
res.end("ok");
|
|
159
160
|
return;
|
|
160
161
|
}
|
|
161
|
-
if (pathname.startsWith("
|
|
162
|
+
if (pathname.startsWith(APP_PUBLIC_PATH + "storage/uploads/")) {
|
|
163
|
+
req.url = req.url.substring(APP_PUBLIC_PATH.length - 1);
|
|
162
164
|
await compress(req, res);
|
|
163
165
|
return (0, import_serve_handler.default)(req, res, {
|
|
164
166
|
public: (0, import_path.resolve)(process.cwd()),
|
|
165
167
|
directoryListing: false
|
|
166
168
|
});
|
|
167
169
|
}
|
|
168
|
-
if (pathname.startsWith(
|
|
170
|
+
if (pathname.startsWith(PLUGIN_STATICS_PATH) && !pathname.includes("/server/")) {
|
|
169
171
|
await compress(req, res);
|
|
170
172
|
const packageName = (0, import_plugin_manager.getPackageNameByExposeUrl)(pathname);
|
|
171
173
|
const publicDir = (0, import_plugin_manager.getPackageDirByExposeUrl)(pathname);
|
|
172
|
-
const destination = pathname.replace(
|
|
174
|
+
const destination = pathname.replace(PLUGIN_STATICS_PATH, "").replace(packageName, "");
|
|
173
175
|
return (0, import_serve_handler.default)(req, res, {
|
|
174
176
|
public: publicDir,
|
|
175
177
|
rewrites: [
|
|
@@ -180,7 +182,8 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
|
|
|
180
182
|
]
|
|
181
183
|
});
|
|
182
184
|
}
|
|
183
|
-
if (!pathname.startsWith(
|
|
185
|
+
if (!pathname.startsWith(process.env.API_BASE_PATH)) {
|
|
186
|
+
req.url = req.url.substring(APP_PUBLIC_PATH.length - 1);
|
|
184
187
|
await compress(req, res);
|
|
185
188
|
return (0, import_serve_handler.default)(req, res, {
|
|
186
189
|
public: `${process.env.APP_PACKAGE_ROOT}/dist/client`,
|
|
@@ -73,7 +73,7 @@ function getPackageFilePathWithExistCheck(packageName, filePath) {
|
|
|
73
73
|
}
|
|
74
74
|
__name(getPackageFilePathWithExistCheck, "getPackageFilePathWithExistCheck");
|
|
75
75
|
function getExposeUrl(packageName, filePath) {
|
|
76
|
-
return `${PLUGIN_STATICS_PATH}${packageName}/${filePath}`;
|
|
76
|
+
return `${process.env.PLUGIN_STATICS_PATH}${packageName}/${filePath}`;
|
|
77
77
|
}
|
|
78
78
|
__name(getExposeUrl, "getExposeUrl");
|
|
79
79
|
function getExposeReadmeUrl(packageName, lang) {
|
|
@@ -92,7 +92,7 @@ function getExposeChangelogUrl(packageName) {
|
|
|
92
92
|
}
|
|
93
93
|
__name(getExposeChangelogUrl, "getExposeChangelogUrl");
|
|
94
94
|
function getPackageNameByExposeUrl(pathname) {
|
|
95
|
-
pathname = pathname.replace(PLUGIN_STATICS_PATH, "");
|
|
95
|
+
pathname = pathname.replace(process.env.PLUGIN_STATICS_PATH, "");
|
|
96
96
|
const pathArr = pathname.split("/");
|
|
97
97
|
if (pathname.startsWith("@")) {
|
|
98
98
|
return pathArr.slice(0, 2).join("/");
|
|
@@ -155,7 +155,10 @@ var resource_default = {
|
|
|
155
155
|
try {
|
|
156
156
|
return {
|
|
157
157
|
...item.toJSON(),
|
|
158
|
-
url: `${(0, import_clientStaticUtils.getExposeUrl)(
|
|
158
|
+
url: `${process.env.APP_SERVER_BASE_URL}${(0, import_clientStaticUtils.getExposeUrl)(
|
|
159
|
+
item.packageName,
|
|
160
|
+
PLUGIN_CLIENT_ENTRY_FILE
|
|
161
|
+
)}?version=${item.version}`
|
|
159
162
|
};
|
|
160
163
|
} catch {
|
|
161
164
|
return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/server",
|
|
3
|
-
"version": "0.20.0-alpha.
|
|
3
|
+
"version": "0.20.0-alpha.12",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
"@koa/cors": "^3.1.0",
|
|
11
11
|
"@koa/multer": "^3.0.2",
|
|
12
12
|
"@koa/router": "^9.4.0",
|
|
13
|
-
"@nocobase/acl": "0.20.0-alpha.
|
|
14
|
-
"@nocobase/actions": "0.20.0-alpha.
|
|
15
|
-
"@nocobase/auth": "0.20.0-alpha.
|
|
16
|
-
"@nocobase/cache": "0.20.0-alpha.
|
|
17
|
-
"@nocobase/data-source-manager": "0.20.0-alpha.
|
|
18
|
-
"@nocobase/database": "0.20.0-alpha.
|
|
19
|
-
"@nocobase/evaluators": "0.20.0-alpha.
|
|
20
|
-
"@nocobase/logger": "0.20.0-alpha.
|
|
21
|
-
"@nocobase/resourcer": "0.20.0-alpha.
|
|
22
|
-
"@nocobase/sdk": "0.20.0-alpha.
|
|
23
|
-
"@nocobase/telemetry": "0.20.0-alpha.
|
|
24
|
-
"@nocobase/utils": "0.20.0-alpha.
|
|
13
|
+
"@nocobase/acl": "0.20.0-alpha.12",
|
|
14
|
+
"@nocobase/actions": "0.20.0-alpha.12",
|
|
15
|
+
"@nocobase/auth": "0.20.0-alpha.12",
|
|
16
|
+
"@nocobase/cache": "0.20.0-alpha.12",
|
|
17
|
+
"@nocobase/data-source-manager": "0.20.0-alpha.12",
|
|
18
|
+
"@nocobase/database": "0.20.0-alpha.12",
|
|
19
|
+
"@nocobase/evaluators": "0.20.0-alpha.12",
|
|
20
|
+
"@nocobase/logger": "0.20.0-alpha.12",
|
|
21
|
+
"@nocobase/resourcer": "0.20.0-alpha.12",
|
|
22
|
+
"@nocobase/sdk": "0.20.0-alpha.12",
|
|
23
|
+
"@nocobase/telemetry": "0.20.0-alpha.12",
|
|
24
|
+
"@nocobase/utils": "0.20.0-alpha.12",
|
|
25
25
|
"@types/decompress": "4.2.4",
|
|
26
26
|
"@types/ini": "^1.3.31",
|
|
27
27
|
"@types/koa-send": "^4.1.3",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"@types/serve-handler": "^6.1.1",
|
|
55
55
|
"@types/ws": "^8.5.5"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "4d6655776b3f418dacd86370126e82ae25e1185a"
|
|
58
58
|
}
|