@azteam/express 1.2.387 → 1.2.389
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/Server.js +3 -1
- package/package.json +2 -1
- package/src/Server.js +3 -2
package/lib/Server.js
CHANGED
|
@@ -17,6 +17,7 @@ var _morgan = _interopRequireDefault(require("morgan"));
|
|
|
17
17
|
var _cors = _interopRequireDefault(require("cors"));
|
|
18
18
|
var _psl = _interopRequireDefault(require("psl"));
|
|
19
19
|
var _ejs = _interopRequireDefault(require("ejs"));
|
|
20
|
+
var _compression = _interopRequireDefault(require("compression"));
|
|
20
21
|
require("express-async-errors");
|
|
21
22
|
var _error = require("@azteam/error");
|
|
22
23
|
var _util = require("@azteam/util");
|
|
@@ -127,10 +128,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
127
128
|
}));
|
|
128
129
|
app.set('trust proxy', 1);
|
|
129
130
|
app.use((0, _cookieParser["default"])(process.env.SECRET_KEY));
|
|
131
|
+
app.use((0, _compression["default"])());
|
|
130
132
|
app.use((0, _cors["default"])(function (req, callback) {
|
|
131
133
|
var origin = req.header('Origin'),
|
|
132
134
|
authorization = req.header('Authorization'),
|
|
133
|
-
agent = req.header('User-Agent');
|
|
135
|
+
agent = req.header('User-Agent') || 'null';
|
|
134
136
|
var error = null;
|
|
135
137
|
if (!authorization && !agent.startsWith(systemUser)) {
|
|
136
138
|
if (origin && whiteList && !whiteList.some(function (re) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azteam/express",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.389",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "toda <sp.azsolution.net@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@grpc/proto-loader": "0.6.12",
|
|
20
20
|
"@socket.io/redis-adapter": "7.2.0",
|
|
21
21
|
"body-parser": "1.19.0",
|
|
22
|
+
"compression": "1.7.4",
|
|
22
23
|
"cookie-parser": "1.4.4",
|
|
23
24
|
"cors": "2.8.4",
|
|
24
25
|
"eiows": "4.1.2",
|
package/src/Server.js
CHANGED
|
@@ -11,6 +11,7 @@ import morgan from 'morgan';
|
|
|
11
11
|
import cors from 'cors';
|
|
12
12
|
import psl from 'psl';
|
|
13
13
|
import ejs from 'ejs';
|
|
14
|
+
import compression from 'compression';
|
|
14
15
|
import 'express-async-errors';
|
|
15
16
|
import {CORS, errorCatch, ErrorException, NOT_FOUND, UNKNOWN} from '@azteam/error';
|
|
16
17
|
import {omitItem, omitArrayItem} from '@azteam/util';
|
|
@@ -101,12 +102,12 @@ class Server {
|
|
|
101
102
|
app.set('trust proxy', 1);
|
|
102
103
|
|
|
103
104
|
app.use(cookieParser(process.env.SECRET_KEY));
|
|
104
|
-
|
|
105
|
+
app.use(compression());
|
|
105
106
|
app.use(
|
|
106
107
|
cors(function (req, callback) {
|
|
107
108
|
const origin = req.header('Origin'),
|
|
108
109
|
authorization = req.header('Authorization'),
|
|
109
|
-
agent = req.header('User-Agent');
|
|
110
|
+
agent = req.header('User-Agent') || 'null';
|
|
110
111
|
|
|
111
112
|
let error = null;
|
|
112
113
|
if (!authorization && !agent.startsWith(systemUser)) {
|