jsir 2.5.2 → 2.5.3
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/deps/server.js +2 -8
- package/package.json +1 -1
package/deps/server.js
CHANGED
|
@@ -32,13 +32,7 @@ function createSign() {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
async function process(routeKey, req, res, params
|
|
36
|
-
if (!clientIp.endsWith(":" + setting.selfRoom.selfNode)) {
|
|
37
|
-
res.writeHead(403, {'Content-Type': 'text/plain'});
|
|
38
|
-
res.end('Forbidden: Not Allowed');
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
35
|
+
async function process(routeKey, req, res, params) {
|
|
42
36
|
let router = routes[routeKey]
|
|
43
37
|
if (router) {
|
|
44
38
|
if ("get /" !== routeKey && !router.isApi) {
|
|
@@ -107,7 +101,7 @@ async function createServer(port) {
|
|
|
107
101
|
const routeKey = `${method} ${url}`;
|
|
108
102
|
let time = Date.now();
|
|
109
103
|
try {
|
|
110
|
-
await process(routeKey, req, res, params
|
|
104
|
+
await process(routeKey, req, res, params);
|
|
111
105
|
} finally {
|
|
112
106
|
debug(`Process cost ${Date.now() - time}ms for ${routeKey} from ${clientIp}`);
|
|
113
107
|
}
|