chanjs 2.6.4 → 2.6.5

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/middleware/waf.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { getIp } from "../helper/ip.js";
2
- import { checkKeywords } from "../utils/checker.js";
3
- import { filterXSS } from "../utils/xss-filter.js";
4
- import { createRateLimitMiddleware } from "../utils/rate-limit.js";
2
+ import { checkKeywords } from "../helper/checker.js";
3
+ import { filterXSS } from "../helper/xss-filter.js";
4
+ import { createRateLimitMiddleware } from "../helper/rate-limit.js";
5
5
 
6
6
  function parseCookies(cookieHeader) {
7
7
  if (!cookieHeader) return {};
@@ -60,7 +60,6 @@ function createWafMiddleware(wafConfig) {
60
60
 
61
61
  return async (req, res, next) => {
62
62
  try {
63
- console.log('[WAF] 中间件开始执行,enabled:', wafConfig.enabled);
64
63
  if (!wafConfig.enabled) {
65
64
  console.log('[WAF] WAF已禁用,跳过检查');
66
65
  return next();
@@ -122,7 +121,7 @@ function createWafMiddleware(wafConfig) {
122
121
 
123
122
  if (matched) {
124
123
  const { category, keyword } = matched;
125
- console.warn(`[WAF 拦截] IP:${clientIp} 路径:${requestPath} 关键词:${keyword} 类别:${category}`);
124
+ console.error(`[WAF 拦截] IP:${clientIp} 路径:${requestPath} 关键词:${keyword} 类别:${category}`);
126
125
 
127
126
  const htmlResponse = `
128
127
  <!DOCTYPE html>
@@ -148,7 +147,7 @@ function createWafMiddleware(wafConfig) {
148
147
  </html>
149
148
  `;
150
149
 
151
- console.log('[WAF] 准备发送响应');
150
+
152
151
  return res.status(403).setHeader('Content-Type', 'text/html').send(htmlResponse);
153
152
  }
154
153
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "chanjs",
4
- "version": "2.6.4",
4
+ "version": "2.6.5",
5
5
  "description": "chanjs基于express5 纯js研发的轻量级mvc框架。",
6
6
  "main": "index.js",
7
7
  "module": "index.js",
Binary file
package/utils/index.js DELETED
@@ -1,4 +0,0 @@
1
- export { success, fail, error, parseDatabaseError, notFoundResponse, errorResponse } from "./response.js";
2
- export { checkKeywords, isIgnored } from "./checker.js";
3
- export { filterXSS } from "./xss-filter.js";
4
- export { createRateLimitMiddleware } from "./rate-limit.js";
File without changes
File without changes
File without changes
File without changes
File without changes