@azteam/express 1.2.257 → 1.2.259
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/package.json +3 -2
- package/src/Server.js +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azteam/express",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.259",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">= 12.0.0",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"method-override": "3.0.0",
|
|
30
30
|
"morgan": "1.10.0",
|
|
31
31
|
"socket.io": "4.4.1",
|
|
32
|
-
"socket.io-redis": "6.1.0"
|
|
32
|
+
"socket.io-redis": "6.1.0",
|
|
33
|
+
"psl": "1.8.0"
|
|
33
34
|
}
|
|
34
35
|
}
|
package/src/Server.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
1
2
|
import fs from 'fs';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
import http from 'http';
|
|
@@ -8,7 +9,7 @@ import bodyParser from 'body-parser';
|
|
|
8
9
|
import cookieParser from 'cookie-parser';
|
|
9
10
|
import morgan from 'morgan';
|
|
10
11
|
import cors from 'cors';
|
|
11
|
-
import
|
|
12
|
+
import psl from 'psl';
|
|
12
13
|
import 'express-async-errors';
|
|
13
14
|
import {CORS, errorCatch, ErrorException, NOT_FOUND, UNKNOWN} from '@azteam/error';
|
|
14
15
|
|
|
@@ -262,6 +263,9 @@ class Server {
|
|
|
262
263
|
app.use(function (req, res, next) {
|
|
263
264
|
delete res.cache;
|
|
264
265
|
|
|
266
|
+
const origin = req.get('Origin');
|
|
267
|
+
req.rootOrigin = origin ? psl.parse(origin).domain : null;
|
|
268
|
+
|
|
265
269
|
req.trackDevice = {
|
|
266
270
|
ip: req.headers['x-forwarded-for'] || req.headers['x-real-ip'] || req.ip,
|
|
267
271
|
device: req.get('X-DEVICE') || req.get('User-Agent'),
|