@azteam/express 1.2.321 → 1.2.322

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 CHANGED
@@ -131,28 +131,32 @@ var Server = /*#__PURE__*/function () {
131
131
  }));
132
132
  app.set('trust proxy', 1);
133
133
  app.use((0, _cookieParser["default"])(process.env.SECRET_KEY));
134
- app.use((0, _cors["default"])(function (req, callback) {
135
- var origin = req.header('Origin');
136
- var authorization = req.header('Authorization');
137
- var appSecret = req.header('x-app-secret');
138
- var agent = req.header('User-Agent');
139
- var error = null;
140
- if (!authorization && !appSecret && !agent.startsWith('toda')) {
141
- if (!origin) {
142
- if (!IS_ALLOW_EMPTY) {
143
- error = new _error.ErrorException(_error.CORS, "Not allowed by CORS");
144
- }
145
- }
146
- // else if (!WHITE_LIST.some((re) => origin.endsWith(re))) {
147
- // error = new ErrorException(CORS, `${origin} Not allowed by CORS`);
148
- // }
149
- }
150
134
 
151
- callback(error, {
152
- credentials: true,
153
- origin: true
154
- });
155
- }));
135
+ // app.use(
136
+ // cors(function (req, callback) {
137
+ // const origin = req.header('Origin');
138
+ // const authorization = req.header('Authorization');
139
+ // const appSecret = req.header('x-app-secret');
140
+ // const agent = req.header('User-Agent');
141
+ //
142
+ // let error = null;
143
+ // if (!authorization && !appSecret && !agent.startsWith('toda')) {
144
+ // if (!origin) {
145
+ // if (!IS_ALLOW_EMPTY) {
146
+ // error = new ErrorException(CORS, `Not allowed by CORS`);
147
+ // }
148
+ // }
149
+ // else if (!WHITE_LIST.some((re) => origin.endsWith(re))) {
150
+ // error = new ErrorException(CORS, `${origin} Not allowed by CORS`);
151
+ // }
152
+ // }
153
+ // callback(error, {
154
+ // credentials: true,
155
+ // origin: true,
156
+ // });
157
+ // })
158
+ // );
159
+
156
160
  if (this.debug) {
157
161
  app.use((0, _morgan["default"])('dev'));
158
162
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azteam/express",
3
- "version": "1.2.321",
3
+ "version": "1.2.322",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./src/index.js",
6
6
  "scripts": {
package/src/Server.js CHANGED
@@ -112,30 +112,30 @@ class Server {
112
112
 
113
113
  app.use(cookieParser(process.env.SECRET_KEY));
114
114
 
115
- app.use(
116
- cors(function (req, callback) {
117
- const origin = req.header('Origin');
118
- const authorization = req.header('Authorization');
119
- const appSecret = req.header('x-app-secret');
120
- const agent = req.header('User-Agent');
121
-
122
- let error = null;
123
- if (!authorization && !appSecret && !agent.startsWith('toda')) {
124
- if (!origin) {
125
- if (!IS_ALLOW_EMPTY) {
126
- error = new ErrorException(CORS, `Not allowed by CORS`);
127
- }
128
- }
129
- // else if (!WHITE_LIST.some((re) => origin.endsWith(re))) {
130
- // error = new ErrorException(CORS, `${origin} Not allowed by CORS`);
131
- // }
132
- }
133
- callback(error, {
134
- credentials: true,
135
- origin: true,
136
- });
137
- })
138
- );
115
+ // app.use(
116
+ // cors(function (req, callback) {
117
+ // const origin = req.header('Origin');
118
+ // const authorization = req.header('Authorization');
119
+ // const appSecret = req.header('x-app-secret');
120
+ // const agent = req.header('User-Agent');
121
+ //
122
+ // let error = null;
123
+ // if (!authorization && !appSecret && !agent.startsWith('toda')) {
124
+ // if (!origin) {
125
+ // if (!IS_ALLOW_EMPTY) {
126
+ // error = new ErrorException(CORS, `Not allowed by CORS`);
127
+ // }
128
+ // }
129
+ // else if (!WHITE_LIST.some((re) => origin.endsWith(re))) {
130
+ // error = new ErrorException(CORS, `${origin} Not allowed by CORS`);
131
+ // }
132
+ // }
133
+ // callback(error, {
134
+ // credentials: true,
135
+ // origin: true,
136
+ // });
137
+ // })
138
+ // );
139
139
 
140
140
  if (this.debug) {
141
141
  app.use(morgan('dev'));